<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Word Frequency in Literary Text
Click on the play icon above to "run" each box of code.
This program generates a table of how often words appear in a file and sorts them to show the ones the author used most frequently. This example uses Jane Eyre, but there are tons of books to choose from here with lots of books in .txt format.
Step1:  Word frequency list
Step2:  Filtering the results
This next part removes some of the less interesting words from the list.
<ASSISTANT_TASK:>
Python Code:
import re
import pandas as pd
import urllib.request
frequency = {}
document_text = urllib.request.urlopen \
    ('http://www.textfiles.com/etext/FICTION/bronte-jane-178.txt') \
    .read().decode('utf-8')
text_string = document_text.lower()
match_pattern = re.findall(r'\b[a-z]{3,15}\b', text_string)
 
for word in match_pattern:
    count = frequency.get(word,0)
    frequency[word] = count + 1
     
frequency_list = frequency.keys()
d = []
for word in frequency_list:
    var = word + "," + str(frequency[word]) + "\r"
    d.append({'word':word, 'Frequency': frequency[word]})
df = pd.DataFrame(d)
Explanation: Word Frequency in Literary Text
Click on the play icon above to "run" each box of code.
This program generates a table of how often words appear in a file and sorts them to show the ones the author used most frequently. This example uses Jane Eyre, but there are tons of books to choose from here with lots of books in .txt format.
End of explanation
df1 = df.sort_values(by="Frequency", ascending=False)
# the next line displays the first number of rows you select
df1.head(10)
Explanation: Word frequency list
End of explanation
df2 = df1.query('word not in \
    ("the","and","it","was","for","but","that") \
    ')
df2.head(10)
Explanation: Filtering the results
This next part removes some of the less interesting words from the list.
End of explanation
<END_TASK>