<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NaturalLanguage",
  "identifier" : "/documentation/NaturalLanguage/NLTagger/tokenRangeAtIndex:unit:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Natural Language"
    ],
    "preciseIdentifier" : "c:objc(cs)NLTagger(im)tokenRangeAtIndex:unit:"
  },
  "title" : "tokenRangeAtIndex:unit:"
}
-->

# tokenRangeAtIndex:unit:

Returns the range of the linguistic unit containing the specified character index.

```
- (NSRange) tokenRangeAtIndex:(NSUInteger) characterIndex unit:(NLTokenUnit) unit;
```

## Parameters

`characterIndex`

The character index to begin examination.

`unit`

The linguistic unit. For possible values, see [`NLTokenUnit`](/documentation/NaturalLanguage/NLTokenUnit).

## Return Value

The range of the substring for 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)