tesseract  3.03
/usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccstruct/ratngs.h File Reference
#include <assert.h>
#include "clst.h"
#include "elst.h"
#include "genericvector.h"
#include "matrix.h"
#include "unichar.h"
#include "unicharset.h"
#include "werd.h"

Go to the source code of this file.

Classes

class  BLOB_CHOICE
class  WERD_CHOICE

Namespaces

namespace  tesseract

Typedefs

typedef GenericVector
< BLOB_CHOICE_LIST * > 
BLOB_CHOICE_LIST_VECTOR

Enumerations

enum  BlobChoiceClassifier {
  BCC_STATIC_CLASSIFIER, BCC_ADAPTED_CLASSIFIER, BCC_SPECKLE_CLASSIFIER, BCC_AMBIG,
  BCC_FAKE
}
enum  PermuterType {
  NO_PERM, PUNC_PERM, TOP_CHOICE_PERM, LOWER_CASE_PERM,
  UPPER_CASE_PERM, NGRAM_PERM, NUMBER_PERM, USER_PATTERN_PERM,
  SYSTEM_DAWG_PERM, DOC_DAWG_PERM, USER_DAWG_PERM, FREQ_DAWG_PERM,
  COMPOUND_PERM, NUM_PERMUTER_TYPES
}
enum  tesseract::ScriptPos { tesseract::SP_NORMAL, tesseract::SP_SUBSCRIPT, tesseract::SP_SUPERSCRIPT, tesseract::SP_DROPCAP }

Functions

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)

Typedef Documentation

typedef GenericVector<BLOB_CHOICE_LIST *> BLOB_CHOICE_LIST_VECTOR

Definition at line 612 of file ratngs.h.


Enumeration Type Documentation

Enumerator:
BCC_STATIC_CLASSIFIER 
BCC_ADAPTED_CLASSIFIER 
BCC_SPECKLE_CLASSIFIER 
BCC_AMBIG 
BCC_FAKE 

Definition at line 39 of file ratngs.h.

                          {
  BCC_STATIC_CLASSIFIER,   // From the char_norm classifier.
  BCC_ADAPTED_CLASSIFIER,  // From the adaptive classifier.
  BCC_SPECKLE_CLASSIFIER,  // Backup for failed classification.
  BCC_AMBIG,               // Generated by ambiguity detection.
  BCC_FAKE,                // From some other process.
};
Enumerator:
NO_PERM 
PUNC_PERM 
TOP_CHOICE_PERM 
LOWER_CASE_PERM 
UPPER_CASE_PERM 
NGRAM_PERM 
NUMBER_PERM 
USER_PATTERN_PERM 
SYSTEM_DAWG_PERM 
DOC_DAWG_PERM 
USER_DAWG_PERM 
FREQ_DAWG_PERM 
COMPOUND_PERM 
NUM_PERMUTER_TYPES 

Definition at line 225 of file ratngs.h.


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);
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines