src/KbaStreamCorpus/KbaStreamCorpusItemWriter.cpp
// Add each mention's information to the tokens that make it up.
Add each mention's information to the tokens that make it up.
Add each mention ' s information to the tokens that make it up .
BOOST_FOREACH(const Mention* mention, mentionList) {
			const SynNode *head = mention->getHead();
			bool unexpected_overlap = false;
			for (int tokno=head->getStartToken(); tokno<=head->getEndToken(); ++tokno) {
				streamcorpus::Token* scToken = _tokenMap[tokSeq->getToken(tokno)];
				if (scToken->mention_id != -1) {
					unexpected_overlap = true;
					BOOST_FOREACH(const Mention* m2, mentionList) {
						std::map<const MentionUID, int>::iterator it = _mentionId.find(m2->getUID());
						if (it != _mentionId.end() && it->second == scToken->mention_id) {
							logMentionOverlap(mention, m2, mention, tokno, sent_no, true);
						}
					}
				}
			}
			if (unexpected_overlap) {
				++_num_mentions_discarded_from_overlap;
				continue;
			}
			++_num_mentions;
			int sc_mention_id = static_cast<int>(_mentionId.size());
			_mentionId[mention->getUID()] = sc_mention_id;
			_mentionSent[mention->getUID()] = sent_no;
			for (int tokno=head->getStartToken(); tokno<=head->getEndToken(); ++tokno) {
				streamcorpus::Token* scToken = _tokenMap[tokSeq->getToken(tokno)];
				scToken->__set_mention_id(sc_mention_id);
				EntityType etype = mention->getEntityType();
				if (etype.isDetermined())
					scToken->__set_entity_type(serifToScEntityType(etype.getName()));
				scToken->__set_mention_type(serifToScMentionType(mention->mentionType));
			}
		}
BOOST_FOREACH ( const Mention * mention , mentionList ) { const SynNode * head = mention -> getHead ( ) ; bool unexpected_overlap = false ; for ( int tokno = head -> getStartToken ( ) ; tokno <= head -> getEndToken ( ) ; ++ tokno ) { streamcorpus :: Token * scToken = _tokenMap [ tokSeq -> getToken ( tokno ) ] ; if ( scToken -> mention_id != -1 ) { unexpected_overlap = true ; BOOST_FOREACH ( const Mention * m2 , mentionList ) { std :: map < const MentionUID , int > :: iterator it = _mentionId . find ( m2 -> getUID ( ) ) ; if ( it != _mentionId . end ( ) && it -> second == scToken -> mention_id ) { logMentionOverlap ( mention , m2 , mention , tokno , sent_no , true ) ; } } } } if ( unexpected_overlap ) { ++ _num_mentions_discarded_from_overlap ; continue ; } ++ _num_mentions ; int sc_mention_id = static_cast < int > ( _mentionId . size ( ) ) ; _mentionId [ mention -> getUID ( ) ] = sc_mention_id ; _mentionSent [ mention -> getUID ( ) ] = sent_no ; for ( int tokno = head -> getStartToken ( ) ; tokno <= head -> getEndToken ( ) ; ++ tokno ) { streamcorpus :: Token * scToken = _tokenMap [ tokSeq -> getToken ( tokno ) ] ; scToken -> __set_mention_id ( sc_mention_id ) ; EntityType etype = mention -> getEntityType ( ) ; if ( etype . isDetermined ( ) ) scToken -> __set_entity_type ( serifToScEntityType ( etype . getName ( ) ) ) ; scToken -> __set_mention_type ( serifToScMentionType ( mention -> mentionType ) ) ; } }
Add each mention's information to the tokens that make it up.
Add each mention ' s information to the tokens that make it up .
// Do a sanity check: this new mention should not overlap // with anything we've already tagged, but if it does, // then issue a warning and move on. // This is intended to never happen -- in particular, // the method fixMentionOverlaps() is supposed to // remove all mentions that overlap.  But it appears // that it's not doing its job entirely, so some get // through.  If they do, then just throw them away. // Tag this mention.