Revision: 8416
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=8416&view=rev
Author:   gulp21-1
Date:     2012-11-18 12:48:51 +0000 (Sun, 18 Nov 2012)
Log Message:
-----------
[nl] add DutchWrongWordInContextRule

Modified Paths:
--------------
    trunk/JLanguageTool/src/main/java/org/languagetool/language/Dutch.java

Added Paths:
-----------
    
trunk/JLanguageTool/src/main/java/org/languagetool/rules/nl/DutchWrongWordInContextRule.java
    
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/nl/wrongWordInContext.txt
    trunk/JLanguageTool/src/test/java/org/languagetool/rules/nl/
    
trunk/JLanguageTool/src/test/java/org/languagetool/rules/nl/DutchWrongWordInContextRuleTest.java

Modified: trunk/JLanguageTool/src/main/java/org/languagetool/language/Dutch.java
===================================================================
--- trunk/JLanguageTool/src/main/java/org/languagetool/language/Dutch.java      
2012-11-18 11:38:22 UTC (rev 8415)
+++ trunk/JLanguageTool/src/main/java/org/languagetool/language/Dutch.java      
2012-11-18 12:48:51 UTC (rev 8416)
@@ -30,6 +30,7 @@
 import org.languagetool.rules.UppercaseSentenceStartRule;
 import org.languagetool.rules.WhitespaceRule;
 import org.languagetool.rules.nl.CompoundRule;
+import org.languagetool.rules.nl.DutchWrongWordInContextRule;
 import org.languagetool.rules.nl.MorfologikDutchSpellerRule;
 import org.languagetool.synthesis.Synthesizer;
 import org.languagetool.synthesis.nl.DutchSynthesizer;
@@ -136,7 +137,8 @@
             UppercaseSentenceStartRule.class,
             MorfologikDutchSpellerRule.class,
             WhitespaceRule.class,
-            CompoundRule.class
+            CompoundRule.class,
+            DutchWrongWordInContextRule.class
     );
   }
 

Added: 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/nl/DutchWrongWordInContextRule.java
===================================================================
--- 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/nl/DutchWrongWordInContextRule.java
                                (rev 0)
+++ 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/nl/DutchWrongWordInContextRule.java
        2012-11-18 12:48:51 UTC (rev 8416)
@@ -0,0 +1,67 @@
+/* LanguageTool, a natural language style checker 
+ * Copyright (C) 2012 Markus Brenneis
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ */
+package org.languagetool.rules.nl;
+
+import java.io.IOException;
+import java.util.ResourceBundle;
+
+import org.languagetool.rules.WrongWordInContextRule;
+
+public class DutchWrongWordInContextRule extends WrongWordInContextRule {
+  
+  public DutchWrongWordInContextRule(final ResourceBundle messages) throws 
IOException {
+    super(messages);
+  }
+  
+  @Override
+  protected String getCategoryString() {
+    return "Easily Confused Words";
+  }
+  
+  @Override
+  public String getId() {
+    return "DUTCH_WRONG_WORD_IN_CONTEXT";
+  }
+  
+  @Override
+  public String getDescription() {
+    return "Confusion of words";
+  }
+  
+  @Override
+  protected String getFilename() {
+    return "/nl/wrongWordInContext.txt";
+  }
+  
+  @Override
+  protected String getMessageString() {
+    return "Possible confusion of words: Did you mean 
<suggestion>$SUGGESTION</suggestion> instead of '$WRONGWORD'?";
+  }
+  
+  @Override
+  protected String getShortMessageString() {
+    return "Possible confusion of words";
+  }
+  
+  @Override
+  protected String getLongMessageString() {
+    return "Possible confusion of words: Did you mean 
<suggestion>$SUGGESTION</suggestion> (= $EXPLANATION_SUGGESTION) instead of 
'$WRONGWORD' (= $EXPLANATION_WRONGWORD)?";
+  }
+
+}

Added: 
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/nl/wrongWordInContext.txt
===================================================================
--- 
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/nl/wrongWordInContext.txt
                             (rev 0)
+++ 
trunk/JLanguageTool/src/main/resources/org/languagetool/rules/nl/wrongWordInContext.txt
     2012-11-18 12:48:51 UTC (rev 8416)
@@ -0,0 +1,4 @@
+#word1 word2   match1  match2  context1        context2        [explanation1   
explanation2]
+#do not forget to add tests to DutchWrongWordInContextRuleTest.java
+# Mine/Miene (example, can be removed)
+# Minen?       Mienen? in      ien     
(?i)explodier.*|unterirdisch.*|Kugelschreiber.*|.*stift|Explosion.*|.*stürzen|.*spreng.*|.*gestürzt
     
verzieh(en|s?t)|verzog(en)?|auf(zu)?setzen|setze.*|setzt|gekränkt.*|unbewegt.*  
unterirdischer Gang, Sprengkörper, Kugelschreibermine   Gesichtsausdruck
\ No newline at end of file

Added: 
trunk/JLanguageTool/src/test/java/org/languagetool/rules/nl/DutchWrongWordInContextRuleTest.java
===================================================================
--- 
trunk/JLanguageTool/src/test/java/org/languagetool/rules/nl/DutchWrongWordInContextRuleTest.java
                            (rev 0)
+++ 
trunk/JLanguageTool/src/test/java/org/languagetool/rules/nl/DutchWrongWordInContextRuleTest.java
    2012-11-18 12:48:51 UTC (rev 8416)
@@ -0,0 +1,43 @@
+/* LanguageTool, a natural language style checker 
+ * Copyright (C) 2012 Markus Brenneis
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ */
+package org.languagetool.rules.nl;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.languagetool.JLanguageTool;
+import org.languagetool.Language;
+
+/**
+ * @author Markus Brenneis
+ */
+public class DutchWrongWordInContextRuleTest extends TestCase {
+
+  public void testRule() throws IOException {
+    DutchWrongWordInContextRule rule = new DutchWrongWordInContextRule(null);
+    JLanguageTool langTool = new JLanguageTool(Language.DUTCH);
+
+    // Mine/Miene (example, can be removed)
+//     assertEquals(0, rule.match(langTool.getAnalyzedSentence("Die Explosion 
der Mine.")).length); // correct sentence
+//     assertEquals(1, rule.match(langTool.getAnalyzedSentence("Die Mienen 
sind gestern Abend explodiert.")).length); // wrong sentence
+//     assertEquals("Minen", rule.match(langTool.getAnalyzedSentence("Er hat 
das mit den Mienen weggesprengt."))[0].getSuggestedReplacements().get(0)); // 
test suggestion
+  }
+  
+}

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to