From 478b538e4da62b5e253a3eedc64d20bab74317d1 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Mon, 22 Jun 2020 17:09:23 +0200 Subject: [PATCH] fix docs_to_json --- spacy/cli/convert.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spacy/cli/convert.py b/spacy/cli/convert.py index 63a6e7474..7827f5238 100644 --- a/spacy/cli/convert.py +++ b/spacy/cli/convert.py @@ -4,9 +4,9 @@ from pathlib import Path from wasabi import Printer import srsly import re -import sys from ._app import app, Arg, Opt +from ..gold import docs_to_json from ..tokens import DocBin from ..gold.converters import iob2docs, conll_ner2docs, json2docs @@ -26,7 +26,7 @@ CONVERTERS = { } -# File types +# File types that can be written to stdout FILE_TYPES_STDOUT = ("json") @@ -81,6 +81,7 @@ def convert_cli( msg=msg, ) + def convert( input_path: Path, output_dir: Path, @@ -124,7 +125,7 @@ def convert( if not output_file.parent.exists(): output_file.parent.mkdir(parents=True) if file_type == "json": - srsly.write_json(output_file, docs2json(docs)) + srsly.write_json(output_file, docs_to_json(docs)) else: data = DocBin(docs=docs).to_bytes() with output_file.open("wb") as file_: