Update NER workflow with new displaCy

This commit is contained in:
ines 2017-05-15 01:42:11 +02:00
parent 860a60e251
commit c6e8d55dcb

View File

@ -105,17 +105,36 @@ p
| consistent state. | consistent state.
+h(2, "displacy") The displaCy #[sup ENT] visualizer +h(2, "displacy") Visualizing named entities
p p
| The #[+a(DEMOS_URL + "/displacy-ent/") displaCy #[sup ENT] visualizer] | The #[+a(DEMOS_URL + "/displacy-ent/") displaCy #[sup ENT] visualizer]
| lets you explore an entity recognition model's behaviour interactively. | lets you explore an entity recognition model's behaviour interactively.
| If you're training a model, it's very useful to run the visualization | If you're training a model, it's very useful to run the visualization
| server yourself. To help you do that, we've open-sourced both the | yourself. To help you do that, spaCy v2.0+ comes with a visualization
| #[+a(gh("spacy-services")) back-end service] and the | module. Simply pass a #[code Doc] or a list of #[code Doc] objects to
| #[+a(gh("displacy-ent")) front-end client]. | displaCy and run #[+api("displacy#serve") #[code displacy.serve]] to
| run the web server, or #[+api("displacy#render") #[code displacy.render]]
| to generate the raw markup.
+codepen("ALxpQO", 450) p
| For more details and examples, see the
| #[+a("/docs/usage/visualizers") usage workflow on visualizing spaCy].
+code("Named Entity example").
import spacy
from spacy import displacy
text = """But Google is starting from behind. The company made a late push
into hardware, and Apples Siri, available on iPhones, and Amazons Alexa
software, which runs on its Echo and Dot devices, have clear leads in
consumer adoption."""
nlp = spacy.load('custom_ner_model')
doc = nlp(text)
displacy.serve(doc, style='ent')
+codepen("a73f8b68f9af3157855962b283b364e4", 345)
+h(2, "entity-types") Built-in entity types +h(2, "entity-types") Built-in entity types