Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import spacy
- import webbrowser
- nlp = spacy.load('en')
- doc = nlp(u'This is a sentence.')
- html = spacy.displacy.render(doc, style='dep')
- with open('temp.svg', 'w') as f:
- f.write(html)
- # open in default program
- # (it doesn't have to be web browser)
- webbrowser.open('temp.svg')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement