Commit e102af6e authored by Raul Sirel's avatar Raul Sirel
Browse files

fix + exception

parent b4d4d0a0
......@@ -15,6 +15,7 @@ from pelecanus import PelicanJson
from texta_mlp.document import Document
from texta_mlp.entity_mapper import EntityMapper
from texta_mlp.utils import parse_bool_env
from tecta_mlp.exceptions import LanguageNotSupported
# Languages supported by default.
......@@ -251,6 +252,9 @@ class MLP:
for entity in sentence.entities:
entities.append(entity)
except KeyError as e:
raise LanguageNotSupported(f"Language {lang} not supported. Check the list of supported languages.")
except Exception as e:
self.logger.exception(e)
return sentences, entities, repr(e)
......@@ -274,7 +278,7 @@ class MLP:
lang=lang,
dir=str(stanza_resource_path),
processors=self._get_stanza_processors(lang),
use_gpu=self.use_gpu,
use_gpu=use_gpu,
logging_level=logging_level
)
return stanza_pipelines
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment