Grammar rule
A grammar rule is a mean to manipulate the pipeline of the Squoia MT system, in order to obtain a particular output translation for an input text, for example:
If we want to incorporate the translation rule for the 'acabar de'/'just' periphrastic verb form in Spanish into its equivalent the -rqu/-ru near future prefix in Quechua, we must follow these steps:
First add the 'acabar de' entry into <SQUOIA>/FreeLingModules/grammar_es/locucions_squoia.dat file, which manages compound entries, as follows:
<acabar>_de acabar_$L2 $1:VMI A
For an in-depth explanation on Multiword Definitions read the Freeling User Manual about this topic.
Once it is added, the output of the tagging process for a Spanish sentence like 'Yo acabo de llegar a casa' / 'I just arrived home', will look like this:
Add the following rules into the esqu_intrachunk_transfer.rules
xpath{ancestor::CHUNK[1]/ancestor::CHUNK[1]/child::NODE[@slem="acabar_de"]} && my.smi=/VMN0000|VSN0000|AUX0000/ lem my.type=/grup-verb/ lem up overwrite
xpath{ancestor::CHUNK[1]/ancestor::CHUNK[1]/child::NODE[@slem="acabar_de"]} && my.smi=/VMN0000|VSN0000/ "yes" my.type=/grup-verb/ delete up overwrite
my.slem=/acabar_de/ && my.smi=/1S/ "+Rptn+1.Sg.Subj" my.type=/grup-verb/ addverbmi up overwrite
my.slem=/acabar_de/ && my.smi=/1P/ "+Rptn+1.Pl.Incl.Subj" my.type=/grup-verb/ addverbmi up overwrite
my.slem=/acabar_de/ && my.smi=/1P/ "+Rptn+1.Pl.Excl.Subj" my.type=/grup-verb/ addverbmi up overwrite
my.slem=/acabar_de/ && my.smi=/2S/ "+Rptn+2.Sg.Subj" my.type=/grup-verb/ addverbmi up overwrite
my.slem=/acabar_de/ && my.smi=/2P/ "+Rptn+2.Pl.Subj" my.type=/grup-verb/ addverbmi up overwrite
my.slem=/acabar_de/ && my.smi=/3S/ "+Rptn+3.Sg.Subj" my.type=/grup-verb/ addverbmi up overwrite
my.slem=/acabar_de/ && my.smi=/3P/ "+Rptn+3.Pl.Subj" my.type=/grup-verb/ addverbmi up overwrite
Add the following rule into de file esqu_interchunk.transfer.rules
my.type=/grup-verb/ && child.smi=/VMN0000|VSN0000/ lem child.slem=/acabar_de/ lem parent 1to2 overwrite
The resulting translation will be:
Spanish: 'Yo acabo de llegar a casa.'
Quechua: 'ñuqa chayarquni wasita .'