!2705 Solve Mass CodeX warning

Merge pull request !2705 from 刘崇鸣/solve_mass_codex_warning
pull/2705/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit e40ba6f8bc

@ -16,8 +16,8 @@
import os import os
import subprocess import subprocess
ENCODER = "subword-nmt apply-bpe -c {codes} -i {input} -o {output}" ENCODER = "subword-nmt apply-bpe -c"
LEARN_DICT = "subword-nmt get-vocab -i {input} -o {dict_path}" LEARN_DICT = "subword-nmt get-vocab -i"
def bpe_encode(codes_path, src_path, output_path, dict_path): def bpe_encode(codes_path, src_path, output_path, dict_path):
@ -43,10 +43,10 @@ def bpe_encode(codes_path, src_path, output_path, dict_path):
raise FileNotFoundError("Dir not found.") raise FileNotFoundError("Dir not found.")
# Encoding. # Encoding.
print(f" | Applying BPE encoding.") print(" | Applying BPE encoding.")
subprocess.call(ENCODER.format(codes=codes_path, input=src_path, output=output_path), commands = ENCODER.split() + [codes_path] + ["-i"] + [src_path] + ["-o"] + [output_path]
shell=True) subprocess.call(commands)
print(f" | Fetching vocabulary from single file.") print(" | Fetching vocabulary from single file.")
# Learn vocab. # Learn vocab.
subprocess.call(LEARN_DICT.format(input=output_path, dict_path=dict_path), commands = LEARN_DICT.split() + [output_path] + ["-o"] + [dict_path]
shell=True) subprocess.call(commands)

Loading…
Cancel
Save