src/Generic/SPropTrees/STreeNode.cpp
//go top-down and collect mentions associated with treenodes.

go top-down and collect mentions associated with treenodes.
go top - down and collect mentions associated with treenodes .
size_t STreeNode::getAllEntityMentions(RelevantMentions& rmns, 
									   bool unique, bool onlyHead, 
									   const std::wstring& etypeName, Mention::Type mtype) const{
	if ( ! _isGood ) return 0;
	const STreeNode* tn=this;
	try {
		EntityType etype=Symbol(etypeName.c_str());
		AltMentions::const_iterator amit;
		for ( amit = _content->_theMentions.begin(); amit != _content->_theMentions.end(); amit++ ) {
			if ( mtype != Mention::NONE && amit->first->getMentionType() != mtype ) continue;
			if ( ! amit->second || ( etype.isDetermined() && !(etype == amit->second->getType()) ) ) continue;
			if ( unique && rmns.find(amit->first) != rmns.end() ) continue;
			rmns.insert(std::make_pair<const Mention*,MentionInfo>(amit->first,MentionInfo(this,amit->second->getType())));
		}
		if ( ! onlyHead ) 
			for ( Roles::const_iterator rci=_parts.begin(); rci != _parts.end(); rci++ )
				rci->second->getAllEntityMentions(rmns, unique, onlyHead, etypeName, mtype);
	} catch ( UnexpectedInputException ) {
		std::wcerr << "unknown entity type specified";
	}
	return rmns.size();
}
size_t STreeNode :: getAllEntityMentions ( RelevantMentions & rmns , bool unique , bool onlyHead , const std :: wstring & etypeName , Mention :: Type mtype ) const { if ( ! _isGood ) return 0 ; const STreeNode * tn = this ; try { EntityType etype = Symbol ( etypeName . c_str ( ) ) ; AltMentions :: const_iterator amit ; for ( amit = _content -> _theMentions . begin ( ) ; amit != _content -> _theMentions . end ( ) ; amit ++ ) { if ( mtype != Mention :: NONE && amit -> first -> getMentionType ( ) != mtype ) continue ; if ( ! amit -> second || ( etype . isDetermined ( ) && ! ( etype == amit -> second -> getType ( ) ) ) ) continue ; if ( unique && rmns . find ( amit -> first ) != rmns . end ( ) ) continue ; rmns . insert ( std :: make_pair < const Mention * , MentionInfo > ( amit -> first , MentionInfo ( this , amit -> second -> getType ( ) ) ) ) ; } if ( ! onlyHead ) for ( Roles :: const_iterator rci = _parts . begin ( ) ; rci != _parts . end ( ) ; rci ++ ) rci -> second -> getAllEntityMentions ( rmns , unique , onlyHead , etypeName , mtype ) ; } catch ( UnexpectedInputException ) { std :: wcerr << " " ; } return rmns . size ( ) ; }
go top-down and collect mentions associated with treenodes.
go top - down and collect mentions associated with treenodes .