How do I visualize the results of Rule-based Matcher in Spacy as an HTML page?

Viewed 100

I am using the rule-based matcher in Spacy to look for some patterns in a text. Here is a example of my pattern

text = "GDP in developing countries such as Vietnam will continue growing at a high rate." 
pattern = [{'DEP':'amod', 'OP':"?"},
           {'POS':'NOUN'},
           {'LOWER': 'such'},
           {'LOWER': 'as'},
           {'POS': 'PROPN'}]

And it extracts Output: countries such as Vietnam. But I want to serve the results on a webpage and highlight the extracted portions in this case ' countries such as Vietnam'. I couldn't find the options in Displacy. Any help/ redirection to documentation would be great.

1 Answers

You can use the EntityRuler to make your matches entities and then give those to displaCy, which will highlight them.

Related