mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-25 10:15:23 +00:00
updated freqs_to_dBpack docstring
This commit is contained in:
parent
59ce14cdd0
commit
3746af1350
@ -26,7 +26,7 @@ def read_freqs(filename, cutoff=0):
|
|||||||
Read words and their frequencies from a CSV file.
|
Read words and their frequencies from a CSV file.
|
||||||
|
|
||||||
Only words with a frequency greater than `cutoff` are returned.
|
Only words with a frequency greater than `cutoff` are returned.
|
||||||
|
|
||||||
If `cutoff` is greater than 0, the csv file must be sorted by frequency
|
If `cutoff` is greater than 0, the csv file must be sorted by frequency
|
||||||
in descending order.
|
in descending order.
|
||||||
"""
|
"""
|
||||||
@ -52,8 +52,11 @@ def read_freqs(filename, cutoff=0):
|
|||||||
|
|
||||||
def freqs_to_dBpack(in_filename, out_filename, cutoff=-60):
|
def freqs_to_dBpack(in_filename, out_filename, cutoff=-60):
|
||||||
"""
|
"""
|
||||||
Convert a dictionary of word frequencies to a file in the idiosyncratic
|
Convert a csv file of words and their frequencies to a file in the
|
||||||
'dBpack' format.
|
idiosyncratic 'dBpack' format.
|
||||||
|
|
||||||
|
Only words with a frequency greater than `cutoff` dB will be written to
|
||||||
|
the new file.
|
||||||
"""
|
"""
|
||||||
freq_cutoff = 10 ** (cutoff / 10.)
|
freq_cutoff = 10 ** (cutoff / 10.)
|
||||||
freqs = read_freqs(in_filename, freq_cutoff)
|
freqs = read_freqs(in_filename, freq_cutoff)
|
||||||
|
Loading…
Reference in New Issue
Block a user