mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 14:31:31 +00:00
ICU-21179 Clean up unused code in the RBBI dictbe
The wordsMatched conditional gave the misleading impression that only the first "first word" candidate that was followed by a dictionary word would be marked, but because the wordsMatched declaration is inside the while loop, every "first word" candidate that's followed by a dictionary word is marked (resulting in the shortest and not the longest first candidate that's followed by a second dictionary word).
This commit is contained in:
parent
45b8834e7a
commit
a138318922
1 changed files with 8 additions and 24 deletions
|
@ -265,13 +265,9 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
|
|||
goto foundBest;
|
||||
}
|
||||
do {
|
||||
int32_t wordsMatched = 1;
|
||||
if (words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
|
||||
if (wordsMatched < 2) {
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound%THAI_LOOKAHEAD].markCurrent();
|
||||
wordsMatched = 2;
|
||||
}
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound%THAI_LOOKAHEAD].markCurrent();
|
||||
|
||||
// If we're already at the end of the range, we're done
|
||||
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
|
||||
|
@ -503,13 +499,9 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
|
|||
goto foundBest;
|
||||
}
|
||||
do {
|
||||
int32_t wordsMatched = 1;
|
||||
if (words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
|
||||
if (wordsMatched < 2) {
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound%LAO_LOOKAHEAD].markCurrent();
|
||||
wordsMatched = 2;
|
||||
}
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound%LAO_LOOKAHEAD].markCurrent();
|
||||
|
||||
// If we're already at the end of the range, we're done
|
||||
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
|
||||
|
@ -699,13 +691,9 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
|
|||
goto foundBest;
|
||||
}
|
||||
do {
|
||||
int32_t wordsMatched = 1;
|
||||
if (words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
|
||||
if (wordsMatched < 2) {
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound%BURMESE_LOOKAHEAD].markCurrent();
|
||||
wordsMatched = 2;
|
||||
}
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound%BURMESE_LOOKAHEAD].markCurrent();
|
||||
|
||||
// If we're already at the end of the range, we're done
|
||||
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
|
||||
|
@ -908,13 +896,9 @@ KhmerBreakEngine::divideUpDictionaryRange( UText *text,
|
|||
goto foundBest;
|
||||
}
|
||||
do {
|
||||
int32_t wordsMatched = 1;
|
||||
if (words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) {
|
||||
if (wordsMatched < 2) {
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound % KHMER_LOOKAHEAD].markCurrent();
|
||||
wordsMatched = 2;
|
||||
}
|
||||
// Followed by another dictionary word; mark first word as a good candidate
|
||||
words[wordsFound % KHMER_LOOKAHEAD].markCurrent();
|
||||
|
||||
// If we're already at the end of the range, we're done
|
||||
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
|
||||
|
|
Loading…
Add table
Reference in a new issue