c343409098b4f4b8396119d9f26e040e479a0e2b,labs/08/speech_recognition_eval.py,,,#,18
Before Change
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
)
return a[-1][-1]
if __name__ == "__main__":
// Parse arguments
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]
if len(predictions) < len(gold):
raise RuntimeError("The predictions are shorter than gold data: {} vs {}.".format(len(predictions), len(gold)))
score = 0
for i in range(len(gold)):
gold_sentence = [TimitMFCC.LETTERS[letter] for letter in gold[i]]
predicted_sentence = predictions[i].split(" ")
score += edit_distance(gold_sentence, predicted_sentence) / len(gold_sentence)
print("Average normalized edit distance: {:.2f}%".format(100 * score / len(gold)))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 9
Instances Project Name: ufal/npfl114
Commit Name: c343409098b4f4b8396119d9f26e040e479a0e2b
Time: 2020-04-20
Author: milan@strakovi.com
File Name: labs/08/speech_recognition_eval.py
Class Name:
Method Name:
Project Name: metalbubble/moments_models
Commit Name: 5212f598c3d65670a0399afe0a7434e91a5556aa
Time: 2018-01-15
Author: alexandonian@gmail.com
File Name: test_model.py
Class Name:
Method Name:
Project Name: has2k1/plotnine
Commit Name: 26e44fb488bd8ab2c504f39e2ca0eeba93329763
Time: 2020-10-06
Author: has2k1@gmail.com
File Name: plotnine/geoms/geom_map.py
Class Name: geom_map
Method Name: draw_panel