From 20d549e4ca421bc0b393b1668bda575a452d7adf Mon Sep 17 00:00:00 2001 From: Thilo von Neumann Date: Wed, 26 Jun 2024 11:00:54 +0200 Subject: [PATCH] Remove numpy from character_based pseudo-word-level boundary computation --- meeteval/wer/wer/time_constrained.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/meeteval/wer/wer/time_constrained.py b/meeteval/wer/wer/time_constrained.py index 7137de25..20cad0b4 100644 --- a/meeteval/wer/wer/time_constrained.py +++ b/meeteval/wer/wer/time_constrained.py @@ -73,9 +73,8 @@ def character_based(interval, words): return [] elif len(words) == 1: return [interval] - import numpy as np - word_lengths = np.asarray([len(w) for w in words]) - end_points = np.cumsum(word_lengths) + word_lengths = [len(w) for w in words] + end_points = list(itertools.accumulate(word_lengths)) total_num_characters = end_points[-1] character_length = (interval[1] - interval[0]) / total_num_characters return [