tesseract v5.3.3.20231005
tesseract::LanguageModelNgramInfo Struct Reference

#include <lm_state.h>

Public Member Functions

 LanguageModelNgramInfo (const char *c, int l, bool p, float nc, float ncc)
 

Public Attributes

std::string context
 
int context_unichar_step_len
 
bool pruned
 
float ngram_cost
 -ln(P_ngram_model(path)) More...
 
float ngram_and_classifier_cost
 -[ ln(P_classifier(path)) + scale_factor * ln(P_ngram_model(path)) ] More...
 

Detailed Description

Struct for storing additional information used by Ngram language model component.

Definition at line 68 of file lm_state.h.

Constructor & Destructor Documentation

◆ LanguageModelNgramInfo()

tesseract::LanguageModelNgramInfo::LanguageModelNgramInfo ( const char *  c,
int  l,
bool  p,
float  nc,
float  ncc 
)
inline

Definition at line 69 of file lm_state.h.

70 : context(c)
72 , pruned(p)
73 , ngram_cost(nc)
const char * p
float ngram_and_classifier_cost
-[ ln(P_classifier(path)) + scale_factor * ln(P_ngram_model(path)) ]
Definition: lm_state.h:87
float ngram_cost
-ln(P_ngram_model(path))
Definition: lm_state.h:85

Member Data Documentation

◆ context

std::string tesseract::LanguageModelNgramInfo::context

context string

Definition at line 75 of file lm_state.h.

◆ context_unichar_step_len

int tesseract::LanguageModelNgramInfo::context_unichar_step_len

Length of the context measured by advancing using UNICHAR::utf8_step() (should be at most the order of the character ngram model used).

Definition at line 78 of file lm_state.h.

◆ ngram_and_classifier_cost

float tesseract::LanguageModelNgramInfo::ngram_and_classifier_cost

-[ ln(P_classifier(path)) + scale_factor * ln(P_ngram_model(path)) ]

Definition at line 87 of file lm_state.h.

◆ ngram_cost

float tesseract::LanguageModelNgramInfo::ngram_cost

-ln(P_ngram_model(path))

Definition at line 85 of file lm_state.h.

◆ pruned

bool tesseract::LanguageModelNgramInfo::pruned

The paths with pruned set are pruned out from the perspective of the character ngram model. They are explored further because they represent a dictionary match or a top choice. Thus ngram_info is still computed for them in order to calculate the combined cost.

Definition at line 83 of file lm_state.h.


The documentation for this struct was generated from the following file: