Skip to content

Commit

Permalink
imporved wpm estimater
Browse files Browse the repository at this point in the history
  • Loading branch information
8cH9azbsFifZ committed Nov 18, 2023
1 parent b708ed1 commit d159758
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions wip/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,23 @@ def normalize_duration_timings(duration_array=my_test_bug):
return result


print (normalize_duration_timings(duration_array=my_v))
print (normalize_duration_timings(duration_array=my_test_bug))
#print (normalize_duration_timings(duration_array=my_v))
#print (normalize_duration_timings(duration_array=my_test_bug))



def wpm_estimater (duration_array):
my_test_bug = [ -347, +145, -183, +51, -160, +51, -47, +47, -51, +47, -211, +144 ]
duration_array = my_test_bug
positive_durations = [duration for duration in duration_array if duration > 0]
average_duration = float(sum(positive_durations))/float(len(positive_durations))
threshold = average_duration
possible_dits = [duration for duration in positive_durations if duration < threshold]
possible_dahs = [duration for duration in positive_durations if duration >= threshold]
print (positive_durations)
print (possible_dits)
print (possible_dahs)
average_dit_duration = ( sum (possible_dits ) + 1/3.0 * sum(possible_dahs) ) / len (positive_durations)
wpm_estimate = int(1200 / average_dit_duration) if average_dit_duration > 0 else 0
print (average_dit_duration)
print (wpm_estimate)

0 comments on commit d159758

Please sign in to comment.