---
title: NLGazetteer
framework: naturallanguage
role: symbol
role_heading: Class
path: naturallanguage/nlgazetteer
---

# NLGazetteer

A collection of terms and their labels, which take precedence over a word tagger.

## Declaration

```swift
class NLGazetteer
```

## Overview

Overview Use an NLGazetteer to augment an NLTagger when you need to tag a specific set of terms (single words or short phrases) with a label. Typically, you add one gazetteer per language, or one language-independent gazetteer, to an NLTagger with its setGazetteers(_:for:) method. The tagger uses its gazetteers to look up each term it processes. If a gazetteer has a label for a term, the tagger uses that label to tag the term, instead of inferring a tag itself. Typically, you create a gazetteer at development time, such as in a macOS playground, with Create ML’s MLGazetteer. Alternatively, you can create an NLGazetteer at runtime by using init(dictionary:language:).

## Topics

### Creating a Gazetteer

- [init(contentsOf:)](naturallanguage/nlgazetteer/init(contentsof:).md)
- [init(data:)](naturallanguage/nlgazetteer/init(data:).md)
- [init(dictionary:language:)](naturallanguage/nlgazetteer/init(dictionary:language:).md)
- [write(_:language:to:)](naturallanguage/nlgazetteer/write(_:language:to:).md)

### Looking Up Labels for Terms

- [label(for:)](naturallanguage/nlgazetteer/label(for:).md)

### Inspecting a Gazetteer

- [data](naturallanguage/nlgazetteer/data.md)
- [language](naturallanguage/nlgazetteer/language.md)

### Initializers

- [init(contentsOfURL:)](naturallanguage/nlgazetteer/init(contentsofurl:)-13iyg.md)
- [init(contentsOfURL:)](naturallanguage/nlgazetteer/init(contentsofurl:)-3inpk.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Using gazetteers with a tagger

- [setGazetteers(_:for:)](naturallanguage/nltagger/setgazetteers(_:for:).md)
- [gazetteers(for:)](naturallanguage/nltagger/gazetteers(for:).md)
