Contents

enumerateTagsInRange:unit:scheme:options:usingBlock:

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

Declaration

- (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 Word, Sentence, Paragraph, or Document.

  • scheme:

    The tag scheme the tagger uses to tag the string, such as Language or Script. This scheme determines which types of Nltag the method passes to your block. For other tag schemes, see Nltagscheme.

  • options:

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

  • block:

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

    tag

    The tag of the token.

    tokenRange

    The range of the token.

    stop

    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.

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.

See Also

Enumerating linguistic tags