mirror of https://github.com/apache/lucene.git
hunspell: allow ignoring exceptions on duplicate ICONV/OCONV mappings (#13155)
hunspell: allow ignoring exceptions on duplicate ICONV/OCONV mappings
This commit is contained in:
parent
193cc62c73
commit
44d48df4b7
|
@ -202,6 +202,8 @@ Improvements
|
||||||
* GITHUB#13087: Changed `static final Set` constants to be immutable. Among others it affected
|
* GITHUB#13087: Changed `static final Set` constants to be immutable. Among others it affected
|
||||||
ScandinavianNormalizer.ALL_FOLDINGS set with public access. (Dmitry Cherniachenko)
|
ScandinavianNormalizer.ALL_FOLDINGS set with public access. (Dmitry Cherniachenko)
|
||||||
|
|
||||||
|
* GITHUB#13155: Hunspell: allow ignoring exceptions on duplicate ICONV/OCONV mappings (Peter Gromov)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -815,7 +815,7 @@ public class Dictionary {
|
||||||
|
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
String[] parts = splitBySpace(reader, reader.readLine(), 3);
|
String[] parts = splitBySpace(reader, reader.readLine(), 3);
|
||||||
if (mappings.put(parts[1], parts[2]) != null) {
|
if (mappings.put(parts[1], parts[2]) != null && !tolerateDuplicateConversionMappings()) {
|
||||||
throw new IllegalStateException("duplicate mapping specified for: " + parts[1]);
|
throw new IllegalStateException("duplicate mapping specified for: " + parts[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1167,6 +1167,14 @@ public class Dictionary {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether duplicate ICONV/OCONV lines should be silently ignored. False by default: an {@link
|
||||||
|
* IllegalStateException} will happen.
|
||||||
|
*/
|
||||||
|
protected boolean tolerateDuplicateConversionMappings() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
char[] allNonSuggestibleFlags() {
|
char[] allNonSuggestibleFlags() {
|
||||||
return Dictionary.toSortedCharArray(
|
return Dictionary.toSortedCharArray(
|
||||||
Stream.of(HIDDEN_FLAG, noSuggest, forbiddenword, onlyincompound, subStandard)
|
Stream.of(HIDDEN_FLAG, noSuggest, forbiddenword, onlyincompound, subStandard)
|
||||||
|
|
|
@ -206,6 +206,11 @@ public class TestDictionary extends LuceneTestCase {
|
||||||
protected boolean tolerateAffixRuleCountMismatches() {
|
protected boolean tolerateAffixRuleCountMismatches() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean tolerateDuplicateConversionMappings() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,8 @@ MAP a b
|
||||||
|
|
||||||
SFX A Y 1
|
SFX A Y 1
|
||||||
SFX A nout l [aeiouyáéíóúýůěr][^aeiouyáéíóúýůěrl][^aeiouy
|
SFX A nout l [aeiouyáéíóúýůěr][^aeiouyáéíóúýůěrl][^aeiouy
|
||||||
SFX A b c d
|
SFX A b c d
|
||||||
|
|
||||||
|
ICONV 2
|
||||||
|
ICONV x y
|
||||||
|
ICONV x y
|
Loading…
Reference in New Issue