Instance Method


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


@nonobjc func tags(in range: Range<String.Index>, unit: NLTokenUnit, scheme: NLTagScheme, options: NLTagger.Options = []) -> [(NLTag?, Range<String.Index>)]



The range from which to return tags.


The linguistic unit. For possible values, see NLTokenUnit.


The tag scheme. For possible values, see NLTagScheme.


The linguistic tagger options to use. For possible values, see NLTagger.Options.

Return Value

An array of the tags in the requested range.


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

See Also

Getting Linguistic Tags

func tag(at: String.Index, unit: NLTokenUnit, scheme: NLTagScheme) -> (NLTag?, Range<String.Index>)

Finds a tag for a given linguistic unit, for a single scheme, at the specified character position.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software