---
title: "tag(at:scheme:tokenRange:sentenceRange:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nslinguistictagger/tag(at:scheme:tokenrange:sentencerange:)"
---

# tag(at:scheme:tokenRange:sentenceRange:)

Returns a tag for a single scheme at the specified character position.

## Declaration

```swift
func tag(at charIndex: Int, scheme: NSLinguisticTagScheme, tokenRange: NSRangePointer?, sentenceRange: NSRangePointer?) -> NSLinguisticTag?
```

## Parameters

- `charIndex`: The position of the initial character.
- `scheme`: The tag scheme. See doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme for the possible values.
- `tokenRange`: A pointer to the token range.
- `sentenceRange`: A pointer to the range of the sentence.

## Return Value

Return Value Returns the tag for the requested tag scheme, or nil. If a tag is returned, this function returns by reference the range of the token to tokenRange, and the range of the enclosing sentence to sentenceRange, if applicable.

## Discussion

Discussion This is a convenience method for calling tag(at:unit:scheme:tokenRange:) and passing NSLinguisticTaggerUnit.word as the linguistic unit.

## See Also

### Getting Linguistic Tags

- [tag(at:unit:scheme:tokenRange:)](foundation/nslinguistictagger/tag(at:unit:scheme:tokenrange:).md)
- [tag(for:at:unit:scheme:orthography:tokenRange:)](foundation/nslinguistictagger/tag(for:at:unit:scheme:orthography:tokenrange:).md)
- [tags(in:unit:scheme:options:tokenRanges:)](foundation/nslinguistictagger/tags(in:unit:scheme:options:tokenranges:).md)
- [tags(in:scheme:options:tokenRanges:)](foundation/nslinguistictagger/tags(in:scheme:options:tokenranges:).md)
- [tags(for:range:unit:scheme:options:orthography:tokenRanges:)](foundation/nslinguistictagger/tags(for:range:unit:scheme:options:orthography:tokenranges:).md)
