You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have written some kind of wrapper to get parsed dependencies tree:
import spacy
nlp = spacy.load('en')
from __future__ import unicode_literals
def parse(text):
result = {}
tokens = nlp(text)
for token in tokens:
if token.head == token:
explore(token, result)
return result
def explore(token, result):
if token.pos_ != 'PRON':
print token.dep_
print token.orth_
result[token.dep_] = token.orth_
for idx, child in enumerate(token.children):
result[idx] = {}
explore(child, result[idx])
Problem is that there are some kind of queries which returns several ROOT objects, not sure if it's an expected behaviour, but in our wrapper or even a bug in the Spacy. Will be glad to get any help!
ines
added
docs
Documentation and website
models
Issues related to the statistical models
lang / en
English language data and models
and removed
docs
Documentation and website
models
Issues related to the statistical models
labels
May 13, 2017
Hi
We have written some kind of wrapper to get parsed dependencies tree:
Problem is that there are some kind of queries which returns several ROOT objects, not sure if it's an expected behaviour, but in our wrapper or even a bug in the Spacy. Will be glad to get any help!
'Bugged' query example: 'find leads first_name Alex'
Python version: 2.7.11
Spacy version: 0.101.0
Thanks,
Alex.
The text was updated successfully, but these errors were encountered: