languagetool-org / languagetool

Style and Grammar Checker for 25+ Languages
https://languagetool.org
GNU Lesser General Public License v2.1
12.04k stars 1.38k forks source link

[pt] Disambiguator to convert to noun “noun-chave” #9469

Open marcoagpinto opened 11 months ago

marcoagpinto commented 11 months ago

Heya, @p-goulart and @susanaboatto

Look at:

fator-chave
fatores-chave
palavra-chave
palavras-chave

etc.

Would it be a good idea to add a disambiguator rule that would convert a noun followed by a hyphen and followed by “chave” into a noun?

If it is a good idea, I will do a “lame” attempt to do it tomorrow.

Thanks!

marcoagpinto commented 10 months ago

Heya, @susanaboatto @p-goulart @jaumeortola @maphjo

I could really use some help here.

I tried in the disambiguator:

    <rule id="SUBSTANTIVO_CHAVE_SUBSTANTIVO" name="Substantivo-chave → substantivo">
      <!-- for example: conceitos-chave → NCMP000 -->
      <pattern>
        <marker>
          <token postag="NC.*" postag_regexp="yes"/>
          <token regexp='yes' spacebefore='no'>&tracos_de_separacao;</token>
          <token spacebefore='no'>chave</token>
        </marker>
      </pattern>
      <disambig action="remove">
        <wd lemma="_PUNCT"/>
        <wd lemma="NCFS000"/>
      </disambig>
    </rule>

But I tagged the text in the stand-alone tool and it didn't do anything: Temos os conceitos-chave importantes.

Thanks!