【发布时间】:2017-05-24 10:53:50
【问题描述】:
我有一个字符串形式:
'I am going to visit "Huge Hotel" and the "Grand River"'
我希望它被标记为
['I', 'am', 'going',..., 'Huge Hotel','and' ,'the' ,'Grand River']
正如所见,'Huge Hotel' 和 'Grand River' 被视为一个单词,因为它们出现在引号中。
import nltk
text = 'I am going to visit "Huge Hotel" and the "Grand River"'
b = nltk.word_tokenize(text)
我已经写了上面的代码,但它不起作用
【问题讨论】:
-
如果你展示你尝试过的东西会更好。现在,这只是适合我的代码,很可能不会在这里受到欢迎。
-
刚刚更新问题
标签: python-2.7 nlp nltk