本文整理汇总了C++中CSentence::GetText方法的典型用法代码示例。如果您正苦于以下问题:C++ CSentence::GetText方法的具体用法?C++ CSentence::GetText怎么用?C++ CSentence::GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSentence
的用法示例。
在下文中一共展示了CSentence::GetText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Append
void CSentence::Append( float starttime, const CSentence& src )
{
#if PHONEME_EDITOR
int i;
// Combine
for ( i = 0 ; i < src.m_Words.Size(); i++ )
{
CWordTag *word = src.m_Words[ i ];
CWordTag *newWord = new CWordTag( *word );
newWord->m_flStartTime += starttime;
newWord->m_flEndTime += starttime;
// Offset times
int c = newWord->m_Phonemes.Count();
for ( int i = 0; i < c; ++i )
{
CPhonemeTag *tag = newWord->m_Phonemes[ i ];
tag->AddStartTime( starttime );
tag->AddEndTime( starttime );
}
AddWordTag( newWord );
}
if ( src.GetText()[ 0 ] )
{
char fulltext[ 4096 ];
if ( GetText()[ 0 ] )
{
Q_snprintf( fulltext, sizeof( fulltext ), "%s %s", GetText(), src.GetText() );
}
else
{
Q_strncpy( fulltext, src.GetText(), sizeof( fulltext ) );
}
SetText( fulltext );
}
int c = src.m_EmphasisSamples.Size();
for ( i = 0; i < c; i++ )
{
CEmphasisSample s = src.m_EmphasisSamples[ i ];
s.time += starttime;
m_EmphasisSamples.AddToTail( s );
}
// Or in voice duck settings
m_bShouldVoiceDuck |= src.m_bShouldVoiceDuck;
#else
Assert( 0 );
#endif
}
示例2: SAPI_ExtractPhonemes
//-----------------------------------------------------------------------------
// Purpose: Given a wavfile and a list of inwords, determines the word/phonene
// sample counts for the sentce
// Input : *wavfile -
// *inwords -
// *outphonemes{ text.Clear( -
// Output : SR_RESULT
//-----------------------------------------------------------------------------
static SR_RESULT SAPI_ExtractPhonemes(
const char *wavfile,
int numsamples,
void (*pfnPrint)( const char *fmt, ... ),
CSentence& inwords,
CSentence& outwords )
{
LogReset();
USES_CONVERSION;
CSpDynamicString text;
text.Clear();
HKEY hkwipe;
LONG lResult = RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Speech\\RecoProfiles", 0, KEY_ALL_ACCESS, &hkwipe );
if ( lResult == ERROR_SUCCESS )
{
RecursiveRegDelKey( hkwipe );
RegCloseKey( hkwipe );
}
if ( strlen( inwords.GetText() ) <= 0 )
{
inwords.SetTextFromWords();
}
// Construct a string from the inwords array
text.Append( T2W( inwords.GetText() ) );
// Assume failure
SR_RESULT result = SR_RESULT_ERROR;
if ( text.Length() > 0 )
{
CSentence sentence;
pfnPrint( "Processing...\r\n" );
// Give it a try
result = ExtractPhonemes( wavfile, text, sentence, pfnPrint );
pfnPrint( "Finished.\r\n" );
// PrintWordsAndPhonemes( sentence, pfnPrint );
// Copy results to outputs
outwords.Reset();
outwords.SetText( inwords.GetText() );
Log( "Starting\n" );
LogWords( inwords );
if ( SR_RESULT_ERROR != result )
{
int i;
Log( "Hypothesized\n" );
LogWords( sentence );
for( i = 0 ; i < sentence.m_Words.Size(); i++ )
{
CWordTag *tag = sentence.m_Words[ i ];
if ( tag )
{
// Skip '...' tag
if ( stricmp( tag->GetWord(), "..." ) )
{
CWordTag *newTag = new CWordTag( *tag );
outwords.m_Words.AddToTail( newTag );
}
}
}
// Now insert unrecognized/skipped words from original list
//
int frompos = 0, topos = 0;
while( 1 )
{
// End of source list
if ( frompos >= inwords.m_Words.Size() )
break;
const CWordTag *fromTag = inwords.m_Words[ frompos ];
// Reached end of destination list, just copy words over from from source list until
// we run out of source words
if ( topos >= outwords.m_Words.Size() )
{
// Just copy words over
//.........这里部分代码省略.........