<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSLinguisticTagScheme",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSLinguisticTagScheme"
  },
  "title" : "NSLinguisticTagScheme"
}
-->

# NSLinguisticTagScheme

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

```
struct NSLinguisticTagScheme
```

## Discussion

When initializing a linguistic tagger with [`init(tagSchemes:options:)`](/documentation/Foundation/NSLinguisticTagger/init(tagSchemes: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 [`availableTagSchemes(for:language:)`](/documentation/Foundation/NSLinguisticTagger/availableTagSchemes(for:language:)) or [`availableTagSchemes(forLanguage:)`](/documentation/Foundation/NSLinguisticTagger/availableTagSchemes(forLanguage:)) 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 [`noun`](/documentation/Foundation/NSLinguisticTag/noun) when using the [`lexicalClass`](/documentation/Foundation/NSLinguisticTagScheme/lexicalClass) tag scheme, “de” (German language) when using the [`language`](/documentation/Foundation/NSLinguisticTagScheme/language) tag scheme, and “Latn” (Latin script) when using the [`script`](/documentation/Foundation/NSLinguisticTagScheme/script) tag scheme, as shown in the following code.

```swift
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.

|Linguistic tag scheme                                                                               |Applicable linguistic units                                                                                                                                                                                                                                                                                                                                    |Possible tag values               |
|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme/tokenType``             |``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/word``                                                                                                                                                                                                                                                                            |See Token Types                   |
|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme/lexicalClass``          |``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/word``                                                                                                                                                                                                                                                                            |See Lexical Classes               |
|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme/nameType``              |``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/word``                                                                                                                                                                                                                                                                            |See Name Types                    |
|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme/nameTypeOrLexicalClass``|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/word``                                                                                                                                                                                                                                                                            |See Name Types and Lexical Classes|
|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme/lemma``                 |``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/word``                                                                                                                                                                                                                                                                            |A stem of the word                |
|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme/language``              |``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/word``, ``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/sentence``, ``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/paragraph``, ``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/document``|A BCP-47 language tag             |
|``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme/script``                |``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/word``, ``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/sentence``, ``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/paragraph``, ``doc://com.apple.foundation/documentation/Foundation/NSLinguisticTaggerUnit/document``|An ISO 15924 script code          |

## Topics

### Schemes

[`tokenType`](/documentation/Foundation/NSLinguisticTagScheme/tokenType)

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

[`lexicalClass`](/documentation/Foundation/NSLinguisticTagScheme/lexicalClass)

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

[`nameType`](/documentation/Foundation/NSLinguisticTagScheme/nameType)

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

[`nameTypeOrLexicalClass`](/documentation/Foundation/NSLinguisticTagScheme/nameTypeOrLexicalClass)

Classifies tokens corresponding to names according to [`nameType`](/documentation/Foundation/NSLinguisticTagScheme/nameType), and classifies all other tokens according to [`lexicalClass`](/documentation/Foundation/NSLinguisticTagScheme/lexicalClass).

[`lemma`](/documentation/Foundation/NSLinguisticTagScheme/lemma)

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

[`language`](/documentation/Foundation/NSLinguisticTagScheme/language)

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

[`script`](/documentation/Foundation/NSLinguisticTagScheme/script)

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



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)