Instance Method


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


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



The range of the string you want the tagger to analyze.


The linguistic unit of scale you’re interested in, such as NLTokenUnitWord, NLTokenUnitSentence, NLTokenUnitParagraph, or NLTokenUnitDocument.


The tag scheme the tagger uses to tag the string, such as NLTagSchemeLanguage or NLTagSchemeScript. This scheme determines which types of NLTag the method passes to your block. For other tag schemes, see NLTagScheme.


The set of linguistic tagger options to use, such as NLTaggerOmitWhitespace. For all available options, see NLTaggerOptions.


The block this method uses to iterate over the tagger’s string property. The block has the following parameters:


The tag of the token.


The range of the token.


A reference to a Boolean value. The block can set the value to true to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this Boolean to true within the block.


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 NLTagSchemeLexicalClass tag scheme to identify which tokens are parts of speech, types of whitespace, or types of punctuation. Use the NLTagSchemeLemma tag scheme to identify the stem form of each word token, if known.

See Also

Enumerating Linguistic Tags


Constants for linguistic tagger enumeration specifying which tokens to omit and whether to join names.


A token type, lexical class, name, lemma, language, or script returned by a linguistic tagger for natural language text.