Good day everyone:
I’ve seen for some time that Galician is looking for a maintainer, so I have decided to start writing rules for Galician, which is my native tongue. I think I have grasped the basic concepts, and before I continue reading the documentation, here come my first two rules:
<rule id="FAI_FRIO_OU_CALOR" name="fai frío/calor » vai frío/calor"> <!-- it's cold/warm -->
<pattern>
<token regexp='yes'>Fai(che)?</token>
<token regexp='yes'>(frío|calor)</token>
</pattern>
<message>O frío (ou a calor) non se fai que xa vén feito.</message>
<example correction='Vai frío'><marker>Fai frío</marker></example>
<example>Vai frío</example>
<example correction='Vai calor'><marker>Fai calor</marker></example>
<example>Vai calor</example>
</rule>
<rule id="A_EFECTOS_DE" name="a efectos de » para os efectos de"> <!-- for the purpose of -->
<pattern>
<token regexp='yes'>(A(os)?|Ós)</token>
<token>efectos</token>
<token regexp='yes'>d(e|[oa]s?)</token>
</pattern>
<message>A expresión correcta é "para os efectos de"</message>
<url>https://gl.wikipedia.org/wiki/Wikipedia:Erros_de_ortograf%C3%ADa_e_desviaci%C3%B3ns</url>
<short>a efectos de » para os efectos de</short>
<example correction="para os efectos de"><marker>Aos efectos da</marker> telefonía é coma un único país con código internacional.</example>
<example>Para os efectos de</example>
<example correction="para os efectos de"><marker>A efectos da</marker> telefonía é coma un único país con código internacional.</example>
<example correction="para os efectos de"><marker>Ós efectos da</marker> telefonía é coma un único país con código internacional.</example>
</rule>
I am sending them both for the admin to update the official grammar.xml file (under <category id="CAT8" name="Fraseoloxía"><rulegroup id="LOCUCIÓNS" name="locucións e frases feitas">
), and also to get feedback and to have a basis to ask a couple of basic questions.
Q1:
In the first rule I would have liked to create an optional token to account for the expression with article and without article:
Vai frío
Vai un frío
Vai calor
Vai unha calor
I have tried both
<token regexp='yes'>Fai(che)?</token>
<token regexp='yes'>(un(ha)? )?</token>
<token regexp='yes'>(frío|calor)</token>
and
<token regexp='yes'>Fai(che)?</token>
<token regexp='yes'>(un(ha)? )?(frío|calor)</token>
but none of them match the pattern with articles. Is there a way to match an optional token other than creating another rule with one more token?
Q2:
In the second rule, I wrote <token>d(e|[oa]s?)</token>
to match both “de” (preposition) and “do/da/dos/das” (prep + article in it’s four inflections combining number and gender). Is there a way to indicate a lemma (e.g. “de”) rather than a form? In that way, the preposition “de” would be matched both when it’s contracted and when it’s not.
In the answer to these questions is in the rest of the documentation that I still haven’t read, I’ll be grateful if you simply could redirect me to the relevant section.
Thanks a lot for your help.
Manuel