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 2021/03/11 15:11:05 UTC

[lucene] branch main updated: LUCENE-9833: Hunspell: AssertionError in WordStorage.lookupWord (#13)

This is an automated email from the ASF dual-hosted git repository.

rmuir pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new e784721  LUCENE-9833: Hunspell: AssertionError in WordStorage.lookupWord (#13)
e784721 is described below

commit e784721e69732a444a0224eefac4cf91327385a7
Author: Peter Gromov <pe...@jetbrains.com>
AuthorDate: Thu Mar 11 16:10:57 2021 +0100

    LUCENE-9833: Hunspell: AssertionError in WordStorage.lookupWord (#13)
---
 .../java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java  | 1 +
 .../common/src/test/org/apache/lucene/analysis/hunspell/rep.aff       | 4 +++-
 .../common/src/test/org/apache/lucene/analysis/hunspell/rep.dic       | 4 +++-
 .../common/src/test/org/apache/lucene/analysis/hunspell/rep.sug       | 2 ++
 .../common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong     | 2 ++
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java
index e135fb6..8f90a41 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java
@@ -132,6 +132,7 @@ class ModifyingSuggester {
     int before = result.size();
     for (RepEntry entry : speller.dictionary.repTable) {
       for (String candidate : entry.substitute(word)) {
+        candidate = candidate.trim();
         if (trySuggestion(candidate)) {
           continue;
         }
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.aff b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.aff
index 485755c..ff5f395 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.aff
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.aff
@@ -3,7 +3,7 @@
 # switch off ngram suggestion for testing
 MAXNGRAMSUGS 0
 
-REP 8
+REP 9
 REP f ph
 REP ph f
 REP shun$ tion
@@ -12,7 +12,9 @@ REP ^foo$ bar
 REP ' _    # "un'alunno" -> "un alunno"
 REP ^vinte�n$ vinte_e_un
 REP s 's
+REP - _	# art-nouveau -> art nouveau
 
+BREAK 0
 
 SFX A Y 1
 SFX A 0 's .
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dic b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dic
index f9a4c00..8d6be34 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dic
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.dic
@@ -1,4 +1,4 @@
-10
+15
 form
 phantom
 vacation
@@ -13,3 +13,5 @@ vinte
 e
 un
 auto/A
+art nouveau
+nouveau
\ No newline at end of file
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sug b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sug
index b48a5b8..ec15195 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sug
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.sug
@@ -6,3 +6,5 @@ un alunno
 bar
 vinte e un
 auto's, auto
+art nouveau
+nouveau
\ No newline at end of file
diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong
index b3254ac..1184a38 100644
--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong
+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/rep.wrong
@@ -9,3 +9,5 @@ foobars
 barfoos
 vinteún
 autos
+art-nouveau
+-nouveau
\ No newline at end of file