mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Merge pull request #6224 from explosion/fix/doc-to-json
Fix morph in Doc.to_json
This commit is contained in:
commit
8b4cc29dbd
|
@ -10,8 +10,16 @@ def doc(en_vocab):
|
|||
heads = [0, 0, 0]
|
||||
deps = ["ROOT", "dobj", "dobj"]
|
||||
ents = ["O", "B-ORG", "O"]
|
||||
morphs = ["Feat1=A", "Feat1=B", "Feat1=A|Feat2=D"]
|
||||
return Doc(
|
||||
en_vocab, words=words, pos=pos, tags=tags, heads=heads, deps=deps, ents=ents
|
||||
en_vocab,
|
||||
words=words,
|
||||
pos=pos,
|
||||
tags=tags,
|
||||
heads=heads,
|
||||
deps=deps,
|
||||
ents=ents,
|
||||
morphs=morphs,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1398,8 +1398,6 @@ cdef class Doc:
|
|||
attributes. Attribute values need to be JSON-serializable. Values will
|
||||
be added to an "_" key in the data, e.g. "_": {"foo": "bar"}.
|
||||
RETURNS (dict): The data in spaCy's JSON format.
|
||||
|
||||
DOCS: https://nightly.spacy.io/api/doc#to_json
|
||||
"""
|
||||
data = {"text": self.text}
|
||||
if self.has_annotation("ENT_IOB"):
|
||||
|
@ -1421,7 +1419,7 @@ cdef class Doc:
|
|||
if include_annotation["POS"]:
|
||||
token_data["pos"] = token.pos_
|
||||
if include_annotation["MORPH"]:
|
||||
token_data["morph"] = token.morph_
|
||||
token_data["morph"] = token.morph
|
||||
if include_annotation["LEMMA"]:
|
||||
token_data["lemma"] = token.lemma_
|
||||
if include_annotation["DEP"]:
|
||||
|
|
Loading…
Reference in New Issue
Block a user