src/Generic/sentences/StatSentenceBreaker.cpp
/**
 * Sets the current document pointer to point to the
 * document passed in and resets the current sentence
 * number to 0.
 */
Sets the current document pointer to point to the
document passed in and resets the current sentence
number to 0.
Sets the current document pointer to point to the document passed in and resets the current sentence number to 0 .
void StatSentenceBreaker::resetForNewDocument(const Document *doc) {
	_curDoc = doc;
	_curRegion = 0;
	_cur_sent_no = 0;
	_model = _defaultModel;
	bool is_all_upper = true;
	bool is_all_lower = true;
	const Region* const* sents = _curDoc->getRegions();
	for (int j = 0; j < _curDoc->getNRegions(); j++) {
		_curRegion = sents[j];
		const LocatedString *sent = _curRegion->getString();
		for (int k = 0; k < sent->length(); k++) {
			if (iswupper(sent->charAt(k))) {
				is_all_lower = false;
				if (!is_all_upper)
					break;
			} else if (iswlower(sent->charAt(k))) {
				is_all_upper = false;
				if (!is_all_lower)
					break;
			}
		}
	}
	if (is_all_lower && _lowerCaseModel != 0) {
		SessionLogger::dbg("low_brkr_0") << "Using lowercase sentence breaker model\n";
		_model = _lowerCaseModel;
	}
	else if (is_all_upper && _upperCaseModel != 0) {
		SessionLogger::dbg("upp_brkr_0") << "Using uppercase sentence breaker model\n";
		_model = _upperCaseModel;
	}
}
void StatSentenceBreaker :: resetForNewDocument ( const Document * doc ) { _curDoc = doc ; _curRegion = 0 ; _cur_sent_no = 0 ; _model = _defaultModel ; bool is_all_upper = true ; bool is_all_lower = true ; const Region * const * sents = _curDoc -> getRegions ( ) ; for ( int j = 0 ; j < _curDoc -> getNRegions ( ) ; j ++ ) { _curRegion = sents [ j ] ; const LocatedString * sent = _curRegion -> getString ( ) ; for ( int k = 0 ; k < sent -> length ( ) ; k ++ ) { if ( iswupper ( sent -> charAt ( k ) ) ) { is_all_lower = false ; if ( ! is_all_upper ) break ; } else if ( iswlower ( sent -> charAt ( k ) ) ) { is_all_upper = false ; if ( ! is_all_lower ) break ; } } } if ( is_all_lower && _lowerCaseModel != 0 ) { SessionLogger :: dbg ( " " ) << " \n " ; _model = _lowerCaseModel ; } else if ( is_all_upper && _upperCaseModel != 0 ) { SessionLogger :: dbg ( " " ) << " \n " ; _model = _upperCaseModel ; } }
Sets the current document pointer to point to the
 document passed in and resets the current sentence
 number to 0.
Sets the current document pointer to point to the document passed in and resets the current sentence number to 0 .