mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-06 14:40:34 +03:00
fix MORPH conversion + enable unit test
This commit is contained in:
parent
a5ee082da1
commit
face0de74f
|
@ -13,7 +13,7 @@ from ..errors import Errors, AlignmentError
|
|||
cpdef Doc annotations2doc(Doc predicted, tok_annot, doc_annot):
|
||||
# TODO: Improve and test this
|
||||
words = tok_annot.get("ORTH", [tok.text for tok in predicted])
|
||||
attrs, array = _annot2array(predicted.vocab.strings, tok_annot, doc_annot)
|
||||
attrs, array = _annot2array(predicted.vocab, tok_annot, doc_annot)
|
||||
output = Doc(predicted.vocab, words=words)
|
||||
if array.size:
|
||||
output = output.from_array(attrs, array)
|
||||
|
@ -117,6 +117,9 @@ def _annot2array(vocab, tok_annot, doc_annot):
|
|||
elif key == "SENT_START":
|
||||
attrs.append(key)
|
||||
values.append(value)
|
||||
elif key == "MORPH":
|
||||
attrs.append(key)
|
||||
values.append([vocab.morphology.add(v) for v in value])
|
||||
elif key == "ENT_IOB":
|
||||
iob_strings = Token.iob_strings()
|
||||
attrs.append(key)
|
||||
|
|
|
@ -60,7 +60,6 @@ def test_Example_from_dict_with_parse(annots):
|
|||
assert token.head.i == annots["heads"][i]
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="TODO - fix")
|
||||
@pytest.mark.parametrize(
|
||||
"annots",
|
||||
[
|
||||
|
|
Loading…
Reference in New Issue
Block a user