NLTagger does not enumerate anymore?

I am using NLTagger to tag lexical classes of words, but it suddenly just stopped working. I boiled my code down to the most basic version, but it's never executing the closure of the enumerateTags() function. What do I have to change or what should I try?

    for e in sentenceArray {
    
    let cupcake = "I like you, have a cupcake"
    tagger.string = cupcake
    tagger.enumerateTags(in: cupcake.startIndex..<cupcake.endIndex, unit: .word, scheme: .nameTypeOrLexicalClass) { tag, range in
        print("TAG")
        return true
    }

Accepted Reply

Solution: after changing .nameTypeOrLexicalClass to just .lexicalClass, it executed the closure.

Replies

Solution: after changing .nameTypeOrLexicalClass to just .lexicalClass, it executed the closure.