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
7
#include "
liblevenshtein/collection/dawg_node.h
"
8
#include "
liblevenshtein/collection/prefix.h
"
9
10
namespace
liblevenshtein
{
11
15
class
DawgIterator
{
16
public
:
17
25
DawgIterator
(
DawgNode
* root);
26
35
DawgIterator
(std::size_t term_index);
36
40
~DawgIterator
();
41
47
auto
operator++
() ->
DawgIterator
&;
48
54
auto
operator*
()
const
-> std::string;
55
66
auto
operator==
(
const
DawgIterator
&
other
)
const
->
bool
;
67
68
private
:
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
liblevenshtein::DawgIterator
Iterates over all the terms in a DAWG dictionary.
Definition
dawg_iterator.h:15
liblevenshtein::DawgIterator::operator++
auto operator++() -> DawgIterator &
Advances the iterator by one term.
Definition
dawg_iterator.cpp:23
liblevenshtein::DawgIterator::_prefixes
std::vector< Prefix * > _prefixes
Used to construct dictionary terms by collecting consecutive edge labels from the root node to their ...
Definition
dawg_iterator.h:72
liblevenshtein::DawgIterator::advance
void advance()
Advances this iterator by one term.
Definition
dawg_iterator.cpp:37
liblevenshtein::DawgIterator::~DawgIterator
~DawgIterator()
Cleans up all the prefixes allocated by this iterator.
Definition
dawg_iterator.cpp:17
liblevenshtein::DawgIterator::_pending
std::queue< Prefix * > _pending
Intermediate prefixes that have not reached all their final nodes yet.
Definition
dawg_iterator.h:75
liblevenshtein::DawgIterator::_next_value
std::string _next_value
Value of this iterator, i.e.
Definition
dawg_iterator.h:78
liblevenshtein::DawgIterator::_term_index
std::size_t _term_index
Current index of the enumerated terms in the dictinary.
Definition
dawg_iterator.h:81
liblevenshtein::DawgIterator::DawgIterator
DawgIterator(DawgNode *root)
Constructs an iterator over the terms in a dictionary.
Definition
dawg_iterator.cpp:6
liblevenshtein::DawgIterator::operator*
auto operator*() const -> std::string
Returns the current dictionary term.
Definition
dawg_iterator.cpp:29
liblevenshtein::DawgIterator::operator==
auto operator==(const DawgIterator &other) const -> bool
Compares this iterator with one representing the boundary following the final term in the dictionary.
Definition
dawg_iterator.cpp:33
liblevenshtein::DawgNode
Represents a position within one or more terms of a DAWG dictionary.
Definition
dawg_node.h:20
dawg_node.h
query
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition
main.cpp:25
liblevenshtein
Various utilities regarding Levenshtein transducers.
Definition
namespaces.dox:9
prefix.h
src
liblevenshtein
collection
dawg_iterator.h
Generated by
1.10.0