本文整理汇总了C++中TPath::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ TPath::empty方法的具体用法?C++ TPath::empty怎么用?C++ TPath::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPath
的用法示例。
在下文中一共展示了TPath::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: candi
bool
CIMIContext::_backTracePaths(const std::vector<TLatticeState>& tail_states,
int rank, TPath& path, TPath& segmentPath)
{
path.clear();
segmentPath.clear();
if (rank >= (int) tail_states.size()) {
// rank out of bounds, only return the segment path
return false;
}
const TLatticeState *bs = &(tail_states[rank]);
while (bs->m_pBackTraceNode) {
unsigned start = bs->m_pBackTraceNode->m_frIdx;
unsigned end = bs->m_frIdx;
CLatticeFrame & end_fr = m_lattice[end];
if (!(end_fr.m_bwType & CLatticeFrame::USER_SELECTED)) {
const TWCHAR* cwstr = NULL;
if (end_fr.m_wstr.empty()) {
cwstr = _getWstr(bs->m_backTraceWordId);
} else {
cwstr = end_fr.m_wstr.c_str();
}
CCandidate candi(start, end, bs->m_pLexiconState, cwstr,
bs->m_backTraceWordId);
end_fr.m_bwType |= CLatticeFrame::BESTWORD;
end_fr.m_bestWords[rank] = candi;
if (rank == 0) {
end_fr.m_selWord = candi; // select the first by default.
}
}
if (bs->m_pBackTraceNode->m_pLexiconState) {
std::vector<unsigned> seg_path =
bs->m_pBackTraceNode->m_pLexiconState->m_seg_path;
std::vector<unsigned>::reverse_iterator it = seg_path.rbegin();
for (; it != seg_path.rend(); ++it) {
if (segmentPath.empty() || segmentPath.back() != *it)
segmentPath.push_back(*it);
}
}
path.push_back(end);
bs = bs->m_pBackTraceNode;
}
std::reverse(path.begin(), path.end());
std::reverse(segmentPath.begin(), segmentPath.end());
#ifdef DEBUG
std::vector<unsigned>::iterator it;
printf("trace lattice path[%d]: ", rank);
for (it = path.begin(); it != path.end(); ++it)
printf("%d ", *it);
printf("\n");
printf("trace segments path[%d]: ", rank);
for (it = segmentPath.begin(); it != segmentPath.end(); ++it)
printf("%d ", *it);
printf("\n");
#endif
return true;
}