本文整理汇总了C++中SyntaxTree::Parse方法的典型用法代码示例。如果您正苦于以下问题:C++ SyntaxTree::Parse方法的具体用法?C++ SyntaxTree::Parse怎么用?C++ SyntaxTree::Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxTree
的用法示例。
在下文中一共展示了SyntaxTree::Parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
init( argc, argv ); // initialize from switches, set flags
// loop through all sentences
int i=0;
char inBuffer[LINE_MAX_LENGTH];
while(true) {
i++;
if (i%1000 == 0) cerr << "." << flush;
if (i%10000 == 0) cerr << ":" << flush;
if (i%100000 == 0) cerr << "!" << flush;
// get line from stdin
SAFE_GETLINE( cin, inBuffer, LINE_MAX_LENGTH, '\n', __FILE__);
if (cin.eof()) break;
// process into syntax tree representation
string inBufferString = string( inBuffer );
set< string > labelCollection; // set of labels, not used
map< string, int > topLabelCollection; // count of top labels, not used
SyntaxTree tree;
ProcessAndStripXMLTags( inBufferString, tree, labelCollection, topLabelCollection );
vector< string > inWords = tokenize( inBufferString.c_str() );
// output tree
// cerr << "BEFORE:" << endl << tree;
ParentNodes parents = tree.Parse();
// execute selected grammar relaxation schemes
if (leftBinarizeFlag)
LeftBinarize( tree, parents );
if (rightBinarizeFlag)
RightBinarize( tree, parents );
if (SAMTLevel>0)
SAMT( tree, parents );
// output tree
// cerr << "AFTER:" << endl << tree;
store( tree, inWords );
}
}