Protect top_n from running on import

This commit is contained in:
Robyn Speer 2019-04-16 11:33:22 -04:00
parent bb1bd50c44
commit 1f61c9b27a

View File

@ -8,7 +8,7 @@ import wordfreq
N = 1000
for lang in sorted(wordfreq.available_languages()):
for word in wordfreq.top_n_list(lang, 1000):
print('{}\t{}'.format(lang, word))
if __name__ == '__main__':
for lang in sorted(wordfreq.available_languages()):
for word in wordfreq.top_n_list(lang, 1000):
print('{}\t{}'.format(lang, word))