mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
formatting
This commit is contained in:
parent
a581d82f33
commit
5b598bd1d5
|
@ -9,6 +9,7 @@ from ...typedefs cimport hash_t, attr_t
|
|||
from ...strings cimport hash_string
|
||||
from ...structs cimport TokenC
|
||||
from ...tokens.doc cimport Doc, set_children_from_heads
|
||||
from ...tokens.token import MISSING_DEP_
|
||||
from ...training.example cimport Example
|
||||
from .stateclass cimport StateClass
|
||||
from ._state cimport StateC, ArcC
|
||||
|
@ -195,7 +196,8 @@ cdef class ArcEagerGold:
|
|||
def __init__(self, ArcEager moves, StateClass stcls, Example example):
|
||||
self.mem = Pool()
|
||||
heads, labels = example.get_aligned_parse(projectivize=True)
|
||||
labels = [example.x.vocab.strings.add(label) if label is not None else 0 for label in labels]
|
||||
labels = [label if label is not None else MISSING_DEP_ for label in labels]
|
||||
labels = [example.x.vocab.strings.add(label) for label in labels]
|
||||
sent_starts = example.get_aligned_sent_starts()
|
||||
assert len(heads) == len(labels) == len(sent_starts), (len(heads), len(labels), len(sent_starts))
|
||||
self.c = create_gold_state(self.mem, stcls.c, heads, labels, sent_starts)
|
||||
|
|
|
@ -265,7 +265,7 @@ def test_Example_from_dict_sentences():
|
|||
assert len(list(ex.reference.sents)) == 1
|
||||
|
||||
|
||||
def test_Example_from_dict_with_parse():
|
||||
def test_Example_missing_deps():
|
||||
vocab = Vocab()
|
||||
words = ["I", "like", "London", "and", "Berlin", "."]
|
||||
deps = ["nsubj", "ROOT", "dobj", "cc", "conj", "punct"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user