NLLanguageRecognizer
The language of a body of text.
Declaration
class NLLanguageRecognizerMentioned in
Overview
An NLLanguageRecognizer object automatically detects the language of a piece of text. It performs language identification by:
Identifying the dominant script of a piece of text. Some languages have a unique script (like Greek), but others share the same script (like English, French, and German, which all share the Latin script).
Identifying the language itself.
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, dominantLanguage(for:), to get the most likely language without creating an NLLanguageRecognizer.