本文整理汇总了Java中com.chenlb.mmseg4j.Word类的典型用法代码示例。如果您正苦于以下问题:Java Word类的具体用法?Java Word怎么用?Java Word使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Word类属于com.chenlb.mmseg4j包,在下文中一共展示了Word类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: incrementToken
import com.chenlb.mmseg4j.Word; //导入依赖的package包/类
@Override
public final boolean incrementToken() throws IOException {
clearAttributes();
Word word = mmSeg.next();
if(word != null) {
//lucene 3.0
//termAtt.setTermBuffer(word.getSen(), word.getWordOffset(), word.getLength());
//lucene 3.1
termAtt.copyBuffer(word.getSen(), word.getWordOffset(), word.getLength());
offsetAtt.setOffset(word.getStartOffset(), word.getEndOffset());
typeAtt.setType(word.getType());
return true;
} else {
end();
return false;
}
}
开发者ID:wanghaile,项目名称:mmseg4j,代码行数:18,代码来源:MMSegTokenizer.java
示例2: segWords
import com.chenlb.mmseg4j.Word; //导入依赖的package包/类
public String segWords(Reader input, String wordSpilt) throws IOException {
StringBuilder sb = new StringBuilder();
Seg seg = getSeg(); //取得不同的分词具体算法
MMSeg mmSeg = new MMSeg(input, seg);
Word word = null;
boolean first = true;
while((word=mmSeg.next())!=null) {
if(!first) {
sb.append(wordSpilt);
}
String w = word.getString();
sb.append(w);
first = false;
}
return sb.toString();
}
开发者ID:wanghaile,项目名称:mmseg4j,代码行数:18,代码来源:Complex.java
示例3: addToken
import com.chenlb.mmseg4j.Word; //导入依赖的package包/类
private void addToken(Token oriToken, int termBufferOffset, int termBufferLength, byte type) {
Token token = new Token(oriToken.buffer(), termBufferOffset, termBufferLength,
oriToken.startOffset()+termBufferOffset, oriToken.startOffset()+termBufferOffset+termBufferLength);
if(type == Character.DECIMAL_DIGIT_NUMBER) {
token.setType(Word.TYPE_DIGIT);
} else {
token.setType(Word.TYPE_LETTER);
}
tokenQueue.offer(token);
}
开发者ID:wanghaile,项目名称:mmseg4j,代码行数:13,代码来源:CutLetterDigitFilter.java
示例4: incrementToken
import com.chenlb.mmseg4j.Word; //导入依赖的package包/类
@Override
public final boolean incrementToken() throws IOException {
clearAttributes();
Word word = mmSeg.next();
if(word != null) {
termAtt.copyBuffer(word.getSen(), word.getWordOffset(), word.getLength());
offsetAtt.setOffset(word.getStartOffset(), word.getEndOffset());
typeAtt.setType(word.getType());
return true;
} else {
return false;
}
}
开发者ID:chenlb,项目名称:mmseg4j-solr,代码行数:14,代码来源:MMSegTokenizer.java
示例5: addToken
import com.chenlb.mmseg4j.Word; //导入依赖的package包/类
private void addToken(PackedTokenAttributeImpl oriToken, int termBufferOffset, int termBufferLength, byte type) {
PackedTokenAttributeImpl token = TokenUtils.subToken(oriToken, termBufferOffset, termBufferLength);
if(type == Character.DECIMAL_DIGIT_NUMBER) {
token.setType(Word.TYPE_DIGIT);
} else {
token.setType(Word.TYPE_LETTER);
}
tokenQueue.offer(token);
}
开发者ID:chenlb,项目名称:mmseg4j-solr,代码行数:12,代码来源:CutLetterDigitFilter.java
示例6: toMMsegWords
import com.chenlb.mmseg4j.Word; //导入依赖的package包/类
public static List<String> toMMsegWords(String txt, Seg seg) {
List<String> words = new ArrayList<String>();
MMSeg mmSeg = new MMSeg(new StringReader(txt), seg);
Word word = null;
try {
while ((word = mmSeg.next()) != null) {
String w = word.getString();
words.add(w);
}
} catch (IOException e) {
e.printStackTrace();
}
return words;
}
开发者ID:chenlb,项目名称:mmseg4j-solr,代码行数:15,代码来源:AnalyzerTest.java
注:本文中的com.chenlb.mmseg4j.Word类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论