作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我需要使用 NLTK 找出英语单词中的音节数。这是我到目前为止的代码:
import curses
from curses.ascii import isdigit
import nltk
from nltk.corpus import cmudict
d = cmudict.dict()
def nsyl(word):
return [len(list(y for y in x if isdigit(y[-1]))) for x in d[word.lower()]]
>>> nsyl(arithmetic)
函数调用后,我收到一个名称错误,指出算术未定义。谁能帮我找出代码中的错误?
最佳答案
你需要在“算术”这个词周围加上引号
关于python - 找出单词中的音节数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5087493/
我正在尝试在图像上打印缅甸字符(准确地说是Myanmar3.ttf)以进行数据生成-OCR。与其他语言不同,缅甸语中的单词/字符是使用音节构成的,并且音节有顺序。因此,缅甸语的 unicode 使用复
我正在尝试以编程方式创建韩语句子,但要正确执行此操作意味着我需要一种方法来确定哪些 Hangul Jamo unicode 字符构成了每个 Hangul Syllable unicode 字符。更具体
我是一名优秀的程序员,十分优秀!