src/Spanish/propositions/es_PropositionStatusClassifier.cpp
/** Use the given pattern matcher to label the status of propositions.  In particular, run each 
  * sentence-level pattern, and any proposition return feature that returns a status name will
  * cause that proposition to get tagged with that status. */
Use the given pattern matcher to label the status of propositions.  In particular, run each
sentence-level pattern, and any proposition return feature that returns a status name will
cause that proposition to get tagged with that status.
Use the given pattern matcher to label the status of propositions . In particular run each sentence - level pattern and any proposition return feature that returns a status name will cause that proposition to get tagged with that status .
void SpanishPropositionStatusClassifier::augmentPropositionTheoryWithPatterns(DocTheory *docTheory, SentenceTheory *sentTheory,
																  PatternMatcher_ptr propStatusPatternMatcher)
{
	if (!propStatusPatternMatcher)
		return;
	std::vector<PatternFeatureSet_ptr> sentMatches = propStatusPatternMatcher->getSentenceSnippets(sentTheory, 0, true);
	BOOST_FOREACH(const PatternFeatureSet_ptr &match, sentMatches) {
		Symbol patternLabel = UNLABELED_PATTERN_SYM;
		for (size_t f = 0; f < match->getNFeatures(); f++) {
			if (TopLevelPFeature_ptr tsf = boost::dynamic_pointer_cast<TopLevelPFeature>(match->getFeature(f)))
				patternLabel = tsf->getPatternLabel();
		}
		for (size_t f = 0; f < match->getNFeatures(); f++) {
			try {
				if (PropositionReturnPFeature_ptr prpf = boost::dynamic_pointer_cast<PropositionReturnPFeature>(match->getFeature(f))) {
					PropositionStatusAttribute status = PropositionStatusAttribute::getFromString(prpf->getReturnLabel().to_string());
					Proposition *prop = const_cast<Proposition*>(prpf->getProp());
					if (_debugPatterns)
						showPatternDebugMessage(patternLabel, prpf->getReturnLabel(), prop);
					prop->addStatus(status);
				}
				if (ParseNodeReturnPFeature_ptr prpf = boost::dynamic_pointer_cast<ParseNodeReturnPFeature>(match->getFeature(f))) {
					PropositionStatusAttribute status = PropositionStatusAttribute::getFromString(prpf->getReturnLabel().to_string());
					const SynNode *node = const_cast<SynNode*>(prpf->getNode());
					Proposition *prop = sentTheory->getPropositionSet()->findPropositionByNode(node);
					if (prop) {
						if (_debugPatterns)
							showPatternDebugMessage(patternLabel, prpf->getReturnLabel(), prop);
						prop->addStatus(status);
					}
				}
			} catch (UnrecoverableException &e) {
				e.prependToMessage(patternLabel.to_debug_string());
				throw;
			}
		}
	}
}
void SpanishPropositionStatusClassifier :: augmentPropositionTheoryWithPatterns ( DocTheory * docTheory , SentenceTheory * sentTheory , PatternMatcher_ptr propStatusPatternMatcher ) { if ( ! propStatusPatternMatcher ) return ; std :: vector < PatternFeatureSet_ptr > sentMatches = propStatusPatternMatcher -> getSentenceSnippets ( sentTheory , 0 , true ) ; BOOST_FOREACH ( const PatternFeatureSet_ptr & match , sentMatches ) { Symbol patternLabel = UNLABELED_PATTERN_SYM ; for ( size_t f = 0 ; f < match -> getNFeatures ( ) ; f ++ ) { if ( TopLevelPFeature_ptr tsf = boost :: dynamic_pointer_cast < TopLevelPFeature > ( match -> getFeature ( f ) ) ) patternLabel = tsf -> getPatternLabel ( ) ; } for ( size_t f = 0 ; f < match -> getNFeatures ( ) ; f ++ ) { try { if ( PropositionReturnPFeature_ptr prpf = boost :: dynamic_pointer_cast < PropositionReturnPFeature > ( match -> getFeature ( f ) ) ) { PropositionStatusAttribute status = PropositionStatusAttribute :: getFromString ( prpf -> getReturnLabel ( ) . to_string ( ) ) ; Proposition * prop = const_cast < Proposition * > ( prpf -> getProp ( ) ) ; if ( _debugPatterns ) showPatternDebugMessage ( patternLabel , prpf -> getReturnLabel ( ) , prop ) ; prop -> addStatus ( status ) ; } if ( ParseNodeReturnPFeature_ptr prpf = boost :: dynamic_pointer_cast < ParseNodeReturnPFeature > ( match -> getFeature ( f ) ) ) { PropositionStatusAttribute status = PropositionStatusAttribute :: getFromString ( prpf -> getReturnLabel ( ) . to_string ( ) ) ; const SynNode * node = const_cast < SynNode * > ( prpf -> getNode ( ) ) ; Proposition * prop = sentTheory -> getPropositionSet ( ) -> findPropositionByNode ( node ) ; if ( prop ) { if ( _debugPatterns ) showPatternDebugMessage ( patternLabel , prpf -> getReturnLabel ( ) , prop ) ; prop -> addStatus ( status ) ; } } } catch ( UnrecoverableException & e ) { e . prependToMessage ( patternLabel . to_debug_string ( ) ) ; throw ; } } } }
Use the given pattern matcher to label the status of propositions.
Use the given pattern matcher to label the status of propositions .
// Use the pattern matcher to look for propositions that should be labeled with select statuses.
