src/Generic/Cbrne/results/CBRNEResultCollector.cpp
// append a relation of type UNK

append a relation of type UNK
append a relation of type UNK
void CBRNEResultCollector::appendVerbRelation(OutputStream &stream,
											  const Proposition *proposition,
											  const RelMentionUID uid,
											  const int sentence_num)
{
	const TokenSequence *tokens = _docTheory->getSentenceTheory(sentence_num)->getTokenSequence();
	const MentionSet *mentions = _docTheory->getSentenceTheory(sentence_num)->getMentionSet();
	const Argument *sub=0, *obj=0, *iobj=0;
	const Symbol headWord = proposition->getPredHead()->getHeadWord();
	int i;
	int startTok = -1, endTok = -1;
	startTok = proposition->getPredHead()->getStartToken();
	endTok = proposition->getPredHead()->getEndToken();
	EDTOffset start = tokens->getToken(startTok)->getStartEDTOffset();
	EDTOffset end = tokens->getToken(endTok)->getEndEDTOffset();
	for (i=0; i<proposition->getNArgs(); i++) {
		const Argument *arg = proposition->getArg(i);
		if(arg->getType() == Argument::MENTION_ARG) {
			if(arg->getRoleSym() == Argument::SUB_ROLE)
				sub = arg;
			if(arg->getRoleSym() == Argument::OBJ_ROLE)
				obj = arg;
			if(arg->getRoleSym() == Argument::IOBJ_ROLE)
				iobj = arg;
			int arg_startTok = arg->getMention(mentions)->getNode()->getStartToken();
			int arg_endTok = arg->getMention(mentions)->getNode()->getEndToken();
			if(arg_startTok < startTok || startTok == -1) {
				startTok = arg_startTok;
				start = tokens->getToken(arg_startTok)->getStartEDTOffset();
			}
			if(arg_endTok > endTok || endTok == -1) {
				endTok = arg_endTok;
				end   = tokens->getToken(arg_endTok)->getEndEDTOffset();
			}
		}
	}
	stream << L"<RELATION_MENTION ";
	stream << L"UID=\"";
	stream << obtainRelMentionUID(NULL, uid);
	stream << L"\" ";
	stream << L"relationType=\"";
	stream << L"UNK";
	stream << L"\" ";
	stream << L"startOffset=\"";
	stream << start;
	stream << L"\" ";
	stream << L"stringLength=\"";
	stream << ((end.value()+1) - start.value());
	stream << L"\" ";
	stream << L"headWord=\"";
	appendEscaped(stream, headWord.to_string());
	stream << L"\" ";
	stream << L"textString=\"";
	appendEscaped(stream, tokens->getToken(startTok)->getSymbol().to_string());
	for(i=startTok+1; i<=endTok; i++) {
		stream << L" ";
		appendEscaped(stream, tokens->getToken(i)->getSymbol().to_string());
	}
	stream << L"\"";
	stream << L"/>\n";
}
void CBRNEResultCollector :: appendVerbRelation ( OutputStream & stream , const Proposition * proposition , const RelMentionUID uid , const int sentence_num ) { const TokenSequence * tokens = _docTheory -> getSentenceTheory ( sentence_num ) -> getTokenSequence ( ) ; const MentionSet * mentions = _docTheory -> getSentenceTheory ( sentence_num ) -> getMentionSet ( ) ; const Argument * sub = 0 , * obj = 0 , * iobj = 0 ; const Symbol headWord = proposition -> getPredHead ( ) -> getHeadWord ( ) ; int i ; int startTok = -1 , endTok = -1 ; startTok = proposition -> getPredHead ( ) -> getStartToken ( ) ; endTok = proposition -> getPredHead ( ) -> getEndToken ( ) ; EDTOffset start = tokens -> getToken ( startTok ) -> getStartEDTOffset ( ) ; EDTOffset end = tokens -> getToken ( endTok ) -> getEndEDTOffset ( ) ; for ( i = 0 ; i < proposition -> getNArgs ( ) ; i ++ ) { const Argument * arg = proposition -> getArg ( i ) ; if ( arg -> getType ( ) == Argument :: MENTION_ARG ) { if ( arg -> getRoleSym ( ) == Argument :: SUB_ROLE ) sub = arg ; if ( arg -> getRoleSym ( ) == Argument :: OBJ_ROLE ) obj = arg ; if ( arg -> getRoleSym ( ) == Argument :: IOBJ_ROLE ) iobj = arg ; int arg_startTok = arg -> getMention ( mentions ) -> getNode ( ) -> getStartToken ( ) ; int arg_endTok = arg -> getMention ( mentions ) -> getNode ( ) -> getEndToken ( ) ; if ( arg_startTok < startTok || startTok == -1 ) { startTok = arg_startTok ; start = tokens -> getToken ( arg_startTok ) -> getStartEDTOffset ( ) ; } if ( arg_endTok > endTok || endTok == -1 ) { endTok = arg_endTok ; end = tokens -> getToken ( arg_endTok ) -> getEndEDTOffset ( ) ; } } } stream << L" " ; stream << L" \" " ; stream << obtainRelMentionUID ( NULL , uid ) ; stream << L" \" " ; stream << L" \" " ; stream << L" " ; stream << L" \" " ; stream << L" \" " ; stream << start ; stream << L" \" " ; stream << L" \" " ; stream << ( ( end . value ( ) + 1 ) - start . value ( ) ) ; stream << L" \" " ; stream << L" \" " ; appendEscaped ( stream , headWord . to_string ( ) ) ; stream << L" \" " ; stream << L" \" " ; appendEscaped ( stream , tokens -> getToken ( startTok ) -> getSymbol ( ) . to_string ( ) ) ; for ( i = startTok + 1 ; i <= endTok ; i ++ ) { stream << L" " ; appendEscaped ( stream , tokens -> getToken ( i ) -> getSymbol ( ) . to_string ( ) ) ; } stream << L" \" " ; stream << L" \n " ; }
append a relation of type UNK
append a relation of type UNK
//int sentence_num = proposition->getArg(0)->getMention(;
