(refs, hyps)
| 49 | |
| 50 | |
| 51 | def compute_cer(refs, hyps): |
| 52 | total_ref = 0 |
| 53 | total_errs = 0 |
| 54 | for ref, hyp in zip(refs, hyps): |
| 55 | r = list(normalize_zh(ref)) |
| 56 | h = list(normalize_zh(hyp)) |
| 57 | total_ref += len(r) |
| 58 | ali = kaldialign.align(r, h, '*') |
| 59 | total_errs += sum(1 for a, b in ali if a != b) |
| 60 | return total_errs / total_ref * 100 if total_ref > 0 else 0 |
| 61 | |
| 62 | |
| 63 | def vad_segment(files, device="cuda:0"): |
no test coverage detected
searching dependent graphs…