Skip to content

Commit

Permalink
Merge pull request #115 from morfologik/revert-114-run-on-camelcase
Browse files Browse the repository at this point in the history
Revert "improve run-on suggestions for camel case words"
  • Loading branch information
dweiss committed Apr 20, 2022
2 parents 37992a5 + e44fac4 commit 2c07544
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@ public List<CandidateData> replaceRunOnWordCandidates(final String original) {
// chop from left to right
final String prefix = wordToCheck.substring(0, i);
final String suffix = wordToCheck.substring(i);
if (isInDictionary(suffix)
// camel case words: e.g. GreatElephant
|| (!isNotCapitalizedWord(suffix) && isInDictionary(suffix.toLowerCase(locale)))) {
if (isInDictionary(suffix)) {
if (isInDictionary(prefix)) {
addReplacement(candidates, prefix + " " + suffix);
} else if (Character.isUpperCase(prefix.charAt(0)) && isInDictionary(prefix.toLowerCase(locale))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ public void testRunonWords() throws IOException {
final URL url2 = getClass().getResource("single-char-word.dict");
final Speller spell2 = new Speller(Dictionary.read(url2));
assertTrue(spell2.replaceRunOnWords("alot").contains("a lot"));
assertTrue(spell2.replaceRunOnWords("Alot").contains("A lot"));
assertTrue(spell2.replaceRunOnWords("ALot").contains("A Lot"));
assertTrue(spell2.replaceRunOnWords("LotAmusement").contains("Lot Amusement"));
//TODO? assertTrue(spell2.replaceRunOnWords("LOTAMUSEMENT").contains("LOT AMUSEMENT"));
assertTrue(spell2.replaceRunOnWords("aalot").contains("aa lot"));
assertTrue(spell2.replaceRunOnWords("aamusement").contains("a amusement"));
assertTrue(spell2.replaceRunOnWords("clot").isEmpty());
Expand Down

0 comments on commit 2c07544

Please sign in to comment.