Lazy-load xx

This commit is contained in:
Ines Montani 2020-10-04 11:10:26 +02:00
parent d3b3663942
commit ff914f4e6f
1 changed files with 3 additions and 3 deletions

View File

@ -2,9 +2,9 @@ from wasabi import Printer
from .. import tags_to_entities from .. import tags_to_entities
from ...training import iob_to_biluo from ...training import iob_to_biluo
from ...lang.xx import MultiLanguage
from ...tokens import Doc, Span from ...tokens import Doc, Span
from ...util import load_model from ...util import load_model
from ...util import load_model, get_lang_class
def conll_ner_to_docs( def conll_ner_to_docs(
@ -86,7 +86,7 @@ def conll_ner_to_docs(
if model: if model:
nlp = load_model(model) nlp = load_model(model)
else: else:
nlp = MultiLanguage() nlp = get_lang_class("xx")()
output_docs = [] output_docs = []
for conll_doc in input_data.strip().split(doc_delimiter): for conll_doc in input_data.strip().split(doc_delimiter):
conll_doc = conll_doc.strip() conll_doc = conll_doc.strip()
@ -136,7 +136,7 @@ def segment_sents_and_docs(doc, n_sents, doc_delimiter, model=None, msg=None):
"Segmenting sentences with sentencizer. (Use `-b model` for " "Segmenting sentences with sentencizer. (Use `-b model` for "
"improved parser-based sentence segmentation.)" "improved parser-based sentence segmentation.)"
) )
nlp = MultiLanguage() nlp = get_lang_class("xx")()
sentencizer = nlp.create_pipe("sentencizer") sentencizer = nlp.create_pipe("sentencizer")
lines = doc.strip().split("\n") lines = doc.strip().split("\n")
words = [line.strip().split()[0] for line in lines] words = [line.strip().split()[0] for line in lines]