Created
September 20, 2019 23:07
-
-
Save colinpollock/6f134437279e1530daf2e030c61ce17d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
from spacy.pipeline import EntityRuler | |
nlp = spacy.load("en_core_web_sm") | |
ruler = EntityRuler(nlp, validate=True) | |
ruler.add_patterns[ | |
{ | |
"label": "PHRASE", | |
"pattern": [ | |
{"POS": "ADJ", "OP": "*"}, | |
{"POS": "NOUN", "OP": "+"}, | |
] | |
} | |
] | |
ruler.add_patterns(patterns) | |
nlp.add_pipe(ruler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment