Page Summary
-
EntityExtractoris a class used for extracting entities (like dates, addresses, phone numbers) from given text. -
It provides methods to annotate text, specifying parameters like reference time and entity types to extract.
-
You can download the necessary model files for entity extraction, with options for controlling download conditions.
-
EntityExtractoroffers both synchronous and asynchronous methods for annotating text, providing flexibility in implementation. -
The class can be configured with various options, allowing customization of the entity extraction process.
EntityExtractor
class EntityExtractor : NSObjectA class that extracts entities from the given input text.
-
Gets an
EntityExtractorinstance configured with the given options. This method is thread safe.Declaration
Swift
class func entityExtractor(options: MLKEntityExtractorOptions) -> EntityExtractorParameters
optionsThe options for the entity extractor.
Return Value
An
EntityExtractorinstance 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
textThe text to be annotated.
completionHandler 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
textThe text to be annotated.
paramsThe entity extraction parameters to be used during entity extraction.
completionHandler 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
completionHandler 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
conditionsThe downloading conditions for the translate model.
completionHandler to call back on the main queue with an error, if any.
-
Unavailable.