|
tesseract
4.0.0-1-g2a2b
|
#include <dawg.h>
Public Member Functions | |
| SquishedDawg (DawgType type, const STRING &lang, PermuterType perm, int debug_level) | |
| SquishedDawg (const char *filename, DawgType type, const STRING &lang, PermuterType perm, int debug_level) | |
| SquishedDawg (EDGE_ARRAY edges, int num_edges, DawgType type, const STRING &lang, PermuterType perm, int unicharset_size, int debug_level) | |
| virtual | ~SquishedDawg () |
| bool | Load (TFile *fp) |
| int | NumEdges () |
| EDGE_REF | edge_char_of (NODE_REF node, UNICHAR_ID unichar_id, bool word_end) const |
| Returns the edge that corresponds to the letter out of this node. More... | |
| void | unichar_ids_of (NODE_REF node, NodeChildVector *vec, bool word_end) const |
| NODE_REF | next_node (EDGE_REF edge) const |
| bool | end_of_word (EDGE_REF edge_ref) const |
| UNICHAR_ID | edge_letter (EDGE_REF edge_ref) const |
| Returns UNICHAR_ID stored in the edge indicated by the given EDGE_REF. More... | |
| void | print_node (NODE_REF node, int max_num_edges) const |
| bool | write_squished_dawg (TFile *file) |
| Writes the squished/reduced Dawg to a file. More... | |
| bool | write_squished_dawg (const char *filename) |
Public Member Functions inherited from tesseract::Dawg | |
| DawgType | type () const |
| const STRING & | lang () const |
| PermuterType | permuter () const |
| virtual | ~Dawg () |
| bool | word_in_dawg (const WERD_CHOICE &word) const |
| Returns true if the given word is in the Dawg. More... | |
| bool | prefix_in_dawg (const WERD_CHOICE &prefix, bool requires_complete) const |
| int | check_for_words (const char *filename, const UNICHARSET &unicharset, bool enable_wildcard) const |
| void | iterate_words (const UNICHARSET &unicharset, TessCallback1< const WERD_CHOICE *> *cb) const |
| void | iterate_words (const UNICHARSET &unicharset, TessCallback1< const char *> *cb) const |
| virtual void | unichar_id_to_patterns (UNICHAR_ID unichar_id, const UNICHARSET &unicharset, GenericVector< UNICHAR_ID > *vec) const |
| virtual EDGE_REF | pattern_loop_edge (EDGE_REF edge_ref, UNICHAR_ID unichar_id, bool word_end) const |
Additional Inherited Members | |
Static Public Attributes inherited from tesseract::Dawg | |
| static const int16_t | kDawgMagicNumber = 42 |
| Magic number to determine endianness when reading the Dawg from file. More... | |
| static const UNICHAR_ID | kPatternUnicharID = 0 |
Protected Member Functions inherited from tesseract::Dawg | |
| Dawg (DawgType type, const STRING &lang, PermuterType perm, int debug_level) | |
| NODE_REF | next_node_from_edge_rec (const EDGE_RECORD &edge_rec) const |
| Returns the next node visited by following this edge. More... | |
| bool | marker_flag_from_edge_rec (const EDGE_RECORD &edge_rec) const |
| Returns the marker flag of this edge. More... | |
| int | direction_from_edge_rec (const EDGE_RECORD &edge_rec) const |
| Returns the direction flag of this edge. More... | |
| bool | end_of_word_from_edge_rec (const EDGE_RECORD &edge_rec) const |
| Returns true if this edge marks the end of a word. More... | |
| UNICHAR_ID | unichar_id_from_edge_rec (const EDGE_RECORD &edge_rec) const |
| Returns UNICHAR_ID recorded in this edge. More... | |
| void | set_next_node_in_edge_rec (EDGE_RECORD *edge_rec, EDGE_REF value) |
| Sets the next node link for this edge in the Dawg. More... | |
| void | set_marker_flag_in_edge_rec (EDGE_RECORD *edge_rec) |
| Sets this edge record to be the last one in a sequence of edges. More... | |
| int | given_greater_than_edge_rec (NODE_REF next_node, bool word_end, UNICHAR_ID unichar_id, const EDGE_RECORD &edge_rec) const |
| bool | edge_rec_match (NODE_REF next_node, bool word_end, UNICHAR_ID unichar_id, NODE_REF other_next_node, bool other_word_end, UNICHAR_ID other_unichar_id) const |
| void | init (int unicharset_size) |
| bool | match_words (WERD_CHOICE *word, int32_t index, NODE_REF node, UNICHAR_ID wildcard) const |
| void | iterate_words_rec (const WERD_CHOICE &word_so_far, NODE_REF to_explore, TessCallback1< const WERD_CHOICE *> *cb) const |
Protected Attributes inherited from tesseract::Dawg | |
| DawgType | type_ |
| STRING | lang_ |
| PermuterType | perm_ |
| Permuter code that should be used if the word is found in this Dawg. More... | |
| int | unicharset_size_ |
| int | flag_start_bit_ |
| int | next_node_start_bit_ |
| uint64_t | next_node_mask_ |
| uint64_t | flags_mask_ |
| uint64_t | letter_mask_ |
| int | debug_level_ |
Concrete class that can operate on a compacted (squished) Dawg (read, search and write to file). This class is read-only in the sense that new words can not be added to an instance of SquishedDawg. The underlying representation of the nodes and edges in SquishedDawg is stored as a contiguous EDGE_ARRAY (read from file or given as an argument to the constructor).
|
inline |
Definition at line 415 of file dawg.h.
|
inline |
Definition at line 418 of file dawg.h.
|
inline |
Definition at line 426 of file dawg.h.
|
virtual |
|
virtual |
Returns the edge that corresponds to the letter out of this node.
Implements tesseract::Dawg.
Definition at line 201 of file dawg.cpp.
|
inlinevirtual |
Returns UNICHAR_ID stored in the edge indicated by the given EDGE_REF.
Implements tesseract::Dawg.
Definition at line 478 of file dawg.h.
|
inlinevirtual |
Returns true if the edge indicated by the given EDGE_REF marks the end of a word.
Implements tesseract::Dawg.
Definition at line 473 of file dawg.h.
|
inline |
Returns the next node visited by following the edge indicated by the given EDGE_REF.
Implements tesseract::Dawg.
Definition at line 467 of file dawg.h.
|
inline |
|
virtual |
Prints the contents of the node indicated by the given NODE_REF. At most max_num_edges will be printed.
Implements tesseract::Dawg.
Definition at line 246 of file dawg.cpp.
|
inlinevirtual |
Fills the given NodeChildVector with all the unichar ids (and the corresponding EDGE_REFs) for which there is an edge out of this node.
Implements tesseract::Dawg.
Definition at line 453 of file dawg.h.
| bool tesseract::SquishedDawg::write_squished_dawg | ( | TFile * | file | ) |
Writes the squished/reduced Dawg to a file.
Definition at line 374 of file dawg.cpp.
|
inline |
Opens the file with the given filename and writes the squished/reduced Dawg to the file.
Definition at line 491 of file dawg.h.