AI-generated Key Takeaways
-
MLKEntityExtractor is a class used for extracting entities, such as addresses, dates, and phone numbers, from given text.
-
It provides methods for annotating text, which identifies and labels these entities within the input.
-
Users can customize the annotation process by specifying parameters like reference time and desired entity types.
-
It also offers functionality to download necessary model files, allowing for both default and custom download conditions.
-
The extracted entities can then be utilized for various purposes, like data analysis or information retrieval.
MLKEntityExtractor
@interface MLKEntityExtractor : NSObjectA class that extracts entities from the given input text.
-
Gets an
EntityExtractorinstance configured with the given options. This method is thread safe.Declaration
Objective-C
+ (nonnull MLKEntityExtractor *)entityExtractorWithOptions: (nonnull MLKEntityExtractorOptions *)options;Parameters
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
Objective-C
- (void)annotateText:(nonnull NSString *)text completion:(nonnull MLKEntityExtractorCallback)completion;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
Objective-C
- (void)annotateText:(nonnull NSString *)text withParams:(nonnull MLKEntityExtractionParams *)params completion:(nonnull MLKEntityExtractorCallback)completion;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
Objective-C
- (void)downloadModelIfNeededWithCompletion: (nonnull MLKEntityExtractorDownloadModelIfNeededCallback)completion;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
Objective-C
- (void) downloadModelIfNeededWithConditions: (nonnull MLKModelDownloadConditions *)conditions completion: (nonnull MLKEntityExtractorDownloadModelIfNeededCallback) completion;Parameters
conditionsThe downloading conditions for the translate model.
completionHandler to call back on the main queue with an error, if any.
-
Unavailable.
Declaration
Objective-C
- (nonnull instancetype)init;