Skip to content

Commit

Permalink
Cleanup from previous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
theraysmith committed Aug 12, 2014
1 parent 736d327 commit cd2653c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ char* TessBaseAPI::GetHOCRText(int page_number) {
hocr_str.add_str_int(" <div class='ocr_page' id='page_", page_id);
hocr_str += "' title='image \"";
if (input_file_) {
HOcrEscape(input_file_->string(), hocr_str);
hocr_str += HOcrEscape(input_file_->string());
} else {
hocr_str += "unknown";
}
Expand Down Expand Up @@ -1453,7 +1453,7 @@ char* TessBaseAPI::GetHOCRText(int page_number) {
hocr_str.add_str_int("; x_wconf ", res_it->Confidence(RIL_WORD));
if (font_info) {
hocr_str += "; x_font ";
HOcrEscape(font_name, hocr_str);
hocr_str += HOcrEscape(font_name);
hocr_str.add_str_int("; x_fsize ", pointsize);
}
hocr_str += "'";
Expand All @@ -1478,7 +1478,7 @@ char* TessBaseAPI::GetHOCRText(int page_number) {
const char *grapheme = res_it->GetUTF8Text(RIL_SYMBOL);
if (grapheme && grapheme[0] != 0) {
if (grapheme[1] == 0) {
HOcrEscape(grapheme, hocr_str);
hocr_str += HOcrEscape(grapheme);
} else {
hocr_str += grapheme;
}
Expand Down Expand Up @@ -2593,9 +2593,9 @@ CubeRecoContext *TessBaseAPI::GetCubeRecoContext() const {
return (tesseract_ == NULL) ? NULL : tesseract_->GetCubeRecoContext();
}


/** Escape a char string - remove <>&"' with HTML codes. */
void HOcrEscape(const char* text, STRING& ret) {
STRING HOcrEscape(const char* text) {
STRING ret;
const char *ptr;
for (ptr = text; *ptr; ptr++) {
switch (*ptr) {
Expand All @@ -2607,5 +2607,7 @@ void HOcrEscape(const char* text, STRING& ret) {
default: ret += *ptr;
}
}
return ret;
}

} // namespace tesseract.
6 changes: 3 additions & 3 deletions api/baseapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#ifndef TESSERACT_API_BASEAPI_H__
#define TESSERACT_API_BASEAPI_H__

#define TESSERACT_VERSION_STR "3.03.00"
#define TESSERACT_VERSION 0x030300
#define TESSERACT_VERSION_STR "3.04.00"
#define TESSERACT_VERSION 0x030400
#define MAKE_VERSION(major, minor, patch) (((major) << 16) | ((minor) << 8) | \
(patch))

Expand Down Expand Up @@ -877,7 +877,7 @@ class TESS_API TessBaseAPI {
}; // class TessBaseAPI.

/** Escape a char string - remove &<>"' with HTML codes. */
void HOcrEscape(const char* text, STRING& ret);
STRING HOcrEscape(const char* text);
} // namespace tesseract.

#endif // TESSERACT_API_BASEAPI_H__
4 changes: 2 additions & 2 deletions ccmain/osdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ void ScriptDetector::detect_blob(BLOB_CHOICE_LIST* scores) {
osr_->scripts_na[i][japanese_id_] += 1.0;
if (prev_id == hangul_id_)
osr_->scripts_na[i][korean_id_] += 1.0;
if (prev_id == han_id_)
if (prev_id == han_id_) {
osr_->scripts_na[i][korean_id_] += kHanRatioInKorean;
if (prev_id == han_id_)
osr_->scripts_na[i][japanese_id_] += kHanRatioInJapanese;
}
}
} // iterate over each orientation
}
Expand Down

0 comments on commit cd2653c

Please sign in to comment.