mirror of https://github.com/apache/lucene.git
Fix hunspell zero-string overgeneration
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1609738 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
07385cbc10
commit
17ca5cab58
|
@ -159,6 +159,9 @@ Bug Fixes
|
|||
* LUCENE-5817: Fix hunspell zero-affix handling: previously only zero-strips worked
|
||||
correctly. (Robert Muir)
|
||||
|
||||
* LUCENE-5818: Fix hunspell overgeneration for short strings that also match affixes.
|
||||
(Robert Muir)
|
||||
|
||||
Test Framework
|
||||
|
||||
* LUCENE-5786: Unflushed/ truncated events file (hung testing subprocess).
|
||||
|
|
|
@ -218,7 +218,7 @@ final class Stemmer {
|
|||
fst.getFirstArc(arc);
|
||||
IntsRef NO_OUTPUT = outputs.getNoOutput();
|
||||
IntsRef output = NO_OUTPUT;
|
||||
for (int i = 0; i < length; i++) {
|
||||
for (int i = 0; i < length-1; i++) {
|
||||
if (i > 0) {
|
||||
int ch = word[i-1];
|
||||
if (fst.findTargetArc(ch, arc, arc, bytesReader) == null) {
|
||||
|
@ -292,7 +292,7 @@ final class Stemmer {
|
|||
fst.getFirstArc(arc);
|
||||
IntsRef NO_OUTPUT = outputs.getNoOutput();
|
||||
IntsRef output = NO_OUTPUT;
|
||||
for (int i = length; i >= 0; i--) {
|
||||
for (int i = length; i > 0; i--) {
|
||||
if (i < length) {
|
||||
int ch = word[i];
|
||||
if (fst.findTargetArc(ch, arc, arc, bytesReader) == null) {
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
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 TestStrangeOvergeneration extends StemmerTestBase {
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
init("strange-overgeneration.aff", "strange-overgeneration.dic");
|
||||
}
|
||||
|
||||
public void testStemming() {
|
||||
assertStemsTo("btasty", "beer");
|
||||
assertStemsTo("tasty");
|
||||
assertStemsTo("yuck");
|
||||
assertStemsTo("foo");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
SET UTF-8
|
||||
|
||||
SFX A Y 1
|
||||
SFX A baz yuck baz
|
||||
|
||||
SFX B Y 1
|
||||
SFX B bar foo .
|
||||
|
||||
SFX C Y 1
|
||||
SFX C eer tasty .
|
|
@ -0,0 +1,5 @@
|
|||
3
|
||||
baz/A
|
||||
bar/B
|
||||
beer/C
|
||||
eer/C
|
Loading…
Reference in New Issue