是否有任何文本预处理可以检测san andreas作为单个单词Api for python

时间:2017-11-20 17:27:23

标签: python nlp nltk

我正在使用twitter数据进行分析,但在分析之前,我想预处理数据。我试过nltk.word_tokenize(),但他们不删除标点符号,他们不理解san andreas和单个单词,但在推文中,有很多这样的单词。这是代码

def inital(): return 0 def get_vocab(lst): vocab_count=defaultdict(inital) i=0 for txt in lst: if type(txt)!=float: txt=txt.decode("utf8") for words in nltk.word_tokenize(txt): vocab_count[words]+=1 return vocab_count

0 个答案:

没有答案