我是靠谱客的博主 伶俐大叔,这篇文章主要介绍自然语言处理nltk分词断句(2),现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from nltk.corpus import gutenberg import nltk # file = gutenberg.words('melville-moby_dick.txt') # text = nltk.Text(file) # print(file) # print(text) # print(text.findall('<a> (<.*>) <man>')) # 对Text对象使用findall的特殊方式 # this is not a list # test_string = '''Over the last 10 years, I have used and tweaked Vim. # This configuration is the ultimate vimrc # (or at least my version of it).''' # print(nltk.word_tokenize(test_string)) # 词干提取 # porter = nltk.PorterStemmer() # lancaster = nltk.LancasterStemmer() # test_list = gutenberg.words('melville-moby_dick.txt')[:10] # list_by_porter = [porter.stem(word) for word in test_list] # list_by_lancaster = [lancaster.stem(word) for word in test_list] # print('the oringin:',test_list) # print('porter stem:',list_by_porter) # print('lancaster stem:',list_by_lancaster) # test_list = gutenberg.words('melv

最后

以上就是伶俐大叔最近收集整理的关于自然语言处理nltk分词断句(2)的全部内容,更多相关自然语言处理nltk分词断句(2)内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(50)

评论列表共有 0 条评论

立即
投稿
返回
顶部