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


Java ObjectIntOpenHashMap.get方法代码示例

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


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

示例1: getJointReader

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
protected JointReader getJointReader(Element eReader)
{
	ObjectIntOpenHashMap<String> map = getFieldMap(eReader);
	
	int iId		= map.get(AbstractColumnReader.FIELD_ID)	 - 1;
	int iForm	= map.get(AbstractColumnReader.FIELD_FORM)	 - 1;
	int iLemma	= map.get(AbstractColumnReader.FIELD_LEMMA)	 - 1;
	int iPos	= map.get(AbstractColumnReader.FIELD_POS)	 - 1;
	int iFeats	= map.get(AbstractColumnReader.FIELD_FEATS)	 - 1;
	int iHeadId	= map.get(AbstractColumnReader.FIELD_HEADID) - 1;
	int iDeprel	= map.get(AbstractColumnReader.FIELD_DEPREL) - 1;
	int iXHeads = map.get(AbstractColumnReader.FIELD_XHEADS) - 1;
	int iSHeads = map.get(AbstractColumnReader.FIELD_SHEADS) - 1;
	int iNament = map.get(AbstractColumnReader.FIELD_NAMENT) - 1;
	int iCoref  = map.get(AbstractColumnReader.FIELD_COREF)  - 1;
	
	JointReader reader = new JointReader(iId, iForm, iLemma, iPos, iFeats, iHeadId, iDeprel, iXHeads, iSHeads, iNament, iCoref);
	reader.initGoldPOSTag(map.get(AbstractColumnReader.FIELD_GPOS) - 1);
	
	return reader;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:22,代码来源:AbstractNLP.java

示例2: toSparseFeatureVector

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
/**
 * Returns the sparse feature vector converted from the string feature vector.
 * During the conversion, discards features not found in this model.
 * @param vector the string feature vector.
 * @return the sparse feature vector converted from the string feature vector.
 */
public SparseFeatureVector toSparseFeatureVector(StringFeatureVector vector)
{
	SparseFeatureVector sparse = new SparseFeatureVector(vector.hasWeight());
	int i, index, size = vector.size();
	ObjectIntOpenHashMap<String> map;
	String type, value;
	
	for (i=0; i<size; i++)
	{
		type  = vector.getType(i);
		value = vector.getValue(i);
		
		if ((map = m_features.get(type)) != null && (index = map.get(value)) > 0)
		{
			if (sparse.hasWeight())
				sparse.addFeature(index, vector.getWeight(i));
			else
				sparse.addFeature(index);
		}
	}
	
	sparse.trimToSize();
	return sparse;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:31,代码来源:StringModel.java

示例3: getProb1DAux

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
private Pair<Double,StringDoublePair[]> getProb1DAux(String key)
{
	ObjectIntOpenHashMap<String> map = get(key);
	if (map == null)	return null;
	
	StringDoublePair[] probs = new StringDoublePair[map.size()-1];
	int i = 0, total = map.get(TOTAL);
	String value;
	
	for (ObjectCursor<String> cur : map.keys())
	{
		value = cur.value;
		
		if (!value.equals(TOTAL))
			probs[i++] = new StringDoublePair(value, (double)map.get(value)/total);
	}
	
	double prior = (double)total / i_total; 
	return new Pair<Double,StringDoublePair[]>(prior, probs);
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:21,代码来源:Prob2DMap.java

示例4: getPOSReader

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
/** Called by {@link AbstractRun#getReader(Element)}. */
private POSReader getPOSReader(Element eReader)
{
	ObjectIntOpenHashMap<String> map = getFieldMap(eReader);
	
	int iForm = map.get(AbstractColumnReader.FIELD_FORM) - 1;
	int iPos  = map.get(AbstractColumnReader.FIELD_POS)  - 1;
	
	if (iForm < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FORM);
		System.exit(1);
	}
	
	return new POSReader(iForm, iPos);
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:17,代码来源:AbstractRun.java

示例5: trimFeatures

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
public StringFeatureVector trimFeatures(StringFeatureVector oVector, String label, double threshold)
{
	StringFeatureVector nVector = new StringFeatureVector(oVector.hasWeight());
	int i, size = oVector.size(), fIndex, lIndex = getLabelIndex(label);
	ObjectIntOpenHashMap<String> map;
	String type, value;
	boolean add;
	
	for (i=0; i<size; i++)
	{
		type  = oVector.getType(i);
		value = oVector.getValue(i);
		add   = false;
		
		if ((map = m_features.get(type)) != null && (fIndex = map.get(value)) > 0)
		{
			if (d_weights[getWeightIndex(lIndex, fIndex)] == threshold)
				add = true;
		}
		else
			add = true;
		
		if (add)
		{
			if (nVector.hasWeight())
				nVector.addFeature(type, value, oVector.getWeight(i));
			else
				nVector.addFeature(type, value);
		}
	}
	
	return nVector;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:34,代码来源:StringModel.java

示例6: getTOKReader

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
/** Called by {@link AbstractRun#getReader(Element)}. */
private TOKReader getTOKReader(Element eReader)
{
	ObjectIntOpenHashMap<String> map = getFieldMap(eReader);
	int iForm = map.get(AbstractColumnReader.FIELD_FORM) - 1;
	
	if (iForm < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FORM);
		System.exit(1);
	}
	
	return new TOKReader(iForm);
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:15,代码来源:AbstractRun.java

示例7: getDAGReader

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
/** Called by {@link AbstractRun#getReader(Element)}. */
private DAGReader getDAGReader(Element eReader)
{
	ObjectIntOpenHashMap<String> map = getFieldMap(eReader);
	
	int iId		= map.get(AbstractColumnReader.FIELD_ID)	 - 1;
	int iForm	= map.get(AbstractColumnReader.FIELD_FORM)	 - 1;
	int iLemma	= map.get(AbstractColumnReader.FIELD_LEMMA)	 - 1;
	int iPos	= map.get(AbstractColumnReader.FIELD_POS)	 - 1;
	int iFeats	= map.get(AbstractColumnReader.FIELD_FEATS)	 - 1;
	int iXheads	= map.get(AbstractColumnReader.FIELD_XHEADS) - 1;
	
	if (iId < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_ID);
		System.exit(1);
	}
	else if (iForm < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FORM);
		System.exit(1);
	}
	else if (iLemma < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_LEMMA);
		System.exit(1);
	}
	else if (iPos < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_POS);
		System.exit(1);
	}
	else if (iFeats < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FEATS);
		System.exit(1);
	}
	
	return new DAGReader(iId, iForm, iLemma, iPos, iFeats, iXheads);
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:41,代码来源:AbstractRun.java

示例8: processModel

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
public ColouredGraph processModel(Model model) {
    ColourPalette vertexPalette = createVertexPalette(model);
    ColourPalette edgePalette = createEdgePalette(model);
    ColouredGraph graph = new ColouredGraph(vertexPalette, edgePalette);
    ObjectIntOpenHashMap<Resource> resourceIdMapping = new ObjectIntOpenHashMap<Resource>();
    StmtIterator iterator = model.listStatements();
    Statement statement;
    Resource subject, object;
    Property property;
    int subjectId, propertyId, objectId;
    String propertyUri;
    // Iterator over all statements
    while (iterator.hasNext()) {
        statement = iterator.next();
        subject = statement.getSubject();
        // Add the subject if it is not existing
        if (resourceIdMapping.containsKey(subject)) {
            subjectId = resourceIdMapping.get(subject);
        } else {
            subjectId = graph.addVertex();
            resourceIdMapping.put(subject, subjectId);
        }
        // if this statement has a resource as object
        if (statement.getObject().isResource()) {
            // Add the object if it is not existing
            object = statement.getObject().asResource();
            if (resourceIdMapping.containsKey(object)) {
                objectId = resourceIdMapping.get(object);
            } else {
                objectId = graph.addVertex();
                resourceIdMapping.put(object, objectId);
            }
            // Add the property if it is not existing
            property = statement.getPredicate();
            propertyId = graph.addEdge(subjectId, objectId);
            // Set the colour of the edge
            propertyUri = property.getURI();
            if (!edgePalette.containsUri(propertyUri)) {
                edgePalette.addColour(propertyUri);
            }
            graph.setEdgeColour(propertyId, edgePalette.getColour(propertyUri));

            // if this triple defines the class of the subject
            if (property.equals(RDF.type)) {
                graph.setVertexColour(subjectId,
                        vertexPalette.addToColour(graph.getVertexColour(subjectId), object.getURI()));
            }
        }
    }
    return graph;
}
 
开发者ID:dice-group,项目名称:Lemming,代码行数:52,代码来源:GraphCreator.java

示例9: expandSRL

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
public String[][] expandSRL(DEPTree tree)
{
	ObjectIntOpenHashMap<DEPNode> map = new ObjectIntOpenHashMap<DEPNode>();
	int i = 0, predId = 0, size = tree.size();
	DEPNode pred, arg;
	String label;
	
	while ((pred = tree.getNextPredicate(predId)) != null)
	{
		map.put(pred, i++);
		predId = pred.id;
	}
	
	if (map.isEmpty())	return null;

	String[][] spans = new String[size][];
	int len = map.size();
	
	for (i=1; i<size; i++)
	{
		spans[i] = new String[len];
		Arrays.fill(spans[i], AbstractColumnReader.BLANK_COLUMN);
	}
	
	for (i=1; i<size; i++)
	{
		arg = tree.get(i);
		
		for (DEPArc arc : arg.getSHeads())
		{
			pred = arc.getNode();
			if (!map.containsKey(pred))	continue;
			
			predId = map.get(pred);
			label  = arc.getLabel();
			
			for (int spanId : getSpan(pred, arg))
				spans[spanId][predId] = label;
		}
	}
	
	return spans;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:44,代码来源:SRLExpand.java

示例10: getDEPReader

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
/** Called by {@link AbstractRun#getReader(Element)}. */
private DEPReader getDEPReader(Element eReader)
{
	ObjectIntOpenHashMap<String> map = getFieldMap(eReader);
	
	int iId		= map.get(AbstractColumnReader.FIELD_ID)	 - 1;
	int iForm	= map.get(AbstractColumnReader.FIELD_FORM)	 - 1;
	int iLemma	= map.get(AbstractColumnReader.FIELD_LEMMA)	 - 1;
	int iPos	= map.get(AbstractColumnReader.FIELD_POS)	 - 1;
	int iFeats	= map.get(AbstractColumnReader.FIELD_FEATS)	 - 1;
	int iHeadId	= map.get(AbstractColumnReader.FIELD_HEADID) - 1;
	int iDeprel	= map.get(AbstractColumnReader.FIELD_DEPREL) - 1;
	
	if (iId < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_ID);
		System.exit(1);
	}
	else if (iForm < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FORM);
		System.exit(1);
	}
	else if (iLemma < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_LEMMA);
		System.exit(1);
	}
	else if (iPos < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_POS);
		System.exit(1);
	}
	else if (iFeats < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FEATS);
		System.exit(1);
	}
	
	return new DEPReader(iId, iForm, iLemma, iPos, iFeats, iHeadId, iDeprel);
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:42,代码来源:AbstractRun.java

示例11: getSRLReader

import com.carrotsearch.hppc.ObjectIntOpenHashMap; //导入方法依赖的package包/类
/** Called by {@link AbstractRun#getReader(Element)}. */
private SRLReader getSRLReader(Element eReader)
{
	ObjectIntOpenHashMap<String> map = getFieldMap(eReader);
	
	int iId		= map.get(AbstractColumnReader.FIELD_ID)	 - 1;
	int iForm	= map.get(AbstractColumnReader.FIELD_FORM)	 - 1;
	int iLemma	= map.get(AbstractColumnReader.FIELD_LEMMA)	 - 1;
	int iPos	= map.get(AbstractColumnReader.FIELD_POS)	 - 1;
	int iFeats	= map.get(AbstractColumnReader.FIELD_FEATS)	 - 1;
	int iHeadId	= map.get(AbstractColumnReader.FIELD_HEADID) - 1;
	int iDeprel	= map.get(AbstractColumnReader.FIELD_DEPREL) - 1;
	int iSheads	= map.get(AbstractColumnReader.FIELD_SHEADS) - 1;
	
	if (iId < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_ID);
		System.exit(1);
	}
	else if (iForm < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FORM);
		System.exit(1);
	}
	else if (iLemma < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_LEMMA);
		System.exit(1);
	}
	else if (iPos < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_POS);
		System.exit(1);
	}
	else if (iFeats < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FEATS);
		System.exit(1);
	}
	else if (iHeadId < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_HEADID);
		System.exit(1);
	}
	else if (iDeprel < 0)
	{
		System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_DEPREL);
		System.exit(1);
	}
	
	return new SRLReader(iId, iForm, iLemma, iPos, iFeats, iHeadId, iDeprel, iSheads);
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:53,代码来源:AbstractRun.java


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