---
title: "tag(for:at:unit:scheme:orthography:tokenRange:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nslinguistictagger/tag(for:at:unit:scheme:orthography:tokenrange:)"
---

# tag(for:at:unit:scheme:orthography:tokenRange:)

Returns a tag for a single scheme, for a given linguistic unit, at the specified character position in a string.

## Declaration

```swift
class func tag(for string: String, at charIndex: Int, unit: NSLinguisticTaggerUnit, scheme: NSLinguisticTagScheme, orthography: NSOrthography?, tokenRange: NSRangePointer?) -> NSLinguisticTag?
```

## Parameters

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

## Return Value

Return Value Returns 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.

## Discussion

Discussion This is a convenience method for initializing a linguistic tagger, setting the string property, and calling the tag(for:at:unit:scheme:orthography:tokenRange:) method. If you analyze the same string more than once, you should create a linguistic tagger object instead of calling this method.

## See Also

### Getting Linguistic Tags

- [tag(at:unit:scheme:tokenRange:)](foundation/nslinguistictagger/tag(at:unit:scheme:tokenrange:).md)
- [tag(at:scheme:tokenRange:sentenceRange:)](foundation/nslinguistictagger/tag(at:scheme:tokenrange:sentencerange:).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)
