displacy.render produces invalid svg by not escaping "<"
See original GitHub issueHow to reproduce the behaviour
import spacy
from spacy import displacy
nlp = spacy.load('de_core_news_sm')
doc = nlp('eins < zwei')
print(displacy.render(doc))
In the resulting svg code you can see that the “<” is not escaped:
...
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="134.5">
<tspan class="displacy-word" fill="currentColor" x="225"><</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="225">CONJ</tspan>
</text>
...
My Environment
- Operating System: Mac OS 10.12.6
- Python Version Used: 3.5.1
- spaCy Version Used: 2.0.11
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Save SpaCy render file as SVG using DisplaCy - Stack Overflow
I think that you have 2 errors there. First you should fix your path - add "." from: output_path = Path("/images/dependency_plot.svg").
Read more >Visualizers · spaCy Usage Documentation
Visualize dependencies and entities in your browser or in a notebook.
Read more >Document Structure — SVG 2
An SVG document fragment can range from an empty fragment (i.e., no content ... are not rendered directly; the display value for the...
Read more >Probably Don't Base64 SVG | CSS-Tricks
For a raster image like a PNG, the data of that image needs to be in base64 format. I'm not a huge expert...
Read more >SVG Elements and Attributes - O'Reilly Design System
Default is usually 0, which usually disables rendering of the element. Negative values are an error. SVG 2 makes it a geometry property...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
and here’s the separate issue for the failed tests: #2379
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.