Skip to content

Commit

Permalink
Remove numpy from character_based pseudo-word-level boundary computation
Browse files Browse the repository at this point in the history
  • Loading branch information
thequilo committed Jun 26, 2024
1 parent a5070a2 commit 20d549e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions meeteval/wer/wer/time_constrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 20d549e

Please sign in to comment.