![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
自然语言处理
物理小乾乾
这个作者很懒,什么都没留下…
展开
-
NotImplementedError: Use label() to access a node label.
在用nltk做词性标注时,出现了这样的错误,后来查了下,可能是因为版本的问题。代码如下:import nltk# 一 NLTK进行分词#将文本拆分成句子列表text='PythonTip.com is a very good website. we can learn a lot from it.'sens=nltk.sent_tokenize(text)print(sens)#对句子进行原创 2018-03-07 16:46:01 · 802 阅读 · 0 评论 -
NLTK was unable to find the java file! Use softwarespecific configuration paramaters or set the JAVA
本文参考自https://weibo.com/p/23041888fb77570102veu9 只是他的是windows系统,我是ubuntu系统。 我的代码如下:from nltk.tag import StanfordPOSTaggerfrom nltk import word_tokenizeimport nltk# nltk.internals.config_java("/home原创 2018-03-08 17:03:46 · 3764 阅读 · 1 评论 -
python去掉字符串中某些特定的字符
1 . 去掉一行字符串中的汉字english_only = ''.join(x for x in str(col) if ord(x) < 256)2. 去掉字符串中所有的英文以及一些特殊符号#re是一个python库,需要提前倒入这个库str = re.sub("[A-Za-z0-9\!\%\[\]\,\。\.]", "", col)原创 2018-03-23 16:27:37 · 2971 阅读 · 0 评论