src/English/names/en_NameRecognizer.cpp
// If PIdF finds "Smith, John" as two names, combine them into one

If PIdF finds "Smith, John" as two names, combine them into one
If PIdF finds " Smith John " as two names combine them into one
void EnglishNameRecognizer::fixReversedNames(PIdFSentence &sentence) {
	Symbol perSymbol = EntityType::getPERType().getName();
	wstring perStr = perSymbol.to_string();
	wstring perCOStr = perStr.append(L"-CO");
	Symbol perCO = Symbol(perCOStr);
	for (int i = 0; i < sentence.getLength() - 2; i++) {
		int tag = sentence.getTag(i);
		if (!_tagSet->isSTTag(tag)) 
			continue;
		Symbol reducedTag = _tagSet->getReducedTagSymbol(tag);
		if (reducedTag != perSymbol) 
			continue;
		int next_tag = sentence.getTag(i + 1);
		if (!_tagSet->isSTTag(next_tag) || !_tagSet->isNoneTag(next_tag))
			continue;
		Symbol nextWord = sentence.getWord(i + 1);
		if (nextWord != EnglishWordConstants::_COMMA_) 
			continue;
		int per_word_count = 0;
		for (int j = i + 2; j < sentence.getLength(); j++) {
			int tag2 = sentence.getTag(j);
			Symbol reducedTag2 = _tagSet->getReducedTagSymbol(tag2);
			if (reducedTag2 != perSymbol)
				break;
			if (j != i + 2 && _tagSet->isSTTag(tag2))
				break;
			per_word_count++;
		}
		if (per_word_count == 0) 
			continue;
		if (!inProbableList(sentence, i)) 
			for (int j = i + 1; j <= i + 1 + per_word_count; j++)
				sentence.setTag(j, _tagSet->getTagIndex(perCO));
	}
}
void EnglishNameRecognizer :: fixReversedNames ( PIdFSentence & sentence ) { Symbol perSymbol = EntityType :: getPERType ( ) . getName ( ) ; wstring perStr = perSymbol . to_string ( ) ; wstring perCOStr = perStr . append ( L" " ) ; Symbol perCO = Symbol ( perCOStr ) ; for ( int i = 0 ; i < sentence . getLength ( ) - 2 ; i ++ ) { int tag = sentence . getTag ( i ) ; if ( ! _tagSet -> isSTTag ( tag ) ) continue ; Symbol reducedTag = _tagSet -> getReducedTagSymbol ( tag ) ; if ( reducedTag != perSymbol ) continue ; int next_tag = sentence . getTag ( i + 1 ) ; if ( ! _tagSet -> isSTTag ( next_tag ) || ! _tagSet -> isNoneTag ( next_tag ) ) continue ; Symbol nextWord = sentence . getWord ( i + 1 ) ; if ( nextWord != EnglishWordConstants :: _COMMA_ ) continue ; int per_word_count = 0 ; for ( int j = i + 2 ; j < sentence . getLength ( ) ; j ++ ) { int tag2 = sentence . getTag ( j ) ; Symbol reducedTag2 = _tagSet -> getReducedTagSymbol ( tag2 ) ; if ( reducedTag2 != perSymbol ) break ; if ( j != i + 2 && _tagSet -> isSTTag ( tag2 ) ) break ; per_word_count ++ ; } if ( per_word_count == 0 ) continue ; if ( ! inProbableList ( sentence , i ) ) for ( int j = i + 1 ; j <= i + 1 + per_word_count ; j ++ ) sentence . setTag ( j , _tagSet -> getTagIndex ( perCO ) ) ; } }
If PIdF finds "Smith, John" as two names, combine them into one
If PIdF finds " Smith John " as two names combine them into one
// check for one word person name, followed by a comma
 // after the comma, count how many words make up a person name, 
 // starting at the word after the comma
