---
title: "tokenRangeAtIndex:unit:"
framework: naturallanguage
role: symbol
role_heading: Instance Method
path: "naturallanguage/nltagger/tokenrangeatindex:unit:"
---

# tokenRangeAtIndex:unit:

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

## Declaration

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

## Parameters

- `characterIndex`: The character index to begin examination.
- `unit`: The linguistic unit. For possible values, see doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTokenUnit.

## Return Value

Return Value The range of the substring for the linguistic unit.

## See Also

### Determining the range of a unit token

- [tokenRangeForRange:unit:](naturallanguage/nltagger/tokenrangeforrange:unit:.md)
- [NLTokenUnit](naturallanguage/nltokenunit.md)
