I am checking words typed by users. I want to get unique words. For checking if the word is valid or not I am using following code:
UITextChecker *checker = [[UITextChecker alloc] init];
NSLocale *currentLocale = [NSLocale currentLocale];
NSString *currentLanguage = [currentLocale objectForKey:NSLocaleLanguageCode];
NSRange searchRange = NSMakeRange(0, [word length]);
NSRange misspelledRange = [checker rangeOfMisspelledWordInString:word range: searchRange startingAt:0 wrap:NO language: currentLanguage];
if (misspelledRange.location == NSNotFound) // valid word
else // Invalid word
This is working well but the problem is it Identifies Hand
and Hands
as a different words as both are different in spell. I want to get only one which occurs first. I can't check with the s
as the last character as I
and Is
are really different.
Is there any way to get identify the singular or plural words?
If I have any word can I get it's plural and singular word?
Thanks.
All plural word doesn't suffice s
or es
to their singular part.
So the answer is NO .
There are many exceptions using that rule. You need a third party/external vocabulary which contains all well-known words with their singular and plural variants.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.