MLKitLanguageID Framework Reference

  • This documentation details globally available type definitions for language identification.

  • MLKIdentifyLanguageCallback is a block that handles the result of language identification, providing the identified language tag or an error.

  • MLKIdentifyPossibleLanguagesCallback is a block that handles the result of identifying possible languages, providing a list of identified languages or an error.

Type Definitions

The following type definitions are available globally.

  • A block that handles a language identification result.

    Declaration

    Objective-C

    typedef void (^MLKIdentifyLanguageCallback)(NSString *_Nullable,
                                                NSError *_Nullable)

    Parameters

    languageTag

    The identified language tag for the text, IdentifiedLanguage.undetermined if no language was identified, or nil if there was an error.

    error

    The error or nil.

  • A block that handles the result of identifying possible languages.

    Declaration

    Objective-C

    typedef void (^MLKIdentifyPossibleLanguagesCallback)(
        NSArray<MLKIdentifiedLanguage *> *_Nullable, NSError *_Nullable)

    Parameters

    identifiedLanguages

    The list of identified languages for the text, or nil in case of an error. If no languages were identified, the result will consist of a single element with the language IdentifiedLanguage.undetermined and confidence 1.

    error

    The error or nil.