本文整理汇总了C++中CSentence::ReadNextFromPlmLines方法的典型用法代码示例。如果您正苦于以下问题:C++ CSentence::ReadNextFromPlmLines方法的具体用法?C++ CSentence::ReadNextFromPlmLines怎么用?C++ CSentence::ReadNextFromPlmLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSentence
的用法示例。
在下文中一共展示了CSentence::ReadNextFromPlmLines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadAndProcessSentences
bool CSentencesCollection::ReadAndProcessSentences(const CPlmLineCollection* piPlmLine)
{
const size_t LinesCount = piPlmLine->m_Items.size();
if( !m_pSyntaxOptions->IsValid())
return false;
if (m_bEnableProgressBar)
printf ("Starting Syntax\n");
time_t t1;
time (&t1);
for (size_t LineNo = 0; LineNo < LinesCount; )
{
if (m_bEnableProgressBar)
printf ("%i of %i \r", LineNo, LinesCount);
CSentence* S = m_pSyntaxOptions->NewSentence();
if (!S)
{
m_pSyntaxOptions->OutputErrorString("Cannot allocate space for the new sentence!");
return false;
};
try
{
S->m_pSyntaxOptions = m_pSyntaxOptions;
bool bResult = S->ReadNextFromPlmLines(piPlmLine,LineNo);
if (m_bLogProcessedSentence)
{
FILE * fp = fopen ("last_read_sentence.log", "w");
fprintf (fp, "%s\n",S->GetSentenceBeginStr().c_str());
fclose(fp);
};
if( !bResult )
{
// a parse error occurs
delete S;
return false;
};
}
catch (...)
{
m_pSyntaxOptions->OutputErrorString("Cannot read a sentence from Mapost");
delete S;
return false;
};
if( S->m_Words.empty() )
{
// no not-empty sentence can be found, we are at the end of the text
delete S;
break;
}
try
{
bool bRes = S->BuildClauses();
if( !bRes )
{
delete S;
return false;
};
S->CalculatePrimitiveClausesCount();
if (m_bEnableProgressBar)
{
if (S->m_bPanicMode)
printf (" found a \"panic\" sentence\n");
};
m_vectorSents.push_back(S);
}
catch (...)
{
if (m_bEnableProgressBar)
{
printf ("\n");
if (!S->m_Words.empty())
printf ("exception at offset %i\n", S->m_Words[0].m_GraphematicalUnitOffset);
};
delete S;
m_pSyntaxOptions->OutputErrorString("An exception in Synan occurred!");
return false;
};
//.........这里部分代码省略.........