src/Generic/names/IdFModel.cpp
/** 
 * Calculates the likelihood of generating all the words contained in the given
 * sentence set, according to the current probability tables. So: walks through 
 * all the sentences, accumulating the log probabilities associated with 
 * generating every word it sees. If the sum ever gets to be lower than the current 
 * best summed score (_best_word_smoothing_score), return immediately.
 *
 * @param sentences set of sentences over which to sum word log probabilities
 * @param sentence_count number of sentences in set
 */
Calculates the likelihood of generating all the words contained in the given
sentence set, according to the current probability tables. So: walks through
all the sentences, accumulating the log probabilities associated with
generating every word it sees. If the sum ever gets to be lower than the current
best summed score (_best_word_smoothing_score), return immediately.

@param sentences set of sentences over which to sum word log probabilities
@param sentence_count number of sentences in set
Calculates the likelihood of generating all the words contained in the given sentence set according to the current probability tables . So : walks through all the sentences accumulating the log probabilities associated with generating every word it sees . If the sum ever gets to be lower than the current best summed score ( _best_word_smoothing_score ) return immediately . @param sentences set of sentences over which to sum word log probabilities @param sentence_count number of sentences in set
double IdFModel::sumWordProbabilities(IdFSentence **sentences, int sentence_count) {
	double score = 0;
	for (int i = 0; i < sentence_count; i++) {
		score += getWordProbabilityFromScratch(sentences[i]->getWord(0),
			sentences[i]->getTag(0), _nameClassTags->getSentenceStartIndex(), 
			_nameClassTags->getSentenceStartTag());
		int length = sentences[i]->getLength();
		for (int j = 1; j < length; j++) {
			score += getWordProbabilityFromScratch(sentences[i]->getWord(j),
				sentences[i]->getTag(j),
				sentences[i]->getTag(j-1), 
				sentences[i]->getWord(j-1));
		}
		if (_best_word_smoothing_score > score)
			return score;
	}
	SessionLogger::info("SERIF") << "      " << _wordReducedTagWBMultiplier << ": ";
	SessionLogger::info("SERIF") << score << std::endl;
	return score;
}
double IdFModel :: sumWordProbabilities ( IdFSentence * * sentences , int sentence_count ) { double score = 0 ; for ( int i = 0 ; i < sentence_count ; i ++ ) { score += getWordProbabilityFromScratch ( sentences [ i ] -> getWord ( 0 ) , sentences [ i ] -> getTag ( 0 ) , _nameClassTags -> getSentenceStartIndex ( ) , _nameClassTags -> getSentenceStartTag ( ) ) ; int length = sentences [ i ] -> getLength ( ) ; for ( int j = 1 ; j < length ; j ++ ) { score += getWordProbabilityFromScratch ( sentences [ i ] -> getWord ( j ) , sentences [ i ] -> getTag ( j ) , sentences [ i ] -> getTag ( j - 1 ) , sentences [ i ] -> getWord ( j - 1 ) ) ; } if ( _best_word_smoothing_score > score ) return score ; } SessionLogger :: info ( " " ) << " " << _wordReducedTagWBMultiplier << " " ; SessionLogger :: info ( " " ) << score << std :: endl ; return score ; }
Calculates the likelihood of generating all the words contained in the given
 sentence set, according to the current probability tables.
Calculates the likelihood of generating all the words contained in the given sentence set according to the current probability tables .