Medical Reports Translation serves for the purposes of medical datasets translation.
- Python 3.9.7 as the code was written in it.
Install all required Python dependencies.
pip3 install -r requirements.txtNote: The requirements_full.txt file contains all packages installed locally during the developement phase.
The repository is structured as follows:
- Contains
Extractorclasses. - These serves for the text extraction from the dataset files as not all datasets are just simple text files. You can define your own class by inheriting the
Extractorabstract class. - Currently supported are OpenI(Indiana University chest X-ray) and MIMIC-CXR datasets.
- Contains
Preprocessorclasses. - These serves for the text preprocessing. Dataset texts may contain undesirable pattern or elements that can be corrected by preprocessing. You can define your own class by inheriting the
Preprocessorabstract class. - Each preprocessor is described inside its own class.
- Contains
Translatorclasses. - These serves for the automatic machine translation of text. You can define your own class by inheriting the
Translatorabstract class. - Currently supported are CUBBITT and DeepL(unusable in real terms due to strict DeepL limits) translators.
- Contains
pytesttests for preprocessors and extractors validation.
- Additional utilies and classes used in the translation process.
The translation of the dataset can be run in the following way. Parameters are further described directly in the source file or by entering the -h or --help option. More information can be found inside the script.
python3 dataset_translate.py [-h]
[--translator {cubbitt,deepl}]
[--dataset {mimic,openi}]
[--data DATA]
[--preprocess {lowercase,pipeline,none}]
[--preprocess_only PREPROCESS_ONLY]
[--anonymous_seq ANONYMOUS_SEQ]The overall script pipeline is currently focused on translation from English to Czech. For other target language, the files need to be updated accordingly.
The script generates the following directories:
- contains all translation runs identified by the translator, dataset, time etc. The translations are contained inside the corresponding run directory. All translations are .txt files
- contains additional logs identified in the similar way as above.
To run the tests:
python3 -m pytest tests