Type Alias

NSLinguisticTagScheme

Constants for the tag schemes specified when initializing a linguistic tagger.

Declaration

typedef NSString *NSLinguisticTagScheme;

Discussion

When initializing a linguistic tagger with initWithTagSchemes:options:, you specify one or more tag schemes that correspond to the kind of information you're interested in for a selection of natural language text. To ensure optimal performance, avoid specifying tag schemes that you won't use.

Some tag schemes are only available for certain units and languages. Use the availableTagSchemesForUnit:language: or availableTagSchemesForLanguage: methods to determine the possible values for a specified language and linguistic unit.

When working with linguistic tags using the methods described in Getting Linguistic Tags and Enumerating Linguistic Tags, the returned tag value depends on the specified scheme. For example, given the token "Überraschung", the returned tag is NSLinguisticTagNoun when using the NSLinguisticTagSchemeLexicalClass tag scheme, "de" (German language) when using the NSLinguisticTagSchemeLanguage tag scheme, and "Latn" (Latin script) when using the NSLinguisticTagSchemeScript tag scheme, as shown in the following code.

let tagger = NSLinguisticTagger(tagSchemes: [.lexicalClass, .language, .script], options: 0)
tagger.string = "Überraschung"

tagger.tag(at: 0, unit: .word, scheme: .lexicalClass, tokenRange: nil) // Noun
tagger.tag(at: 0, unit: .word, scheme: .language, tokenRange: nil) // de
tagger.tag(at: 0, unit: .word, scheme: .script, tokenRange: nil) // Latn

The following table lists the available tag schemes, their applicable linguistic units, and possible tag values.

Topics

Schemes

NSLinguisticTagSchemeTokenType

Classifies tokens according to their broad type: word, punctuation, or whitespace.

NSLinguisticTagSchemeLexicalClass

Classifies tokens according to class: part of speech, type of punctuation, or whitespace.

NSLinguisticTagSchemeNameType

Classifies tokens according to whether they are part of a named entity.

NSLinguisticTagSchemeNameTypeOrLexicalClass

Classifies tokens corresponding to names according to NSLinguisticTagSchemeNameType, and classifies all other tokens according to NSLinguisticTagSchemeLexicalClass.

NSLinguisticTagSchemeLemma

Supplies a stem form of a word token, if known.

NSLinguisticTagSchemeLanguage

Supplies the language for a token, if one can be determined.

NSLinguisticTagSchemeScript

Supplies the script for a token, if one can be determined.

See Also

Supporting Types

NSLinguisticTaggerUnit

Constants representing linguistic units.

NSLinguisticTag

A token, lexical class, name, lemma, language, or script returned by a linguistic tagger for natural language text.