mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-23 09:21:37 +00:00
Make the almost-median deterministic when it rounds down to 0
This commit is contained in:
parent
1a16b0f84c
commit
74892a0ac9
@ -190,8 +190,9 @@ def merge_freqs(freq_dicts):
|
|||||||
missing_values += 1
|
missing_values += 1
|
||||||
if missing_values > 2:
|
if missing_values > 2:
|
||||||
continue
|
continue
|
||||||
|
freqs.append(0.)
|
||||||
freqs.append(freq)
|
else:
|
||||||
|
freqs.append(freq)
|
||||||
|
|
||||||
if freqs:
|
if freqs:
|
||||||
median = statistics.median(freqs)
|
median = statistics.median(freqs)
|
||||||
@ -208,7 +209,7 @@ def merge_freqs(freq_dicts):
|
|||||||
return merged
|
return merged
|
||||||
|
|
||||||
|
|
||||||
def write_wordlist(freqs, filename, cutoff=1e-9):
|
def write_wordlist(freqs, filename, cutoff=1e-8):
|
||||||
"""
|
"""
|
||||||
Write a dictionary of either raw counts or frequencies to a file of
|
Write a dictionary of either raw counts or frequencies to a file of
|
||||||
comma-separated values.
|
comma-separated values.
|
||||||
|
Loading…
Reference in New Issue
Block a user