turned frequency into a string for json

threading
Jeff Yates 2020-11-22 15:24:29 -05:00
parent fa39e4d040
commit e2aaa7a2b5
1 changed files with 3 additions and 1 deletions

View File

@ -162,7 +162,9 @@ def process_file (file_name, binfile, type)
output[key][:words] = bin_counter(bins[bin_number], text)
output[key][:total] = count_total(output[key])
output[key][:frequency] = 0
output[key][:frequency] = output[key][:total].to_f / output[:total_words].to_f if output[:total_words] != 0
#output[key][:frequency] = output[key][:total].to_f / output[:total_words].to_f if output[[:total_words] != 0
freq = output[key][:total].to_f / output[:total_words].to_f
output[key][:frequency] = freq.to_s
end
write_output_json(output,outfile + '-out.json')
write_output_csv(output,outfile + '-out.csv')