Skip to content

Instantly share code, notes, and snippets.

@SandyRogers
Created March 17, 2020 10:34
Show Gist options
  • Save SandyRogers/d718a16e015f44e13fe529fe58d9f5ec to your computer and use it in GitHub Desktop.
Save SandyRogers/d718a16e015f44e13fe529fe58d9f5ec to your computer and use it in GitHub Desktop.
category = "wellbeing"
seeds = ["stress", "engagement", "burnout"]
matcher = Matcher(nlp.vocab)
rule_patterns = [
[{"LEMMA": "-PRON-", "OP": "?"}]
+ [{"LEMMA": tok.lemma_} for tok in nlp(seed)]
for seed in seeds
]
matcher.add(category, rule_patterns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment