mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-28 02:04:07 +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]
|
heads = [0, 0, 0]
|
||||||
deps = ["ROOT", "dobj", "dobj"]
|
deps = ["ROOT", "dobj", "dobj"]
|
||||||
ents = ["O", "B-ORG", "O"]
|
ents = ["O", "B-ORG", "O"]
|
||||||
|
morphs = ["Feat1=A", "Feat1=B", "Feat1=A|Feat2=D"]
|
||||||
return Doc(
|
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
|
attributes. Attribute values need to be JSON-serializable. Values will
|
||||||
be added to an "_" key in the data, e.g. "_": {"foo": "bar"}.
|
be added to an "_" key in the data, e.g. "_": {"foo": "bar"}.
|
||||||
RETURNS (dict): The data in spaCy's JSON format.
|
RETURNS (dict): The data in spaCy's JSON format.
|
||||||
|
|
||||||
DOCS: https://nightly.spacy.io/api/doc#to_json
|
|
||||||
"""
|
"""
|
||||||
data = {"text": self.text}
|
data = {"text": self.text}
|
||||||
if self.has_annotation("ENT_IOB"):
|
if self.has_annotation("ENT_IOB"):
|
||||||
|
@ -1421,7 +1419,7 @@ cdef class Doc:
|
||||||
if include_annotation["POS"]:
|
if include_annotation["POS"]:
|
||||||
token_data["pos"] = token.pos_
|
token_data["pos"] = token.pos_
|
||||||
if include_annotation["MORPH"]:
|
if include_annotation["MORPH"]:
|
||||||
token_data["morph"] = token.morph_
|
token_data["morph"] = token.morph
|
||||||
if include_annotation["LEMMA"]:
|
if include_annotation["LEMMA"]:
|
||||||
token_data["lemma"] = token.lemma_
|
token_data["lemma"] = token.lemma_
|
||||||
if include_annotation["DEP"]:
|
if include_annotation["DEP"]:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user