Hèctor Alòs i Font <[email protected]> čálii:
> I'm writing lexical selection rules for French prix (price/prize). Is there
> any form to match a word specifically at the beginning of a sentence (as it
> can be
> done in CG)? Matching the word with capital letters is not a good solution in
> this case.
Something like
<rules>
<rule weight="1.0">
<match lemma="one" tags="vblex.*"> <select lemma="one"/> </match>
</rule>
<rule weight="2.0">
<match tags="*"/>
<match lemma="one" tags="vblex.*"> <select lemma="two"/> </match>
</rule>
<rule weight="3.0">
<match tags="sent"/>
<match lemma="one" tags="vblex.*"> <select lemma="one"/> </match>
</rule>
</rules>
will turn "One. H One. One." into "One. H Two. One.".
$ cat from-biltrans
^One<vblex><pres>/Two<vblex><pres>/One<vblex><pres>$^.<sent>/.<sent><clb>$
^H<prn><pers><p3><sg><nom>/H<prn><pers><p3><sg><nom>$
^one<vblex><pres>/two<vblex><pres>/one<vblex><pres>$^.<sent>/.<sent><clb>$
^One<vblex><pres>/Two<vblex><pres>/One<vblex><pres>$^.<sent>/.<sent><clb>$
$ lrx-comp onetwo.lrx onetwo.autolex.bin
3: 47@51
$ lrx-proc -m -t onetwo.autolex.bin < from-biltrans
4:SELECT:1.00000:One<vblex><pres>:One<vblex><pres>
^One<vblex><pres>/One<vblex><pres>$^.<sent>/.<sent><clb>$
4:SELECT:2.00000:one<vblex><pres>:two<vblex><pres>
^H<prn><pers><p3><sg><nom>/H<prn><pers><p3><sg><nom>$
^one<vblex><pres>/two<vblex><pres>$^.<sent>/.<sent><clb>$
4:SELECT:4.00000:One<vblex><pres>:One<vblex><pres>
^One<vblex><pres>/One<vblex><pres>$^.<sent>/.<sent><clb>$
The first One is matched only by rule 1.
The second One is matched only by rule 2.
The third One is matched rule 1 and 3.
I don't know if there's a way to match "beginning-of-stream" explicitly
– then you could do with just two rules.
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________ Apertium-stuff mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/apertium-stuff
