本文整理汇总了C++中Token::GetEndTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Token::GetEndTime方法的具体用法?C++ Token::GetEndTime怎么用?C++ Token::GetEndTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::GetEndTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTransitionCostGenericTimeBased
int Graph::GetTransitionCostGenericTimeBased(size_t* coordcurr, size_t* coordprev)
{
bool deletable = false;
int mintime = -1;
int maxtime = -1;
int deletioncost = 0;
int transitioncost = 0;
for(size_t i=0; i<GetDimension(); ++i)
{
if(coordcurr[i] != coordprev[i])
{
Token* aToken = m_TabVecHypRef[i][coordcurr[i]];
deletable = aToken->IsOptional();
if( (mintime == -1) || (aToken->GetStartTime() < mintime) )
mintime = aToken->GetStartTime();
if( (maxtime == -1) || (aToken->GetEndTime() > maxtime) )
maxtime = aToken->GetEndTime();
}
}
for(size_t i=0; i<GetDimension(); ++i)
{
if(coordcurr[i] != coordprev[i])
{
Token* aToken = m_TabVecHypRef[i][coordcurr[i]];
transitioncost = maxtime - aToken->GetEndTime() + aToken->GetStartTime() - mintime;
}
else
deletioncost += maxtime - mintime;
}
return( (GetCostInsertion(deletable)*deletioncost + GetCostTransition()*transitioncost)/m_TimeBasedSafeDivider );
}
示例2: TestTime
void TestToken::TestTime()
{
SpeechSet* speechSet = new SpeechSet();
Speech* speech = new Speech(speechSet);
Segment* segment = Segment::CreateWithDuration(0, 10000, speech);
Token* token = Token::CreateWithEndTime(25460, 26460, segment); //build with (start, end)
assert((token->GetDuration() - 1000) < 10);
delete token;
token = Token::CreateWithDuration(25460, 2000, segment); //build with (start, duration)
assert((token->GetEndTime() - 27460) < 10);
delete token;
delete segment;
delete speech;
delete speechSet;
}
示例3: ValidateTransitionInsertionDeletion
bool Graph::ValidateTransitionInsertionDeletion(size_t* coordcurr, size_t* coordprev)
{
if(!m_bPruneOptimization && !m_bWordOptimization)
return true;
Token* pToken;
size_t nrbchanged = NumberChanged(coordcurr, coordprev);
if( (nrbchanged == 1) && m_bPruneOptimization )// Insertion or Deletion
{
size_t chgdim = 0;
while( (chgdim<GetDimension()) && (coordcurr[chgdim] == coordprev[chgdim]) )
++chgdim;
pToken = m_TabVecHypRef[chgdim][coordcurr[chgdim]];
int currentchgbegin;
int currentchgend;
if(pToken)
{
currentchgbegin = pToken->GetStartTime();
if(currentchgbegin < 0)
{
currentchgbegin = pToken->GetParentSegment()->GetStartTime();
if(currentchgbegin < 0)
return true;
}
else
return true;
currentchgend = pToken->GetEndTime();
if(currentchgend < 0)
{
currentchgend = pToken->GetParentSegment()->GetEndTime();
if(currentchgend < 0)
return true;
}
else
return true;
}
else
return true;
int currentstaybegin;
int currentstayend;
for(size_t i=0; i<GetDimension(); ++i)
{
if(i != chgdim)
{
pToken = m_TabVecHypRef[i][coordcurr[i]];
if(pToken)
{
currentstaybegin = pToken->GetStartTime();
if(currentstaybegin < 0)
{
currentstaybegin = pToken->GetParentSegment()->GetStartTime();
if(currentstaybegin < 0)
return true;
}
currentstayend = pToken->GetEndTime();
if(currentstayend < 0)
{
currentstayend = pToken->GetParentSegment()->GetEndTime();
if(currentstayend < 0)
return true;
}
}
else
return true;
if(currentchgbegin < currentstaybegin)
{
int gap = 0;
if(currentchgend < currentstaybegin) // Change before Stay
{
gap = currentstaybegin - currentchgend;
}
else if(currentstayend < currentchgbegin) // Stay before Change
{
gap = currentchgbegin - currentstayend;
}
if(gap > m_PruneOptimizationThreshold)
return false;
}
}
//.........这里部分代码省略.........