Go to the documentation of this file.
84 int unicharset_size,
int debug_level)
86 init(unicharset_size);
99 bool word_end)
const override {
103 &edge_ptr, &edge_index))
return NO_EDGE;
112 bool word_end)
const override {
114 nodes_[
static_cast<int>(node)]->forward_edges;
115 for (
int i = 0; i < forward_edges.
size(); ++i) {
128 if (edge_ref == NO_EDGE ||
num_edges_ == 0)
return NO_EDGE;
137 if (edge_ref == NO_EDGE ||
num_edges_ == 0)
return false;
143 if (edge_ref == NO_EDGE ||
num_edges_ == 0)
return INVALID_UNICHAR_ID;
243 bool word_end)
const override {
244 if (edge_ref == NO_EDGE)
return NO_EDGE;
286 int edge_index =
static_cast<int>(
288 int node_index =
static_cast<int>(
301 int direction,
bool word_end,
UNICHAR_ID unichar_id) {
322 return (node_ref != NO_EDGE &&
323 nodes_[
static_cast<int>(node_ref)]->forward_edges.
size() == 1);
329 tprintf(
"\n__________________________\n%s\n", msg);
331 tprintf(
"__________________________\n");
339 int direction,
bool word_end,
UNICHAR_ID unichar_id,
345 int direction,
bool word_end,
351 bool repeats,
bool word_end,
UNICHAR_ID unichar_id) {
353 word_end, unichar_id) &&
355 word_end, unichar_id));
static const char kAlphanumPatternUnicode[]
EDGE_VECTOR forward_edges
NODE_REF next_node(EDGE_REF edge_ref) const override
static const int kSaneNumConcreteChars
void link_edge(EDGE_RECORD *edge, NODE_REF nxt, bool repeats, int direction, bool word_end, UNICHAR_ID unichar_id)
void reduce_node_input(NODE_REF node, NODE_MARKER reduced_nodes)
bool initialized_patterns_
bool DeadEdge(const EDGE_RECORD &edge_rec) const
void init(int unicharset_size)
EDGE_REF pattern_loop_edge(EDGE_REF edge_ref, UNICHAR_ID unichar_id, bool word_end) const override
void print_edge_rec(const EDGE_RECORD &edge_rec) const
bool end_of_word_from_edge_rec(const EDGE_RECORD &edge_rec) const
Returns true if this edge marks the end of a word.
UNICHAR_ID unichar_id_from_edge_rec(const EDGE_RECORD &edge_rec) const
Returns UNICHAR_ID recorded in this edge.
UNICHAR_ID alpha_pattern_
bool eliminate_redundant_edges(NODE_REF node, const EDGE_RECORD &edge1, const EDGE_RECORD &edge2)
bool add_new_edge(NODE_REF node1, NODE_REF node2, bool repeats, bool word_end, UNICHAR_ID unichar_id)
uint64_t deref_node_index_mask_
NODE_REF next_node_from_edge_rec(const EDGE_RECORD &edge_rec) const
Returns the next node visited by following this edge.
UNICHAR_ID lower_pattern_
EDGE_REF edge_char_of(NODE_REF node_ref, UNICHAR_ID unichar_id, bool word_end) const override
bool read_word_list(const char *filename, GenericVector< STRING > *words)
void KillEdge(EDGE_RECORD *edge_rec) const
bool read_pattern_list(const char *filename, const UNICHARSET &unicharset)
EDGE_REF make_edge_ref(NODE_REF node_index, EDGE_INDEX edge_index) const
EDGE_RECORD * deref_edge_ref(EDGE_REF edge_ref) const
const STRING & lang() const
DLLSYM void tprintf(const char *format,...)
UNICHAR_ID upper_pattern_
void print_all(const char *msg, int max_num_edges)
Trie(DawgType type, const STRING &lang, PermuterType perm, int unicharset_size, int debug_level)
void print_node(NODE_REF node, int max_num_edges) const override
void add_word_ending(EDGE_RECORD *edge, NODE_REF the_next_node, bool repeats, UNICHAR_ID unichar_id)
void sort_edges(EDGE_VECTOR *edges)
GenericVector< EDGE_INDEX > root_back_freelist_
bool read_and_add_word_list(const char *filename, const UNICHARSET &unicharset, Trie::RTLReversePolicy reverse)
bool can_be_eliminated(const EDGE_RECORD &edge_rec)
SquishedDawg * trie_to_dawg()
uint64_t deref_direction_mask_
bool add_word_list(const GenericVector< STRING > &words, const UNICHARSET &unicharset, Trie::RTLReversePolicy reverse_policy)
void unichar_id_to_patterns(UNICHAR_ID unichar_id, const UNICHARSET &unicharset, GenericVector< UNICHAR_ID > *vec) const override
UNICHAR_ID alphanum_pattern_
static const char kAlphaPatternUnicode[]
EDGE_VECTOR backward_edges
UNICHAR_ID edge_letter(EDGE_REF edge_ref) const override
static const char * get_reverse_policy_name(RTLReversePolicy reverse_policy)
void unichar_ids_of(NODE_REF node, NodeChildVector *vec, bool word_end) const override
int direction_from_edge_rec(const EDGE_RECORD &edge_rec) const
Returns the direction flag of this edge.
static const char kPuncPatternUnicode[]
static const char kDigitPatternUnicode[]
void delete_data_pointers()
void remove_edge_linkage(NODE_REF node1, NODE_REF node2, int direction, bool word_end, UNICHAR_ID unichar_id)
bool add_word_to_dawg(const WERD_CHOICE &word, const GenericVector< bool > *repetitions)
bool add_edge_linkage(NODE_REF node1, NODE_REF node2, bool repeats, int direction, bool word_end, UNICHAR_ID unichar_id)
void initialize_patterns(UNICHARSET *unicharset)
bool reduce_lettered_edges(EDGE_INDEX edge_index, UNICHAR_ID unichar_id, NODE_REF node, EDGE_VECTOR *backward_edges, NODE_MARKER reduced_nodes)
UNICHAR_ID digit_pattern_
UNICHAR_ID character_class_to_pattern(char ch)
void remove_edge(NODE_REF node1, NODE_REF node2, bool word_end, UNICHAR_ID unichar_id)
static const char kLowerPatternUnicode[]
bool end_of_word(EDGE_REF edge_ref) const override
bool add_word_to_dawg(const WERD_CHOICE &word)
static const char kUpperPatternUnicode[]
bool marker_flag_from_edge_rec(const EDGE_RECORD &edge_rec) const
Returns the marker flag of this edge.