src/Generic/common/TimexUtils.cpp
/**
 * Now implemented as a regular expression EnglishTemporalNormalizer::docid_date_re.
 * Returns the same session log error if no match (previously happened
 * for any document not matching GALE docid format).
 *
 * @author nward@bbn.com
 * @date 2010.05.10
 * @param docid Symbol containing document ID, probably obtained from Document::getName()
 * @return std::wstring containing an 8-digit date of the form YYYYMMDD
 **/
Now implemented as a regular expression EnglishTemporalNormalizer::docid_date_re.
Returns the same session log error if no match (previously happened
for any document not matching GALE docid format).


Now implemented as a regular expression EnglishTemporalNormalizer :: docid_date_re . Returns the same session log error if no match ( previously happened for any document not matching GALE docid format ) .
std::wstring TimexUtils::extractDateFromDocId(Symbol docid) {
	boost::wcmatch match;
	if (boost::regex_match(docid.to_string(), match, docid_date_re)) {
		if (match.str(L"learnit_genre") == L"" || match.str(L"learnit_genre") == L"gigaword") {
			return match.str(L"doc_date");
		}
	}
	return std::wstring(L"XXXX-XX-XX");
}
std :: wstring TimexUtils :: extractDateFromDocId ( Symbol docid ) { boost :: wcmatch match ; if ( boost :: regex_match ( docid . to_string ( ) , match , docid_date_re ) ) { if ( match . str ( L" " ) == L" " || match . str ( L" " ) == L" " ) { return match . str ( L" " ) ; } } return std :: wstring ( L" " ) ; }
Now implemented as a regular expression EnglishTemporalNormalizer::docid_date_re.
Now implemented as a regular expression EnglishTemporalNormalizer :: docid_date_re .
// Try to match using the regex
 // If a LearnIt cache prefix was present, only use document dates from gigaword
 // Extract just the 8-digit date
 // No match
