本文整理汇总了C++中CSentence::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ CSentence::Reset方法的具体用法?C++ CSentence::Reset怎么用?C++ CSentence::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSentence
的用法示例。
在下文中一共展示了CSentence::Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadSentenceFromWavFileUsingIO
bool CSoundCombiner::LoadSentenceFromWavFileUsingIO( char const *wavfile, CSentence& sentence, IFileReadBinary& io )
{
sentence.Reset();
InFileRIFF riff( wavfile, io );
// UNDONE: Don't use printf to handle errors
if ( riff.RIFFName() != RIFF_WAVE )
{
return false;
}
// set up the iterator for the whole file (root RIFF is a chunk)
IterateRIFF walk( riff, riff.RIFFSize() );
// This chunk must be first as it contains the wave's format
// break out when we've parsed it
bool found = false;
while ( walk.ChunkAvailable() && !found )
{
switch( walk.ChunkName() )
{
case WAVE_VALVEDATA:
{
found = true;
CSoundCombiner::ParseSentence( sentence, walk );
}
break;
}
walk.ChunkNext();
}
return true;
}
示例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
//.........这里部分代码省略.........