Skip to content

Commit

Permalink
Merge pull request #107 from paolo-losi/master
Browse files Browse the repository at this point in the history
counter.py: reduce output
  • Loading branch information
lissyx authored Mar 4, 2020
2 parents 3c8aee8 + 5d1d640 commit cec24e8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions DeepSpeech/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ def main(input_file, output_file, top_count=100000):
fcontent = input.readlines()
all_file = len(fcontent)
print('Ingesting {}: {}'.format(input_file, all_file))
current = 0
for line in fcontent:
print('Feeding {}: {}/{} ({:.2f}%)'.format(input_file, current, all_file, (current / all_file) * 100), end='\r')
for current, line in enumerate(fcontent):
if (current % 1000) == 0:
print('Feeding {}: {}/{} ({:.2f}%)'.format(input_file, current, all_file, (current / all_file) * 100), end='\r')
counter.update(line.split())
current += 1
print('Counting {}'.format(input_file))
vocab_str = '\n'.join(word for word, count in counter.most_common(top_count))
print('Writing {}'.format(output_file))
Expand Down

0 comments on commit cec24e8

Please sign in to comment.