The language of a body of text.


@interface NLLanguageRecognizer : NSObject


The identification obtained from an NLLanguageRecognizer object can be either a single most likely language, access through dominantLanguage, or a set of language candidates with probabilities, using languageHypothesesWithMaximum:. You can reset the recognizer to its initial state, to be reused for new analysis.

Use the convenience method, dominantLanguageForString:, to get the most likely language without creating an NLLanguageRecognizer.


Creating a Recognizer

- init

Creates a recognizer that you can customize.

Determining the Language

+ dominantLanguageForString:

Finds the most likely language of a piece of text.

- processString:

Analyzes the piece of text to determine its dominant language.


The most likely language for the processed text.

- languageHypothesesWithMaximum:

Generates the probabilities of possible languages for the processed text.

- reset

Resets the recognizer to its initial state.

Guiding the Recognizer


A dictionary that maps languages to their probabilities in the language identification process.


Limits the set of possible languages that the recognizer will return.


Inherits From

See Also

Language Identification


The languages supported by the Natural Language framework.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software