LUCENE-5817: Fix hunspell zero-affix handling

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1609723 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-07-11 15:04:41 +00:00
parent 054a386610
commit 07385cbc10
5 changed files with 41 additions and 3 deletions

View File

@ -156,6 +156,9 @@ Bug Fixes
incorrect results when grouping on fields with missing values. incorrect results when grouping on fields with missing values.
(海老澤 志信, hossman) (海老澤 志信, hossman)
* LUCENE-5817: Fix hunspell zero-affix handling: previously only zero-strips worked
correctly. (Robert Muir)
Test Framework Test Framework
* LUCENE-5786: Unflushed/ truncated events file (hung testing subprocess). * LUCENE-5786: Unflushed/ truncated events file (hung testing subprocess).

View File

@ -435,7 +435,7 @@ public class Dictionary {
char flag = flagParsingStrategy.parseFlag(ruleArgs[1]); char flag = flagParsingStrategy.parseFlag(ruleArgs[1]);
String strip = ruleArgs[2].equals("0") ? "" : ruleArgs[2]; String strip = ruleArgs[2].equals("0") ? "" : ruleArgs[2];
String affixArg = ruleArgs[3]; String affixArg = ruleArgs[3].equals("0") ? "" : ruleArgs[3];
char appendFlags[] = null; char appendFlags[] = null;
int flagSep = affixArg.lastIndexOf('/'); int flagSep = affixArg.lastIndexOf('/');
@ -452,8 +452,6 @@ public class Dictionary {
twoStageAffix = true; twoStageAffix = true;
} }
// TODO: add test and fix zero-affix handling!
String condition = ruleArgs.length > 4 ? ruleArgs[4] : "."; String condition = ruleArgs.length > 4 ? ruleArgs[4] : ".";
// at least the gascon affix file has this issue // at least the gascon affix file has this issue
if (condition.startsWith("[") && condition.indexOf(']') == -1) { if (condition.startsWith("[") && condition.indexOf(']') == -1) {

View File

@ -0,0 +1,31 @@
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 TestZeroAffix extends StemmerTestBase {
@BeforeClass
public static void beforeClass() throws Exception {
init("zeroaffix.aff", "zeroaffix.dic");
}
public void testStemming() {
assertStemsTo("drink", "drinksierranevada");
}
}

View File

@ -0,0 +1,4 @@
SET UTF-8
SFX X Y 1
SFX X sierranevada 0 .

View File

@ -0,0 +1,2 @@
1
drinksierranevada/X [VERB]