commit 83fbf45158e4273fcaff537c77f62a8d93ed0336 Author: vivekvardhanadepu Date: Sat Jul 17 13:13:23 2021 +0530 added config_file as an arg to lexical_training.py diff --git a/README.md b/README.md index bd04391..a36684e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The procedure for lexical selection training is a bit messy, with various script for more, read https://wiki.apertium.org/wiki/Ideas_for_Google_Summer_of_Code/User-friendly_lexical_selection_training -## Requirements +## requirements - [parallel corpus](https://wiki.apertium.org/wiki/Corpora) - [apertium-core](https://wiki.apertium.org/wiki/Installation) (install apertium-lex-tools with yasmet) @@ -12,12 +12,22 @@ for more, read https://wiki.apertium.org/wiki/Ideas_for_Google_Summer_of_Code/Us - [language pair](https://wiki.apertium.org/wiki/List_of_language_pairs) (install locally) - python dependencies in [requirements.txt](requirements.txt) -## Installation steps +## how to use - install the requirements and download or clone this repo (`git clone https://github.com/vivekvardhanadepu/apertium-lexical-training.git`) - create config.toml and provide tools' and corpus' paths in it (for ref, see [config.toml.example](config.toml.example)) -- run lexical_training.py +- run lexical_training.py
+ ``` + python3 lexical_training.py [CONFIG_FILE] + + args: + CONFIG_FILE : optional, default='config.toml' + ``` ## tests -This folder contains scripts for automated testing of the helper scripts +This folder contains scripts and data for automated testing of the training scripts + +## references + + diff --git a/lexical_training.py b/lexical_training.py index 47f263a..d91916e 100644 --- a/lexical_training.py +++ b/lexical_training.py @@ -286,9 +286,9 @@ def training(config, cache_dir, log): ngrams_to_rules(ngrams_all) -def main(): +def main(config_file): print("validating configuration....") - config = check_config() + config = check_config(config_file) # adding lex scripts to path lex_tools = '/usr/share/apertium-lex-tools' @@ -317,4 +317,7 @@ def main(): if __name__ == '__main__': - main() + config_file = 'config.toml' + if(len(sys.argv)==2): + config_file = sys.argv[1] + main(config_file)