| Index: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java |
| =================================================================== |
| --- lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java (revision 1612357) |
| +++ lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java (working copy) |
| @@ -474,9 +474,10 @@ |
| |
| 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 @@ |
| 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 |
| Index: lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestZeroAffix2.java |
| =================================================================== |
| --- lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestZeroAffix2.java (revision 0) |
| +++ lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestZeroAffix2.java (working copy) |
| @@ -0,0 +1,32 @@ |
| +package org.apache.lucene.analysis.hunspell; |
| + |
| +/* |
| + * Licensed to the Apache Software Foundation (ASF) under one or more |
| + * contributor license agreements. See the NOTICE file distributed with |
| + * this work for additional information regarding copyright ownership. |
| + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| + * (the "License"); you may not use this file except in compliance with |
| + * the License. You may obtain a copy of the License at |
| + * |
| + * http://www.apache.org/licenses/LICENSE-2.0 |
| + * |
| + * Unless required by applicable law or agreed to in writing, software |
| + * distributed under the License is distributed on an "AS IS" BASIS, |
| + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| + * See the License for the specific language governing permissions and |
| + * limitations under the License. |
| + */ |
| + |
| +import org.junit.BeforeClass; |
| + |
| +public class TestZeroAffix2 extends StemmerTestBase { |
| + |
| + @BeforeClass |
| + public static void beforeClass() throws Exception { |
| + init("zeroaffix2.aff", "zeroaffix2.dic"); |
| + } |
| + |
| + public void testStemming() { |
| + assertStemsTo("b", "beer"); |
| + } |
| +} |
| |
| Property changes on: lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestZeroAffix2.java |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| ## -0,0 +1 ## |
| +native |
| \ No newline at end of property |
| Index: lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.aff |
| =================================================================== |
| --- lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.aff (revision 0) |
| +++ lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.aff (working copy) |
| @@ -0,0 +1,6 @@ |
| +SET UTF-8 |
| +FLAG num |
| + |
| +SFX 322 Y 1 |
| +SFX 322 eer 0/100 . |
| + |
| |
| Property changes on: lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.aff |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| ## -0,0 +1 ## |
| +native |
| \ No newline at end of property |
| Index: lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.dic |
| =================================================================== |
| --- lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.dic (revision 0) |
| +++ lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.dic (working copy) |
| @@ -0,0 +1,2 @@ |
| +1 |
| +beer/322 |
| |
| Property changes on: lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/zeroaffix2.dic |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| ## -0,0 +1 ## |
| +native |
| \ No newline at end of property |