Ejemplo n.º 1
0
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 );
	}
}