本文整理汇总了C++中Arc::head方法的典型用法代码示例。如果您正苦于以下问题:C++ Arc::head方法的具体用法?C++ Arc::head怎么用?C++ Arc::head使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arc
的用法示例。
在下文中一共展示了Arc::head方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: floydWarshallInit
void floydWarshallInit(IHypergraph<Arc> const& hg, Util::Matrix<typename ArcWtFn::Weight>* pdistances,
ArcWtFn arcWtFn) {
typedef typename ArcWtFn::Weight Weight;
Util::Matrix<Weight>& dist = *pdistances;
dist.setDiagonal(Weight::one(), Weight::zero());
for (StateId tail = 0, numStates = (StateId)dist.getNumRows(); tail < numStates; ++tail) {
Weight* rowTail = dist.row(tail);
for (ArcId aid : hg.outArcIds(tail)) {
Arc* arc = hg.outArc(tail, aid);
StateId head = arc->head();
Hypergraph::plusBy(arcWtFn(arc), rowTail[head]);
}
}
}
示例2: stringPairToFst
void stringPairToFst(Strings const& inputTokens, std::vector<std::string> const& outputTokens,
IMutableHypergraph<Arc>* pHgResult,
StringToHypergraphOptions const& opts = StringToHypergraphOptions()) {
if (inputTokens.size() != outputTokens.size()) {
SDL_THROW_LOG(Hypergraph.stringPairToFst, IndexException,
"The two strings must have same number of words");
}
// 1. Create simple FSA from input tokens:
stringToHypergraph(inputTokens, pHgResult, opts);
// 2. Insert output tokens:
IVocabularyPtr pVoc = pHgResult->getVocabulary();
std::vector<std::string>::const_iterator it = outputTokens.begin();
StateId stateId = pHgResult->start();
const StateId finalId = pHgResult->final();
while (stateId != finalId) {
Arc* arc = pHgResult->outArc(stateId, 0);
const Sym sym = opts.terminalMaybeUnk(pVoc.get(), *it);
setFsmOutputLabel(pHgResult, *arc, sym);
++it;
stateId = arc->head();
}
}