【发布时间】:2014-07-16 20:04:30
【问题描述】:
在使用基于 JAVA 的文档分类器(例如 OpenNLP)等之前,有没有办法删除停用词(例如,'of' 'a' 'the' 等)。或者如果您自己做(使用 JAVA )什么可能是最有效的方法(鉴于字符串比较效率低下)。此外,鉴于每个文档本身并没有那么大,即平均大约 100 个单词,但假设文档的数量很大。
E.g.,
// Populate the stop words to a list
List<String> stopWordsList = ArrayList<>();
// Iterate through a list of documents
String currentDoc = getCurrentDoc();
String[] wordsArray = currentDoc.split(" ");
for ( String word : wordsArray ) {
if (stopWordsList.contains(word)){
// Drop it
}
}
【问题讨论】:
标签: java performance nlp opennlp