---
title: "tag(at:unit:scheme:)"
framework: naturallanguage
role: symbol
role_heading: Instance Method
path: "naturallanguage/nltagger/tag(at:unit:scheme:)"
---

# tag(at:unit:scheme:)

Finds a tag for a given linguistic unit, for a single scheme, at the specified character position.

## Declaration

```swift
@nonobjc func tag(at index: String.Index, unit: NLTokenUnit, scheme: NLTagScheme) -> (NLTag?, Range<String.Index>)
```

## Parameters

- `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.

## Return Value

Return Value The tag for the requested tag scheme and linguistic unit, or nil. If a tag is returned, this function returns by reference the range of the token to tokenRange.

## See Also

### Getting linguistic tags

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