我可以访问英文字典来循环使用莫尔斯电码吗?如果不能,我可以将它从某些地方复制并粘贴到几行上? [英] 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?

查看:186
本文介绍了我可以访问英文字典来循环使用莫尔斯电码吗?如果不能,我可以将它从某些地方复制并粘贴到几行上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

So I am writing a program in python 2.7 that loops through all of the words in the English 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

所以我的问题是:

很难找到列出所有英文单词,并将其复制成一个巨大的字符串。那么有没有办法或一些Python模块来访问英文字典中的所有单词,只需要输入一点?

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

推荐答案

有一个python称为附魔的字典工具。查看此线程。

There is a dictionary tool for python called enchant. Check out this thread.

如何检查一个单词是否是Python的英文单词?

这篇关于我可以访问英文字典来循环使用莫尔斯电码吗?如果不能,我可以将它从某些地方复制并粘贴到几行上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆