#include <dawg.h>
Public Member Functions | |
SquishedDawg (FILE *file, DawgType type, const STRING &lang, PermuterType perm) | |
SquishedDawg (const char *filename, DawgType type, const STRING &lang, PermuterType perm) | |
SquishedDawg (EDGE_ARRAY edges, int num_edges, DawgType type, const STRING &lang, PermuterType perm, int unicharset_size) | |
~SquishedDawg () | |
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. | |
void | unichar_ids_of (NODE_REF node, NodeChildVector *vec) 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. | |
void | print_node (NODE_REF node, int max_num_edges) const |
void | write_squished_dawg (const char *filename) |
Writes the squished/reduced Dawg to a file. |
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).
tesseract::SquishedDawg::SquishedDawg | ( | FILE * | file, | |
DawgType | type, | |||
const STRING & | lang, | |||
PermuterType | perm | |||
) | [inline] |
tesseract::SquishedDawg::SquishedDawg | ( | const char * | filename, | |
DawgType | type, | |||
const STRING & | lang, | |||
PermuterType | perm | |||
) | [inline] |
tesseract::SquishedDawg::SquishedDawg | ( | EDGE_ARRAY | edges, | |
int | num_edges, | |||
DawgType | type, | |||
const STRING & | lang, | |||
PermuterType | perm, | |||
int | unicharset_size | |||
) | [inline] |
tesseract::SquishedDawg::~SquishedDawg | ( | ) |
EDGE_REF tesseract::SquishedDawg::edge_char_of | ( | NODE_REF | node, | |
UNICHAR_ID | unichar_id, | |||
bool | word_end | |||
) | const [virtual] |
Returns the edge that corresponds to the letter out of this node.
Implements tesseract::Dawg.
UNICHAR_ID tesseract::SquishedDawg::edge_letter | ( | EDGE_REF | edge_ref | ) | const [inline, virtual] |
Returns UNICHAR_ID stored in the edge indicated by the given EDGE_REF.
Implements tesseract::Dawg.
Returns true if the edge indicated by the given EDGE_REF marks the end of a word.
Implements tesseract::Dawg.
Returns the next node visited by following the edge indicated by the given EDGE_REF.
Implements tesseract::Dawg.
void tesseract::SquishedDawg::print_node | ( | NODE_REF | node, | |
int | max_num_edges | |||
) | const [virtual] |
Prints the contents of the node indicated by the given NODE_REF. At most max_num_edges will be printed.
Implements tesseract::Dawg.
void tesseract::SquishedDawg::unichar_ids_of | ( | NODE_REF | node, | |
NodeChildVector * | vec | |||
) | const [inline, virtual] |
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.
void tesseract::SquishedDawg::write_squished_dawg | ( | const char * | filename | ) |
Writes the squished/reduced Dawg to a file.