---
title: "tags(in:unit:scheme:options:)"
framework: naturallanguage
role: symbol
role_heading: Instance Method
path: "naturallanguage/nltagger/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.

## Declaration

```swift
@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 doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTokenUnit for possible values.
- `scheme`: The tag scheme. See doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagScheme for possible values.
- `options`: The linguistic tagger options to use. See doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagger/Options for possible values.

## Return Value

Return Value An array of the tags in the requested range.

## Discussion

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

## See Also

### Getting linguistic tags

- [tag(at:unit:scheme:)](naturallanguage/nltagger/tag(at:unit:scheme:).md)
- [tagHypotheses(at:unit:scheme:maximumCount:)](naturallanguage/nltagger/taghypotheses(at:unit:scheme:maximumcount:).md)
