About new lexical rules syntax

⚠️ In version 1.0 (September 2018), the syntax of lexical rules has changed. The difference between the two syntaxes is explained here.

The differences between old syntax and new syntax are:

We describe below through examples, the correspondence between old and new syntax.

Using a lexicon in the same file

For short lexicons, it is easier to put the lexicon next to the rule. Lexical items are described one by line between the two special markers #BEGIN and #END. In the new syntax, the name of the lexicon is given on the line with the #BEGIN marker.

Old syntax

rule update_trans (feature $lemma, $is_trans) {
  pattern { N [lemma = $lemma, !trans] }
  commands { N.trans = $is_trans}
}
#BEGIN
dormir#no
manger#yes
vendre#yes
#END

New syntax

rule update_trans {
  pattern { N [lemma = transitive_lexicon.lemma, !trans] }
  commands { N.trans = transitive_lexicon.is_trans }
}
#BEGIN transitive_lexicon
lemma	is_trans
%---------------
dormir	no
manger	yes
vendre	yes
#END

NB: the line %--------------- is not required, lines beginning with % are considered as comments and are discarded.

Using a lexicon declared in an external file

If the lexicon contains a large number of items, it can be declared in an external file. External declaration is also useful for referring to the same lexicon in several different rules. With external declaration, the name of the lexicon is declared after the rule name with the keyword from in the syntax: (lexicon_name from "lexicon_file").

Old syntax

Rule:

rule update_trans (feature $lemma, $is_trans; file "path_to_the_file/trans.lex") {
  pattern { N [lemma = $lemma, !trans] }
  commands { N.trans = $is_trans }
}

Lexicon file trans.lex:

dormir#no
manger#yes
vendre#yes

New syntax

rule update_trans (transitive_lexicon from "path_to_the_file/trans.lex") {
  pattern { N [lemma = transitive_lexicon.lemma, !trans] }
  commands { N.trans = transitive_lexicon.is_trans}
}

Lexicon file trans.lex:

lemma	is_trans
%---------------
dormir	no
manger	yes
vendre	yes