liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
position.cpp
Go to the documentation of this file.
2
3namespace liblevenshtein {
4
5Position::Position(std::size_t term_index, std::size_t num_errors, bool is_special)
6 : _term_index(term_index),
7 _num_errors(num_errors),
8 _is_special(is_special)
9{}
10
12 delete _next;
13}
14
16 _next = next;
17}
18
20 return _next;
21}
22
23auto Position::term_index() const -> std::size_t {
24 return _term_index;
25}
26
27auto Position::num_errors() const -> std::size_t {
28 return _num_errors;
29}
30
32 return _is_special;
33}
34
35} // namespace liblevenshtein
Represents a location within the Levenshtein automaton.
Definition position.h:11
std::size_t _term_index
The current position within the dictionary term.
Definition position.h:71
~Position()
Frees any owned allocations.
Definition position.cpp:11
auto next() const -> Position *
Returns the Position that follows this one along the current path.
Definition position.cpp:19
auto term_index() const -> std::size_t
Returns the current position in the dictionary term.
Definition position.cpp:23
Position * _next
The Position that follows this one along the current path.
Definition position.h:68
auto is_special() const -> bool
Returns whether this is a special state of one of the extended algorithms.
Definition position.cpp:31
auto num_errors() const -> std::size_t
Returns the accumulated number of errors at the term_index.
Definition position.cpp:27
std::size_t _num_errors
The accumulated number of errors between the spelling candidate and query term, at term_index of the ...
Definition position.h:75
Position(std::size_t term_index, std::size_t num_errors, bool is_special=false)
Constructs a new Position within the Levenshtein automaton.
Definition position.cpp:5
bool _is_special
Whether this is a special state of one of the extended algorithms.
Definition position.h:78
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
STL namespace.