src/PredFinder/inference/ElfInference.cpp
// Get inferred dates, but exclude dates on propositions that explicitly do NOT refer to the event,
//   e.g. "he was accused Tuesday of bombing the embassy".
// Called by ElfDocument constructor.

Get inferred dates, but exclude dates on propositions that explicitly do NOT refer to the event,
e.g. "he was accused Tuesday of bombing the embassy".
Called by ElfDocument constructor.
Get inferred dates but exclude dates on propositions that explicitly do NOT refer to the event e . g . " he was accused Tuesday of bombing the embassy " . Called by ElfDocument constructor .
void ElfInference::addInferredDateForEvent(EIDocData_ptr docData, int sent_no, const PatternFeatureSet_ptr featureSet) {
	throw_if_ei_not_initialized();
	if (!EIUtils::isViolentTBDEvent(featureSet))
		return;	
	std::set<const ValueMention*> dateMentions;
	std::set<const ValueMention*> badDateMentions;
	for (size_t i = 0; i < featureSet->getNFeatures(); i++) {
		PatternFeature_ptr feature = featureSet->getFeature(i);
		if (PropPFeature_ptr pf = dynamic_pointer_cast<PropPFeature>(feature)) {
			EIUtils::getDates(docData->getDocTheory(), sent_no, pf->getProp(), dateMentions);
		} else if (MentionPFeature_ptr mf = dynamic_pointer_cast<MentionPFeature>(feature)) {
			PropositionSet *pSet = docData->getSentenceTheory(sent_no)->getPropositionSet();
			const Proposition *defProp = pSet->getDefinition(mf->getMention()->getIndex());
			if (defProp != 0)
				EIUtils::getDates(docData->getDocTheory(), sent_no, defProp, dateMentions);
		} else if (ValueMentionReturnPFeature_ptr rf = dynamic_pointer_cast<ValueMentionReturnPFeature>(feature)) {
			if (rf->getReturnValue(L"tbd").compare(L"bad_date"))
				badDateMentions.insert(rf->getValueMention());
		} 
	}
	BOOST_FOREACH(const ValueMention* dateMention, dateMentions) {	
		if (badDateMentions.find(dateMention) != badDateMentions.end())
			continue;
		ValueMentionReturnPFeature_ptr dateFeature = boost::make_shared<ValueMentionReturnPFeature>(Symbol(L"inferredDate"), dateMention);
		dateFeature->setCoverage(docData->getDocTheory()); 
		dateFeature->setReturnValue(L"role", L"eru:eventDate");
		dateFeature->setReturnValue(L"type", L"xsd:date");
		dateFeature->setReturnValue(L"value", L"true");
		featureSet->addFeature(dateFeature);
	}
}
void ElfInference :: addInferredDateForEvent ( EIDocData_ptr docData , int sent_no , const PatternFeatureSet_ptr featureSet ) { throw_if_ei_not_initialized ( ) ; if ( ! EIUtils :: isViolentTBDEvent ( featureSet ) ) return ; std :: set < const ValueMention * > dateMentions ; std :: set < const ValueMention * > badDateMentions ; for ( size_t i = 0 ; i < featureSet -> getNFeatures ( ) ; i ++ ) { PatternFeature_ptr feature = featureSet -> getFeature ( i ) ; if ( PropPFeature_ptr pf = dynamic_pointer_cast < PropPFeature > ( feature ) ) { EIUtils :: getDates ( docData -> getDocTheory ( ) , sent_no , pf -> getProp ( ) , dateMentions ) ; } else if ( MentionPFeature_ptr mf = dynamic_pointer_cast < MentionPFeature > ( feature ) ) { PropositionSet * pSet = docData -> getSentenceTheory ( sent_no ) -> getPropositionSet ( ) ; const Proposition * defProp = pSet -> getDefinition ( mf -> getMention ( ) -> getIndex ( ) ) ; if ( defProp != 0 ) EIUtils :: getDates ( docData -> getDocTheory ( ) , sent_no , defProp , dateMentions ) ; } else if ( ValueMentionReturnPFeature_ptr rf = dynamic_pointer_cast < ValueMentionReturnPFeature > ( feature ) ) { if ( rf -> getReturnValue ( L" " ) . compare ( L" " ) ) badDateMentions . insert ( rf -> getValueMention ( ) ) ; } } BOOST_FOREACH ( const ValueMention * dateMention , dateMentions ) { if ( badDateMentions . find ( dateMention ) != badDateMentions . end ( ) ) continue ; ValueMentionReturnPFeature_ptr dateFeature = boost :: make_shared < ValueMentionReturnPFeature > ( Symbol ( L" " ) , dateMention ) ; dateFeature -> setCoverage ( docData -> getDocTheory ( ) ) ; dateFeature -> setReturnValue ( L" " , L" " ) ; dateFeature -> setReturnValue ( L" " , L" " ) ; dateFeature -> setReturnValue ( L" " , L" " ) ; featureSet -> addFeature ( dateFeature ) ; } }
Get inferred dates, but exclude dates on propositions that explicitly do NOT refer to the event,
e.g.
Get inferred dates but exclude dates on propositions that explicitly do NOT refer to the event e . g .
// These are dates on propositions that explicitly do NOT refer to the event,
 //   e.g. "he was accused Tuesday of bombing the embassy"
 /*
	// MUCH more aggressive 
	if (dateMentions.size() == 0) {
		PropositionSet *pSet = docData->getSentenceTheory(sent_no)->getPropositionSet();
		for (int p = 0; p < pSet->getNPropositions(); p++) {
			EIUtils::getDates(docInfo->getDocTheory(), sent_no, pSet->getProposition(p), dateMentions);			
		}
	}
	*/ // essential!
