MLKitLanguageID Framework Reference

LanguageIdentification

class LanguageIdentification : NSObject

The 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() -> LanguageIdentification

    Return Value

    A new instance of LanguageIdentification with the default options.

  • Gets a language identification instance with the given options.

    Declaration

    Swift

    class func languageIdentification(options: MLKLanguageIdentificationOptions) -> LanguageIdentification

    Parameters

    options

    The options used for language identification.

    Return Value

    A new instance of LanguageIdentification with the given options.

  • Identifies the main language for the given text.

    Declaration

    Swift

    func identifyLanguage(for text: String, completion: @escaping IdentifyLanguageCallback)

    Parameters

    text

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

    completion

    Handler 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

    text

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

    completion

    Handler to call back on the main queue with identified languages or error.

  • Unavailable.