Can anybody duplicate this result? I’m testing rangeOfMisspelledWordInString (in iOS) to find mispelled words and some random letters return a valid word as shown below.
UITextChecker* pSpellChecker = [[[UITextChecker alloc] init] autorelease];
NSRange rangeWord = NSMakeRange(0, 8);
NSRange rangeCheck = [_pSpellChecker rangeOfMisspelledWordInString:@"lhpcjeuw"
range:rangeWord
startingAt:0
wrap:NO
language:@"en_US"];
if (rangeCheck.location == NSNotFound) {
NSLog(@"Valid Word:");
}
Below are some of the words that are also valid according to rangeOfMisspelledWordInString:
BTW, I’ve made sure to convert the following words to lowercase before testing.
LD
THY
THE
THECA
TD
HL
HT
YD
YLEQXXH
DV
DVX
DVXX
DVXXD
DVXXDX
DVXXX
DVHXG
DVHEJWCP
DH
DH
DPJLEHHY
Very strange. Am I doing something wrong?
I think “the” and “thy” just might be valid words 😉
Other than that, my best guess is that the text system can’t provide a guess for the word, and so ignores it entirely – the semantic meaning of “misspelled word” might not include “strings of letters which cannot conceivably be a misspelling of a word.” I notice that when I type those strings into a system text field (e.g. in Messages), I don’t get any replacement suggestions.
You could also make sure that your UITextChecker instance isn’t set to ignore those particular words; take a look at the
ignoredWordsproperty.