本文整理汇总了Java中gnu.trove.TObjectDoubleHashMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java TObjectDoubleHashMap.size方法的具体用法?Java TObjectDoubleHashMap.size怎么用?Java TObjectDoubleHashMap.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TObjectDoubleHashMap
的用法示例。
在下文中一共展示了TObjectDoubleHashMap.size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LRIdentificationModelSingleNode
import gnu.trove.TObjectDoubleHashMap; //导入方法依赖的package包/类
public LRIdentificationModelSingleNode(TObjectDoubleHashMap<String> paramList, ArrayList<String> frameLines, ArrayList<String> parseLines, String reg, double l, String initParamFile, WordNetRelations mWNR,THashMap<String,THashSet<String>> frameMap, String modelFile, String trainOrTest)
{
mParamList = paramList;
initializeParameterIndexes();
this.mFrameLines = frameLines;
mNumExamples = mFrameLines.size();
mFrameMap = frameMap;
initializeParameters();
totalNumberOfParams=paramList.size();
this.mParseLines = parseLines;
mReg=reg;
mLambda=l/mNumExamples;
mInitParamFile=initParamFile;
this.mWNR=mWNR;
resetAllGradients();
mFeatureCache = new THashMap<String,THashMap<String,Double>>();
mModelFile=modelFile;
mLookupChart = new TIntObjectHashMap<LogFormula>();
mTrainOrTest = ""+trainOrTest;
}
示例2: FrameIdentificationDecoder
import gnu.trove.TObjectDoubleHashMap; //导入方法依赖的package包/类
public FrameIdentificationDecoder(TObjectDoubleHashMap<String> paramList,
String reg,
double l,
WordNetRelations mwnr,
THashMap<String, THashSet<String>> frameMap,
THashMap<String, THashSet<String>> wnRelationCache)
{
super(paramList,reg,l,mwnr,frameMap);
initializeParameterIndexes();
this.mParamList=paramList;
mReg=reg;
mLambda=l;
mWNR=mwnr;
mFrameMap=frameMap;
totalNumberOfParams=paramList.size();
initializeParameters();
mLookupChart = new TIntObjectHashMap<LogFormula>();
mWnRelationsCache = wnRelationCache;
}
示例3: add
import gnu.trove.TObjectDoubleHashMap; //导入方法依赖的package包/类
public static TObjectDoubleHashMap<String> add(TObjectDoubleHashMap<String> vector,
TObjectDoubleHashMap<String> oldVector, int count) {
TObjectDoubleHashMap<String> res = new TObjectDoubleHashMap<String>();
if (oldVector == null) {
oldVector = new TObjectDoubleHashMap<String>();
}
String[] vKeys = new String[vector.size()];
vector.keys(vKeys);
for (int i = 0; i < vKeys.length; i++) {
double value = vector.get(vKeys[i]) / (double)count;
if (oldVector.contains(vKeys[i])) {
res.put(vKeys[i], value + oldVector.get(vKeys[i]));
oldVector.remove(vKeys[i]);
} else {
res.put(vKeys[i], value);
}
}
String[] oldKeys = new String[oldVector.size()];
oldVector.keys(oldKeys);
for (int i = 0; i < oldKeys.length; i++) {
res.put(oldKeys[i], oldVector.get(oldKeys[i]));
}
return res;
}
示例4: FastFrameIdentifier
import gnu.trove.TObjectDoubleHashMap; //导入方法依赖的package包/类
public FastFrameIdentifier(TObjectDoubleHashMap<String> paramList,
String reg,
double l,
THashMap<String, THashSet<String>> frameMap,
THashMap<String, THashSet<String>> wnRelationCache,
THashMap<String,THashSet<String>> hvCorrespondenceMap,
Map<String, Set<String>> relatedWordsForWord,
Map<String, Map<String, Set<String>>> revisedRelationsMap,
Map<String, String> hvLemmas)
{
super(paramList,reg,l,null,frameMap);
initializeParameterIndexes();
this.mParamList=paramList;
mReg=reg;
mLambda=l;
mFrameMap=frameMap;
totalNumberOfParams=paramList.size();
initializeParameters();
mLookupChart = new TIntObjectHashMap<LogFormula>();
mHvCorrespondenceMap = hvCorrespondenceMap;
mRelatedWordsForWord = relatedWordsForWord;
mRevisedRelationsMap = revisedRelationsMap;
mHVLemmas = hvLemmas;
}
示例5: getAllGradients
import gnu.trove.TObjectDoubleHashMap; //导入方法依赖的package包/类
public THashMap<String,LDouble> getAllGradients(TObjectDoubleHashMap<String> paramMap)
{
THashMap<String,LDouble> gradientMap = new THashMap<String,LDouble>();
String[] keys = new String[paramMap.size()];
paramMap.keys(keys);
int len = keys.length;
for(int i = 0; i < len; i ++)
{
int paramIndex = localA.get(keys[i]);
LDouble gradient = G[paramIndex];
gradientMap.put(keys[i], gradient);
}
return gradientMap;
}
示例6: LRIdentificationModelHadoop
import gnu.trove.TObjectDoubleHashMap; //导入方法依赖的package包/类
public LRIdentificationModelHadoop(TObjectDoubleHashMap<String> paramList, String reg, double l, WordNetRelations mwnr, THashMap<String, THashSet<String>> frameMap, String trainOrTest, THashMap<String, THashSet<String>> wnRelationCache)
{
super(paramList,reg,l,mwnr,frameMap);
initializeParameterIndexes();
this.mParamList=paramList;
mReg=reg;
mLambda=l;
mWNR=mwnr;
mFrameMap=frameMap;
totalNumberOfParams=paramList.size();
initializeParameters();
mLookupChart = new TIntObjectHashMap<LogFormula>();
mTrainOrTest=""+trainOrTest;
mWnRelationsCache = wnRelationCache;
}
示例7: printFinalMap
import gnu.trove.TObjectDoubleHashMap; //导入方法依赖的package包/类
public static void printFinalMap(THashMap<String, TObjectDoubleHashMap<String>> finalMap, String outFile) {
Set<String> keySet = finalMap.keySet();
String[] arr = new String[keySet.size()];
keySet.toArray(arr);
Arrays.sort(arr);
ArrayList<String> finalLines = new ArrayList<String>();
Comparator<Pair<String, Double>> c = new Comparator<Pair<String, Double>> () {
public int compare(Pair<String, Double> o1, Pair<String, Double> o2) {
if (o1.getSecond() > o2.getSecond())
return -1;
else if (o1.getSecond() == o2.getSecond()) {
return 0;
} else
return 1;
}
};
for (String unit: arr) {
String line = unit + "\t";
TObjectDoubleHashMap<String> map = finalMap.get(unit);
String[] keys = new String[map.size()];
map.keys(keys);
Pair<String, Double>[] pArray = new Pair[map.size()];
for (int i = 0; i < keys.length; i++) {
pArray[i] = new Pair<String, Double>(keys[i], map.get(keys[i]));
}
Arrays.sort(pArray, c);
for (int i = 0; i < keys.length; i++) {
line += pArray[i].getFirst() + "\t" + pArray[i].getSecond() + "\t";
}
line = line.trim();
finalLines.add(line);
}
ParsePreparation.writeSentencesToTempFile(outFile, finalLines);
}