HashMap<String, String> strHashMap = new HashMap<String, String>();
String stopWordTable = "StopWordTable.txt";
File f = new File(stopWordTable);
FileInputStream fileInputStream = new FileInputStream(f);
//读入停用词文件
BufferedReader StopWordFileBr = new BufferedReader(new InputStreamReader(fileInputStream));
String stopWord = null;
for(; (stopWord = StopWordFileBr.readLine()) != null;){
strHashMap.put(stopWord , "_stop");
}
StopWordFileBr.close();
FilterModifWord.setUpdateDic(strHashMap);
StopWordTable.txt为中文通用词列表,去网上可以搜索到。strHashMap为生成号的停用词词典。在调用
FilterModifWord.modifResult()方法就可以实现去掉停用词。