Spacy Phrase Matcher - unhashable type: 'dict'

Viewed 385

I am trying to add a regex pattern to a spacy matcher, but I keep getting an unhashable type: 'dict' error and I'm not sure why. None of the keys are dictionaries themselves.

pattern = [{"TEXT": {"REGEX": "^[Uu](\.?|nited)$"}},
           {"TEXT": {"REGEX": "^[Ss](\.?|tates)$"}},
           {"LOWER": "president"}]

matcher = PhraseMatcher(nlp.vocab)
matcher.add('Regex Test', None, pattern)   # error line

This is essentially right from https://spacy.io/usage/rule-based-matching#regex-text.

0 Answers
Related