Steven Zheng commited on
Commit
6d2fae5
1 Parent(s): 9ec6ab9

correction on trasncription

Browse files
Files changed (1) hide show
  1. evaluate_asr.py +2 -2
evaluate_asr.py CHANGED
@@ -19,8 +19,8 @@ def evaluate_model(ds, pipe, wer_metric):
19
  for idx, sample in enumerate(tqdm(ds, desc="Evaluating", total=len(list(ds)))):
20
  audio_sample = sample["audio"]
21
  transcription = pipe(audio_sample["array"])['text']
22
- # Remove , and . from the transcription
23
- transcription = transcription.replace(",", "").replace(".", "")
24
  wer = wer_metric.compute(predictions=[transcription.upper()], references=[sample["text"].upper()])
25
  wer_scores.append(wer)
26
  wer_results.append({
 
19
  for idx, sample in enumerate(tqdm(ds, desc="Evaluating", total=len(list(ds)))):
20
  audio_sample = sample["audio"]
21
  transcription = pipe(audio_sample["array"])['text']
22
+ # Keep only letter and spaces for evaluation
23
+ transcription = "".join([char for char in transcription if char.isalpha() or char.isspace()])
24
  wer = wer_metric.compute(predictions=[transcription.upper()], references=[sample["text"].upper()])
25
  wer_scores.append(wer)
26
  wer_results.append({