<!--
{
  "availability" : [
    "iOS: 5.0.0 - 27.0.0",
    "iPadOS: 5.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.7.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 2.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSLinguisticTagger/tag(at:scheme:tokenRange:sentenceRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLinguisticTagger(im)tagAtIndex:scheme:tokenRange:sentenceRange:"
  },
  "title" : "tag(at:scheme:tokenRange:sentenceRange:)"
}
-->

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

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

```
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 [`NSLinguisticTagScheme`](/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

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

This is a convenience method for calling [`tag(at:unit:scheme:tokenRange:)`](/documentation/Foundation/NSLinguisticTagger/tag(at:unit:scheme:tokenRange:)) and passing [`NSLinguisticTaggerUnit.word`](/documentation/Foundation/NSLinguisticTaggerUnit/word) as the linguistic unit.

---

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)