commit c9133b8be4e6c8723af5ea77120e41865c75946e Author: vivekvardhanadepu Date: Mon May 31 15:59:11 2021 +0530 minor changes diff --git a/README.md b/README.md index 5b55fe8..4ef0816 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,3 @@ In moses_training, change the relevant paths and run training_script.sh Ref: www.statmt.org/moses/?n=Moses.Baseline - -**Simple TOML parser** - -parser: toml_parser.py - -parser test: parser_test.toml - -parser test output: parser_test.out - -Right now, it takes toml file, checks the syntax, converts and outputs it as a dictionary diff --git a/check_config.py b/check_config.py index 5459f5b..5a2d5d4 100644 --- a/check_config.py +++ b/check_config.py @@ -21,20 +21,9 @@ def check_config(filename='config.toml'): assert config_toml == dumps(config) # changing the paths to absolute - if not os.path.isabs(config['CORPUS_SL']): - config['CORPUS_SL'] = os.path.join(os.path.abspath('.'), config['CORPUS_SL']) - - if not os.path.isabs(config['CORPUS_TL']): - config['CORPUS_TL'] = os.path.join(os.path.abspath('.'), config['CORPUS_TL']) - - if not os.path.isabs(config['LEX_TOOLS']): - config['LEX_TOOLS'] = os.path.join(os.path.abspath('.'), config['LEX_TOOLS']) - - if not os.path.isabs(config['FAST_ALIGN']): - config['FAST_ALIGN'] = os.path.join(os.path.abspath('.'), config['FAST_ALIGN']) - - if not os.path.isabs(config['LANG_DATA']): - config['LANG_DATA'] = os.path.join(os.path.abspath('.'), config['LANG_DATA']) + for key in ['CORPUS_SL', 'CORPUS_TL', 'LEX_TOOLS', 'FAST_ALIGN', 'LANG_DATA']: + if not os.path.isabs(config[key]): + config[key] = os.path.join(os.path.abspath('.'), config[key]) if not os.path.isfile(config['CORPUS_SL']): print("'"+config['CORPUS_SL']+"'(CORPUS_SL)","is not a file, provide a valid"+ \ diff --git a/config.toml b/config.toml index 0d67a99..df7c7a3 100644 --- a/config.toml +++ b/config.toml @@ -10,16 +10,16 @@ SL = "eng" TL = "spa" # source corpus -CORPUS_SL = "../europarl-v7.eng-spa.eng" +CORPUS_SL = "europarl-v7.eng-spa.eng" # target corpus -CORPUS_TL = "../europarl-v7.eng-spa.spa" +CORPUS_TL = "europarl-v7.eng-spa.spa" # apertium-lex-tools scripts -LEX_TOOLS = "../../apertium-lex-tools/scripts" +LEX_TOOLS = "../apertium-lex-tools/scripts" # fast align build folder -FAST_ALIGN = "../coding_challenges/fast_align/build" +FAST_ALIGN = "coding_challenges/fast_align/build" # apertium language data -LANG_DATA = "../coding_challenges/apertium-eng-spa" +LANG_DATA = "coding_challenges/apertium-eng-spa" diff --git a/tests/check_config_test.py b/tests/check_config_test.py index 9ad1581..08753b6 100644 --- a/tests/check_config_test.py +++ b/tests/check_config_test.py @@ -30,8 +30,6 @@ def main(argc, argv): _, _ = os.wait() - # print() - # Test 2 config_file = open('config_test.toml', 'r') config_toml = config_file.read() @@ -81,8 +79,6 @@ def main(argc, argv): shutil.move(os.path.join(path, 'yasmet'+'abc'), os.path.join(path, 'yasmet')) break - # print() - # Test 3 config_file = open('config_test.toml', 'r') config_toml = config_file.read()