mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-10 00:20:35 +03:00
* Fix off-by-one in head reading
This commit is contained in:
parent
3d6b3fc6fb
commit
9568ebed08
|
@ -16,10 +16,11 @@ def read_json_file(loc):
|
||||||
labels = []
|
labels = []
|
||||||
iob_ents = []
|
iob_ents = []
|
||||||
for token in paragraph['tokens']:
|
for token in paragraph['tokens']:
|
||||||
|
#print token['start'], token['orth'], token['head'], token['dep']
|
||||||
words.append(token['orth'])
|
words.append(token['orth'])
|
||||||
ids.append(token['start'])
|
ids.append(token['start'])
|
||||||
tags.append(token['tag'])
|
tags.append(token['tag'])
|
||||||
heads.append(token['head'] if token['head'] >= 1 else token['start'])
|
heads.append(token['head'] if token['head'] >= 0 else token['start'])
|
||||||
labels.append(token['dep'])
|
labels.append(token['dep'])
|
||||||
iob_ents.append(token.get('iob_ent', 'O'))
|
iob_ents.append(token.get('iob_ent', 'O'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user