本文整理汇总了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;
}
示例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;
}
示例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;
}