Difference between revisions of "Constraint-based lexical selection module"
Jump to navigation
Jump to search
(→Text) |
(→Text) |
||
Line 38: | Line 38: | ||
s ("carn" n) ("flesh" n) (1 "i") (2 "os") |
s ("carn" n) ("flesh" n) (1 "i") (2 "os") |
||
s ("sobre" pr) ("over" n) (-1 "victòria") |
s ("sobre" pr) ("over" n) (-1 "victòria") |
||
</pre> |
|||
===Usage=== |
|||
<pre> |
|||
$ cat /tmp/test | python apertium-lex-rules.py rules.txt 2>/dev/null |
|||
^El<det><def><f><sg>/The<det><def><f><sg>$ |
|||
^estació<n><f><sg>/season<n><sg>$ ^més<preadv>/more<preadv>$ ^plujós<adj><f><sg>/rainy<adj><sint><f><sg>$ |
|||
^ser<vbser><pri><p3><sg>/be<vbser><pri><p3><sg>$ ^el<det><def><f><sg>/the<det><def><f><sg>$ |
|||
^tardor<n><f><sg>/autumn<n><sg>/fall<n><sg>$^,<cm>/,<cm>$ ^i<cnjcoo>/and<cnjcoo>$ ^el<det><def><f><sg>/the<det><def><f><sg>$ |
|||
^més<preadv>/more<preadv>$ ^sec<adj><f><sg>/dry<adj><sint><f><sg>$ ^el<det><def><m><sg>/the<det><def><m><sg>$ |
|||
^estiu<n><m><sg>/summer<n><sg>$ ^.<sent>/.<sent>$ |
|||
</pre> |
</pre> |
||
Revision as of 10:03, 3 October 2011
Lexical transfer
[74306] ^El<det><def><f><sg>/The<det><def><f><sg>$ ^estació<n><f><sg>/season<n><sg>/station<n><sg>$ ^més<preadv>/more<preadv>$ ^plujós<adj><f><sg>/rainy<adj><sint><f><sg>$ ^ser<vbser><pri><p3><sg>/be<vbser><pri><p3><sg>$ ^el<det><def><f><sg>/the<det><def><f><sg>$ ^tardor<n><f><sg>/autumn<n><sg>/fall<n><sg>$^,<cm>/,<cm>$ ^i<cnjcoo>/and<cnjcoo>$ ^el<det><def><f><sg>/the<det><def><f><sg>$ ^més<preadv>/more<preadv>$ ^sec<adj><f><sg>/dry<adj><sint><f><sg>$ ^el<det><def><m><sg>/the<det><def><m><sg>$ ^estiu<n><m><sg>/summer<n><sg>$^.<sent>/.<sent>$
Rule format
A rule is made up of:
- An action (select, remove)
- A "centre" (the source language token that will be treated)
- A target language pattern on which the action takes place
- A source language context
Text
s ("estació" n) ("season" n) (1 "plujós") s ("estació" n) ("season" n) (2 "plujós") s ("estació" n) ("season" n) (1 "de") (3 "any") s ("estació" n) ("station" n) (1 "de") (3 "Línia") s ("prova" n) ("evidence" n) (1 "arqueològic") s ("prova" n) ("test" n) (1 "estadístic") s ("prova" n) ("event" n) (-3 "guanyador") (-2 "de") s ("prova" n) ("testing" n) (-2 "tècnica") (-1 "de") s ("joc" n) ("game" n) (1 "olímpic") s ("joc" n) ("set" n) (1 "de") (2 "caràcter") r ("pista" n) ("hint" n) (1 "més") (2 "llarg") r ("pista" n) ("clue" n) (1 "més") (2 "llarg") r ("motiu" n) ("motif" n) (-1 "aquest") (-2 "per") s ("carn" n) ("flesh" n) (1 "i") (2 "os") s ("sobre" pr) ("over" n) (-1 "victòria")
Usage
$ cat /tmp/test | python apertium-lex-rules.py rules.txt 2>/dev/null ^El<det><def><f><sg>/The<det><def><f><sg>$ ^estació<n><f><sg>/season<n><sg>$ ^més<preadv>/more<preadv>$ ^plujós<adj><f><sg>/rainy<adj><sint><f><sg>$ ^ser<vbser><pri><p3><sg>/be<vbser><pri><p3><sg>$ ^el<det><def><f><sg>/the<det><def><f><sg>$ ^tardor<n><f><sg>/autumn<n><sg>/fall<n><sg>$^,<cm>/,<cm>$ ^i<cnjcoo>/and<cnjcoo>$ ^el<det><def><f><sg>/the<det><def><f><sg>$ ^més<preadv>/more<preadv>$ ^sec<adj><f><sg>/dry<adj><sint><f><sg>$ ^el<det><def><m><sg>/the<det><def><m><sg>$ ^estiu<n><m><sg>/summer<n><sg>$ ^.<sent>/.<sent>$