liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
dawg_iterator.h
Go to the documentation of this file.
1#ifndef LIBLEVENSHTEIN_COLLECTION_DAWG_ITERATOR_H
2#define LIBLEVENSHTEIN_COLLECTION_DAWG_ITERATOR_H
3
4#include <queue>
5#include <vector>
6
9
10namespace liblevenshtein {
11
16public:
17
26
35 DawgIterator(std::size_t term_index);
36
41
47 auto operator++() -> DawgIterator &;
48
54 auto operator*() const -> std::string;
55
66 auto operator==(const DawgIterator &other) const -> bool;
67
68private:
69
72 std::vector<Prefix *> _prefixes;
73
75 std::queue<Prefix *> _pending;
76
78 std::string _next_value;
79
81 std::size_t _term_index = 0;
82
86 void advance();
87};
88
89} // namespace DawgIterator
90
91
92#endif // LIBLEVENSHTEIN_COLLECTION_DAWG_ITERATOR_H
Iterates over all the terms in a DAWG dictionary.
auto operator++() -> DawgIterator &
Advances the iterator by one term.
std::vector< Prefix * > _prefixes
Used to construct dictionary terms by collecting consecutive edge labels from the root node to their ...
void advance()
Advances this iterator by one term.
~DawgIterator()
Cleans up all the prefixes allocated by this iterator.
std::queue< Prefix * > _pending
Intermediate prefixes that have not reached all their final nodes yet.
std::string _next_value
Value of this iterator, i.e.
std::size_t _term_index
Current index of the enumerated terms in the dictinary.
DawgIterator(DawgNode *root)
Constructs an iterator over the terms in a dictionary.
auto operator*() const -> std::string
Returns the current dictionary term.
auto operator==(const DawgIterator &other) const -> bool
Compares this iterator with one representing the boundary following the final term in the dictionary.
Represents a position within one or more terms of a DAWG dictionary.
Definition dawg_node.h:20
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition main.cpp:25
Various utilities regarding Levenshtein transducers.
Definition namespaces.dox:9