Skip to content

Commit b84f2cb

Browse files
committed
If a morphseg doesn't exist for a language, raise an exception as soon as we know there is a problem
1 parent 35633b8 commit b84f2cb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

stanza/pipeline/morphseg_processor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from stanza.pipeline.core import UnsupportedProcessorError
12
from stanza.pipeline.processor import UDProcessor, register_processor
23
from stanza.pipeline._constants import MORPHSEG, TOKENIZE
34

@@ -38,6 +39,8 @@ def _set_up_model(self, config, pipeline, device):
3839
lang=lang,
3940
load_pretrained=True
4041
)
42+
if self._segmenter.sequence_labeller is None:
43+
raise UnsupportedProcessorError("morphseg", lang)
4144

4245
def process(self, document):
4346
# Collect all words from all sentences

0 commit comments

Comments
 (0)