0

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.

Kapil Choubisa
  • 5,152
  • 9
  • 65
  • 100
  • probably you'll need a dictionary/vocabulary which contains all well-known words with their plurals – Seryozha May 20 '14 at 12:00

2 Answers2

0

All plural word doesn't suffice s or es to their singular part.

So the answer is NO.

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
0

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.

Seryozha
  • 1,649
  • 1
  • 14
  • 13