mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-13 13:17:06 +03:00
* Fix heads problem in read_conll
This commit is contained in:
parent
0eec1d12af
commit
f69fe6a635
|
@ -13,7 +13,6 @@ def parse(sent_text, strip_bad_periods=False):
|
||||||
id_map = {}
|
id_map = {}
|
||||||
for i, line in enumerate(sent_text.split('\n')):
|
for i, line in enumerate(sent_text.split('\n')):
|
||||||
word, tag, head, dep = _parse_line(line)
|
word, tag, head, dep = _parse_line(line)
|
||||||
id_map[i] = len(words)
|
|
||||||
if strip_bad_periods and words and _is_bad_period(words[-1], word):
|
if strip_bad_periods and words and _is_bad_period(words[-1], word):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -24,8 +23,6 @@ def parse(sent_text, strip_bad_periods=False):
|
||||||
'head': int(head) - 1,
|
'head': int(head) - 1,
|
||||||
'dep': dep})
|
'dep': dep})
|
||||||
words.append(word)
|
words.append(word)
|
||||||
for entry in annot:
|
|
||||||
entry['head'] = id_map.get(entry['head'], entry['head'])
|
|
||||||
return words, annot
|
return words, annot
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user