Reputation: 2495
Let's say I have a title string, written in different languages.
Is there way to check which language is each string?
Upvotes: 2
Views: 746
Reputation: 14694
I have not played with it but you should look at NSLinguisticTagger and its - (NSOrthography *)orthographyAtIndex:(NSUInteger)charIndex effectiveRange:(NSRangePointer)effectiveRange
method. From the NSOrthography docs:
The NSOrthography class describes the linguistic content of a piece of text, typically used for the purposes of spelling and grammar checking.
An NSOrthography instance describes:
Which scripts the text contains. A dominant language and possibly other languages for each of these scripts. A dominant script and language for the text as a whole. Scripts are uniformly described by standard four-letter tags (Latn, Grek, Cyrl, etc.) with the supertags Jpan and Kore typically used for Japanese and Korean text, Hans and Hant for Chinese text; the tag Zyyy is used if a specific script cannot be identified. See Internationalization Programming Topics for more information on internationalization.
Languages are uniformly described by BCP-47 tags , preferably in canonical form; the tag und is used if a specific language cannot be determined.
Upvotes: 7
Reputation: 7502
You can simply use the Google Transalate REST API to find the language.
And you can use something like RestKit to make the REST requests to the google servers.
Upvotes: 4
Reputation: 7504
There's Google translation API available that allows language conversation. I am sure there must be something you will find that returns matched language for your string. See Google Translate APIs for details.
Upvotes: 0
Reputation: 1
You could use N-gram sampling frequencies techniques. I am not an expert, but they are rumored to work well in practice.
See netspeak and papers like this etc etc.
Upvotes: 0