Apertium has moved from SourceForge to GitHub.
If you have any questions, please come and talk to us on #apertium on irc.freenode.net or contact the GitHub migration team.

Apertium-recursive/Cookbook

From Apertium
< Apertium-recursive
Revision as of 16:46, 5 August 2019 by Popcorndude (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page is intended to be a collection of solutions to common transfer problems. It is sorted vaguely be complexity, so it could potentially also serve as a tutorial. Functioning rulesets for each of these examples can be found at https://github.com/apertium/apertium-recursive/tree/master/tests/cookbook.

Noun-Adjective Gender Agreement

NP -> adj n { 1(gender=2.gender) _1 2 } ;

This will copy the gender tag of the noun to the adjective.

Reordering

NP -> adj n { 2 _1 1 } ;

This will reverse the order of the noun and adjective.

Agreement across Multiple Levels

NP -> n.$gender.$number { 1 } |
      adj NP.$gender.$number { 2 _1 1(gender=2.gender) } ;
DP -> det NP { 1(number=2.number) _1 2 } ;

These rules will match a determiner, 0 or more adjectives, and a noun and make all the adjectives agree with the noun in gender and the determiner agree with the noun in number. The adjectives will also be output after the noun in the reverse of their input order.

Personal tools