MLKitEntityExtraction Framework Reference

MLKEntityExtractor


@interface MLKEntityExtractor : NSObject

A class that extracts entities from the given input text.

  • Gets an EntityExtractor instance configured with the given options. This method is thread safe.

    Declaration

    Objective-C

    + (nonnull MLKEntityExtractor *)entityExtractorWithOptions:
        (nonnull MLKEntityExtractorOptions *)options;

    Parameters

    options

    The options for the entity extractor.

    Return Value

    An EntityExtractor instance with the given options.

  • Annotates the given text with the default value for MLKEntityExtractionParams. Uses the current time as the reference time and device timezone as the reference timezone. Annotates all supported entity types.

    Declaration

    Objective-C

    - (void)annotateText:(nonnull NSString *)text
              completion:(nonnull MLKEntityExtractorCallback)completion;

    Parameters

    text

    The text to be annotated.

    completion

    Handler to call back on the main queue with the entity extraction result or error.

  • Annotates the given text with the given parameters such as reference time, reference time zone and entity types filter.

    Declaration

    Objective-C

    - (void)annotateText:(nonnull NSString *)text
              withParams:(nonnull MLKEntityExtractionParams *)params
              completion:(nonnull MLKEntityExtractorCallback)completion;

    Parameters

    text

    The text to be annotated.

    params

    The entity extraction parameters to be used during entity extraction.

    completion

    Handler to call back on the main queue with the entity extraction result or error.

  • Downloads the model files required for entity extraction with the default download conditions (cellular access allowed and background downloads disallowed). If model has already been downloaded, completes without additional work.

    Declaration

    Objective-C

    - (void)downloadModelIfNeededWithCompletion:
        (nonnull MLKEntityExtractorDownloadModelIfNeededCallback)completion;

    Parameters

    completion

    Handler to call back on the main queue with an error, if any.

  • Downloads the model files required for entity extraction when the given conditions are met. If model has already been downloaded, completes without additional work.

    Declaration

    Objective-C

    - (void)
        downloadModelIfNeededWithConditions:
            (nonnull MLKModelDownloadConditions *)conditions
                                 completion:
                                     (nonnull
                                          MLKEntityExtractorDownloadModelIfNeededCallback)
                                         completion;

    Parameters

    conditions

    The downloading conditions for the translate model.

    completion

    Handler to call back on the main queue with an error, if any.

  • Unavailable.

    Declaration

    Objective-C

    - (nonnull instancetype)init;