mirror of
https://github.com/explosion/spaCy.git
synced 2025-09-20 02:52:45 +03:00
chore(ipython): import from IPython.display
instead of IPython.core.display
This commit is contained in:
parent
41e07772dc
commit
f767ab90cd
|
@ -66,7 +66,7 @@ def render(
|
||||||
if jupyter or (jupyter is None and is_in_jupyter()):
|
if jupyter or (jupyter is None and is_in_jupyter()):
|
||||||
# return HTML rendered by IPython display()
|
# return HTML rendered by IPython display()
|
||||||
# See #4840 for details on span wrapper to disable mathjax
|
# See #4840 for details on span wrapper to disable mathjax
|
||||||
from IPython.core.display import HTML, display
|
from IPython.display import HTML, display
|
||||||
|
|
||||||
return display(HTML('<span class="tex2jax_ignore">{}</span>'.format(html)))
|
return display(HTML('<span class="tex2jax_ignore">{}</span>'.format(html)))
|
||||||
return html
|
return html
|
||||||
|
|
|
@ -1452,7 +1452,7 @@ detecting the IPython kernel. Mainly used for the
|
||||||
> ```python
|
> ```python
|
||||||
> html = "<h1>Hello world!</h1>"
|
> html = "<h1>Hello world!</h1>"
|
||||||
> if util.is_in_jupyter():
|
> if util.is_in_jupyter():
|
||||||
> from IPython.core.display import display, HTML
|
> from IPython.display import display, HTML
|
||||||
> display(HTML(html))
|
> display(HTML(html))
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
|
@ -254,12 +254,12 @@ rendering if auto-detection fails.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Internally, displaCy imports `display` and `HTML` from `IPython.core.display`
|
Internally, displaCy imports `display` and `HTML` from `IPython.display`
|
||||||
and returns a Jupyter HTML object. If you were doing it manually, it'd look like
|
and returns a Jupyter HTML object. If you were doing it manually, it'd look like
|
||||||
this:
|
this:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from IPython.core.display import display, HTML
|
from IPython.display import display, HTML
|
||||||
|
|
||||||
html = displacy.render(doc, style="dep")
|
html = displacy.render(doc, style="dep")
|
||||||
display(HTML(html))
|
display(HTML(html))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user