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


Java Object2IntMap.putAll方法代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.objects.Object2IntMap.putAll方法的典型用法代码示例。如果您正苦于以下问题:Java Object2IntMap.putAll方法的具体用法?Java Object2IntMap.putAll怎么用?Java Object2IntMap.putAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.fastutil.objects.Object2IntMap的用法示例。


在下文中一共展示了Object2IntMap.putAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateDocVec

import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public Object2IntMap<String> calculateDocVec(List<String> tokens) {

		Object2IntMap<String> docVec = new Object2IntOpenHashMap<String>();
		// add the word-based vector
		if(this.createWordAtts)
			docVec.putAll(affective.core.Utils.calculateTermFreq(tokens,UNIPREFIX,this.freqWeights));

		if(this.createClustAtts){
			// calcultates the vector of clusters
			List<String> brownClust=affective.core.Utils.clustList(tokens,brownDict);
			docVec.putAll(affective.core.Utils.calculateTermFreq(brownClust,CLUSTPREFIX,this.freqWeights));			
		}	


		return docVec;

	}
 
开发者ID:felipebravom,项目名称:AffectiveTweets,代码行数:18,代码来源:PTCM.java

示例2: calculateDocVec

import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public Object2IntMap<String> calculateDocVec(List<String> tokens) {

		Object2IntMap<String> docVec = new Object2IntOpenHashMap<String>();
		// add the word-based vector
		if(this.createWordAtts)
			docVec.putAll(affective.core.Utils.calculateTermFreq(tokens,UNIPREFIX,this.freqWeights));

		if(this.createClustAtts){
			// calcultates the vector of clusters
			List<String> brownClust=affective.core.Utils.clustList(tokens,brownDict);
			docVec.putAll(affective.core.Utils.calculateTermFreq(brownClust,CLUSTPREFIX,this.freqWeights));			
		}	

		return docVec;

	}
 
开发者ID:felipebravom,项目名称:AffectiveTweets,代码行数:17,代码来源:TweetCentroid.java

示例3: calculateDocVec

import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
/**
 * Calculates a vector of attributes from a String
 * 
 * @param content the input 
 * @return an Object2IntMap object mapping the attributes to their values
 */		
public Object2IntMap<String> calculateDocVec(String content) {

	// tokenizes the content 
	List<String> tokens = affective.core.Utils.tokenize(content, this.toLowerCase, this.standarizeUrlsUsers, this.reduceRepeatedLetters, this.m_tokenizer,this.m_stemmer,this.m_stopwordsHandler);
	Object2IntMap<String> docVec = new Object2IntOpenHashMap<String>();

	if(this.calculateCharNgram){
		for(int i=this.getCharNgramMinDim();i<=this.getCharNgramMaxDim();i++){
			docVec.putAll(affective.core.Utils.calculateTermFreq(affective.core.Utils.extractCharNgram(content,i),"CHAR-"+i+"-",this.freqWeights));	
		}
	}

	if(this.clustNgramMaxDim>0){
		// calcultates the vector of clusters
		List<String> brownClust=affective.core.Utils.clustList(tokens,brownDict);
		docVec.putAll(affective.core.Utils.calculateTermFreq(brownClust,this.clustPrefix+"1-",this.freqWeights));		
		// add ngrams where n > 1
		if(this.clustNgramMaxDim>1){
			for(int i=2;i<=this.clustNgramMaxDim;i++){
				docVec.putAll(affective.core.Utils.calculateTermFreq(affective.core.Utils.calculateTokenNgram(brownClust,i),this.clustPrefix+i+"-",this.freqWeights));					
			}

		}
	}	

	if(this.posNgramMaxDim>0){
		List<String> posTags=this.getPOStags(tokens);
		docVec.putAll(affective.core.Utils.calculateTermFreq(posTags,this.posPrefix+"1-",this.freqWeights));
		// add ngrams where n > 1
		if(this.posNgramMaxDim>1){
			for(int i=2;i<=this.posNgramMaxDim;i++){
				docVec.putAll(affective.core.Utils.calculateTermFreq(affective.core.Utils.calculateTokenNgram(posTags,i),this.posPrefix+i+"-",this.freqWeights));					
			}
		}
	}

	// use negated tokens for word ngrams features if option is set
	if(this.negateTokens)
		tokens=affective.core.Utils.negateTokens(tokens, this.negEval.getWordList());

	// add the ngram vectors
	if(this.wordNgramMaxDim>0){
		// add the unigrams
		docVec.putAll(affective.core.Utils.calculateTermFreq(tokens,this.wordNgramPrefix+"1-",this.freqWeights));
		// add ngrams where n > 1
		if(this.wordNgramMaxDim>1){
			for(int i=2;i<=this.wordNgramMaxDim;i++){
				docVec.putAll(affective.core.Utils.calculateTermFreq(affective.core.Utils.calculateTokenNgram(tokens,i),this.wordNgramPrefix+i+"-",this.freqWeights));					
			}				
		}			
	}

	return docVec;
}
 
开发者ID:felipebravom,项目名称:AffectiveTweets,代码行数:61,代码来源:TweetToSparseFeatureVector.java


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