A long introduction to transfer rules
Writing transfer rules seems to be tricky. People generally understand the basic concepts, but they struggle with the formalism. We think the formalism isn't that bad. And compared to many other formalisms,[1] it's fairly straightforward. Maybe one of the reasons people struggle is that we mix declarative and procedural programming. Could be.
Some formalities
Before starting, it is important to give some idea of what we can't do, before explaining what we can. If you come at rule-learning expecting something else, then it's likely to be confusing.
- There are no recursive rules. Rules match fixed-length patterns. There is no optionality at the level of words. There is no way of saying one-or-more, it's just one.
- Apertium's rules are very tied to the Apertium stream format. If you don't understand the stream format, you it will be a lot more difficult to understand the rules.
- Rules contain both declarative parts and procedural parts. You can't just expect to say what you want or how you want to do it. You need to do both -- but in different places.
Lexical transfer and structural transfer
Overview of a transfer file
Apertium 1
Otisla si tiho i bez pozdrava
Lexical transfer
Apertium 3
Resorni je ministar navlačio ljude, kaže sejte biljku zelenu i čudo će da bude
Lexical transfer
Notes
- ↑ e.g. Matxin, OpenLogos, ...