Protect top_n from running on import

This commit is contained in:
Robyn Speer 2019-04-16 11:33:22 -04:00
parent 17b1537f2f
commit 3d02a88b14

View File

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