Inheritance#

Attribute - push_att#

You can pass the attributes from an inner annotation to a parent annotation. It is a kind of reverse inheritance, and the construct to do that is wow::push_att.

For instance, we have gender information in our given names:

lexicon:
{
    John,
    George
} = Giv@(gender="male",language="EN");

lexicon:
{
    Sally,
    Lucy
} = Giv@(gender="female",language="EN");

lexicon:
{
    María,
    Lola
} = Giv@(gender="female",language="ES");

If I make a rule to define my persons as a given name followed by a Proper:

rule:
{
    Giv
    Prop
} = Person;

We get the desired output, but the person does not contain the gender information:

Command:

wow -p "english,rules" -i "John Tavolta and Sally Holmes." --tool stagger**

Output:

Sentence -> John Tavolta and Sally Holmes .
Person -> John Tavolta
Giv -> John @ gender=male;
Person -> Sally Holmes
Giv -> Sally @ gender=female;

I could fix it by making 2 rules:

rule:
{
    Giv@(gender="male")
    Prop
} = Person@(gender="male");

But this is not ideal, as I could have more attributes that I want to pass on and there would be a combinatorial explosion.

So I can push the attribute or attributes from the child annotation to the parent annotation:

rule:
{
    {Giv} = wow::push_att@(from="Giv",to="Person",attributes="gender")
    Prop
} = Person;

Or to pass all:

rule:
{
    {Giv} = wow::push_att@(from="Giv",to="Person")
    Prop
} = Person;

As with the filter, you can also pass regular expressions:

rule:
{
    {Giv} = wow::push_att@(from="Giv",to="/Person(.)*/")
    Prop
} = Person;

Attribute - inherit#

You can also use inherit from a parent annotation, to get the attributes of a child annotation.

lexicon: {Jean} = GivName@(gender="male");
lexicon: {Marie} = GivName@(gender="female");

rule:
{
    GivName (GivName)*
    Prop
} = PersonName@(inherit="GivName[1]");

GivName[1], refers to the first GivName, in case there are several: “Jean Marie Paff”

Note

If the value is “true” then it will inherit the attributes from smaller annotations with the same uri. This is used to expand an existing annotation.

Attribute - pos#

You can use the attribute pos to make sure that what you are matching has the correct part of speech. This is useful only in lexicons as in rule you can already enforce the POS.

lexicon: {Jean} = GivName@(pos="Prop");

lexicon: {Jean Paul} = GivName@(pos="/(Prop)+/");