apertium / apertium-recursive

Recursive structural transfer module for Apertium
https://wiki.apertium.org/wiki/Apertium-recursive
GNU General Public License v3.0
6 stars 4 forks source link

Confusing duplicate lines from -T – what do they mean? #93

Closed unhammer closed 1 year ago

unhammer commented 1 year ago

What does it mean when rtx-proc -r show the same "Applying rule" multiple times? Is it backtracking? (It happens even when there are no warning about rules being discarded due to ?-conditions.)

E.g. in sme-smj from today ( e420857ecff960fe76da542add7c29ebfd091035 ), I get

$ echo leat 5 ja 8 |apertium -d . sme-smj_rtx-transfer

Applying rule 121 (vblex - line 507): ^leat<vblex><iv><indic><pres><p3><pl><@+FMAINV>/liehket<vblex><iv><indic><pres><p3><pl><@+FMAINV>$

Applying rule 51 (NP:num - line 384): ^5<num><arab><sg><nom><←ext→><@←SUBJext>/5<num><arab><sg><nom><←ext→><@←SUBJext>$

Applying rule 51 (NP:num - line 384): ^5<num><arab><sg><nom><←ext→><@←SUBJext>/5<num><arab><sg><nom><←ext→><@←SUBJext>$

Applying rule 214 (leat@+FMAINV SUBJext - line 708): ^leat<vblex><iv><indic><pres><p3><pl><@+FMAINV>/liehket<vblex><iv><indic><pres><p3><pl><@+FMAINV>$ ^5<NP><sg><nom><@←SUBJext>{^5<num><arab><sg><nom><←ext→><@←SUBJext>/5<num><arab><sg><nom><←ext→><@←SUBJext>$}$

Applying rule 205 (line 690): ^ja<cnjcoo><@CNP>/ja<cnjcoo><@CNP>$

Applying rule 205 (line 690): ^ja<cnjcoo><@CNP>/ja<cnjcoo><@CNP>$

Applying rule 205 (line 690): ^ja<cnjcoo><@CNP>/ja<cnjcoo><@CNP>$

Applying rule 71 (AP:adj - line 411): ^8<adj><arab><ord><attr><@←ADVL>/8<adj><arab><ord><attr><@←ADVL>$

Applying rule 71 (AP:adj - line 411): ^8<adj><arab><ord><attr><@←ADVL>/8<adj><arab><ord><attr><@←ADVL>$

Applying rule 71 (AP:adj - line 411): ^8<adj><arab><ord><attr><@←ADVL>/8<adj><arab><ord><attr><@←ADVL>$

Applying output rule 213 (leat@+FMAINV SUBJext - line 708): liehket<S><@+FMAINV> -> ^leat<vblex><iv><indic><pres><p3><pl><@+FMAINV>/liehket<vblex><iv><indic><pres><p3><pl><@+FMAINV>$ ^5<NP><sg><nom><@←SUBJext>{^5<num><arab><sg><nom><←ext→><@←SUBJext>/5<num><arab><sg><nom><←ext→><@←SUBJext>$}$

No rule specified: ^liehket<vblex><indic><pres><p3><pl>$

Applying output rule 50 (NP:num - line 384): 5<NP><sg><nom><@←SUBJext> -> ^5<num><arab><sg><nom><←ext→><@←SUBJext>/5<num><arab><sg><nom><←ext→><@←SUBJext>$

No rule specified: ^5<num><arab><sg><nom>$

Applying output rule 204 (line 690): ja<C> -> ^ja<cnjcoo><@CNP>/ja<cnjcoo><@CNP>$

No rule specified: ^ja<cnjcoo>$

Applying output rule 70 (AP:adj - line 411): 8<AP><attr><@←ADVL> -> ^8<adj><arab><ord><attr><@←ADVL>/8<adj><arab><ord><attr><@←ADVL>$

No rule specified: ^8<adj><arab><ord><attr>$
^liehket<vblex><indic><pres><p3><pl>$ ^5<num><arab><sg><nom>$ ^ja<cnjcoo>$ ^8<adj><arab><ord><attr>$

with Applying rule 205 thrice, rule 51 twice, rule 71 thrice. Why?

mr-martian commented 1 year ago

If there's ambiguity in the grammar (which there nearly always is) it parses all options in parallel, and lines get repeated if there are two different partial parses that can both have that rule applied.

unhammer commented 1 year ago

OK, makes sense, thanks for the explanation