MLKitEntityExtraction Framework Reference

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

EntityExtractor

class EntityExtractor : 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

    Swift

    class func entityExtractor(options: MLKEntityExtractorOptions) -> EntityExtractor

    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

    Swift

    func annotateText(_ text: String, completion: @escaping EntityExtractorCallback)

    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

    Swift

    func annotateText(_ text: String, params: MLKEntityExtractionParams, completion: @escaping EntityExtractorCallback)

    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

    Swift

    func downloadModelIfNeeded(completion: @escaping EntityExtractorDownloadModelIfNeededCallback)

    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

    Swift

    func downloadModelIfNeeded(with conditions: MLKModelDownloadConditions, completion: @escaping EntityExtractorDownloadModelIfNeededCallback)

    Parameters

    conditions

    The downloading conditions for the translate model.

    completion

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

  • Unavailable.