本文整理汇总了C++中Token::AddNextToken方法的典型用法代码示例。如果您正苦于以下问题:C++ Token::AddNextToken方法的具体用法?C++ Token::AddNextToken怎么用?C++ Token::AddNextToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::AddNextToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestPrecNextGraph
void TestToken::TestPrecNextGraph()
{
SpeechSet* speechSet = new SpeechSet();
Speech* speech = new Speech(speechSet);
Segment* segment = Segment::CreateWithDuration(0, 10000, speech);
/* initialize tokens with a graph like
* B
* / \
* --A D--
* \ /
* C
*/
Token* tokenA = Token::CreateWithDuration(0, 0, segment);
tokenA->SetSourceText("A");
Token* tokenB = Token::CreateWithDuration(0, 0, segment);
tokenB->SetSourceText("B");
Token* tokenC = Token::CreateWithDuration(0, 0, segment);
tokenC->SetSourceText("C");
Token* tokenD = Token::CreateWithDuration(0, 0, segment);
tokenD->SetSourceText("D");
tokenA->AddNextToken(tokenB);
tokenA->AddNextToken(tokenC);
tokenB->AddPrecToken(tokenA);
tokenB->AddNextToken(tokenD);
tokenC->AddPrecToken(tokenA);
tokenC->AddNextToken(tokenD);
tokenD->AddPrecToken(tokenB);
tokenD->AddPrecToken(tokenC);
// a few basics assert
assert(tokenA->GetNextToken(0)->GetNextToken(0) == tokenA->GetNextToken(1)->GetNextToken(0));
assert(tokenD->GetPrecToken(0)->GetPrecToken(0) == tokenA->GetPrecToken(1)->GetPrecToken(0));
//TODO need to be more complex
delete tokenA;
delete tokenB;
delete tokenC;
delete tokenD;
delete segment;
delete speech;
}
示例2: CreateWithEndTime
Token* Token::CreateWithEndTime(const int& _startTime, const int& _endTime, Segment* parent, const string& _text, Token* first_prec_tokens, ...)
{
Token* token = Token::CreateWithEndTime(_startTime, _endTime, parent, _text);
Token* tok = first_prec_tokens;
va_list marker;
va_start( marker, first_prec_tokens); /* Initialize variable arguments. */
while (tok != NULL)
{
tok->AddNextToken(token);
token->AddPrecToken(tok);
tok = va_arg(marker, Token*);
}
va_end(marker);
return token;
}