Back to LanguageTool Homepage - Privacy - Imprint


(Mility) #1

You may be attracted by the Chinese title,, To be honest, I am a Chinese man. Today, I used LanguaheTool to check my text, I found a mistake not check out. Just like below:

Example.wrong("I like play piano ."),
Example.fixed("I like play the piano ."));

How to add this rule to make LanguageTool more perfect? How to describe this rule? the lost? or....

Thank you in advance.

(Daniel Naber) #2

Have you tried our online rule editor? You would need to create two tokens, "play" and "piano".

(Mility) #4

There are problems with my rule. Could you tell me how to do it right?
Thanks in advance.

(Daniel Naber) #5

That's correct. But actually searching for "play piano" will get a lot of hits on Google, did you ask a native English speaker if that's really incorrect? About the error: could you send a complete screen shot where the whole page is visible?

(Mility) #6

I'm confused. We used to add the definite article before the instrument.
Here are the full screen shot :

(Daniel Naber) #7

There's a typo in Token #2.

(Mility) #8

oh, my god.Thanks.

(Mility) #9

I add it to the grammar.xml file of your LanguageTool installation and restart LanguageTool. New problem happen. Just like this message: Cannot load or parse input stream of '/org/languagetool/rules/en/grammar.xml'

(Daniel Naber) #10

There's a syntax error in your XML. What you posted seems to be only a part of the error message, somewhere in the rest the reason of the failure should be explained.

(Mility) #11

Thanks, online rule editor generate Example and incorrect Example:
I like play piano.
I like play the piano.

but grammar.xml are:
I like play piano.
I like play the piano.

so add a new rule:

<rule id="ID" name="the lost">    
            <message>Did you miss <suggestion>the</suggestion>?</message>
            <example type='incorrect'>I like <marker>play piano</marker>.</example>
            <example type="correct">I like play the piano.</example>

And the output success.

(Daniel Naber) #12

The suggestion needs to be "play the piano", not just "the" to get rid of the error.

Anyway, here's some discussion by (I guess) native speakers, and they find both forms acceptable:

(Mility) #13

Thanks. In the above, I mean online rule editor generate Example and incorrect Example format does not match grammar.xml.

(Daniel Naber) #14

The grammar.xml format has changed recently, with the next release of LT (in about 2 weeks) it will match again.

(Mility) #15

In English,a/an article should never be used with a noun in a plural form. The current LanguageTool rule to detect such a case is defined as follows:

<rulegroup id="A_PLURAL" name="Agreement: 'a' + plural word">    
                    <token><exception regexp="yes">’|'|division|class|category|zone|formula|type|influenza|hepatitis|series</exception><exception postag="CD"></exception></token>
                        <token regexp="yes">a|an</token>
                        <token postag="NNS|NNPS" postag_regexp="yes"><exception postag="NN:.*|NN|VBZ|NNP|CC|CD" postag_regexp="yes"/><exception regexp="yes">savings|headquarters</exception></token> <!-- savings has singular concord according to OED; headquarters may as well -->
                    <token><exception postag="NN.*" postag_regexp="yes"></exception><exception regexp="yes">['’]|and</exception></token>
                <message>Don't use indefinite articles with plural words. Did you mean <suggestion><match no="2"></match> <match no="3" postag="NN(:UN?)?" postag_regexp="yes"></match></suggestion> or simply <suggestion><match no="3"></match></suggestion>?</message>
                <short>Possible agreement error</short>
                <example correction="a criterion|criteria" type="incorrect">I needed to use a text line as <marker>a criteria</marker> to select users for a list.</example>
                <example type="correct">It is a criteria list that we prepared last night.</example>
                <example type="correct">He was employed for a time by a Mrs. Reed.</example>
                <example type="correct">There was a children's party at the Joneses yesterday.</example>
                <example type="correct">A men's retailer opened in Florida.</example>
                <example type="correct">Shi'a Muslims are nice.</example>
                <example type="correct">The league created two A divisions.</example>
                <example type="correct">Division A teams are the best.</example>
                <example type="correct">Atlas District, an arts and entertainment district in the Near Northeast</example>
                <example type="correct">"The murderer," wrote Schopenhauer, "who is condemned to death according to the law must, it is true, be now used as a mere means, and with complete right."</example>

                    <token><exception regexp="yes">’|'|division|class|category|zone|formula|type|influenza|hepatitis|series</exception><exception postag="CD"></exception></token>
                    <token regexp="yes">a|an</token>
                    <token postag="JJ"><exception regexp="yes">few|dozen|time</exception><exception postag="CD"></exception></token>
                        <token postag="NNS|NNPS" postag_regexp="yes"><exception postag="NN:.*|NN|VBZ|NNP|CC|CD" postag_regexp="yes"/><exception regexp="yes">sometimes|savings|headquarters</exception></token>
                    <token><exception postag="NN.*" postag_regexp="yes"></exception><exception regexp="yes">['’]|and</exception></token>
                <message>Don't use indefinite articles with plural words. Did you mean <suggestion><match no="4" postag="NN(:UN?)?" postag_regexp="yes"/></suggestion>?</message>
                <short>Possible agreement error</short>
                <example correction="milestone" type="incorrect">The Syria resolution was a major <marker>milestones</marker> for the United Nations.</example>
                <example type="correct">The Syria resolution was a major <marker>milestone</marker> for the United Nations.</example>
                <example type="correct">Only half a dozen asteroids are larger than 87 Sylvia.</example>
                <example type="correct">It's a ten minutes walk to the bus stop.</example>
                <example type="correct">The only exception to this is that if a defendant appeals a conviction for a crime.</example>
                <example type="incorrect" correction="woman">The average figure of a Korean <marker>women</marker> in her twenties</example>


However, this rule ignores the fact that there can be more than one JJ(adjective) between a/an and the corresponding noun( “a simple wooden box”). So I changed the corresponding rule :
<token min="0" max="2" postag="JJ">few|dozen|time

and such errors can be checked:
I made a simple wooden desks.

Potential error at line 0, column 876: Don't use indefinite articles with plural words. Did you mean desk?
Suggested correction: [desk]

(Daniel Naber) #16

Thanks, you're right - I've added the attribute.

(Mility) #17
<rule id="GERUND_AFTER_PREPOSITIONS" name="gerund after prepositions">

                    <token inflected="yes" regexp="yes">without|at|by</token>
                        <token postag="VB"></token>
                <message>This prep is used with gerund from: <suggestion><match no="2" postag="VBG"></match></suggestion>.</message>
                <short>Grammatical problem: use gerund</short>
                <example type="correct">She is good at painting.</example>
                <example type="correct">He learns music by listening to the chords.</example>
                <example type="correct">I was the fastest at climbing the rope.</example>
                <example correction="painting" type="incorrect">She is good at <marker>paint</marker>.</example>

(Daniel Naber) #18

Thanks. When I run this rule over a lot of sentences, I get quite some false alarms, e.g. for these sentences:

There were attempts at compromise.

In 1832, at age 23, Lincoln and a partner bought...
You can't feel at ease with a headache.
Tea with ice isn't good without sugar.

Maybe you could try to fix these (although it's probably not easy, as so many verbs in English are also nouns).

(Mility) #19

Is there a way to reduce these tokens to one?

(Daniel Naber) #20

You could try with disambiguation.xml, it's documented at

(Mility) #21

Which tagger is used in the LanguageTool now? Could we change the tagger to meet the requirements?