2017-05-15 02:25:18 +03:00
|
|
|
|
//- 💫 DOCS > USAGE > VISUALIZERS
|
|
|
|
|
|
2017-10-03 15:26:20 +03:00
|
|
|
|
include ../_includes/_mixins
|
2017-05-15 02:25:18 +03:00
|
|
|
|
|
2017-10-03 20:40:39 +03:00
|
|
|
|
+section
|
|
|
|
|
p
|
|
|
|
|
| As of v2.0, our popular visualizers, #[+a(DEMOS_URL + "/displacy") displaCy]
|
|
|
|
|
| and #[+a(DEMOS_URL + "/displacy-ent") displaCy #[sup ENT]] are finally an
|
|
|
|
|
| official part of the library. Visualizing a dependency parse or named
|
|
|
|
|
| entities in a text is not only a fun NLP demo – it can also be incredibly
|
|
|
|
|
| helpful in speeding up development and debugging your code and training
|
|
|
|
|
| process. If you're running a #[+a("https://jupyter.org") Jupyter] notebook,
|
|
|
|
|
| displaCy will detect this and return the markup in a format
|
|
|
|
|
| #[+a("#jupyter") ready to be rendered and exported].
|
|
|
|
|
|
|
|
|
|
+aside("What about the old visualizers?")
|
|
|
|
|
| Our JavaScript-based visualizers #[+src(gh("displacy")) #[code displacy.js]] and
|
|
|
|
|
| #[+src(gh("displacy-ent")) #[code displacy-ent.js]] will still be available on
|
|
|
|
|
| GitHub. If you're looking to implement web-based visualizations, we
|
|
|
|
|
| generally recommend using those instead of spaCy's built-in
|
|
|
|
|
| #[code displacy] module. It'll allow your application to perform all
|
|
|
|
|
| rendering on the client and only rely on the server for the text
|
|
|
|
|
| processing. The generated markup is also more compatible with modern web
|
|
|
|
|
| standards.
|
|
|
|
|
|
|
|
|
|
p
|
|
|
|
|
| The quickest way visualize #[code Doc] is to use
|
|
|
|
|
| #[+api("displacy#serve") #[code displacy.serve]]. This will spin up a
|
|
|
|
|
| simple web server and let you view the result straight from your browser.
|
|
|
|
|
| displaCy can either take a single #[code Doc] or a list of #[code Doc]
|
|
|
|
|
| objects as its first argument. This lets you construct them however you
|
|
|
|
|
| like – using any model or modifications you like.
|
|
|
|
|
|
|
|
|
|
+section("dep")
|
|
|
|
|
+h(2, "dep") Visualizing the dependency parse
|
|
|
|
|
include _visualizers/_dep
|
|
|
|
|
|
|
|
|
|
+section("ent")
|
|
|
|
|
+h(2, "ent") Visualizing the entity recognizer
|
|
|
|
|
include _visualizers/_ent
|
|
|
|
|
|
|
|
|
|
+section("jupyter")
|
|
|
|
|
+h(2, "jupyter") Using displaCy in Jupyter notebooks
|
|
|
|
|
include _visualizers/_jupyter
|
|
|
|
|
|
|
|
|
|
+section("html")
|
|
|
|
|
+h(2, "html") Rendering HTML
|
|
|
|
|
include _visualizers/_html
|