Instance Method

tags(in:unit:scheme:options:)

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

Declaration

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

Parameters

range

The range from which to return tags.

unit

The linguistic unit. For possible values, see NLTokenUnit.

scheme

The tag scheme. For possible values, see NLTagScheme.

options

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

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 ("").

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