diff --git a/README.md b/README.md index 39b231f..d1fe3df 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Can be used standalone (instructions below) or as part of other programs. help: ./run_txt_aug.py -h example usage: -./run_txt_aug.py corpus_1br_10pt_15sept.tok --aug translate random --action delete --maxs 10 --lang en --translate_mode local --append --output out.txt +./run_txt_aug.py corpus_1br_10pt_15sept.tok --aug backtranslate random_del --maxs 5 --lang en --translate_mode google --apend --output out.txt ``` ## Offline text generation diff --git a/run_txt_aug.py b/run_txt_aug.py index 44ededf..732e3b4 100755 --- a/run_txt_aug.py +++ b/run_txt_aug.py @@ -11,7 +11,7 @@ """ example usage: -./txt_aug.py corpus.tok --aug translate random --action delete --maxs 10 --lang en --append +./txt_aug.py corpus.tok --aug translate random_del --maxs 10 --lang en --append """ diff --git a/text/aug.py b/text/aug.py index 5b2ec5e..b50ec8f 100755 --- a/text/aug.py +++ b/text/aug.py @@ -223,14 +223,13 @@ def backtranslate_sentences_api( skips_count += 1 continue try: - backtranslator = backtranslator.translate(translation) + backtranslation = backtranslator.translate(translation) + backtranslations.append(backtranslation) except Exception as e: print(f"[!] Skipping backtranslating sentence '{translation}': {e}") skips_count += 1 continue skips_count = 0 - backtranslation = backtranslator.translate(translation) - backtranslations.append(backtranslation) print(f"{sentence} -> {translation} -> {backtranslation}") return backtranslations