当前位置: 首页>>代码示例>>Java>>正文


Java ContextVector.inc方法代码示例

本文整理汇总了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;
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:33,代码来源:C99LINA.java

示例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;

}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:30,代码来源:C99Parser.java

示例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;
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:27,代码来源:C99.java


注:本文中的uk.ac.man.cs.choif.extend.structure.ContextVector.inc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。