Made lemma requirement and error message more specific

This commit is contained in:
Cyprian Laskowski 2021-09-10 15:56:01 +02:00
parent 30bafe09ac
commit 67382bb74f

View File

@ -227,8 +227,9 @@ class Converter:
value = feature.find_value_by_char(value_char, msd.language)
feature_name = feature.names.get(language)
feature_value = value.names.get(language)
if (lemma is None and category_name in [level_exception[0] for level_exception in LEVEL_EXCEPTIONS]):
exit('[ERROR] lemma is None but feature levels depend on lemma for category {}'.format(category_name))
if (lemma is None and (category_name, index) in [(le[0], le[1]) for le in LEVEL_EXCEPTIONS]):
exit('[ERROR] lemma is None but feature level depends on lemma for category={category}, position={position}'\
.format(category=category_name, position=index))
level_exception_flag = (category_name, feature.position, lemma) in LEVEL_EXCEPTIONS
lexeme_level_flag = feature.lexeme_level_flag if not level_exception_flag else not feature.lexeme_level_flag
feature_value_list.append((feature, value))