Revision: 8730
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=8730&view=rev
Author:   dnaber
Date:     2012-12-30 20:09:18 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
bugfix: suggestions for compounds parts were missing sometimes

Modified Paths:
--------------
    trunk/JLanguageTool/CHANGES.txt
    
trunk/JLanguageTool/src/main/java/org/languagetool/rules/AbstractCompoundRule.java
    
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ro/CompoundRule.java
    
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java

Modified: trunk/JLanguageTool/CHANGES.txt
===================================================================
--- trunk/JLanguageTool/CHANGES.txt     2012-12-30 19:54:53 UTC (rev 8729)
+++ trunk/JLanguageTool/CHANGES.txt     2012-12-30 20:09:18 UTC (rev 8730)
@@ -2,7 +2,7 @@
 
 2.1-dev (release planned for 2013-03-31)
 
- -...
+ -bugfix: suggestions for compounds parts were missing sometimes
 
 
 2.0 (2012-12-30)

Modified: 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/AbstractCompoundRule.java
===================================================================
--- 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/AbstractCompoundRule.java
  2012-12-30 19:54:53 UTC (rev 8729)
+++ 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/AbstractCompoundRule.java
  2012-12-30 20:09:18 UTC (rev 8730)
@@ -57,9 +57,6 @@
 
   private String shortDesc;
 
-  /** Compounds with more than maxNoHyphensSize parts should always use 
hyphens */
-  private int maxUnHyphenatedWordCount = 2;
-
   /** Flag to indicate if the hyphen is ignored in the text entered by the 
user.
    * Set this to false if you want the rule to offer suggestions for words 
like [ro] "câte-și-trei" (with hyphen), not only for "câte și trei" (with 
spaces)
    * This is only available for languages with hyphen as a word separator (ie: 
not available for english, available for Romanian)
@@ -97,14 +94,6 @@
     this.hyphenIgnored = ignoreHyphen;
   }
 
-  public int getMaxUnHyphenatedWordCount() {
-    return maxUnHyphenatedWordCount;
-  }
-
-  public void setMaxUnHyphenatedWordCount(int maxNoHyphensSize) {
-    this.maxUnHyphenatedWordCount = maxNoHyphensSize;
-  }
-
   @Override
   public RuleMatch[] match(final AnalyzedSentence text) {
     final List<RuleMatch> ruleMatches = new ArrayList<RuleMatch>();
@@ -113,7 +102,7 @@
     RuleMatch prevRuleMatch = null;
     final Queue<AnalyzedTokenReadings> prevTokens = new 
ArrayBlockingQueue<AnalyzedTokenReadings>(MAX_TERMS);
     for (int i = 0; i < tokens.length + MAX_TERMS-1; i++) {
-      AnalyzedTokenReadings token = null;
+      AnalyzedTokenReadings token;
       // we need to extend the token list so we find matches at the end of the 
original list:
       if (i >= tokens.length) {
         token = new AnalyzedTokenReadings(new AnalyzedToken("", "", null), 
prevTokens.peek().getStartPos());
@@ -159,9 +148,7 @@
             replacement.add(origStringToCheck.replace(' ', '-'));
             msg = withHyphenMessage;
           }
-          // assume that compounds with more than maxUnHyphenatedWordCount 
(default: two) parts should always use hyphens:
-          if (!hasAllUppercaseParts(origStringToCheck) && 
countParts(stringToCheck) <= getMaxUnHyphenatedWordCount()
-              && !onlyDashSuggestion.contains(stringToCheck)) {
+          if (!hasAllUppercaseParts(origStringToCheck) && 
!onlyDashSuggestion.contains(stringToCheck)) {
             replacement.add(mergeCompound(origStringToCheck));
             msg = withoutHyphenMessage;
           }

Modified: 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ro/CompoundRule.java
===================================================================
--- 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ro/CompoundRule.java   
    2012-12-30 19:54:53 UTC (rev 8729)
+++ 
trunk/JLanguageTool/src/main/java/org/languagetool/rules/ro/CompoundRule.java   
    2012-12-30 20:09:18 UTC (rev 8730)
@@ -38,8 +38,6 @@
             "Cuvântul se scrie legat.",
             "Cuvântul se scrie legat sau cu cratimă.");
     super.setShort("Problemă de scriere (cratimă, spațiu, etc.)");
-    // default value (2) is not ok for Romanian
-    setMaxUnHyphenatedWordCount(Integer.MAX_VALUE);
     // there are words that should not be written with hyphen but as one word
     setHyphenIgnored(false);
   }

Modified: 
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java
===================================================================
--- 
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java
   2012-12-30 19:54:53 UTC (rev 8729)
+++ 
trunk/JLanguageTool/src/test/java/org/languagetool/rules/de/CompoundRuleTest.java
   2012-12-30 20:09:18 UTC (rev 8730)
@@ -67,7 +67,7 @@
     check(2, "Der dumme System Administrator legt die CD ROM ein blah");
     check(2, "System Administrator CD ROM");
     check(2, "Hals Wirbel Säule");
-    // TODO: check(1, "Und herum zu knobeln können.", new 
String[]{"herumzuknobeln"});
+    check(1, "Und herum zu knobeln können.", new String[]{"herumzuknobeln"});
     //FIXME: suggestions / longest match
     //check(1, "Roll on roll off Schiff", new 
String[]{"Roll-on-roll-off-Schiff"});
     check(1, "Spin off");

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


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to