Contents

NLLanguageRecognizer

The language of a body of text.

Declaration

class NLLanguageRecognizer

Mentioned in

Overview

An NLLanguageRecognizer object automatically detects the language of a piece of text. It performs language identification by:

  1. 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).

  2. 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.

Topics

Creating a recognizer

Determining the language

Guiding the recognizer

See Also

Language identification