src/PredFinder/elf/ElfRelation.cpp
/**
 * Take the return features that represent a TBD relation from the pattern file.
 * Transform their roles and types into the appropriate values for this event.
 * Also, set _name appropriately.
 *
 * @param doc_theory The DocTheory containing the matched
 * SnipppetFeatureSet.
 * @param tbdEventFeature The SnippetReturnFeature* corresponding to the
 * event itself, typically pointing to a Proposition or Event. 
 * @param tbdAgentFeatures The SnippetReturnFeature* corresponding
 * to agents of the event.
 * @param tbdPatientFeatures The SnippetReturnFeature* corresponding
 * to patients of the event.
 *
 * @author eboschee@bbn.com
 * @date 2010.12.12
 **/
Take the return features that represent a TBD relation from the pattern file.
Transform their roles and types into the appropriate values for this event.
Also, set _name appropriately.




Take the return features that represent a TBD relation from the pattern file . Transform their roles and types into the appropriate values for this event . Also set _name appropriately .
void ElfRelation::fix_tbd_arguments(const DocTheory *doc_theory, ReturnPatternFeature_ptr tbdEventFeature, 
									std::vector<ReturnPatternFeature_ptr>& tbdAgentFeatures,
									std::vector<ReturnPatternFeature_ptr>& tbdPatientFeatures)
{
	if (tbdEventFeature == 0)
		return;
	std::wstring event_type = tbdEventFeature->getReturnValue(L"tbd");
	std::wstring role = EITbdAdapter::getEventRole(event_type);
	if (!role.empty())
		tbdEventFeature->setReturnValue(L"role", role);
	std::wstring type = EITbdAdapter::getEventType(event_type, !tbdAgentFeatures.empty());
	if (!type.empty())
		tbdEventFeature->setReturnValue(L"type", type);
	BOOST_FOREACH(ReturnPatternFeature_ptr feature, tbdAgentFeatures) {
		MentionReturnPFeature_ptr mf = dynamic_pointer_cast<MentionReturnPFeature>(feature);
		if (!mf) {
			continue; 
		}
		const Mention *ment = mf->getMention();
		EntitySubtype est = ment->guessEntitySubtype(doc_theory);
		std::wstring role = EITbdAdapter::getAgentRole(event_type);
		if (!role.empty())
			mf->setReturnValue(L"role", role);
		std::wstring type = EITbdAdapter::getAgentType(ment->getEntityType(), est);
		if (!type.empty())
			mf->setReturnValue(L"type", type);
	}
	BOOST_FOREACH(ReturnPatternFeature_ptr feature, tbdPatientFeatures) {
		MentionReturnPFeature_ptr mf = dynamic_pointer_cast<MentionReturnPFeature>(feature);
		if (!mf) {
			continue; 
		}
		const Mention *ment = mf->getMention();
		EntitySubtype est = ment->guessEntitySubtype(doc_theory);
		std::wstring role = EITbdAdapter::getPatientRole(event_type, ment->getEntityType(), est);		
		if (!role.empty())
			mf->setReturnValue(L"role", role);
		std::wstring type = EITbdAdapter::getPatientType(event_type, ment->getEntityType(), est);
		if (!type.empty())
			mf->setReturnValue(L"type", type);
	}
	_name = EITbdAdapter::getEventName(event_type, !tbdAgentFeatures.empty());
}
void ElfRelation :: fix_tbd_arguments ( const DocTheory * doc_theory , ReturnPatternFeature_ptr tbdEventFeature , std :: vector < ReturnPatternFeature_ptr > & tbdAgentFeatures , std :: vector < ReturnPatternFeature_ptr > & tbdPatientFeatures ) { if ( tbdEventFeature == 0 ) return ; std :: wstring event_type = tbdEventFeature -> getReturnValue ( L" " ) ; std :: wstring role = EITbdAdapter :: getEventRole ( event_type ) ; if ( ! role . empty ( ) ) tbdEventFeature -> setReturnValue ( L" " , role ) ; std :: wstring type = EITbdAdapter :: getEventType ( event_type , ! tbdAgentFeatures . empty ( ) ) ; if ( ! type . empty ( ) ) tbdEventFeature -> setReturnValue ( L" " , type ) ; BOOST_FOREACH ( ReturnPatternFeature_ptr feature , tbdAgentFeatures ) { MentionReturnPFeature_ptr mf = dynamic_pointer_cast < MentionReturnPFeature > ( feature ) ; if ( ! mf ) { continue ; } const Mention * ment = mf -> getMention ( ) ; EntitySubtype est = ment -> guessEntitySubtype ( doc_theory ) ; std :: wstring role = EITbdAdapter :: getAgentRole ( event_type ) ; if ( ! role . empty ( ) ) mf -> setReturnValue ( L" " , role ) ; std :: wstring type = EITbdAdapter :: getAgentType ( ment -> getEntityType ( ) , est ) ; if ( ! type . empty ( ) ) mf -> setReturnValue ( L" " , type ) ; } BOOST_FOREACH ( ReturnPatternFeature_ptr feature , tbdPatientFeatures ) { MentionReturnPFeature_ptr mf = dynamic_pointer_cast < MentionReturnPFeature > ( feature ) ; if ( ! mf ) { continue ; } const Mention * ment = mf -> getMention ( ) ; EntitySubtype est = ment -> guessEntitySubtype ( doc_theory ) ; std :: wstring role = EITbdAdapter :: getPatientRole ( event_type , ment -> getEntityType ( ) , est ) ; if ( ! role . empty ( ) ) mf -> setReturnValue ( L" " , role ) ; std :: wstring type = EITbdAdapter :: getPatientType ( event_type , ment -> getEntityType ( ) , est ) ; if ( ! type . empty ( ) ) mf -> setReturnValue ( L" " , type ) ; } _name = EITbdAdapter :: getEventName ( event_type , ! tbdAgentFeatures . empty ( ) ) ; }
Take the return features that represent a TBD relation from the pattern file.
Take the return features that represent a TBD relation from the pattern file .
// Set event role/type
 // Set agent role/type
 // maybe we should throw instead?
 // Set patient role/type
 // maybe we should throw instead?
