args = parser.parse_args()
with open(args.system, "r", encoding="utf-8") as system_file:
system = [line.rstrip("\n") for line in system_file]
with open(args.gold, "r", encoding="utf-8") as gold_file:
gold = [line.rstrip("\n") for line in gold_file]
After Change
parser = argparse.ArgumentParser()
parser.add_argument("predictions", type=str, help="Path to predicted output.")
parser.add_argument("dataset", type=str, help="Which dataset to evaluate ("dev", "test").")
args = parser.parse_args([] if "__file__" not in globals() else None)
gold = getattr(TimitMFCC(), args.dataset).data["letters"]
with open(args.predictions, "r", encoding="utf-8") as predictions_file:
predictions = [line.rstrip("\n") for line in predictions_file]