liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
|
Represents a location within the Levenshtein automaton. More...
#include <position.h>
Public Member Functions | |
Position (std::size_t term_index, std::size_t num_errors, bool is_special=false) | |
Constructs a new Position within the Levenshtein automaton. | |
~Position () | |
Frees any owned allocations. | |
void | next (Position *next) |
Assigns the subsequent Position along the current path. | |
auto | next () const -> Position * |
Returns the Position that follows this one along the current path. | |
auto | term_index () const -> std::size_t |
Returns the current position in the dictionary term. | |
auto | num_errors () const -> std::size_t |
Returns the accumulated number of errors at the term_index . | |
auto | is_special () const -> bool |
Returns whether this is a special state of one of the extended algorithms. | |
Private Attributes | |
Position * | _next = nullptr |
The Position that follows this one along the current path. | |
std::size_t | _term_index |
The current position within the dictionary term. | |
std::size_t | _num_errors |
The accumulated number of errors between the spelling candidate and query term, at term_index of the spelling candidate. | |
bool | _is_special |
Whether this is a special state of one of the extended algorithms. | |
Represents a location within the Levenshtein automaton.
Definition at line 11 of file position.h.
liblevenshtein::Position::Position | ( | std::size_t | term_index, |
std::size_t | num_errors, | ||
bool | is_special = false ) |
Constructs a new Position within the Levenshtein automaton.
term_index | Current location within the dictionary term. |
num_errors | Accumulated number of errors at the term_index. |
is_special | Whether this is a special position representing an extended state. |
Definition at line 5 of file position.cpp.
liblevenshtein::Position::~Position | ( | ) |
Frees any owned allocations.
Definition at line 11 of file position.cpp.
References _next.
Returns whether this is a special state of one of the extended algorithms.
Definition at line 31 of file position.cpp.
References _is_special.
Assigns the subsequent Position along the current path.
next | The Position following this one. |
Definition at line 15 of file position.cpp.
Referenced by liblevenshtein::State::add(), liblevenshtein::StateIterator::advance(), liblevenshtein::State::find_middle(), liblevenshtein::State::head(), liblevenshtein::State::insert_after(), liblevenshtein::State::merge(), liblevenshtein::State::merge_sort(), liblevenshtein::StateIterator::remove(), and liblevenshtein::State::remove().
auto liblevenshtein::Position::num_errors | ( | ) | const -> std::size_t |
Returns the accumulated number of errors at the term_index
.
Definition at line 27 of file position.cpp.
References _num_errors.
Referenced by liblevenshtein::UnsubsumeFn::operator()().
auto liblevenshtein::Position::term_index | ( | ) | const -> std::size_t |
Returns the current position in the dictionary term.
Definition at line 23 of file position.cpp.
References _term_index.
Referenced by liblevenshtein::merge< Algorithm::MERGE_AND_SPLIT >(), liblevenshtein::merge< Algorithm::STANDARD >(), liblevenshtein::merge< Algorithm::TRANSPOSITION >(), liblevenshtein::position_transition< Algorithm::MERGE_AND_SPLIT >(), and liblevenshtein::position_transition< Algorithm::TRANSPOSITION >().
|
private |
Whether this is a special state of one of the extended algorithms.
Definition at line 78 of file position.h.
Referenced by is_special().
The Position that follows this one along the current path.
Definition at line 68 of file position.h.
Referenced by next(), next(), and ~Position().
|
private |
The accumulated number of errors between the spelling candidate and query term, at term_index of the spelling candidate.
Definition at line 75 of file position.h.
Referenced by num_errors().
|
private |
The current position within the dictionary term.
Definition at line 71 of file position.h.
Referenced by term_index().