I have been waiting for solution for case insensitive spell check but I did not get 100% solution.
@Yakov gave me a temporary solution. Thanks for that but still I have issues with case insensitive check.
As Yakov replied in GitHub Update en_US.info by surekha1317 · Pull Request #1425 · languagetool-org/languagetool · GitHub I have overriden the isMissplelled api as below
if (!speller.isMisspelled(word.toLowerCase(conversionLocale))) {
return false;
}else if(!speller.isMisspelled(word.toUpperCase(conversionLocale)))
{
return false;
}
//for initcap words
else if(!speller.isMisspelled(word.substring(0, 1).toUpperCase(conversionLocale) + word.substring(1).toLowerCase(conversionLocale)))
{
return false;
}
but it is still not covering all cases.
Ex: I am passing word “mastercard” for spell check.
Actual word in dictionary is “MasterCard” so, it is failing. I have added logic to convert each letter in my word to capital and checking as a temporary solution. This will deffinetly cause a performance issue.
I am looking for better solution. Please provide me the solution.
I feel some issue with this condition
Please check below part for all cases.
Ex: BLue, friday (one is mixed case and another is not)
!(!isMixedCase(wordToCheck) &&
(isInDictionary(wordToCheck.toLowerCase(dictionaryMetadata.getLocale()))
|| isAllUppercase(wordToCheck) && isInDictionary(initialUppercase(wordToCheck))))
Taken from Speller.java(isMisspelled api)
wordToCheck.length() > 0
&& (!dictionaryMetadata.isIgnoringPunctuation() || isAlphabetic)
&& (!dictionaryMetadata.isIgnoringNumbers() || containsNoDigit(wordToCheck))
&& !(dictionaryMetadata.isIgnoringCamelCase() && isCamelCase(wordToCheck))
&& !(dictionaryMetadata.isIgnoringAllUppercase() && isAlphabetic &&
isAllUppercase(wordToCheck))
&& !isInDictionary(wordToCheck)
&& (!dictionaryMetadata.isConvertingCase() ||
!(!isMixedCase(wordToCheck) &&
(isInDictionary(wordToCheck.toLowerCase(dictionaryMetadata.getLocale()))
|| isAllUppercase(wordToCheck) && isInDictionary(initialUppercase(wordToCheck)))));`
Please check and provide me the solution. I have been looking for this but I did not get it.