<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 12.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/NLTagger/tags(in:unit:scheme:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Natural Language",
      "NaturalLanguage"
    ],
    "preciseIdentifier" : "s:So8NLTaggerC15NaturalLanguageE4tags2in4unit6scheme7optionsSaySo5NLTagaSg_SnySS5IndexVGtGAN_So11NLTokenUnitVSo0I6SchemeaSo0A7OptionsVtF"
  },
  "title" : "tags(in:unit:scheme:options:)"
}
-->

# tags(in:unit:scheme:options:)

Finds an array of linguistic tags and token ranges for a given string range and linguistic unit.

```
@nonobjc func tags(in range: Range<String.Index>, unit: NLTokenUnit, scheme: NLTagScheme, options: NLTagger.Options = []) -> [(NLTag?, Range<String.Index>)]
```

## Parameters

`range`

The range from which to return tags.

`unit`

The linguistic unit. See [`NLTokenUnit`](/documentation/NaturalLanguage/NLTokenUnit) for possible values.

`scheme`

The tag scheme. See [`NLTagScheme`](/documentation/NaturalLanguage/NLTagScheme) for possible values.

`options`

The linguistic tagger options to use. See [`NLTagger.Options`](/documentation/NaturalLanguage/NLTagger/Options) for possible values.

## Return Value

An array of the tags in the requested range.

## Discussion

When the returned array contains an entry that doesn’t have a corresponding tag scheme, that entry is an empty string (””).

---

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)