Hi,
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…
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?
I add it to the grammar.xml file of your LanguageTool installation and restart LanguageTool. New problem happen. Just like this message:
java.io.IOException: Cannot load or parse input stream of ‘/org/languagetool/rules/en/grammar.xml’
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.
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">
<pattern>
<token>play</token>
<token>piano</token>
</pattern>
<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>
</rule>
Thanks.
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">
<rule>
<pattern>
<token><exception regexp="yes">’|'|division|class|category|zone|formula|type|influenza|hepatitis|series</exception><exception postag="CD"></exception></token>
<marker>
<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 -->
</marker>
<token><exception postag="NN.*" postag_regexp="yes"></exception><exception regexp="yes">['’]|and</exception></token>
</pattern>
<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>
</rule>
<rule>
<pattern>
<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>
<marker>
<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>
</marker>
<token><exception postag="NN.*" postag_regexp="yes"></exception><exception regexp="yes">['’]|and</exception></token>
</pattern>
<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>
</rule>
</rulegroup>
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]
<rule id="GERUND_AFTER_PREPOSITIONS" name="gerund after prepositions">
<pattern>
<token inflected="yes" regexp="yes">without|at|by</token>
<marker>
<token postag="VB"></token>
</marker>
</pattern>
<message>This prep is used with gerund from: <suggestion><match no="2" postag="VBG"></match></suggestion>.</message>
<url>http://www.edufind.com/english-grammar/ing-forms/</url>
<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>
</rule>
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).