Accepting a word only in a specific POS

Hi,

I am trying to use the first example in Tips and Tricks - LanguageTool Wiki to accept a word only in a specific part-of-speech:

For example, I’d like to accept the word “attribute” as a noun, but not as a verb:

<rule id="attribute-noun" name="attribute-noun">    
                <pattern>
                        <token postag="NN">attribute<exception negate_pos="yes" postag="NN"/></token>
                </pattern>
                <message>Use this word as a noun.</message>
                <example type='incorrect'> To <marker>attribute</marker> a foo to the bar, select Apply.</example>
                <example type='correct'> The connection has the following <marker>attribute</marker>.</example>
        </rule>

However, it does not seem to work as expected: LT marks “attribute” as an error in the second sentence, and accepts it as a verb in the first one. The result of the tagging is:

To[to/IN,to/TO,B-VP] attribute[attribute/NN,attribute/VB,attribute/VBP,I-VP] a[a/DT,B-NP-singular] foo[foo/NN,E-NP-singular] to[to/IN,to/TO,B-PP] the[the/DT,B-NP-singular] bar[bar/JJ,bar/NN,bar/VB,bar/VBP,E-NP-singular] ,[,/,O] select[select/JJ,select/VB,select/VBP,B-NP-singular] Apply[apply/VB,apply/VBP,E-NP-singular] .[./.,,O] The[the/DT,B-NP-singular] connection[connection/NN:UN,E-NP-singular] has[have/VBZ,B-VP] the[the/DT,B-NP-singular] following[following/IN,following/JJ,follow/VBG,I-NP-singular] attribute[attribute/NN,E-NP-singular] .[./.,,O]

Any help on what I am doing wrong is appreciated.

Regards,

Robert Fekete

You aren’t doing anyhting wrong, but LT doesn’t know which “attribute” is a noun and which is a verb. This can only be decided by context and to do that you’ll have to write disambiguation rules, as described at Developing a Disambiguator - LanguageTool Wiki. There are already English disambiguation rules in the file en/disambiguation.xml.

Hi Daniel,

Thanks a lot for your help!

Robert