Instance Method

linguisticTags(in:scheme:options:orthography:tokenRanges:)

Returns an array of linguistic tags for the specified range and requested tags within the receiving string.

Declaration

func linguisticTags(in range: NSRange, scheme tagScheme: String, options opts: NSLinguisticTagger.Options = [], orthography: NSOrthography?, tokenRanges: AutoreleasingUnsafeMutablePointer<NSArray?>?) -> [String]

Parameters

range

The range of the string to analyze.

tagScheme

The tag scheme to use. See Linguistic Tag Schemes for supported values.

opts

The linguistic tagger options to use. See NSLinguisticTagger.Options for the constants. These constants can be combined using the C-Bitwise OR operator.

orthography

The orthography of the string. If nil, the linguistic tagger will attempt to determine the orthography from the string content.

tokenRanges

An array returned by-reference containing the token ranges of the linguistic tags wrapped in NSValue objects.

Return Value

Returns an array containing the linguistic tags for the tokenRanges within the receiving string.

Discussion

This is a convenience method. It is the equivalent of creating an instance of NSLinguisticTagger, specifying the receiver as the string to be analyzed, and the orthography (or nil) and then invoking the NSLinguisticTagger method or linguisticTags(in:scheme:options:orthography:tokenRanges:).