src/LearnIt/LearnIt2Matcher.cpp
// it's assumed that we already know slotsFillerMap has a sufficient
// slots set

it's assumed that we already know slotsFillerMap has a sufficient
slots set
it ' s assumed that we already know slotsFillerMap has a sufficient slots set
MatchInfo::PatternMatch slotFillerMapToPatternMatch(
	const Target_ptr target, const SentenceTheory* sent_theory,
	const SlotFillerMap& slotFillerMap, double score, std::wstring source) 
{
	int earliest_token = std::numeric_limits<int>::max();
	int latest_token = -1;
	std::vector<SlotFiller_ptr> slotFillersVector;
	for (int i = 0; i < target->getNumSlots(); ++i) {
		SlotFillerMap::const_iterator it = slotFillerMap.find(i);
		if (it!=slotFillerMap.end()) {
			SlotFiller_ptr filler = it->second;
			slotFillersVector.push_back(filler);
			if (filler->getStartToken() < earliest_token) {
				earliest_token = filler->getStartToken();
			}
			if (filler->getEndToken() > latest_token) {
				latest_token = filler->getEndToken();
			}
		} else {
			slotFillersVector.push_back(boost::make_shared<SlotFiller>(
				SlotConstraints::UNFILLED_OPTIONAL));
		}
	}
	return MatchInfo::PatternMatch(slotFillersVector, earliest_token, 
									latest_token, score, source);
}
MatchInfo :: PatternMatch slotFillerMapToPatternMatch ( const Target_ptr target , const SentenceTheory * sent_theory , const SlotFillerMap & slotFillerMap , double score , std :: wstring source ) { int earliest_token = std :: numeric_limits < int > :: max ( ) ; int latest_token = -1 ; std :: vector < SlotFiller_ptr > slotFillersVector ; for ( int i = 0 ; i < target -> getNumSlots ( ) ; ++ i ) { SlotFillerMap :: const_iterator it = slotFillerMap . find ( i ) ; if ( it != slotFillerMap . end ( ) ) { SlotFiller_ptr filler = it -> second ; slotFillersVector . push_back ( filler ) ; if ( filler -> getStartToken ( ) < earliest_token ) { earliest_token = filler -> getStartToken ( ) ; } if ( filler -> getEndToken ( ) > latest_token ) { latest_token = filler -> getEndToken ( ) ; } } else { slotFillersVector . push_back ( boost :: make_shared < SlotFiller > ( SlotConstraints :: UNFILLED_OPTIONAL ) ) ; } } return MatchInfo :: PatternMatch ( slotFillersVector , earliest_token , latest_token , score , source ) ; }
it's assumed that we already know slotsFillerMap has a sufficient
slots set
it ' s assumed that we already know slotsFillerMap has a sufficient slots set