本文整理汇总了C++中Token::TimeSafeDivider方法的典型用法代码示例。如果您正苦于以下问题:C++ Token::TimeSafeDivider方法的具体用法?C++ Token::TimeSafeDivider怎么用?C++ Token::TimeSafeDivider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::TimeSafeDivider方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: min
/** Constructor with the list of segments and the position of the first ref */
Graph::Graph(SegmentsGroup* _segmentsGroup, SpeakerMatch* _pSpeakerMatch, const int& _typeCost, const int& _costTrans, const int& _costIns, const int& _costOpt, const int& _costCorrectNonSpeaker, const int& _costAdaptive, const bool& _optRef, const bool& _optHyp, const bool& _bCompressedArray)
: m_pSpeakerMatch(_pSpeakerMatch),
m_typeCostModel(_typeCost),
m_CostTransition(_costTrans),
m_CostInsertion(_costIns),
m_CostOptionally(_costOpt),
m_CostCorrectNonSpeaker(_costCorrectNonSpeaker),
m_CostAdaptive(_costAdaptive),
m_useOptForRef(_optRef),
m_useOptForHyp(_optHyp),
m_bCompressedArray(_bCompressedArray)
{
m_HypRefStatus = (string("true").compare(Properties::GetProperty("align.genericmethod")) != 0);
// m_NbThreads = static_cast<size_t>(atoi(Properties::GetProperty("threads.number").c_str()));
if(m_typeCostModel == 2)
{
// Calculate the safe divider
m_TimeBasedSafeDivider = min(min(min(m_CostTransition, m_CostInsertion), m_CostOptionally), m_CostCorrectNonSpeaker);
}
Token* curToken;
size_t i, k, sizevector;
SetDimension(_segmentsGroup->GetNumberOfReferences()+_segmentsGroup->GetNumberOfHypothesis());
if(m_HypRefStatus)
SetIndexRef(_segmentsGroup->GetNumberOfHypothesis());
else
SetIndexRef(0);
m_TabDimensionDeep = new size_t[GetDimension()];
m_TabVecHypRef = new vector<Token*>[GetDimension()];
m_TabMapTokenIndex = new map<Token*, size_t>[GetDimension()];
m_TabFirstTokens = new list<Token*>[GetDimension()];
m_TabLastTokens = new list<Token*>[GetDimension()];
int minTimeSafeDividerToken = -1;
// Planning each Segment and look for the last and first token
for(i=0; i<GetDimension(); ++i)
{
vector<Segment*> temp_segs;
if (i < _segmentsGroup->GetNumberOfHypothesis())
{
m_TabVecHypRef[i] = _segmentsGroup->ToTopologicalOrderedStructHyp(i);
temp_segs = _segmentsGroup->GetHypothesis(i);
}
else
{
m_TabVecHypRef[i] = _segmentsGroup->ToTopologicalOrderedStructRef(i-_segmentsGroup->GetNumberOfHypothesis());
temp_segs = _segmentsGroup->GetReference(i-_segmentsGroup->GetNumberOfHypothesis());
}
sizevector = m_TabVecHypRef[i].size();
SetDimensionDeep(i, sizevector);
for(k=0; k<sizevector; ++k)
{
curToken = m_TabVecHypRef[i][k];
if(curToken != NULL)
{
if(m_typeCostModel == 2)
{
int TimeSafeDividerToken = curToken->TimeSafeDivider();
if( (minTimeSafeDividerToken == -1) || (TimeSafeDividerToken < minTimeSafeDividerToken) )
minTimeSafeDividerToken = TimeSafeDividerToken;
}
m_TabMapTokenIndex[i][curToken] = k;
size_t prcs = 0;
while( (prcs < (temp_segs.size()-1)) && (temp_segs[prcs]->isEmpty()) )
++prcs;
if(temp_segs[prcs]->isFirstToken(curToken))
m_TabFirstTokens[i].push_front(curToken);
prcs = temp_segs.size()-1;
while( (prcs > 0) && (temp_segs[prcs]->isEmpty()) )
--prcs;
if(temp_segs[prcs]->isLastToken(curToken))
m_TabLastTokens[i].push_front(curToken);
}
}
}
SetGraphOptimization();
m_MaxDurationSegmentGroup = _segmentsGroup->GetTotalDuration();
if(m_bCompressedArray)
{
//.........这里部分代码省略.........