本文整理汇总了Java中uk.ac.man.cs.choif.extend.structure.ContextVector.inc方法的典型用法代码示例。如果您正苦于以下问题:Java ContextVector.inc方法的具体用法?Java ContextVector.inc怎么用?Java ContextVector.inc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.ac.man.cs.choif.extend.structure.ContextVector
的用法示例。
在下文中一共展示了ContextVector.inc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: normalize
import uk.ac.man.cs.choif.extend.structure.ContextVector; //导入方法依赖的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.extend.structure.ContextVector; //导入方法依赖的package包/类
/** Redefine the method normalize of the super class C99
* we write the same code excepted that we use the result of the WST and Snowball component
* to obtain the tokens and their associated stem (stored in the tabTokenStem object)
* The S parameter is not be used but is coming from the normalize method which is inherited
* The tabTokenStem array replaces S in the UIMA implementation
*/
public ContextVector[] normalize(final String[][] S) {
WordList stopword = WordList.stopwordList();
ContextVector[] v = new ContextVector[rawText.getSentenceArrayOfTokenFeatureArray().length];
String token, stem;
for (int i=rawText.getSentenceArrayOfTokenFeatureArray().length; i-->0;) {
v[i] = new ContextVector();
for (int j=rawText.getSentenceArrayOfTokenFeatureArray()[i].length; j-->0;) {
token = rawText.getSentenceArrayOfTokenFeatureArray()[i][j].getToken().toLowerCase();
// to take into account the behavior of isWord() method
// for this method,if a "-" is involved in the token, this one is a word
// so the "-" is a word to for this method
if (!token.equals("-")){
if (Punctuation.isWord(token) && !stopword.has(token)) {
stem = rawText.getSentenceArrayOfTokenFeatureArray()[i][j].getTokenFeature().toLowerCase();
ContextVector.inc(stem, 1, v[i]);
}
}
}
}
return v;
}
示例3: normalize
import uk.ac.man.cs.choif.extend.structure.ContextVector; //导入方法依赖的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;
}