【发布时间】:2017-11-05 06:04:12
【问题描述】:
我正在使用 NLTK 斯坦福 Pos Tagger 和我自己的模型来标记文本文件中的句子行。我的标注器的输出是这样的:
sentences = [((Word,WordTag),....(Word,WordTag)]
我正在处理印尼语,我在做 Pos 标签后做了 2 步:
- 停用词删除
- 词干
我在文本文件 (stopword.txt) 中有一个停用词列表,然后对句子进行词干处理。
到目前为止,我已经完成了标记部分。我不知道如何过滤sentences 中的单词并删除stopword.txt 中的单词并阻止sentences 中的单词
到目前为止,我已经尝试使用此代码删除单词,但仍未删除该单词及其单词标签:
stopWords = getStopWordList('id_stopword.txt')
filtered_sentences = [w for w in sentences if not w in stopWords]
filtered_sentences = []
for w in sentences:
if w not in stopWords:
filtered_sentences.append(w)
【问题讨论】:
标签: python nltk stanford-nlp