Turned message into a warning rather than an exception

This commit is contained in:
Cyprian Laskowski 2021-12-07 17:22:17 +01:00
parent eeca70ade8
commit 5027a8388d

View File

@ -254,8 +254,13 @@ class Converter:
exit('Could not parse specifications xml file provided.')
def msd_to_properties(self, msd, language, lemma=None):
"""Convert Msd to Properties (possibly in the other language)."""
"""Convert Msd to Properties (possibly in the other language).
The level (lexeme vs form) of certain reflexive msd features
depends on the lemma, so set the lemma if you need accurate
level information.
"""
if (msd.code not in self.specifications.codes_map[msd.language]):
raise ConverterException('The msd {} is unknown'.format(msd.code))
@ -273,8 +278,8 @@ class Converter:
feature_name = feature.names.get(language)
feature_value = value.names.get(language)
if (lemma is None and (category_name, index) in [(le[0], le[1]) for le in LEVEL_EXCEPTIONS]):
raise ConverterException('The lemma is None but feature level depends on lemma for category={category}, position={position}'\
.format(category=category_name, position=index))
print('[WARN] The level of feature (category={category}, position={position}) may be incorrect, as it is lemma-specific and no lemma has been specified.'
.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))