diff --git a/reading_machine/src/Config.cpp b/reading_machine/src/Config.cpp index 0429372f3d41cd61514f54f4fd75019a8a646099..6aec0fb3f84f72097e7fcd23dabee390d5a7fecd 100644 --- a/reading_machine/src/Config.cpp +++ b/reading_machine/src/Config.cpp @@ -149,13 +149,13 @@ void Config::printForDebug(FILE * dest) const toPrint.back().emplace_back(line == (int)wordIndex ? "=>" : ""); for (unsigned int i = 0; i < getNbColumns(); i++) { - auto & colContent = getAsFeature(i, line); + std::string colContent = has(i,line,0) ? getAsFeature(i, line).get() : "?"; std::string toPrintCol = colContent; try { if (getColName(i) == headColName && toPrintCol != "_" && !toPrintCol.empty()) - if (toPrintCol != "0") - toPrintCol = getAsFeature(idColName, std::stoi(toPrintCol)); + if (toPrintCol != "0" && toPrintCol != "?") + toPrintCol = has(0,std::stoi(toPrintCol),0) ? getAsFeature(idColName, std::stoi(toPrintCol)).get() : "?"; } catch(std::exception & e) {util::myThrow(fmt::format("toPrintCol='{}' {}", toPrintCol, e.what()));} toPrint.back().emplace_back(util::shrink(toPrintCol, maxWordLength)); } @@ -219,7 +219,7 @@ void Config::printForDebug(FILE * dest) const Config::String & Config::getLastNotEmpty(int colIndex, int lineIndex) { if (!has(colIndex, lineIndex, 0)) - util::myThrow(fmt::format("asked for line {} but nbLines = {}", lineIndex, getNbLines())); + util::myThrow(fmt::format("asked for line {} but last line = {}", lineIndex, getNbLines()+getFirstLineIndex()-1)); int baseIndex = getIndexOfLine(lineIndex-getFirstLineIndex()) + getIndexOfCol(colIndex); for (int i = nbHypothesesMax; i > 0; --i)