<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NaturalLanguage",
  "identifier" : "/documentation/NaturalLanguage/NLTagger/dominantLanguage",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Natural Language"
    ],
    "preciseIdentifier" : "c:objc(cs)NLTagger(py)dominantLanguage"
  },
  "title" : "dominantLanguage"
}
-->

# dominantLanguage

The dominant language of the string set for the linguistic tagger.

```
var dominantLanguage: NLLanguage? { get }
```

## Discussion

If you want to know the dominant language of a string that you’re analyzing with a linguistic tagger (for example, identifying part of speech for each word), specify the [`language`](/documentation/NaturalLanguage/NLTagScheme/language) tag scheme in the initializer. After you set the [`string`](/documentation/NaturalLanguage/NLTagger/string) property of the linguistic tagger, the dominant language can be determined with the [`dominantLanguage`](/documentation/NaturalLanguage/NLTagger/dominantLanguage) property, as shown in this example:

```swift
let text = "Die Kleinen haben friedlich zusammen gespielt."
let tagger = NLTagger(tagSchemes: [.language], options: 0)
tagger.string = text
tagger.dominantLanguage // NLLanguage.german
```

In the example, [`german`](/documentation/NaturalLanguage/NLLanguage/german) is the dominant language, indicating that the text is in German.

---

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)