用nltk提取ngram特征

from nltk.util import ngrams
a = ['1','2','3','4','5']
b = ngrams(a,2)
for i in b:
     print i

##############
('1', '2')
('2', '3')
('3', '4')
('4', '5')

展开阅读全文

没有更多推荐了,返回首页