12 #if defined(DEVEL_LOTHAR)
14 #endif // DEVEL_LOTHAR
31 size_t tokenBegin = 0;
33 while (tokenEnd != description.size()) {
34 tokenEnd = description.find_first_of(
' ', tokenBegin);
35 if (tokenEnd == string::npos) tokenEnd = description.size();
36 int tokLength = tokenEnd - tokenBegin;
38 tokenLP->push_back(description.substr(tokenBegin, tokenEnd - tokenBegin));
40 tokenBegin = tokenEnd + 1;
55 tokenLP =
tokenize(descriptionString, tokenLP);
58 TokL::iterator it = tokenLP->begin();
59 while (it != tokenLP->end()) {
60 if (((*it).at(0) ==
'(') && *it !=
string(
"(corrig.)")) it = tokenLP->erase(it);
68 int sspPos[2] = { 0, 0 };
71 bool isRenamed =
false;
72 bool isHetero =
false;
80 for (TokL::iterator it = tokenLP->begin(); it != tokenLP->end(); ++it, ++ssp) {
84 std::cout <<
"genus detected" << std::endl;
90 if (*it ==
string(
"->")) {
97 std::cout <<
"renaming detected" << std::endl;
101 if (*it ==
string(
"=>")) {
108 std::cout <<
"heteronym detected" << std::endl;
112 if (*it ==
string(
"=")) {
119 std::cout <<
"homonym detected" << std::endl;
123 if (*it ==
string(
"(corrig.)")) {
126 std::cout <<
"correction" << std::endl;
130 if (*it ==
string(
"see:")) {
134 std::cout <<
"reference" << std::endl;
138 if (*it ==
string(
"subsp.")) {
140 std::cout <<
"subspecies detected at position: >>>" << ssp <<
"<<<" << std::endl;
142 ssp == 2 ? sspPos[0] = ssp : sspPos[1] = ssp;
145 std::cout <<
"position of subsp.: " << sspPos[0] <<
"\tand: " << sspPos[1] << std::endl;
160 std::cout <<
" GENUS description found " << std::endl;
163 descNames[0] = (*tokenLP)[0];
166 std::cout <<
"VALIDGEN type set to: " << actType << std::endl;
171 descNames[0] = (*tokenLP)[2];
172 descNames[3] = (*tokenLP)[0];
175 std::cout <<
"HETERONYMGEN type set to: " << actType << std::endl;
180 descNames[0] = (*tokenLP)[2];
181 descNames[3] = (*tokenLP)[0];
184 std::cout <<
"HOMONYMGEN type set to: " << actType << std::endl;
191 descNames[0] = (*tokenLP)[2];
192 descNames[3] = (*tokenLP)[0];
195 std::cout <<
"RENAMEDGEN type set to: " << actType << std::endl;
200 std::cout <<
"no meaningful combination of conditions reached" << std::endl
201 <<
"for line: " << descriptionString << std::endl;
202 std::cout <<
"description type is set to NOTYPE: " <<
NOTYPE << std::endl;
206 std::cout <<
"isValid set to false " << std::endl;
217 if (!(((sspPos[0] == 0) || (sspPos[0] == 2)) && (((sspPos[1] > 4)&&(sspPos[1]< 9))||(sspPos[1]==0)))) {
219 std::cout <<
"subsp. at strange position found in line:" << std::endl << descriptionString << endl;
220 std::cout <<
"description type is set to NOTYPE: " <<
NOTYPE << std::endl;
224 std::cout <<
"isValid set to false " << std::endl;
230 descNames[0] = (*tokenLP)[0];
231 descNames[1] = (*tokenLP)[1];
232 if (sspPos[0] != 0) { descNames[2] = (*tokenLP)[sspPos[0]+1]; }
237 descNames[0] = (*tokenLP)[3 + sspPos[0]];
238 descNames[1] = (*tokenLP)[4 + sspPos[0]];
239 if (sspPos[1]!=0) { descNames[2]=(*tokenLP)[6 + sspPos[0]]; }
241 descNames[3] = (*tokenLP)[0];
242 descNames[4] = (*tokenLP)[1];
243 if (sspPos[0]!=0) { descNames[5]=(*tokenLP)[sspPos[0]+1]; }
249 descNames[0] = (*tokenLP)[3 + sspPos[0]];
250 descNames[1] = (*tokenLP)[4 + sspPos[0]];
251 if (sspPos[1]!=0) { descNames[2]=(*tokenLP)[6 + sspPos[0]]; }
253 descNames[3] = (*tokenLP)[0];
254 descNames[4] = (*tokenLP)[1];
255 if (sspPos[0]!=0) { descNames[5]=(*tokenLP)[sspPos[0]+1]; }
262 descNames[0] = (*tokenLP)[3 + sspPos[0]];
263 descNames[1] = (*tokenLP)[4 + sspPos[0]];
264 if (sspPos[1]!=0) { descNames[2]=(*tokenLP)[6 + sspPos[0]]; }
266 descNames[3] = (*tokenLP)[0];
267 descNames[4] = (*tokenLP)[1];
268 if (sspPos[0]!=0) { descNames[5]=(*tokenLP)[sspPos[0]+1]; }
275 std::cout <<
"not a valid description line detected" << std::endl;
276 std::cout <<
"isValid: " << isValid << std::endl;
277 std::cout <<
"isRenamed: " << isRenamed << std::endl;
278 std::cout <<
"isHetero: " << isHetero << std::endl;
279 std::cout <<
"isHomo: " << isHomo << std::endl;
280 std::cout <<
"isGenus: " << isGenus << std::endl;
281 std::cout <<
"isSee: " << isSee << std::endl;
282 std::cout <<
"isCorr: " << isCorr << std::endl;
283 std::cout <<
"sspPos: " << sspPos[0] <<
" and " << sspPos[1] << std::endl;
284 std::cout << descriptionString << std::endl;
296 std::cout << descriptionString << std::endl;
297 std::cout <<
"classified as " << actType << std::endl;
300 Desco actDesc(actType, isCorr, descNames[0], descNames[1], descNames[2], descNames[3], descNames[4], descNames[5]);
306 string Desco::getFirstName() {
307 string tmp = firstgen;
308 if (!firstspec.empty()) {
309 tmp = tmp +
" " + firstspec;
310 if (!firstsub.empty()) {
311 tmp = tmp +
" " +
"subsp." +
" " + firstsub;
319 string Desco::getSecondName() {
320 string tmp = secondgen;
321 if (!secondspec.empty()) {
322 tmp = tmp +
" " + firstspec;
323 if (!secondsub.empty()) {
324 tmp = tmp +
" " +
"subsp." +
" " + secondsub;
332 for (
size_t i=0; i<input.length(); ++i) {
333 if (input[i]<
'A' || input[i]>
'Z')
return false;
return string(buffer, length)
Desco determineType(const string &descriptionString)
bool isUpperCase(const string &input)
TokLPtr tokenize(const std::string &description, TokLPtr tokenLP)
std::vector< std::string > TokL