text_plain_output_1.png
import collections

import os

folder_dir = '/kaggle/input/108-2-ntut-dl-app-hw2'
filename = 'tag_list.txt'
vocabulary_size = 990

file_path = os.path.join(folder_dir, filename)
with open(file_path, 'r', encoding='utf-8') as f:
    words = f.read().split()

word_count = [['UNK', -1]]
word_count.extend(collections.Counter(words).most_common(vocabulary_size - 1))

print('Most common words (+UNK) are: %s' % word_count[:10])