mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-05 02:47:00 +08:00
Correctly read cutoff classes.
This commit is contained in:
parent
71f578a198
commit
0364832ab8
@ -53,9 +53,14 @@ void Classify::ReadNewCutoffs(TFile* fp, uint16_t* Cutoffs) {
|
|||||||
char line[kMaxLineSize];
|
char line[kMaxLineSize];
|
||||||
while (fp->FGets(line, kMaxLineSize) != nullptr) {
|
while (fp->FGets(line, kMaxLineSize) != nullptr) {
|
||||||
std::string Class;
|
std::string Class;
|
||||||
|
auto p = line;
|
||||||
|
while (*p != ' ' && p - line < kMaxLineSize)
|
||||||
|
Class.push_back(*p++);
|
||||||
CLASS_ID ClassId;
|
CLASS_ID ClassId;
|
||||||
std::istringstream stream(line);
|
// do not use stream to extract Class as it may contain unicode spaces (0xA0)
|
||||||
stream >> Class >> Cutoff;
|
// they are eaten by stream, but they are a part of Class
|
||||||
|
std::istringstream stream(p);
|
||||||
|
stream >> Cutoff;
|
||||||
if (stream.fail()) {
|
if (stream.fail()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user