f = open('alice.txt', 'r')

count = {}

for line in f:
    for word in line.split():

        # remove punctuation
        word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '')
        word = word.replace('-', '').replace('?', '').replace('!', '').replace("'", "")
        word = word.replace('(', '').replace(')', '').replace(':', '').replace('[', '')
        word = word.replace(']', '').replace(';', '')

        # ignore case
        word = word.lower()

        # ignore numbers
        if word.isalpha():
            if word in count:
                count[word] = count[word] + 1
            else:
                count[word] = 1

keys = count.keys()
keys.sort()

# save the word count analysis to a file
out = open('alice_words.txt', 'w')

for word in keys:
    out.write(word + " " + str(count[word]))
    out.write('\n')

print("The word 'alice' appears " + str(count['alice']) + " times in the book.")

2af001f46c5d07d2513c0eb0048e674eb8a84dfa
<mask token>

<mask token>
for line in f:
    for word in line.split():
        word = word.replace('_', '').replace('"', '').replace(',', '').replace(
            '.', '')
        word = word.replace('-', '').replace('?', '').replace('!', '').replace(
            "'", '')
        word = word.replace('(', '').replace(')', '').replace(':', '').replace(
            '[', '')
        word = word.replace(']', '').replace(';', '')
        word = word.lower()
        if word.isalpha():
            if word in count:
                count[word] = count[word] + 1
            else:
                count[word] = 1
<mask token>
keys.sort()
<mask token>
for word in keys:
    out.write(word + ' ' + str(count[word]))
    out.write('\n')
print("The word 'alice' appears " + str(count['alice']) + ' times in the book.'
    )

f = open('alice.txt', 'r')
count = {}
for line in f:
    for word in line.split():
        word = word.replace('_', '').replace('"', '').replace(',', '').replace(
            '.', '')
        word = word.replace('-', '').replace('?', '').replace('!', '').replace(
            "'", '')
        word = word.replace('(', '').replace(')', '').replace(':', '').replace(
            '[', '')
        word = word.replace(']', '').replace(';', '')
        word = word.lower()
        if word.isalpha():
            if word in count:
                count[word] = count[word] + 1
            else:
                count[word] = 1
keys = count.keys()
keys.sort()
out = open('alice_words.txt', 'w')
for word in keys:
    out.write(word + ' ' + str(count[word]))
    out.write('\n')
print("The word 'alice' appears " + str(count['alice']) + ' times in the book.'
    )

f = open('alice.txt', 'r')

count = {}

for line in f:
    for word in line.split():

        # remove punctuation
        word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '')
        word = word.replace('-', '').replace('?', '').replace('!', '').replace("'", "")
        word = word.replace('(', '').replace(')', '').replace(':', '').replace('[', '')
        word = word.replace(']', '').replace(';', '')

        # ignore case
        word = word.lower()

        # ignore numbers
        if word.isalpha():
            if word in count:
                count[word] = count[word] + 1
            else:
                count[word] = 1

keys = count.keys()
keys.sort()

# save the word count analysis to a file
out = open('alice_words.txt', 'w')

for word in keys:
    out.write(word + " " + str(count[word]))
    out.write('\n')

print("The word 'alice' appears " + str(count['alice']) + " times in the book.")
