<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NaturalLanguage",
  "identifier" : "/documentation/NaturalLanguage/NLTagScheme",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Natural Language"
    ],
    "preciseIdentifier" : "c:@T@NLTagScheme"
  },
  "title" : "NLTagScheme"
}
-->

# NLTagScheme

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

```
struct NLTagScheme
```

## Overview

When initializing a linguistic tagger with [`init(_:)`](/documentation/NaturalLanguage/NLTagScheme/init(_:)), 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 [`availableTagSchemes(for:language:)`](/documentation/NaturalLanguage/NLTagger/availableTagSchemes(for:language:)) 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 in [`NLTagger`](/documentation/NaturalLanguage/NLTagger), the returned tag value depends on the specified scheme. For example, given the token “Überraschung”, the returned tag is [`noun`](/documentation/NaturalLanguage/NLTag/noun) when using the [`lexicalClass`](/documentation/NaturalLanguage/NLTagScheme/lexicalClass) tag scheme, [`german`](/documentation/NaturalLanguage/NLLanguage/german) (German language) when using the [`language`](/documentation/NaturalLanguage/NLTagScheme/language) tag scheme, and “Latn” (Latin script) when using the [`script`](/documentation/NaturalLanguage/NLTagScheme/script) tag scheme, as shown in the following code.

```swift
let tagger = NLTagger(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) // german
tagger.tag(at: 0, unit: .word, scheme: .script, tokenRange: nil) // Latn
```

## Topics

### Schemes

[`tokenType`](/documentation/NaturalLanguage/NLTagScheme/tokenType)

A scheme that classifies tokens according to their broad type: word, punctuation, or whitespace.

[`lexicalClass`](/documentation/NaturalLanguage/NLTagScheme/lexicalClass)

A scheme that classifies tokens according to class: part of speech, type of punctuation, or whitespace.

[`nameType`](/documentation/NaturalLanguage/NLTagScheme/nameType)

A scheme that classifies tokens according to whether they are part of a named entity.

[`nameTypeOrLexicalClass`](/documentation/NaturalLanguage/NLTagScheme/nameTypeOrLexicalClass)

A scheme that classifies tokens corresponding to names according to [`nameType`](/documentation/NaturalLanguage/NLTagScheme/nameType), and classifies all other tokens according to [`lexicalClass`](/documentation/NaturalLanguage/NLTagScheme/lexicalClass).

[`lemma`](/documentation/NaturalLanguage/NLTagScheme/lemma)

A scheme that supplies a stem form of a word token, if known.

[`language`](/documentation/NaturalLanguage/NLTagScheme/language)

A scheme that supplies the language for a token, if it can determine one.

[`script`](/documentation/NaturalLanguage/NLTagScheme/script)

A scheme that supplies the script for a token, if it can determine one.

[`sentimentScore`](/documentation/NaturalLanguage/NLTagScheme/sentimentScore)

A scheme that scores text as positive, negative, or neutral based on its sentiment polarity.

### Initializers

[`init(_:)`](/documentation/NaturalLanguage/NLTagScheme/init(_:))

Creates a tag scheme.

[`init(rawValue:)`](/documentation/NaturalLanguage/NLTagScheme/init(rawValue:))

Creates a tag scheme with the specified raw value.



---

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)