From 44433f16b467e18dd57b970857e08a5830cad4e1 Mon Sep 17 00:00:00 2001 From: quillotm Date: Sun, 29 Aug 2021 17:16:52 +0200 Subject: [PATCH] Updating converter command. --- volia/masseffect.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/volia/masseffect.py b/volia/masseffect.py index 7d21669..8828dbd 100644 --- a/volia/masseffect.py +++ b/volia/masseffect.py @@ -84,8 +84,12 @@ def converter(file: str, outtype: str, outfile: str): with open(outfile, "w") as of: for key in data: splited = key.replace("\n", "").split(",") - of.write(key.replace("\n", "") + " " + ",".join([splited[0], splited[1], splited[3]]) + "\n") - + masseffect_id = key.replace("\n", "") + kaldi_id = ",".join([splited[0], splited[1], splited[3]]) + if outtype == "masseffect2kaldi": + of.write(f"{masseffect_id} {kaldi_id}\n") + elif outtype == "kaldi2masseffect": + of.write(f"{kaldi_id} {masseffect_id}\n") if __name__ == '__main__': @@ -124,7 +128,7 @@ if __name__ == '__main__': type=str, required=True, help="File with ids from which create converter.") - parser_converter.add_argument("--outtype", type=str, choices=["complet", "kaldi"]) + parser_converter.add_argument("--outtype", type=str, choices=["kaldi2masseffect", "masseffect2kaldi"]) parser_converter.add_argument("--outfile", type=str, required=True, help="") parser_converter.set_defaults(which="converter") -- 1.8.2.3