Contents

tags(for:range:unit:scheme:options:orthography:tokenRanges:)

Returns an array of linguistic tags and token ranges for a given string and linguistic unit.

Declaration

class func tags(for string: String, range: NSRange, unit: NSLinguisticTaggerUnit, scheme: NSLinguisticTagScheme, options: NSLinguisticTagger.Options = [], orthography: NSOrthography?, tokenRanges: AutoreleasingUnsafeMutablePointer<NSArray?>?) -> [NSLinguisticTag]

Parameters

  • string:

    The range from which to return tags.

  • range:

    The linguistic unit. See Nslinguistictaggerunit for possible values.

  • unit:

    The tag scheme. See Nslinguistictagscheme for possible values.

  • scheme:

    The linguistic tagger options to use. See Options for possible values.

  • options:

    Returns by reference an array of token ranges.

Return Value

An array of the tags in the requested range.

Discussion

When the returned array contains an entry that doesn’t have a corresponding tag scheme, that entry is an empty string ("").

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

See Also

Getting Linguistic Tags