Skip to content

Commit

Permalink
Merge pull request #88 from jaumeortola/master
Browse files Browse the repository at this point in the history
Fixes #86: speller - handling of words containing input separator
  • Loading branch information
dweiss committed Apr 24, 2017
2 parents ba71e87 + 8de7439 commit 5eff208
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion morfologik-speller/src/main/java/morfologik/speller/Speller.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,18 @@ public boolean isInDictionary(final CharSequence word) {
// Try to find a partial match in the dictionary.
final MatchResult match = matcher.match(matchResult, byteBuffer.array(), 0, byteBuffer.remaining(), rootNode);

if (match.kind == EXACT_MATCH) {
// Make sure the word doesn't contain a separator if there is an exact match
if (containsSeparators && match.kind == EXACT_MATCH) {
containsSeparators = false;
for (int i=0; i<word.length(); i++) {
if (word.charAt(i) == dictionaryMetadata.getSeparator()) {
containsSeparators = true;
break;
}
}
}

if (match.kind == EXACT_MATCH && !containsSeparators) {
return true;
}

Expand Down

0 comments on commit 5eff208

Please sign in to comment.