import enchant
import string

d = enchant.Dict('en_US')

with open('vocab.txt') as f:
    vocab = set()
    for word in f.readlines():
        word = word.strip()
        #word_no_punct = word.strip(string.punctuation)
        #if word_no_punct != '':
        #    word = word_no_punct
        if d.check(word):
            vocab.add(word)

with open('vocab.txt', 'w') as f:
    f.write('\n'.join(sorted(vocab)))

3eb504a2f2e87e3c1ba55681360f10f72dad596b
<mask token>

<mask token>
with open('vocab.txt') as f:
    vocab = set()
    for word in f.readlines():
        word = word.strip()
        if d.check(word):
            vocab.add(word)
with open('vocab.txt', 'w') as f:
    f.write('\n'.join(sorted(vocab)))

<mask token>
d = enchant.Dict('en_US')
with open('vocab.txt') as f:
    vocab = set()
    for word in f.readlines():
        word = word.strip()
        if d.check(word):
            vocab.add(word)
with open('vocab.txt', 'w') as f:
    f.write('\n'.join(sorted(vocab)))

import enchant
import string
d = enchant.Dict('en_US')
with open('vocab.txt') as f:
    vocab = set()
    for word in f.readlines():
        word = word.strip()
        if d.check(word):
            vocab.add(word)
with open('vocab.txt', 'w') as f:
    f.write('\n'.join(sorted(vocab)))

import enchant
import string

d = enchant.Dict('en_US')

with open('vocab.txt') as f:
    vocab = set()
    for word in f.readlines():
        word = word.strip()
        #word_no_punct = word.strip(string.punctuation)
        #if word_no_punct != '':
        #    word = word_no_punct
        if d.check(word):
            vocab.add(word)

with open('vocab.txt', 'w') as f:
    f.write('\n'.join(sorted(vocab)))
