本文整理汇总了Java中cc.mallet.fst.Transducer.IMPOSSIBLE_WEIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java Transducer.IMPOSSIBLE_WEIGHT属性的具体用法?Java Transducer.IMPOSSIBLE_WEIGHT怎么用?Java Transducer.IMPOSSIBLE_WEIGHT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cc.mallet.fst.Transducer
的用法示例。
在下文中一共展示了Transducer.IMPOSSIBLE_WEIGHT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
public Double call() throws Exception {
double value = 0;
for (int ii = start; ii < end; ii++) {
Instance inst = trainingSet.get(ii);
Sequence input = (Sequence) inst.getData();
double initProbs[] = initialProbList.get(ii);
double finalProbs[] = finalProbList.get(ii);
double transProbs[][][] = transitionProbList.get(ii);
double[][][] cachedDots = new double[input.size()][crf.numStates()][crf.numStates()];
for (int j = 0; j < input.size(); j++) {
for (int k = 0; k < crf.numStates(); k++) {
for (int l = 0; l < crf.numStates(); l++) {
cachedDots[j][k][l] = Transducer.IMPOSSIBLE_WEIGHT;
}
}
}
double labeledWeight = new SumLatticeKL(crf, input, initProbs,
finalProbs, transProbs, cachedDots, null).getTotalWeight();
value += labeledWeight;
//double unlabeledWeight = new SumLatticeDefault(crf, input,
// expectationsCopy.new Incrementor()).getTotalWeight();
double unlabeledWeight = new SumLatticeDefaultCachedDot(crf, input, null,
cachedDots, expectationsCopy.new Incrementor(), false, null).getTotalWeight();
value -= unlabeledWeight;
}
return value;
}
示例2: CachedDotTransitionIterator
protected CachedDotTransitionIterator(State source, Object fv,
String output, double[] dots) {
this.source = source;
this.input = fv;
this.weights = new double[source.numDestinations()];
for (int i = 0; i < source.numDestinations(); i++) {
weights[i] = dots[source.getDestinationState(i).getIndex()];
}
// Prepare nextIndex, pointing at the next non-impossible transition
nextIndex = 0;
while (nextIndex < source.numDestinations()
&& weights[nextIndex] == Transducer.IMPOSSIBLE_WEIGHT)
nextIndex++;
}
示例3: nextState
public Transducer.State nextState() {
assert (nextIndex < source.numDestinations());
index = nextIndex;
nextIndex++;
while (nextIndex < source.numDestinations()
&& weights[nextIndex] == Transducer.IMPOSSIBLE_WEIGHT)
nextIndex++;
return source.getDestinationState(index);
}
示例4: LatticeNode
public LatticeNode() {
alpha = new LogNumber[numStates];
beta = new LogNumber[numStates];
for (int si = 0; si < numStates; ++si) {
alpha[si] = new LogNumber(Transducer.IMPOSSIBLE_WEIGHT,true);
beta[si] = new LogNumber(Transducer.IMPOSSIBLE_WEIGHT,true);
}
}