MLKitLanguageID Framework Reference

Stay organized with collections Save and categorize content based on your preferences.

MLKLanguageIdentification


@interface MLKLanguageIdentification : 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

    Objective-C

    + (nonnull MLKLanguageIdentification *)languageIdentification;

    Return Value

    A new instance of LanguageIdentification with the default options.

  • Gets a language identification instance with the given options.

    Declaration

    Objective-C

    + (nonnull MLKLanguageIdentification *)languageIdentificationWithOptions:
        (nonnull MLKLanguageIdentificationOptions *)options;

    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

    Objective-C

    - (void)identifyLanguageForText:(nonnull NSString *)text
                         completion:(nonnull MLKIdentifyLanguageCallback)completion;

    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

    Objective-C

    - (void)identifyPossibleLanguagesForText:(nonnull NSString *)text
                                  completion:
                                      (nonnull MLKIdentifyPossibleLanguagesCallback)
                                          completion;

    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.

    Declaration

    Objective-C

    - (nonnull instancetype)init;