Annotation#

The annotation is whatever you want to call a certain portion of text. It is advisable that you use meaningful terms, rather than terms that you won’t recognize later or could be puzzling to someone else working on your rules (test, rule1, myrule are all bad names). If you are clever on the choice of your annotations it could be very readable when you reuse them in other rules:

lexicon: (input="stem") { buy, purchase, acquire } = Buys;

rule: { Company .. Buys .. Company } = CompanyAcquisition;

Though there are no restrictions on the semantic level, restrictions do apply on the syntax:

  • Only alphanumeric characters in the A-Z range [a-zA-Z0-9] and underscore _ are allowed:

    Bank_Account_Number
    Case_01230
  • Annotations should be longer than one character:

{ .. } = B  --> this is not allowed
  • Annotations are always preceded by the enclosure characters and the equal sign { } =

  • Annotations might be followed by a list of attribute-value pairs. For the attribute names, the same restrictions as for annotation names are to be followed:

rule :
{
    {
        (Prop)+
    } = SportsPerson@(sports="tennis")
    "is" "a"
    "tennis"
    "player"
};

Output:

Rafael Nadal is a tennis player”
SportsPerson
- sports=”tennis”

Note

if the attribute key starts with an underscore it will not show in the output results but it still can be used.