mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 12:18:04 +03:00
db55577c45
* Remove unicode declarations * Remove Python 3.5 and 2.7 from CI * Don't require pathlib * Replace compat helpers * Remove OrderedDict * Use f-strings * Set Cython compiler language level * Fix typo * Re-add OrderedDict for Table * Update setup.cfg * Revert CONTRIBUTING.md * Revert lookups.md * Revert top-level.md * Small adjustments and docs [ci skip]
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
from spacy import displacy
|
|
|
|
|
|
def test_issue3531():
|
|
"""Test that displaCy renderer doesn't require "settings" key."""
|
|
example_dep = {
|
|
"words": [
|
|
{"text": "But", "tag": "CCONJ"},
|
|
{"text": "Google", "tag": "PROPN"},
|
|
{"text": "is", "tag": "VERB"},
|
|
{"text": "starting", "tag": "VERB"},
|
|
{"text": "from", "tag": "ADP"},
|
|
{"text": "behind.", "tag": "ADV"},
|
|
],
|
|
"arcs": [
|
|
{"start": 0, "end": 3, "label": "cc", "dir": "left"},
|
|
{"start": 1, "end": 3, "label": "nsubj", "dir": "left"},
|
|
{"start": 2, "end": 3, "label": "aux", "dir": "left"},
|
|
{"start": 3, "end": 4, "label": "prep", "dir": "right"},
|
|
{"start": 4, "end": 5, "label": "pcomp", "dir": "right"},
|
|
],
|
|
}
|
|
example_ent = {
|
|
"text": "But Google is starting from behind.",
|
|
"ents": [{"start": 4, "end": 10, "label": "ORG"}],
|
|
}
|
|
dep_html = displacy.render(example_dep, style="dep", manual=True)
|
|
assert dep_html
|
|
ent_html = displacy.render(example_ent, style="ent", manual=True)
|
|
assert ent_html
|