src/Generic/distributionalKnowledge/DistributionalAssocPropClass.cpp
// this has close similarities to the way causality scores are assigned
// based on the propositions gathered by EventAAObservation for (anchor, arg), we can now set our assoc prop features
// populates: _assocPropSim , _assocPropSimFea , _assocPropSimSB , _assocPropPmi , _assocPropPmiFea , _assocPropPmiSB
//
// to assign assoc prop scores features, we do the following:
// - take the candidate argument, and gather the set of its associated SERIF propositions 
//     (i.e. propositions which have the candidate arg as one of their prop arguments)
// - for each of these propositions, take note of the proposition's predicate, and the proposition-role between (predicate, candidate argument)
//     (in our current implementation, we actually don't use the proposition role, but it's nice to have if in future you want to do something special for <sub>, <obj>
// - for each predicate, measure the pmi and cosine-sim score between (predicate, anchor)
//
// we take in a set of (proposition-role, proposition-predicate) associated with the candidate argument
this has close similarities to the way causality scores are assigned
based on the propositions gathered by EventAAObservation for (anchor, arg), we can now set our assoc prop features
populates: _assocPropSim , _assocPropSimFea , _assocPropSimSB , _assocPropPmi , _assocPropPmiFea , _assocPropPmiSB

to assign assoc prop scores features, we do the following:
take the candidate argument, and gather the set of its associated SERIF propositions

for each of these propositions, take note of the proposition's predicate, and the proposition-role between (predicate, candidate argument)
(in our current implementation, we actually don't use the proposition role, but it's nice to have if in future you want to do something special for , 
for each predicate, measure the pmi and cosine-sim score between (predicate, anchor)

we take in a set of (proposition-role, proposition-predicate) associated with the candidate argument
this has close similarities to the way causality scores are assigned based on the propositions gathered by EventAAObservation for ( anchor arg ) we can now set our assoc prop features populates : _assocPropSim _assocPropSimFea _assocPropSimSB _assocPropPmi _assocPropPmiFea _assocPropPmiSB to assign assoc prop scores features we do the following : take the candidate argument and gather the set of its associated SERIF propositions for each of these propositions take note of the proposition ' s predicate and the proposition - role between ( predicate candidate argument ) ( in our current implementation we actually don ' t use the proposition role but it ' s nice to have if in future you want to do something special for for each predicate measure the pmi and cosine - sim score between ( predicate anchor ) we take in a set of ( proposition - role proposition - predicate ) associated with the candidate argument
void DistributionalAssocPropClass::assignAssocPropFeatures(const std::set<SymbolPair>& feas) {
	float maxS=-1, maxPmi=-1, s=-1;
	std::set<Symbol> keywords;
	keywords.insert(_anchor);
	for(std::set<SymbolPair>::const_iterator it=feas.begin(); it!=feas.end(); it++) {
		SymbolPair fea = *it;
		Symbol w = fea.second;		
		for(std::set<Symbol>::iterator kwIt=keywords.begin(); kwIt!=keywords.end(); kwIt++) {
			Symbol kw = *kwIt;
			if(w != kw) {
				s = DistributionalKnowledgeTable::getVVSim(w, kw);
				if(s > maxS) 
					maxS = s;
				s = DistributionalKnowledgeTable::getNNSim(w, kw);
				if(s > maxS) 
					maxS = s;
				s = DistributionalKnowledgeTable::getVNSim(w, kw);
				if(s > maxS) 
					maxS = s;
				s = DistributionalKnowledgeTable::getVNSim(kw, w);
				if(s > maxS) 
					maxS = s;
				s = DistributionalKnowledgeTable::getVVPmi(w, kw);
				if(s > maxPmi) 
					maxPmi = s;
				s = DistributionalKnowledgeTable::getNNPmi(w, kw);
				if(s > maxPmi) 
					maxPmi = s;
				s = DistributionalKnowledgeTable::getVNPmi(w, kw);
				if(s > maxPmi) 
					maxPmi = s;
				s = DistributionalKnowledgeTable::getVNPmi(kw, w);
				if(s > maxPmi) 
					maxPmi = s;
				}
			}
	}
	_assocPropSim = maxS;
	_assocPropPmi = maxPmi;
	_assocPropSimSB = DistributionalUtil::scoreToBin(_assocPropSim);
	_assocPropPmiSB = DistributionalUtil::scoreToBin(_assocPropPmi);
}
void DistributionalAssocPropClass :: assignAssocPropFeatures ( const std :: set < SymbolPair > & feas ) { float maxS = -1 , maxPmi = -1 , s = -1 ; std :: set < Symbol > keywords ; keywords . insert ( _anchor ) ; for ( std :: set < SymbolPair > :: const_iterator it = feas . begin ( ) ; it != feas . end ( ) ; it ++ ) { SymbolPair fea = * it ; Symbol w = fea . second ; for ( std :: set < Symbol > :: iterator kwIt = keywords . begin ( ) ; kwIt != keywords . end ( ) ; kwIt ++ ) { Symbol kw = * kwIt ; if ( w != kw ) { s = DistributionalKnowledgeTable :: getVVSim ( w , kw ) ; if ( s > maxS ) maxS = s ; s = DistributionalKnowledgeTable :: getNNSim ( w , kw ) ; if ( s > maxS ) maxS = s ; s = DistributionalKnowledgeTable :: getVNSim ( w , kw ) ; if ( s > maxS ) maxS = s ; s = DistributionalKnowledgeTable :: getVNSim ( kw , w ) ; if ( s > maxS ) maxS = s ; s = DistributionalKnowledgeTable :: getVVPmi ( w , kw ) ; if ( s > maxPmi ) maxPmi = s ; s = DistributionalKnowledgeTable :: getNNPmi ( w , kw ) ; if ( s > maxPmi ) maxPmi = s ; s = DistributionalKnowledgeTable :: getVNPmi ( w , kw ) ; if ( s > maxPmi ) maxPmi = s ; s = DistributionalKnowledgeTable :: getVNPmi ( kw , w ) ; if ( s > maxPmi ) maxPmi = s ; } } } _assocPropSim = maxS ; _assocPropPmi = maxPmi ; _assocPropSimSB = DistributionalUtil :: scoreToBin ( _assocPropSim ) ; _assocPropPmiSB = DistributionalUtil :: scoreToBin ( _assocPropPmi ) ; }
this has close similarities to the way causality scores are assigned
based on the propositions gathered by EventAAObservation for (anchor, arg), we can now set our assoc prop features
populates: _assocPropSim , _assocPropSimFea , _assocPropSimSB , _assocPropPmi , _assocPropPmiFea , _assocPropPmiSB
this has close similarities to the way causality scores are assigned based on the propositions gathered by EventAAObservation for ( anchor arg ) we can now set our assoc prop features populates : _assocPropSim _assocPropSimFea _assocPropSimSB _assocPropPmi _assocPropPmiFea _assocPropPmiSB
//_assocPropSimFea.clear(); //_assocPropPmiFea.clear(); // right now, keywords actually just consist of the anchor.  // in future, you might want to experiment with adding .. say a list of keywords (based on the event type represented by the anchor) // grab the predicate // meaningless to assign scores if anchor and predicate are the same word string //std::vector<std::wstring> bins = DistributionalUtil::scoreToBins(maxS); //for(unsigned i=0; i<bins.size(); i++) { //	_assocPropSimFea.push_back( Symbol(L"assocpropsim_"+bins[i]) ); //} //bins = DistributionalUtil::scoreToBins(maxPmi); //for(unsigned i=0; i<bins.size(); i++) { //	_assocPropPmiFea.push_back( Symbol(L"assocproppmi_"+bins[i]) ); //}