So I am writing a program in python 2.7 that loops through all of the words in the English language to see if the Morse code version of English word matches the unknown Morse phrase. The reason I can't just interpret it is because there are no spaces between letters. This is a snippet of the code:
def morse_solver(nol,morse,words):
#nol is the number of letters to cut down search time,morse is the Morse phrase to decode, and words is a string (or can be a list) of all english words.
lista=_index(words)
#_index is a procedure that organizes the input in the following way:[nol,[]]
selection=lista[nol-1][1]
#selects the words with that nol to loop through
for word in selection:
if morse_encode(word)==morse:
print morse+"="+word
So my Question is:
It's kinda hard to find a list of all the words in the English language and copy it over into a huge string. So is there a way or some Python module to access all the words in the English dictionary by only having to type a little bit?
If such a thing doesn't exist, how can I handle such a large string? Is there some place I can copy paste from (onto just one line)? Thanks in advance