AI-generated Key Takeaways
-
MLKEntityExtractionParamscustomizes entity extraction calls with parameters like reference time, time zone, and preferred locale. -
It allows filtering for specific entity types using
typesFilter, excluding others from detection. -
Relative dates are interpreted based on
referenceTimeandreferenceTimeZone, defaulting to current time and system locale. -
preferredLocalehelps disambiguate dates and supports a range of locales matching available models. -
Initialization defaults to
nilfor time/zone, includes all entity types viatypesFilter, and sets locale to the device's system locale.
MLKEntityExtractionParams
@interface MLKEntityExtractionParams : NSObjectAn object that contains various parameters that can be customized on each entity extraction call.
-
Reference time based on which relative dates (e.g. “tomorrow”) should be interpreted, in milliseconds from the epoch of 1970-01-01T00:00:00 (UTC timezone). A nil value means that the current time (when entity extraction is invoked) should be used.
Declaration
Objective-C
@property (nonatomic, nullable) NSDate *referenceTime; -
Reference time zone based on which relative dates (e.g. “tomorrow”) should be interpreted. If this is not set, the current time zone (when entity extraction is invoked) will be used.
Declaration
Objective-C
@property (nonatomic, nullable) NSTimeZone *referenceTimeZone; -
A preferred locale that can be used to disambiguate potential values for date-time entities. For example, “01/02/2000” is ambiguous and could refer to either January 2nd or February 1st, but a locale preference could help pick the right one (‘en-US’ would pick the former, and ‘en-UK’ the latter). The default value is the device’s system locale. The supported locales match the list of supported models. So any of (or a subset of): {
'en-*'} ({‘en-US’}, {'en-UK'}, {‘en-CA’}, …), {'ar-*'}, {‘de-’}, {“` ‘es-’}, {'fr-*'}, {‘it-’}, {”` ‘ja-’}, {'ko-*'}, {‘nl-’}, {“` ‘pl-’}, {'pt-*'}, {‘ru-’}, {”` ‘th-’}, {'tr-*'}, {‘zh-*’}Declaration
Objective-C
@property (nonatomic, null_resettable) NSLocale *preferredLocale; -
The subset of entity types (
EntityExtractionEntityType) that will be detected by the entity extractor. Types not present in the set will not be returned even if they are present in the input text.nilsets will be reset to the default set returned byMLKEntityExtractionEntityTypeAllEntityTypes.Declaration
Objective-C
@property (nonatomic, copy, null_resettable) NSSet<MLKEntityExtractionEntityType> *typesFilter; -
Initializes an allocated
EntityExtractionParamsinstance with the default values. Sets the referenceTime and referenceTimezone toniland sets the typesFilter to a set containing all values returned fromMLKEntityExtractionEntityTypeAllEntityTypes.Declaration
Objective-C
- (nonnull instancetype)init;