AI-generated Key Takeaways
-
The
LanguageIdentificationclass identifies the primary language and possible languages of a given text. -
It provides methods to create instances with default or custom options using
languageIdentification()andlanguageIdentification(options:). -
The
identifyLanguage(for:completion:)method identifies the main language, whileidentifyPossibleLanguages(for:completion:)identifies multiple potential languages. -
Input texts exceeding 200 characters are truncated for language identification as longer input doesn't enhance accuracy.
LanguageIdentification
class LanguageIdentification : NSObjectThe LanguageIdentification class that identifies the main language or possible languages for
the given text.
-
Gets a language identification instance with the default options.
Declaration
Swift
class func languageIdentification() -> LanguageIdentificationReturn Value
A new instance of
LanguageIdentificationwith the default options. -
Gets a language identification instance with the given options.
Declaration
Swift
class func languageIdentification(options: MLKLanguageIdentificationOptions) -> LanguageIdentificationParameters
optionsThe options used for language identification.
Return Value
A new instance of
LanguageIdentificationwith the given options. -
Identifies the main language for the given text.
Declaration
Swift
func identifyLanguage(for text: String, completion: @escaping IdentifyLanguageCallback)Parameters
textThe input text to use for identifying the language. Inputs longer than 200 characters are truncated to 200 characters, as longer input does not improve the detection accuracy.
completionHandler to call back on the main queue with the identified language tag or error.
-
Identifies possible languages for the given text.
Declaration
Swift
func identifyPossibleLanguages(for text: String, completion: @escaping IdentifyPossibleLanguagesCallback)Parameters
textThe input text to use for identifying the language. Inputs longer than 200 characters are truncated to 200 characters, as longer input does not improve the detection accuracy.
completionHandler to call back on the main queue with identified languages or error.
-
Unavailable.