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


Java Sequence.get方法代码示例

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


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

示例1: bestStateAlignments

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
/**
  * Perform the backward pass of Viterbi, returning the n-best sequences of
  * States. Note that the length of each State Sequence is inputLength+1,
  * because the first element of the sequence is the start state, and the first
  * input/output symbols occur on the transition from a start state to the next
  * state. The last State in the sequence corresponds to the final state.
  */	
public List<SequencePairAlignment<Object,State>> bestStateAlignments (int n) {
	if (stateAlignmentCache != null && stateAlignmentCache.size() >= n)
		return stateAlignmentCache;
	bestViterbiNodeSequences(n); // ensure that viterbiNodeAlignmentCache has at least size n
	ArrayList<SequencePairAlignment<Object,State>> ret = new ArrayList<SequencePairAlignment<Object,State>>(n);
	for (int i = 0; i < n; i++) {
		State[] ss = new State[latticeLength];
		Sequence<ViterbiNode> vs = viterbiNodeAlignmentCache.get(i).output();
		for (int j = 0; j < latticeLength; j++)
			ss[j] = vs.get(j).state; // Here is where we grab the state from the ViterbiNode
		ret.add(new SequencePairAlignment<Object,State>(input, new ArraySequence<State>(ss), viterbiNodeAlignmentCache.get(i).getWeight()));
	}
	stateAlignmentCache = ret;
	return ret;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:23,代码来源:MaxLatticeDefault.java

示例2: transitionIterator

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
public Transducer.TransitionIterator transitionIterator(
		Sequence inputSequence, int inputPosition,
		Sequence outputSequence, int outputPosition) {
	if (inputPosition < 0 || outputPosition < 0)
		throw new UnsupportedOperationException(
				"Epsilon transitions not implemented.");
	if (inputSequence == null)
		throw new UnsupportedOperationException(
				"HMMs are generative models; but this is not yet implemented.");
	if (!(inputSequence instanceof FeatureSequence))
		throw new UnsupportedOperationException(
				"HMMs currently expect Instances to have FeatureSequence data");
	return new TransitionIterator(this,
			(FeatureSequence) inputSequence, inputPosition,
			(outputSequence == null ? null : (String) outputSequence
					.get(outputPosition)), hmm);
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:18,代码来源:HMM.java

示例3: sequencesMatch

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
private boolean sequencesMatch (Sequence trueOutput, Sequence predOutput)
{
  for (int j = 0; j < trueOutput.size(); j++) {
    Object tru = trueOutput.get(j);
    Object pred = predOutput.get(j);
    if (!tru.toString().equals (pred.toString())) {
      return false;
    }
  }
  return true;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:12,代码来源:InstanceAccuracyEvaluator.java

示例4: transitionIterator

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
public Transducer.TransitionIterator transitionIterator (Sequence inputSequence, int inputPosition,
		Sequence outputSequence, int outputPosition)
{
	if (inputPosition < 0 || outputPosition < 0)
		throw new UnsupportedOperationException ("Epsilon transitions not implemented.");
	if (inputSequence == null)
		throw new UnsupportedOperationException ("CRFs are not generative models; must have an input sequence.");
	return new TransitionIterator (this, (FeatureVectorSequence)inputSequence, inputPosition,
			(outputSequence == null ? null : (String)outputSequence.get(outputPosition)), crf);
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:11,代码来源:CRF.java

示例5: bestOutputAlignments

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
public List<SequencePairAlignment<Object,Object>> bestOutputAlignments (int n) {
	if (outputAlignmentCache != null && outputAlignmentCache.size() >= n)
		return outputAlignmentCache;
	bestViterbiNodeSequences(n); // ensure that viterbiNodeAlignmentCache has at least size n
	ArrayList<SequencePairAlignment<Object,Object>> ret = new ArrayList<SequencePairAlignment<Object,Object>>(n);
	for (int i = 0; i < n; i++) {
		Object[] ss = new Object[latticeLength-1];
		Sequence<ViterbiNode> vs = viterbiNodeAlignmentCache.get(i).output();
		for (int j = 0; j < latticeLength-1; j++)
			ss[j] = vs.get(j+1).output; // Here is where we grab the output from the ViterbiNode destination
		ret.add(new SequencePairAlignment<Object,Object>(input, new ArraySequence<Object>(ss), viterbiNodeAlignmentCache.get(i).getWeight()));
	}
	outputAlignmentCache = ret;
	return ret;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:16,代码来源:MaxLatticeDefault.java

示例6: transitionIterator

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
public Transducer.TransitionIterator transitionIterator (
		Sequence inputSequence, int inputPosition,
		Sequence outputSequence, int outputPosition)
{
	if (inputPosition < 0 || outputPosition < 0)
		throw new UnsupportedOperationException ("Epsilon transitions not implemented.");
	if (inputSequence == null)
		throw new UnsupportedOperationException ("CRFs are not generative models; must have an input sequence.");
	return new TransitionIterator (
			this, (FeatureVectorSequence)inputSequence, inputPosition,
			(outputSequence == null ? null : (String)outputSequence.get(outputPosition)), crf);
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:13,代码来源:MEMM.java

示例7: ArraySequence

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
protected ArraySequence (Sequence<E> s, boolean copy)
{
	if (s instanceof ArraySequence) {
		if (copy) {
			data = (E[])new Object[s.size()];
			System.arraycopy (((ArraySequence)s).data, 0, data, 0, data.length);
		} else
			data = ((ArraySequence<E>)s).data;
	} else {
		data = (E[])new Object[s.size()];
		for (int i = 0; i < s.size(); i++)
			data[i] = s.get(i);
	}
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:15,代码来源:ArraySequence.java

示例8: CachedDotTransitionIterator

import cc.mallet.types.Sequence; //导入方法依赖的package包/类
public CachedDotTransitionIterator(State source,
    Sequence inputSeq, int inputPosition, String output,
    double[] dots) {
  this(source, inputSeq.get(inputPosition), output, dots);
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:6,代码来源:CachedDotTransitionIterator.java


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