src/English/values/en_NumberConverter.cpp
/**
 * Hard-coded table of mappings from English number words to integers.
 * Probably want to implement a table plus language-generic version of this method.
 **/
Hard-coded table of mappings from English number words to integers.
Probably want to implement a table plus language-generic version of this method.
Hard - coded table of mappings from English number words to integers . Probably want to implement a table plus language - generic version of this method .
int EnglishNumberConverter::convertSpelledOutNumberWord(const std::wstring& str) {
	if (!str.compare(L"zero")) return 0;
	if (!str.compare(L"one")) return 1;
	if (!str.compare(L"two")) return 2;
	if (!str.compare(L"three")) return 3;
	if (!str.compare(L"four")) return 4;
	if (!str.compare(L"five")) return 5;
	if (!str.compare(L"six")) return 6;
	if (!str.compare(L"seven")) return 7;
	if (!str.compare(L"eight")) return 8;
	if (!str.compare(L"nine")) return 9;
	if (!str.compare(L"ten")) return 10;
	if (!str.compare(L"eleven")) return 11;
	if (!str.compare(L"twelve")) return 12;
	if (!str.compare(L"thirteen")) return 13;
	if (!str.compare(L"fourteen")) return 14;
	if (!str.compare(L"fifteen")) return 15;
	if (!str.compare(L"sixteen")) return 16;
	if (!str.compare(L"seventeen")) return 17;
	if (!str.compare(L"eighteen")) return 18;
	if (!str.compare(L"nineteen")) return 19;
	if (!str.compare(L"twenty")) return 20;
	if (!str.compare(L"thirty")) return 30;
	if (!str.compare(L"forty")) return 40;
	if (!str.compare(L"fifty")) return 50;
	if (!str.compare(L"sixty")) return 60;
	if (!str.compare(L"seventy")) return 70;
	if (!str.compare(L"eighty")) return 80;
	if (!str.compare(L"ninety")) return 90;
	if (!str.compare(L"hundred")) return 100;
	if (!str.compare(L"thousand")) return 1000;
	if (!str.compare(L"million")) return 1000000;
	if (!str.compare(L"billion")) return 1000000000;
	if (!str.compare(L"dozen")) return 12;
	return INT_MIN; 
}
int EnglishNumberConverter :: convertSpelledOutNumberWord ( const std :: wstring & str ) { if ( ! str . compare ( L" " ) ) return 0 ; if ( ! str . compare ( L" " ) ) return 1 ; if ( ! str . compare ( L" " ) ) return 2 ; if ( ! str . compare ( L" " ) ) return 3 ; if ( ! str . compare ( L" " ) ) return 4 ; if ( ! str . compare ( L" " ) ) return 5 ; if ( ! str . compare ( L" " ) ) return 6 ; if ( ! str . compare ( L" " ) ) return 7 ; if ( ! str . compare ( L" " ) ) return 8 ; if ( ! str . compare ( L" " ) ) return 9 ; if ( ! str . compare ( L" " ) ) return 10 ; if ( ! str . compare ( L" " ) ) return 11 ; if ( ! str . compare ( L" " ) ) return 12 ; if ( ! str . compare ( L" " ) ) return 13 ; if ( ! str . compare ( L" " ) ) return 14 ; if ( ! str . compare ( L" " ) ) return 15 ; if ( ! str . compare ( L" " ) ) return 16 ; if ( ! str . compare ( L" " ) ) return 17 ; if ( ! str . compare ( L" " ) ) return 18 ; if ( ! str . compare ( L" " ) ) return 19 ; if ( ! str . compare ( L" " ) ) return 20 ; if ( ! str . compare ( L" " ) ) return 30 ; if ( ! str . compare ( L" " ) ) return 40 ; if ( ! str . compare ( L" " ) ) return 50 ; if ( ! str . compare ( L" " ) ) return 60 ; if ( ! str . compare ( L" " ) ) return 70 ; if ( ! str . compare ( L" " ) ) return 80 ; if ( ! str . compare ( L" " ) ) return 90 ; if ( ! str . compare ( L" " ) ) return 100 ; if ( ! str . compare ( L" " ) ) return 1000 ; if ( ! str . compare ( L" " ) ) return 1000000 ; if ( ! str . compare ( L" " ) ) return 1000000000 ; if ( ! str . compare ( L" " ) ) return 12 ; return INT_MIN ; }
Hard-coded table of mappings from English number words to integers.
Hard - coded table of mappings from English number words to integers .
// signals invalid value
