本文整理汇总了Java中edu.stanford.nlp.util.ErasureUtils.noop方法的典型用法代码示例。如果您正苦于以下问题:Java ErasureUtils.noop方法的具体用法?Java ErasureUtils.noop怎么用?Java ErasureUtils.noop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.util.ErasureUtils
的用法示例。
在下文中一共展示了ErasureUtils.noop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHeuristicDelta
import edu.stanford.nlp.util.ErasureUtils; //导入方法依赖的package包/类
/**
* For a given coverage set C of a given hypothesis, this finds all the gaps
* in the coverage set (e.g., if C = {1,5,10}, then gaps are 2-4 and 6-9), and
* sums the future costs associated with all gaps (e.g., future-cost(2-4) +
* future-cost(6-9)).
*
* This is the same as in Moses, though this may sometimes over estimate
* future cost with discontinuous phrases.
*/
@Override
public double getHeuristicDelta(Derivation<TK, FV> hyp,
CoverageSet newCoverage) {
double oldH = hyp.parent.h;
double newH = 0.0;
CoverageSet coverage = hyp.sourceCoverage;
int startEdge = coverage.nextClearBit(0);
if (Double.isNaN(oldH)) {
System.err.printf("getHeuristicDelta:\n");
System.err.printf("coverage: %s\n", hyp.sourceCoverage);
System.err.println("old H: " + oldH);
throw new RuntimeException();
}
int foreignSize = hyp.sourceSequence.size();
for (int endEdge; startEdge < foreignSize; startEdge = coverage
.nextClearBit(endEdge)) {
endEdge = coverage.nextSetBit(startEdge);
if (endEdge == -1) {
endEdge = hyp.sourceSequence.size();
}
double localH = hSpanScores.getScore(startEdge, endEdge - 1);
if (Double.isNaN(localH)) {
System.err.printf("Bad retrieved score for %d:%d ==> %f\n", startEdge,
endEdge - 1, localH);
throw new RuntimeException();
}
newH += localH;
if (Double.isNaN(newH)) {
System.err.printf(
"Bad total retrieved score for %d:%d ==> %f (localH=%f)\n",
startEdge, endEdge - 1, newH, localH);
throw new RuntimeException();
}
}
if ((Double.isInfinite(newH) || newH == MINUS_INF)
&& (Double.isInfinite(oldH) || oldH == MINUS_INF))
return 0.0;
double delta = newH - oldH;
ErasureUtils.noop(delta);
return delta;
}