mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-24 09:51:38 +00:00
parent
b6d03324b9
commit
4117480a0e
@ -66,11 +66,10 @@ def freqs_to_cBpack(in_filename, out_filename, cutoff=-600):
|
|||||||
cBpack = []
|
cBpack = []
|
||||||
for token, freq in freqs.items():
|
for token, freq in freqs.items():
|
||||||
cB = round(math.log10(freq) * 100)
|
cB = round(math.log10(freq) * 100)
|
||||||
if cB >= cutoff:
|
neg_cB = -cB
|
||||||
neg_cB = -cB
|
while neg_cB >= len(cBpack):
|
||||||
while neg_cB >= len(cBpack):
|
cBpack.append([])
|
||||||
cBpack.append([])
|
cBpack[neg_cB].append(token)
|
||||||
cBpack[neg_cB].append(token)
|
|
||||||
|
|
||||||
for sublist in cBpack:
|
for sublist in cBpack:
|
||||||
sublist.sort()
|
sublist.sort()
|
||||||
|
Loading…
Reference in New Issue
Block a user