Type Method

tag(for:at:unit:scheme:orthography:tokenRange:)

Returns a tag for a single scheme, for a given linguistic unit, at the specified character position in a string.

Declaration

class func tag(for string: String, at charIndex: Int, unit: NSLinguisticTaggerUnit, scheme: NSLinguisticTagScheme, orthography: NSOrthography?, tokenRange: NSRangePointer?) -> NSLinguisticTag?

Parameters

charIndex

The position of the initial character.

unit

The linguistic unit. See NSLinguisticTaggerUnit for possible values.

tagScheme

The tag scheme. See NSLinguisticTagScheme for possible values.

tokenRange

A pointer to the token range.

Return Value

Returns the tag for the requested tag scheme and linguistic unit, or nil. If a tag is returned, this function returns by reference the range of the token to tokenRange.

Discussion

This is a convenience method for initializing a linguistic tagger, setting the string property, and calling the tag(for:at:unit:scheme:orthography:tokenRange:) method. If you analyze the same string more than once, you should create a linguistic tagger object instead of calling this method.