Conversions scripts and resources between established formats etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Cyprian Laskowski 8845cce2f4
Added README file with JOS conversion and translation examples
3 years ago
conversion_utils Implemented eq for Msd and Properties 3 years ago
scripts Replaced JOS XML specifications with preprocessed pickle 3 years ago
tests Added support for translating msds or properties 3 years ago
.gitignore Implemented specifications parse and msd->properties conversion 3 years ago
MANIFEST.in Replaced JOS XML specifications with preprocessed pickle 3 years ago
README.md Added README file with JOS conversion and translation examples 3 years ago
setup.py Replaced JOS XML specifications with preprocessed pickle 3 years ago

README.md

Conversion utilities

This repository is currently intended for common conversions needed by CJVT developers. For the moment, this is limited to JOS msds and properties.

JOS msds and properties

You can use the Msd and Properties to encode, and convert between the two types in either direction (specifying both the input and output language (English or Slovene)) or just translate between English and Slovene. Example usage:

>>> from conversion_utils.jos_msds_and_properties import Converter, Msd, Properties
>>> converter = Converter()
>>> msd = Msd('Sozem', 'sl')
>>> msd.code
'Sozem'
>>> msd.language
'sl'
>>> properties = converter.msd_to_properties(msd, 'en')
>>> properties.category
'noun'
>>> properties.lexeme_feature_map
{'type': 'common', 'gender': 'feminine'}
>>> properties.form_feature_map
{'number': 'singular', 'case': 'locative'}
>>> properties.language
'en'
>>> msd2 = converter.properties_to_msd(properties, 'sl')
>>> msd2 == msd
True
>>> print(converter.translate_msd(msd, 'en'))
code=Ncfsl, language=en
>>> print(converter.translate_properties(properties, 'sl'))
language=sl, category=samostalnik, lexeme features={'vrsta': 'občno_ime', 'spol': 'ženski'}, form_features={'število': 'ednina', 'sklon': 'mestnik'}