Back to LanguageTool Homepage - Privacy - Imprint

Add rule


(Mility) #1
<rule id="ARRIVE_NNP" name="arrive nnp (arrive in nnp)">

 <pattern>
  <token>arrive</token>
  <token postag='NNP'></token>
 </pattern>
 <message>Did you mean <suggestion> arrive in </suggestion></message>
 <short>Grammatical problem</short>
 <example correction=''>I would like to see flight <marker>arrive Dallas</marker> next day.</example>
 <example>I would like to see flight arrive in Dallas next day.</example>
</rule>

<rule id="WILL_LIKE_TO" name="will like to (would like to)">

 <pattern>
  <token postag='PRP'></token>
  <marker>
  <token>will</token>
  </marker>
  <token>like</token>
  <token>to</token>
 </pattern>
 <message>Did you mean <suggestion> would like to </suggestion>?</message>
 <short>Grammatical problem</short>
 <example correction=''>I <marker>will like to</marker> do something.</example>
 <example>I would like to do something.</example>
</rule>

(Daniel Naber) #2

Thanks, I've added your rules. They will be available tonight on languagetool.org.


(Mility) #3

How about this rule?

<rule id="ID" name="">

 <pattern>
  <token>the</token>
  <token postag='NN'><exception>police</exception></token>
  <token>are</token>
 </pattern>
 <message>Did you mean <suggestion> is</suggestion></message>
 <example correction=''><marker>The engine are</marker> running smoothly now.</example>
 <example>The engine is running smoothly now.</example>
</rule>

(Daniel Naber) #4

I think that would produce false alarms with sentences like "The plane and the train are fast."


(Mility) #5

Thanks, How about this?

<rule id="ID" name="">

 <pattern>
 <token><exception>and</exception></token>
  <token>the</token>
  <token postag='NN'><exception>police</exception></token>
  <token>are</token>
 </pattern>
 <message>Did you mean <suggestion>is</suggestion>?</message>
 <example correction=''>The engine <marker>are</marker> running smoothly now.</example>
 <example>The engine is running smoothly now.</example>
</rule>

(Mility) #6

And this:

<rule id="THE_NN_AND_THE_NN" name="the nn and the nn is(the nn and the nn are)">    
 <pattern>
 <token>the</token>
  <token postag='NN'></token>
 <token>and</token>
  <token>the</token>
  <token postag='NN'></token>
  <marker>
  <token>is</token>
  </marker>
   </pattern>
 <message>Did you mean <suggestion>are</suggestion>?</message>
 <example correction=''>The plane and the train <marker>is</marker> fast.</example>
 <example>The plane and the train are fast.</example>
</rule>

(Daniel Naber) #7

That could work, could you test this with a lot of sentences from Wikipedia and/or Tatoeba, as described at http://wiki.languagetool.org/developing-robust-rules?


(Mility) #8

Here is the test result of these rules.


(Daniel Naber) #9

The rule editor can only check against a small number of sentences for performance reasons, that's why I was asking if you could check against a larger number, as documented in our Wiki.


(Mility) #10

Yesterday, I found it's hard for me.


(Mility) #11

I tried and I have not mastered the test method.

<rule id="BUY_VBG" name="buy+vbg(by+vbg)">

 <pattern>
 <marker>
  <token>buy</token>
  </marker>
  <token postag='VBG'><exception>cooking</exception></token>
 </pattern>
 <message>Did you mean <suggestion>by</suggestion>?</message>
 <example correction=''>We exploit these two feature <marker>buy</marker> using Named Entity recognition.</example>
 <example>We exploit these two feature by using Named Entity recognition.</example>
</rule>

<rule id="A_GREAT_NUMBER_OF+NN" name="a great number of+nn(nns)">

 <pattern>
  <token>a</token>
  <token>great</token>
  <token>number</token>
  <token>of</token>
  <marker>
  <token postag='NN'><exception>cars</exception></token>
  </marker>
 </pattern>
 <message>Did you mean<suggestion> <match no="5"  postag = "NNS"/></suggestion>?</message>
 <example correction=''>A great number of <marker>problem</marker> have arisen.</example>
 <example>A great number of problems have arisen.</example>
</rule>

(Mility) #12

Could we use this way to detect some error of preposition?

<!-- English rule, 2015-04-08 -->

<rule id="BE_FOND_TO" name="Wrong preposition: 'be fond to' (be fond of)">

 <pattern>
  <token postag='VBP|VB' postag_regexp='yes'></token>
  <token>fond</token>
  <marker>
  <token postag='IN'><exception>of</exception></token>
  </marker>
  <token postag='VBG'></token>
 </pattern>
 <message>Did you mean <suggestion>of</suggestion>?</message>
 <example correction=''>Children are fond <marker>to</marker> skipping.</example>
 <example>Children are fond of skipping.</example>
</rule>

(Mility) #13
<rule id="MANY_KINDS_OF" name="many kinds of+nn(many kinds of+nns)">    
               <pattern>
                   <token>many</token>
                   <token>kinds</token>
                   <token>of</token>
                   <token postag='NN'></token>
               </pattern>
               <message>Did you mean <suggestion><match no="4" postag="NNS" /></suggestion> ?</message>
               <example correction=''>There are <marker>many kinds of book</marker> in the shop.</example>
               <example>There are many kinds of books in the shop.</example>
           </rule>

(Daniel Naber) #14

Thanks. This causes a false alarm with "How Many Kinds Of Immigrant Visas Does It Take To Staff A Startup?". At http://community.languagetool.org/analysis/index?lang=en you can see how this gets analyzed and that the plural phrase "immigrant visas" is detected. Maybe you could use the "" to improve the rule to not detect false alarms? (for this, you need to switch to the "expert mode" and edit the XML directly).


(Mility) #15
<!-- English rule, 2015-04-15 -->


<rule id="MANY_KINDS_OF_NN" name="many kinds of+nn(many kinds of+nns)">    
            <antipattern>
                <token chunk="B-NP-plural"/>
                <token chunk="E-NP-plural"/>
            </antipattern>
               <pattern>
                   <token>many</token>
                   <token>kinds</token>
                   <token>of</token>
                   <token postag='NN'></token>
               </pattern>
               <message>Did you mean <suggestion><match no="4" postag="NNS" /></suggestion> ?</message>
               <example correction=''>There are <marker>many kinds of book</marker> in the shop.</example>
               <example>There are many kinds of books in the shop.</example>
           </rule>

(Daniel Naber) #16

Thanks, I've just added these rules to LanguageTool:

BUY_VBG
THE_NN_AND_THE_NN
MANY_KINDS_OF_NN
BE_FOND_TO
A_GREAT_NUMBER_OF_NN

They will become active on languagetool.org tonight.


(Mility) #17
	  	<!-- English rule, 2015-04-17 -->


<rulegroup id="AFFORD_VB" name="'afford', 'choose', 'deserve', 'pretend', 'learn', 'strive' and 'struggle' used with base form instead of infinitive">    
		  	 <rule>
                <pattern>
                  <token inflected="yes" regexp="yes">afford|choose|deserve|pretend|strive|struggle|learn</token>
                  <marker>
                  <token postag="VB"><exception>reward</exception></token>
                  </marker>
                </pattern>
                <message>This verb used with infinitive: <suggestion>to <match no="2" postag="VB"></match></suggestion>.</message>
                <short>Grammatical problem</short>
                <example>We cannot afford to spend the whole month in Alps.</example>
                <example>He didn't deserve to lose his job.</example>
                <example correction="to spend">We cannot afford <marker>spend</marker> the whole month in Alps.</example>
            </rule>


<rule>    
                <pattern>
                    <token inflected="yes" regexp="yes">afford|choose|deserve|pretend|strive|struggle|learn</token>
                    <token>not</token>
                    <marker>
                        <token postag="VB"></token>
                    </marker>
                </pattern>
                <message>This verb used with infinitive: <suggestion>to <match no="3" postag="VB"></match></suggestion>.</message>
                <short>Grammatical problem</short>
                <example>We cannot afford not to spend the whole month in Alps.</example>
                <example correction="to spend">We cannot afford not <marker>spend</marker> the whole month in Alps.</example>
            </rule>

        </rulegroup>

(Daniel Naber) #18

Thanks, I've added this rule. It will be live on languagetool.org tonight.


(Mility) #19
<rule id="ID" name="">

 <pattern>
  <token inflected='yes'>it</token>
  <token>is</token>
  <token postag='JJ'><exception>subject</exception></token>
  <token postag='IN'><exception>for</exception></token>
  <token postag='NNS|NN' postag_regexp='yes'></token>
 </pattern>
 <message>Did you mean <suggestion> for</suggestion>?</message>
 <example correction=''><marker>It is important with students</marker> to obtain part-time jobs.</example>
 <example>It is important for students to obtain part-time jobs.</example>
</rule>
<rule id="ID" name="">

 <pattern>
  <token>is</token>
  <token>it</token>
  <token postag='JJ'><exception>subject</exception></token>
  <token postag='IN'><exception>for</exception></token>
  <token postag='NNS|NN' postag_regexp='yes'></token>
 </pattern>
 <message>Did you mean <suggestion> for</suggestion>?</message>
 <example correction=''>Why <marker>is it important with students</marker> to obtain part-time jobs?</example>
 <example>Why is it important for students to obtain part-time jobs?</example>
</rule>

(Mility) #20
<rule id="ON_ADDITION" name="wrong preposition: 'On addition' (In addition)">    
           <pattern>
            <token poatag="SENT_START"/>
            <marker>
            <token postag='IN'><exception>in</exception></token>
            </marker>
            <token>addition</token>
            </pattern>
            <message>Did you mean <suggestion>in</suggestion>?</message>
            <example correction=''>. <marker>On</marker> addition</example>
            <example>. In addition</example>
           </rule>