Hi,

yes, the types need to be declared before. The DECLARE statements have
been omitted in the example.


Ruta 2.4.0 introduced annotation expressions. Before that, annotations
have only ben e referenced by type expressons. Ruta tries to guess which
annotation is meant by the given type expression using the context.

So, if you "assign" a type to a feature that expects one annotation,
then the first annotation of that type within the matching window of the
rule element is selected. In that example, this is the first annotation
of the type Employee  within the currently matched sentence annotation.

Here are some more (with declare, but without the Indicator annotation)
examples how to assign feature values for the trivial text "Peter works
for Frank.":


DECLARE Employer, Employee;
DECLARE EmplRelation (Annotation employee, Annotation employer);
"Peter"-> Employee;
"Frank"-> Employer;

// CREATE
Document{-> CREATE(EmplRelation, "employee" = Employee, "employer" =
Employer)};

// GATHER
Employee # Employer{-> GATHER(EmplRelation, 1, 3, "employee" = 1,
"employer" = 3)};

// implicit actions
(Employee # Employer){-> EmplRelation,
    EmplRelation.employee = Employee,
    EmplRelation.employer = Employer};

// annotation variables
ANNOTATION e1,e2;
(Employee{-> ASSIGN(e1, Employee)} # Employer{-> ASSIGN(e2, Employer)})
    {-> CREATE(EmplRelation, "employee" = e1, "employer" = e2)};

// labels   
(e1:Employee # e2:Employer)
    {-> CREATE(EmplRelation, "employee" = e1, "employer" = e2)};

Best,


Peter

Am 14.09.2016 um 01:20 schrieb Bonnie MacKellar:
> Hi,
>
> I need to create annotations with features, but I am struggling to
> understand the one example given in the manual
>
> DECLARE Annotation EmplRelation
>     (Employee employeeRef, Employer employerRef);
> Sentence{CONTAINS(EmploymentIndicator) -> CREATE(EmplRelation,
>     "employeeRef" = Employee, "employerRef" = Employer)};
>
> I understand that this declares an Annotation with two features, one of
> type Employee and one of type Employer. I am assuming these are Annotations
> that have also been declared in the script? The second part really baffles
> me. The way I am reading this, if a sentence contains an annotation of type
> EmploymentIndicator, then create a EmplRelation annotation - and assign the
> type Employer to feature employeeRef????  That makes no sense. It looks
> like this assigns a type to a feature. I would have assumed we would want
> some text as the value, no? Could anyone explain this in more detail?
>
> thanks,
> Bonnie MacKellar
>

Reply via email to