---
title: "tags(in:scheme:options:tokenRanges:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nslinguistictagger/tags(in:scheme:options:tokenranges:)"
---

# tags(in:scheme:options:tokenRanges:)

Returns an array of linguistic tags and token ranges for a given string range.

## Declaration

```swift
func tags(in range: NSRange, scheme tagScheme: String, options opts: NSLinguisticTagger.Options = [], tokenRanges: AutoreleasingUnsafeMutablePointer<NSArray?>?) -> [String]
```

## Parameters

- `range`: The range from which to return tags.
- `tagScheme`: The tag scheme. See doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagScheme for possible values.
- `opts`: The linguistic tagger options to use. See doc://com.apple.foundation/documentation/Foundation/NSLinguisticTagger/Options for possible values.
- `tokenRanges`: Returns by reference an array of token ranges.

## Return Value

Return Value An array of the tags in the requested range.

## Discussion

Discussion When the returned array contains an entry that doesn’t have a corresponding tag scheme, that entry is an empty string (""). This is a convenience method for calling tags(in:unit:scheme:options:tokenRanges:) 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(at:scheme:tokenRange:sentenceRange:)](foundation/nslinguistictagger/tag(at:scheme:tokenrange:sentencerange:).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(for:range:unit:scheme:options:orthography:tokenRanges:)](foundation/nslinguistictagger/tags(for:range:unit:scheme:options:orthography:tokenranges:).md)
