Turned message into a warning rather than an exception
This commit is contained in:
parent
eeca70ade8
commit
5027a8388d
|
@ -254,7 +254,12 @@ class Converter:
|
||||||
exit('Could not parse specifications xml file provided.')
|
exit('Could not parse specifications xml file provided.')
|
||||||
|
|
||||||
def msd_to_properties(self, msd, language, lemma=None):
|
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]):
|
if (msd.code not in self.specifications.codes_map[msd.language]):
|
||||||
raise ConverterException('The msd {} is unknown'.format(msd.code))
|
raise ConverterException('The msd {} is unknown'.format(msd.code))
|
||||||
|
@ -273,8 +278,8 @@ class Converter:
|
||||||
feature_name = feature.names.get(language)
|
feature_name = feature.names.get(language)
|
||||||
feature_value = value.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]):
|
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}'\
|
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))
|
.format(category=category_name, position=index))
|
||||||
level_exception_flag = (category_name, feature.position, lemma) in LEVEL_EXCEPTIONS
|
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
|
lexeme_level_flag = feature.lexeme_level_flag if not level_exception_flag else not feature.lexeme_level_flag
|
||||||
feature_value_list.append((feature, value))
|
feature_value_list.append((feature, value))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user