本文整理汇总了C++中Grammar::stateIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Grammar::stateIndex方法的具体用法?C++ Grammar::stateIndex怎么用?C++ Grammar::stateIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grammar
的用法示例。
在下文中一共展示了Grammar::stateIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mkStrPredRecord
PredRecord mkStrPredRecord(Grammar const & g, string const & entryId, unsigned begin, unsigned end, string const & fold, vector_t const & posScore)
{
PredRecord pr;
pr.id = entryId;
pr.begin = begin;
pr.end = end;
pr.cykProbStr = g.subSeqCykProb(g.stateIndex(STR_BEGIN), begin, end);
pr.cykProbNoStr = g.subSeqCykProb(g.stateIndex(NON_STR_BEGIN), begin, end);
pr.insideProbStr = g.subSeqInsideProb(g.stateIndex(STR_BEGIN), begin, end);
pr.insideProbNoStr = g.subSeqInsideProb(g.stateIndex(NON_STR_BEGIN), begin, end);
pr.cykScore = (pr.cykProbNoStr != 0) ? log(pr.cykProbStr / pr.cykProbNoStr) : INFINITY;
pr.score = (pr.insideProbNoStr != 0) ? log(pr.insideProbStr / pr.insideProbNoStr) : INFINITY;
if (pr.cykProbStr !=0)
if (pr.insideProbStr != 0)
pr.strPostProb = toNumber(pr.cykProbStr / pr.insideProbStr);
else // denom = 0
pr.strPostProb = INFINITY;
else
pr.strPostProb = 0;
pr.fold = string(fold, begin, end - begin);
pr.bpCount = countBasePairs(fold);
pr.posScore.resize(end - begin);
for (unsigned i = 0; i < end - begin; i++)
pr.posScore[i] = posScore[i + begin];
return pr;
}