src/LearnIt/MatchInfo.cpp
/** Helper function for findPropPaths: Return a list of all paths that connect a 
  * proposition to a given slot filler, via a specified argument. */
Helper function for findPropPaths: Return a list of all paths that connect a
proposition to a given slot filler, via a specified argument.
Helper function for findPropPaths : Return a list of all paths that connect a proposition to a given slot filler via a specified argument .
void MatchInfo::findPropPathsViaArg(const SentenceTheory *sentTheory, 
									const Proposition *prop, Argument *arg, 
									SlotFiller_ptr slotFiller, const PropPath &pathToHere,
									std::vector<PropPath> &result)
{
	assert(arg->getRoleSym().to_string() != NULL);
	if (arg->getType() == Argument::MENTION_ARG) {
		if(slotFiller->matchesArgument(arg)){
			PropPath path(pathToHere);
			path.push_back(PropPathLink(prop, L"", true));
			result.push_back(path);
			return;
		}
	}
	Proposition const *argProp = NULL;
	if (arg->getType() == Argument::PROPOSITION_ARG) {
		argProp = arg->getProposition();
	} else if (arg->getType() == Argument::MENTION_ARG) {
		argProp = sentTheory->getPropositionSet()->getDefinition(arg->getMentionIndex());
	}
	if (argProp && (argProp != prop)) {
		findPropPaths(sentTheory, argProp, slotFiller, pathToHere, result);
	}
}
void MatchInfo :: findPropPathsViaArg ( const SentenceTheory * sentTheory , const Proposition * prop , Argument * arg , SlotFiller_ptr slotFiller , const PropPath & pathToHere , std :: vector < PropPath > & result ) { assert ( arg -> getRoleSym ( ) . to_string ( ) != NULL ) ; if ( arg -> getType ( ) == Argument :: MENTION_ARG ) { if ( slotFiller -> matchesArgument ( arg ) ) { PropPath path ( pathToHere ) ; path . push_back ( PropPathLink ( prop , L" " , true ) ) ; result . push_back ( path ) ; return ; } } Proposition const * argProp = NULL ; if ( arg -> getType ( ) == Argument :: PROPOSITION_ARG ) { argProp = arg -> getProposition ( ) ; } else if ( arg -> getType ( ) == Argument :: MENTION_ARG ) { argProp = sentTheory -> getPropositionSet ( ) -> getDefinition ( arg -> getMentionIndex ( ) ) ; } if ( argProp && ( argProp != prop ) ) { findPropPaths ( sentTheory , argProp , slotFiller , pathToHere , result ) ; } }
Helper function for findPropPaths: Return a list of all paths that connect a
 proposition to a given slot filler, via a specified argument.
Helper function for findPropPaths : Return a list of all paths that connect a proposition to a given slot filler via a specified argument .
// Check if the argument is the slot-filler we're looking for.  If so, then
 // return a single empty path -- the caller will add the prop/arg pair to it.
 // Return immediately (don't look inside the arg), because we don't care 
 // about slot fillers that occur inside themselves.
 // Otherwise, check if the argument contains a proposition.  This can happen
 // either (1) if the arg is a proposition itself; or (2) if the arg is a 
 // mention that corresponds to a proposition.
 // If the argument does contain a proposition (and it's not a self-loop), 
 // then recurse to find any paths through that argument's arguments.
