tesseract  3.03
/usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccstruct/ratngs.cpp File Reference
#include "ratngs.h"
#include "blobs.h"
#include "callcpp.h"
#include "genericvector.h"
#include "matrix.h"
#include "normalis.h"
#include "unicharset.h"

Go to the source code of this file.

Namespaces

namespace  tesseract

Functions

 ELISTIZE (BLOB_CHOICE)
 ELISTIZE (WERD_CHOICE)
BLOB_CHOICEFindMatchingChoice (UNICHAR_ID char_id, BLOB_CHOICE_LIST *bc_list)
const char * tesseract::ScriptPosToString (enum ScriptPos script_pos)
bool EqualIgnoringCaseAndTerminalPunct (const WERD_CHOICE &word1, const WERD_CHOICE &word2)
void print_ratings_list (const char *msg, BLOB_CHOICE_LIST *ratings, const UNICHARSET &current_unicharset)

Variables

const int kMinSubscriptOffset = 20
const int kMinSuperscriptOffset = 20
const int kMaxDropCapBottom = -128
const double kMaxOverlapDenominator = 0.125
const double kMinXHeightMatch = 0.5
const double kMaxBaselineDrift = 0.0625

Function Documentation

bool EqualIgnoringCaseAndTerminalPunct ( const WERD_CHOICE word1,
const WERD_CHOICE word2 
)

Definition at line 792 of file ratngs.cpp.

                                                                 {
  const UNICHARSET *uchset = word1.unicharset();
  if (word2.unicharset() != uchset) return false;
  int w1start, w1end;
  word1.punct_stripped(&w1start, &w1end);
  int w2start, w2end;
  word2.punct_stripped(&w2start, &w2end);
  if (w1end - w1start != w2end - w2start) return false;
  for (int i = 0; i < w1end - w1start; i++) {
    if (uchset->to_lower(word1.unichar_id(w1start + i)) !=
        uchset->to_lower(word2.unichar_id(w2start + i))) {
        return false;
    }
  }
  return true;
}
BLOB_CHOICE* FindMatchingChoice ( UNICHAR_ID  char_id,
BLOB_CHOICE_LIST *  bc_list 
)

Definition at line 161 of file ratngs.cpp.

                                                           {
  // Find the corresponding best BLOB_CHOICE.
  BLOB_CHOICE_IT choice_it(bc_list);
  for (choice_it.mark_cycle_pt(); !choice_it.cycled_list();
       choice_it.forward()) {
    BLOB_CHOICE* choice = choice_it.data();
    if (choice->unichar_id() == char_id) {
      return choice;
    }
  }
  return NULL;
}
void print_ratings_list ( const char *  msg,
BLOB_CHOICE_LIST *  ratings,
const UNICHARSET current_unicharset 
)

print_ratings_list

Send all the ratings out to the logfile.

Parameters:
msgintro message
ratingslist of ratings
current_unicharsetunicharset that can be used for id-to-unichar conversion

Definition at line 820 of file ratngs.cpp.

                                                              {
  if (ratings->length() == 0) {
    tprintf("%s:<none>\n", msg);
    return;
  }
  if (*msg != '\0') {
    tprintf("%s\n", msg);
  }
  BLOB_CHOICE_IT c_it;
  c_it.set_to_list(ratings);
  for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward()) {
    c_it.data()->print(&current_unicharset);
    if (!c_it.at_last()) tprintf("\n");
  }
  tprintf("\n");
  fflush(stdout);
}

Variable Documentation

const double kMaxBaselineDrift = 0.0625

Definition at line 53 of file ratngs.cpp.

const int kMaxDropCapBottom = -128

Definition at line 45 of file ratngs.cpp.

const double kMaxOverlapDenominator = 0.125

Definition at line 47 of file ratngs.cpp.

const int kMinSubscriptOffset = 20

Definition at line 41 of file ratngs.cpp.

const int kMinSuperscriptOffset = 20

Definition at line 43 of file ratngs.cpp.

const double kMinXHeightMatch = 0.5

Definition at line 50 of file ratngs.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines