Merged converters into one

This commit is contained in:
cyp
2021-09-10 15:15:04 +02:00
parent 5c5b2c20cc
commit 2f7f90d073
3 changed files with 21 additions and 27 deletions
+3 -9
View File
@@ -196,12 +196,12 @@ class Msd:
return 'code={code}, language={language}'.format(code=self.code, language=self.language)
class MsdToProperties:
class Converter:
def __init__(self, specifications):
self.specifications = specifications
def convert(self, msd, lemma, properties_language):
def msd_to_properties(self, msd, lemma, properties_language):
category_char = msd.code[0].lower()
value_chars = msd.code[1:]
category = self.specifications.find_category_by_char(category_char, msd.language)
@@ -224,13 +224,7 @@ class MsdToProperties:
form_feature_map[feature_name] = feature_value
return Properties(category_name, lexeme_feature_map, form_feature_map, properties_language)
class PropertiesToMsd:
def __init__(self, specifications):
self.specifications = specifications
def convert(self, properties, msd_language):
def properties_to_msd(self, properties, msd_language):
category = self.specifications.find_category_by_name(properties.category, properties.language)
category_char = category.char_pair.get(msd_language).upper()
feature_map = properties.lexeme_feature_map.copy()