src/Generic/trainers/AnnotatedParseReader.cpp
// tries to read coref information, or returns CorefItem::NO_ID if there is no coref information

tries to read coref information, or returns CorefItem::NO_ID if there is no coref information
tries to read coref information or returns CorefItem :: NO_ID if there is no coref information
int AnnotatedParseReader::readOptionalID() {
	startRead();
	int result = CorefItem::NO_ID;
	UTF8Token token = getToken(LPAREN | WORD);
	if(token.symValue() == SymbolConstants::leftParen) {
		readFailed();
		return result;
	}
	const wchar_t *word = token.chars();
	const wchar_t *loc = wcsstr(word, L"ID=");
	if (loc != NULL) {	
		loc += 3;
		if (*loc == '"')
			loc++;
		wchar_t second[256];
		size_t count = wcslen(loc);
		wcsncpy(second, loc, count);
		if (count > 0 && second[count-1] == '"')
			second[count-1] = L'\0';
		else
			second[count] = L'\0';
		result = wcstol(second, NULL, 10);
		readSucceeded();
		return result;
	}
	else {
		readFailed();
		return result;
	}
}
int AnnotatedParseReader :: readOptionalID ( ) { startRead ( ) ; int result = CorefItem :: NO_ID ; UTF8Token token = getToken ( LPAREN | WORD ) ; if ( token . symValue ( ) == SymbolConstants :: leftParen ) { readFailed ( ) ; return result ; } const wchar_t * word = token . chars ( ) ; const wchar_t * loc = wcsstr ( word , L" " ) ; if ( loc != NULL ) { loc += 3 ; if ( * loc == ' ' ) loc ++ ; wchar_t second [ 256 ] ; size_t count = wcslen ( loc ) ; wcsncpy ( second , loc , count ) ; if ( count > 0 && second [ count - 1 ] == ' ' ) second [ count - 1 ] = L' \0 ' ; else second [ count ] = L' \0 ' ; result = wcstol ( second , NULL , 10 ) ; readSucceeded ( ) ; return result ; } else { readFailed ( ) ; return result ; } }
tries to read coref information, or returns CorefItem::NO_ID if there is no coref information
tries to read coref information or returns CorefItem :: NO_ID if there is no coref information
// = can be in a token, too
 // advance past the equals sign and open quote
 // copy just the digits into a new string
 // convert string to int
