Split the raising of the msd_to_properties error to more cases

This commit is contained in:
2026-10-23 08:54:51 +02:00
parent 2e3fdbe2e0
commit cbf06209ca
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -379,16 +379,20 @@ class Converter:
category_char = msd.code[0].lower()
value_chars = msd.code[1:]
category = self.specifications.find_category_by_code(category_char, msd.language)
if category is None:
raise MsdException(f"Msd '{msd.code}' cannot be converted to Properties: unknown category '{category_char}'.")
category_name = category.names.get(language)
feature_value_list = []
lexeme_feature_map = {}
form_feature_map = {}
if msd.state not in [Msd.State.FULL, Msd.State.PARTIAL]:
raise MsdException(f"Msd must be full or partial to be converted to Properties, but is {msd.state.name}.")
for (index, value_char) in enumerate(value_chars, start=1):
if (value_char != '-'):
feature = category.find_feature_by_position(index)
if feature is None:
raise MsdException(f"Msd '{msd.code}' cannot be converted to Properties: no feature at position {index}.")
value = feature.find_value_by_char(value_char, msd.language)
if value is None:
raise MsdException(f"Msd '{msd.code}' cannot be converted to Properties: unknown value '{value_char}' at position {index}.")
feature_name = feature.names.get(language)
feature_value = value.names.get(language)
if (warn_level_flag and lemma is None and (category_name, index) in [(le[0], le[1]) for le in LEVEL_EXCEPTIONS]):
+1 -1
View File
@@ -6,7 +6,7 @@ with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(name='cjvt_conversion_utils',
version='0.4.1',
version='0.4.2',
description='CJVT conversion utilities',
long_description=long_description,
long_description_content_type="text/markdown",