本文整理汇总了Java中uk.ac.man.cs.choif.nlp.surface.Stemmer类的典型用法代码示例。如果您正苦于以下问题:Java Stemmer类的具体用法?Java Stemmer怎么用?Java Stemmer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Stemmer类属于uk.ac.man.cs.choif.nlp.surface包,在下文中一共展示了Stemmer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalize
import uk.ac.man.cs.choif.nlp.surface.Stemmer; //导入依赖的package包/类
/**
* Given a document as a list of tokenised sentences,
* this function produces a list of stem frequency tables,
* or context vector
* Creation date: (11/05/99 03:43:34)
* @return uk.ac.man.cs.choif.extend.structure.ContextVector[]
* @param S java.lang.String[][]
*/
// modification par Christine Jacquin le 28/09/10
// avant: méthode private final static, maintenant=> protected
protected ContextVector[] normalize(final String[][] S) {
//System.out.println("on passe pas dans la bonne normalise");
WordList stopword = WordList.stopwordList();
ContextVector[] V = new ContextVector[S.length];
String token, stem;
for (int i=S.length; i-->0;) {
V[i] = new ContextVector();
for (int j=S[i].length; j-->0;) {
token = S[i][j].toLowerCase();
if (Punctuation.isWord(token) && !stopword.has(token)) {
stem = Stemmer.stemOf(token);
ContextVector.inc(stem, 1, V[i]);
}
}
}
return V;
}
示例2: normalize
import uk.ac.man.cs.choif.nlp.surface.Stemmer; //导入依赖的package包/类
/**
* Given a document as a list of tokenised sentences,
* this function produces a list of stem frequency tables,
* or context vector
* Creation date: (11/05/99 03:43:34)
* @return uk.ac.man.cs.choif.extend.structure.ContextVector[]
* @param S java.lang.String[][]
*/
private final static ContextVector[] normalize(final String[][] S) {
WordList stopword = WordList.stopwordList();
ContextVector[] V = new ContextVector[S.length];
String token, stem;
for (int i=S.length; i-->0;) {
V[i] = new ContextVector();
for (int j=S[i].length; j-->0;) {
token = S[i][j].toLowerCase();
if (Punctuation.isWord(token) && !stopword.has(token)) {
stem = Stemmer.stemOf(token);
ContextVector.inc(stem, 1, V[i]);
}
}
}
return V;
}