Conversions scripts and resources between established formats etc.
Go to file
2023-10-31 10:39:19 +01:00
conversion_utils Added rudimentary module documentation and made a couple of basic fixes 2023-10-26 17:13:54 +02:00
scripts Added rudimentary module documentation and made a couple of basic fixes 2023-10-26 17:13:54 +02:00
.gitignore Updated setup.py and licence 2023-10-31 10:39:19 +01:00
LICENSE.txt Updated setup.py and licence 2023-10-31 10:39:19 +01:00
MANIFEST.in Moved files from nova_slovnica and data_admin repositories 2021-12-07 18:47:49 +01:00
README.md Added rudimentary module documentation and made a couple of basic fixes 2023-10-26 17:13:54 +02:00
setup.py Updated setup.py and licence 2023-10-31 10:39:19 +01:00

CJVT conversion utilities

This repository is intended for common conversions needed by CJVT developers. It can of course also be used more broadly, but most of the scripts (with the exception of jos_msds_and_properties.py) were written with specific tasks in mind, and may not generalise as expected. Use at your own risk.

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'}