You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/07/22 05:53:57 UTC

svn commit: r1612453 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/analysis/ lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/

Author: rmuir
Date: Tue Jul 22 03:53:57 2014
New Revision: 1612453

URL: http://svn.apache.org/r1612453
Log:
LUCENE-5840: fix parsing of zero-affixes with continuation classes

Added:
    lucene/dev/branches/branch_4x/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestZeroAffix2.java
      - copied unchanged from r1612452, lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestZeroAffix2.java
    lucene/dev/branches/branch_4x/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.aff
      - copied unchanged from r1612452, lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.aff
    lucene/dev/branches/branch_4x/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.dic
      - copied unchanged from r1612452, lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.dic
Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java

Modified: lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java?rev=1612453&r1=1612452&r2=1612453&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java (original)
+++ lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java Tue Jul 22 03:53:57 2014
@@ -474,9 +474,10 @@ public class Dictionary {
       
       char flag = flagParsingStrategy.parseFlag(ruleArgs[1]);
       String strip = ruleArgs[2].equals("0") ? "" : ruleArgs[2];
-      String affixArg = ruleArgs[3].equals("0") ? "" : ruleArgs[3];
+      String affixArg = ruleArgs[3];
       char appendFlags[] = null;
       
+      // first: parse continuation classes out of affix
       int flagSep = affixArg.lastIndexOf('/');
       if (flagSep != -1) {
         String flagPart = affixArg.substring(flagSep + 1);
@@ -490,6 +491,10 @@ public class Dictionary {
         Arrays.sort(appendFlags);
         twoStageAffix = true;
       }
+      // zero affix -> empty string
+      if ("0".equals(affixArg)) {
+        affixArg = "";
+      }
       
       String condition = ruleArgs.length > 4 ? ruleArgs[4] : ".";
       // at least the gascon affix file has this issue