lucene 进行去除停用词和词干提取
来源:互联网 发布:巴朗托福 知乎 编辑:程序博客网 时间:2024/06/11 00:31
简单的示例代码如下,从文件中读取内容进行去除停用词和词干提取,结果保存在result中。
Version matchVersion = Version.LUCENE_43;BufferedReader stopwordsReader = new BufferedReader( new FileReader("a.txt"));Analyzer analyzer = new StandardAnalyzer(matchVersion, stopwordsReader);BufferedReader fileReader = null;fileReader = new BufferedReader(new FileReader(new File(docName)));List<String> result = new ArrayList<String>();TokenStream ts = analyzer.tokenStream(null, fileReader);ts = new PorterStemFilter(ts);OffsetAttribute offsetAttribute = ts.addAttribute(OffsetAttribute.class);CharTermAttribute charTermAttribute = ts.addAttribute(CharTermAttribute.class);ts.reset();//必须的while( ts.incrementToken() ){int startOffset = offsetAttribute.startOffset();int endOffset = offsetAttribute.endOffset();String term = charTermAttribute.toString();result.add(term);System.out.println(term);}System.out.println(result.size());ts.end();ts.close();
参考:http://stackoverflow.com/questions/5391840/stemming-english-words-with-lucene
- lucene 进行去除停用词和词干提取
- lucene-词干分析与保留空位和停用词
- IKAnalyzer进行中文分词和去停用词
- python 去除停用词 结巴分词
- python27使用jieba分词,去除停用词
- lucene自定义停用词分词器和mmseg中文分词器
- Lucene 3.6.2入门:自定义停用词分词器和同义词分词器
- 文本分类实验中用java实现取名词和去除停用词
- IKAnalyzer使用停用词词典进行分词
- 词干提取和词形还原
- 词干提取和词形还原
- jieba分词和去停用词
- Lucene扩展停用词字典与自定义词库
- 使用IKAnalyzer实现中文分词&去除中文停用词
- 使用CountVectorizer和TfidfVectorizer对fetch_20newsgroups数据进行分类,并对是否使用停用词进行对比(精确度)
- 停用词的自动检测
- Stop Words(停用词)
- 停用词stopWord
- 收天猫评论,按要求做审核100%通过(必须是天猫商品)
- Lync UI suppression 设置
- C# MP3 Compressor
- 有关矩阵函数的求导问题
- SVM基础
- lucene 进行去除停用词和词干提取
- Eclipse 使用配置记录(持续增加中)
- Android百度地图API实现定位与目的地导航
- 单击图片实现“原图比例展示、上一张、下一张”类似相册的效果
- 上海的高中生真轻松
- Linux Centos 命令(个人备忘持续更新)
- Django+jQuery框架下使用AJAX笔记
- Git的简单使用
- Quartz.net 动态调整任务的调度时间