Back to LanguageTool Homepage - Privacy - Imprint

Setpos or another way to suggest a better agreement

(Marija) #1

Hello everyone,

I am trying to create a new xml grammar rule for the French language for the agreement between a noun and a past participle.
In order to propose a better suggestion I would like to get a part of the noun tag information and to apply it to the tag of the participle.

As per now, I see that the “setpos” is the best way to do it, but i can’t find any examples how it works.

Has anyone used this attribute or maybe you have a better idea how to get a part of tag information and apply it to another word.

Thank you in advance.


(Daniel Naber) #2

Have you tried “You can use postag_replace to require the suggestion to have only some of the same POS tags as the matching word.” as documented here? While it’s not used in the French grammar file, the English grammar.xml uses it quite often.

(Marija) #3

Thank you for the answer.
i tried it.
Actually what i need is just a part of the tag not the same tag.

Let’s say the phrase i want to correct is: “Examen réaliser” (instead of “Examen réalisé”).

In the French version of the LanguageTool, the tags are as follows:
Examen - “N m s” (noun, masc, sing)
Réaliser - “V inf” (Verb, infinitif).

And the correct tag sequence would be in this case : Examen (N m s) réalisé (V ppa m s).
So I was trying to see how to get “m s” information from the noun tag and to apply it to the past participle tag.

of course, i can something like:

<token postag=“SENT_START”/>
<token postag=“N m s” postag_regexp=“yes”/>
<token postag=“V inf”/>
<message>Vous voulez dire : \1 \2 ?</message>"

The idea though is not to create 4 different rules:
Examen réaliser -> Examen réalisé
Examens réaliser -> Examens réalisés
Étude réaliser -> étude réalisée
Études réaliser -> études réalisées