The NSLinguisticTagger class is used to automatically segment natural-language text and tag it with information, such as parts of speech. It can also tag languages, scripts, stem forms of words, etc. An instance of this class is assigned a string to tag, and clients can then obtain tags and ranges for tokens in that string appropriate to a given tag scheme.


Thread Safety

A given instance of NSLinguisticTagger should not be used from more than one thread simultaneously.

Nested Types


These constants specify the linguistic tagger options. They can be combined using the C-Bitwise OR operator.


Creating a Linguistic Tagger

init(tagSchemes: [String], options: Int)

Creates a linguistic tagger instance using the specified tag schemes and options.

Getting the Tag Schemes

var tagSchemes: [String]

The tag schemes configured for this linguistic tagger.

class func availableTagSchemes(forLanguage: String)

Returns the tag schemes supported by the linguistic tagger for a particular language.

Getting and Setting the Analyzed String

var string: String?

The string being analyzed by the linguistic tagger.

func stringEdited(in: NSRange, changeInLength: Int)

Notifies the linguistic tagger that the string (if mutable) has changed as specified by the parameters.

Getting and Setting Orthography

func setOrthography(NSOrthography?, range: NSRange)

Sets the orthography for the specified range.

func orthography(at: Int, effectiveRange: NSRangePointer?)

Returns the orthography at the index and also returns the effective range.

Determining a Sentence for a Range

func sentenceRange(for: NSRange)

Returns the range of a sentence boundary containing the specified range.



These constants specify the linguistic tagger options. They can be combined using the C-Bitwise OR operator.

Linguistic Tag Schemes

These constants specify the linguistic tag schemes used by init(tagSchemes:options:) to create the linguistic tagger instance. The method tagSchemes returns an array of the schemes the instance was created with.


These constants return the linguistic token type according to their broad type.


These constants specify the lexical class of a token.


These constants define linguistic tags for specific types of words: people, places, and organizations.


Inherits From

Conforms To