src/English/values/en_PatternEventValueRecognizer.cpp
//We should now have PatternFeatureSets for each of the values we have found
//add their information to the event mention

We should now have PatternFeatureSets for each of the values we have found
add their information to the event mention
We should now have PatternFeatureSets for each of the values we have found add their information to the event mention
BOOST_FOREACH(PatternFeatureSet_ptr pfs, matchingResults) {
					pfs->setCoverage(docTheory);
					for (size_t f = 0; f < pfs->getNFeatures(); f++) {
						PatternFeature_ptr feat = pfs->getFeature(f);
						if(ReturnPatternFeature_ptr rf = boost::dynamic_pointer_cast<ReturnPatternFeature>(feat)) {
							std::map<std::wstring, std::wstring> returnValuesMap = rf->getPatternReturn()->getCopyOfReturnValuesMap();
							typedef std::pair<std::wstring, std::wstring> str_pair;
							BOOST_FOREACH(str_pair keyVal, returnValuesMap) {
								if(keyVal.first == L"value") {
									if(MentionReturnPFeature_ptr mrf = boost::dynamic_pointer_cast<MentionReturnPFeature>(rf)) {
										const SynNode* node = mrf->getMention()->getNode();
										while (node != 0 && node->getParent() != 0 && node->getParent()->getHead() == node) {
											node = node->getParent();
										}
										if(node)
											addValueMention(docTheory, vment->eventMention, mrf->getMention()->getNode(), keyVal.second, 1.0);
									} else if (ValueMentionReturnPFeature_ptr vmrf=boost::dynamic_pointer_cast<ValueMentionReturnPFeature>(rf)) {
										const SynNode* node = sTheory->getPrimaryParse()->getRoot()->getNodeByTokenSpan(vmrf->getStartToken(), vmrf->getEndToken());
										while (node != 0 && node->getParent() != 0 && node->getParent()->getHead() == node) {
											node = node->getParent();
										}
										if(node)
											addValueMention(docTheory, vment->eventMention, node, keyVal.second, 1.0);
									} else if (PropositionReturnPFeature_ptr prf = boost::dynamic_pointer_cast<PropositionReturnPFeature>(rf)) {
										const SynNode* node = prf->getProp()->getPredHead();
										while (node != 0 && node->getParent() != 0 && node->getParent()->getHead() == node) {
											node = node->getParent();
										}
										if(node)
											addValueMention(docTheory, vment->eventMention, node, keyVal.second, 1.0);
									} else if (TokenSpanReturnPFeature_ptr tsrf = boost::dynamic_pointer_cast<TokenSpanReturnPFeature>(rf)) {
										const SynNode* node = sTheory->getPrimaryParse()->getRoot()->getNodeByTokenSpan(tsrf->getStartToken(), tsrf->getEndToken());
										while (node != 0 && node->getParent() != 0 && node->getParent()->getHead() == node) {
											node = node->getParent();
										}
										if(node)
											addValueMention(docTheory, vment->eventMention, node, keyVal.second, 1.0);
									}
								}
							}
						}
					}
				}
BOOST_FOREACH ( PatternFeatureSet_ptr pfs , matchingResults ) { pfs -> setCoverage ( docTheory ) ; for ( size_t f = 0 ; f < pfs -> getNFeatures ( ) ; f ++ ) { PatternFeature_ptr feat = pfs -> getFeature ( f ) ; if ( ReturnPatternFeature_ptr rf = boost :: dynamic_pointer_cast < ReturnPatternFeature > ( feat ) ) { std :: map < std :: wstring , std :: wstring > returnValuesMap = rf -> getPatternReturn ( ) -> getCopyOfReturnValuesMap ( ) ; typedef std :: pair < std :: wstring , std :: wstring > str_pair ; BOOST_FOREACH ( str_pair keyVal , returnValuesMap ) { if ( keyVal . first == L" " ) { if ( MentionReturnPFeature_ptr mrf = boost :: dynamic_pointer_cast < MentionReturnPFeature > ( rf ) ) { const SynNode * node = mrf -> getMention ( ) -> getNode ( ) ; while ( node != 0 && node -> getParent ( ) != 0 && node -> getParent ( ) -> getHead ( ) == node ) { node = node -> getParent ( ) ; } if ( node ) addValueMention ( docTheory , vment -> eventMention , mrf -> getMention ( ) -> getNode ( ) , keyVal . second , 1.0 ) ; } else if ( ValueMentionReturnPFeature_ptr vmrf = boost :: dynamic_pointer_cast < ValueMentionReturnPFeature > ( rf ) ) { const SynNode * node = sTheory -> getPrimaryParse ( ) -> getRoot ( ) -> getNodeByTokenSpan ( vmrf -> getStartToken ( ) , vmrf -> getEndToken ( ) ) ; while ( node != 0 && node -> getParent ( ) != 0 && node -> getParent ( ) -> getHead ( ) == node ) { node = node -> getParent ( ) ; } if ( node ) addValueMention ( docTheory , vment -> eventMention , node , keyVal . second , 1.0 ) ; } else if ( PropositionReturnPFeature_ptr prf = boost :: dynamic_pointer_cast < PropositionReturnPFeature > ( rf ) ) { const SynNode * node = prf -> getProp ( ) -> getPredHead ( ) ; while ( node != 0 && node -> getParent ( ) != 0 && node -> getParent ( ) -> getHead ( ) == node ) { node = node -> getParent ( ) ; } if ( node ) addValueMention ( docTheory , vment -> eventMention , node , keyVal . second , 1.0 ) ; } else if ( TokenSpanReturnPFeature_ptr tsrf = boost :: dynamic_pointer_cast < TokenSpanReturnPFeature > ( rf ) ) { const SynNode * node = sTheory -> getPrimaryParse ( ) -> getRoot ( ) -> getNodeByTokenSpan ( tsrf -> getStartToken ( ) , tsrf -> getEndToken ( ) ) ; while ( node != 0 && node -> getParent ( ) != 0 && node -> getParent ( ) -> getHead ( ) == node ) { node = node -> getParent ( ) ; } if ( node ) addValueMention ( docTheory , vment -> eventMention , node , keyVal . second , 1.0 ) ; } } } } } }
We should now have PatternFeatureSets for each of the values we have found
add their information to the event mention
We should now have PatternFeatureSets for each of the values we have found add their information to the event mention
//set the coverage for this set
 //figure out what node we want by looking, starting at the prop's predhead for a parent node that has itself as it's head
 //in other words, find the head of this prop phrase?
