我可以访问英语词典以循环匹配莫尔斯电码吗?如果不能,我可以将它从某个地方复制并粘贴到几行吗?

Can I access the English dictionary to loop through matches in morse code? If not can I copy and paste it from some place onto just afew lines?

所以我在 python 2.7 中编写了一个程序,它循环遍历所有英语单词,以查看英语单词的摩尔斯电码版本是否与未知的摩尔斯短语相匹配。我不能只解释它的原因是因为字母之间没有空格。这是代码片段:

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

所以我的问题是:
很难找到所有英语单词的列表并将其复制到一个巨大的字符串中。那么有没有一种方法或一些 Python 模块只需要输入一点点就可以访问英语词典中的所有单词?

如果不存在这样的东西,我怎么处理这么大的字符串?有什么地方可以复制粘贴(到一行)?提前致谢

python 有一个名为 enchant 的词典工具。查看此线程。

How to check if a word is an English word with Python?

听不见摩尔斯电码有什么好玩的?如果这在 Python 2.7:

中不起作用,请告诉我
from winsound import Beep
from time import sleep

dot = 150 # milliseconds
dash = 300 
freq = 2500 #Hertz
delay = 0.05 #delay between beeps in seconds

def transmit(morseCode):
    for key in morseCode:
        if key == '.':
            Beep(freq,dot)
        elif key == '-':
            Beep(freq,dash)
        else:
            pass #ignore (e.g. new lines)
        sleep(delay)

example = '----. ----.   -... --- - - .-.. .   --- ..-.   -... . . .-.'
#This last is the first line of
#99 Bottles of Beer in Morse Code
#from http://99-bottles-of-beer.net/language-morse-code-406.html

transmit(example)