---
title: "enumerateTagsInRange:unit:scheme:options:usingBlock:"
framework: naturallanguage
role: symbol
role_heading: Instance Method
path: "naturallanguage/nltagger/enumeratetagsinrange:unit:scheme:options:usingblock:"
---

# enumerateTagsInRange:unit:scheme:options:usingBlock:

Enumerates a block over the tagger’s string, given a range, token unit, and tag scheme.

## Declaration

```occ
- (void) enumerateTagsInRange:(NSRange) range unit:(NLTokenUnit) unit scheme:(NLTagScheme) scheme options:(NLTaggerOptions) options usingBlock:(void (^)(NLTag tag, NSRange tokenRange, BOOL *stop)) block;
```

## Parameters

- `range`: The range of the string you want the tagger to analyze.
- `unit`: The linguistic unit of scale you’re interested in, such as doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTokenUnit/word, doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTokenUnit/sentence, doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTokenUnit/paragraph, or doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTokenUnit/document.
- `scheme`: The tag scheme the tagger uses to tag the string, such as doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagScheme/language or doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagScheme/script. This scheme determines which types of doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTag the method passes to your block. For other tag schemes, see doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagScheme.
- `options`: The set of linguistic tagger options to use, such as doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagger/Options/omitWhitespace. For all available options, see doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagger/Options.
- `block`: The block this method uses to iterate over the tagger’s doc://com.apple.naturallanguage/documentation/NaturalLanguage/NLTagger/string property. The block has the following parameters:

## Discussion

Discussion Use this method to iterate your block over the given range of a string. The method divides up the string with the given NLTokenUnit and NLTagScheme and then calls your block. For example, use the lexicalClass tag scheme to identify which tokens are parts of speech, types of whitespace, or types of punctuation. Use the lemma tag scheme to identify the stem form of each word token, if known. important: This method enumerates over the ranges of all tokens that intersect the specified range.

## See Also

### Enumerating linguistic tags

- [NLTagger.Options](naturallanguage/nltagger/options.md)
- [NLTag](naturallanguage/nltag.md)
