liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
liblevenshtein::LazyIterator< Result > Class Template Reference

Lazily traverses the intersection between the dictionary automaton and Levenshtein automaton, guided by the query term, and yields each spelling candidate as it is matched. More...

#include <lazy_query.h>

Collaboration diagram for liblevenshtein::LazyIterator< Result >:

Public Member Functions

 LazyIterator (const std::string &term, std::size_t max_distance, Intersection *intersection, TransitionFn transition, DistanceFn min_distance)
 Constructs a new LazyIterator which yields spelling candidates as they are matched while traversing the intersection between the dictionary automaton and Levenshtein automaton, guided by the query term.
 
auto begin () -> LazyQuery< Result >
 Returns an instance of LazyQuery that yields spelling candidates of the given Type.
 
auto end () -> LazyQuery< Result >
 Returns a placeholder representing the end of the spelling candidates.
 

Private Attributes

std::string _term
 Query term whose spelling candidates are to be matched.
 
std::size_t _max_distance
 Maximum edit distance to consider when matching spelling candidates.
 
Intersection_intersection
 Initial Intersection between the dictionary root node and initial Levenshtein State.
 
TransitionFn transition
 Maps one Levenshtein State to another given the state and a characteristic vector.
 
DistanceFn min_distance
 Infers the Levenshtein distance between the query term and a spelling candidate.
 

Detailed Description

template<class Result>
class liblevenshtein::LazyIterator< Result >

Lazily traverses the intersection between the dictionary automaton and Levenshtein automaton, guided by the query term, and yields each spelling candidate as it is matched.

Definition at line 180 of file lazy_query.h.

Constructor & Destructor Documentation

◆ LazyIterator()

template<class Result >
liblevenshtein::LazyIterator< Result >::LazyIterator ( const std::string & term,
std::size_t max_distance,
Intersection * intersection,
TransitionFn transition,
DistanceFn min_distance )

Constructs a new LazyIterator which yields spelling candidates as they are matched while traversing the intersection between the dictionary automaton and Levenshtein automaton, guided by the query term.

Parameters
termQuery term whose spelling candidates are to be matched.
max_distanceMaximum edit distance to consider when matching spelling candidates.
intersectionInitial Intersection between the root node of the dictionary and the initial Levenshtein State.
transitionFunction that maps one Levenshtein State to another with input from a characteristic vector.
min_distanceInfers the Levenshtein distance between the query term and a spelling candidate.

Definition at line 134 of file lazy_query.cpp.

139 : _term(term), _max_distance(max_distance),
141 min_distance(std::move(min_distance)) {}
TransitionFn transition
Maps one Levenshtein State to another given the state and a characteristic vector.
Definition lazy_query.h:231
std::size_t _max_distance
Maximum edit distance to consider when matching spelling candidates.
Definition lazy_query.h:223
Intersection * _intersection
Initial Intersection between the dictionary root node and initial Levenshtein State.
Definition lazy_query.h:227
std::string _term
Query term whose spelling candidates are to be matched.
Definition lazy_query.h:220
DistanceFn min_distance
Infers the Levenshtein distance between the query term and a spelling candidate.
Definition lazy_query.h:235
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition main.cpp:25

Member Function Documentation

◆ begin()

Returns an instance of LazyQuery that yields spelling candidates of the given Type.

Returns
An iterator over the spelling candidates for the query term.

Definition at line 144 of file lazy_query.cpp.

References query().

Here is the call graph for this function:

◆ end()

Returns a placeholder representing the end of the spelling candidates.

Returns
A boundary representing the end of the spelling candidates.

Definition at line 150 of file lazy_query.cpp.

150 {
151 return LazyQuery<Result>();
152}

References query().

Here is the call graph for this function:

Member Data Documentation

◆ _intersection

template<class Result >
Intersection* liblevenshtein::LazyIterator< Result >::_intersection
private

Initial Intersection between the dictionary root node and initial Levenshtein State.

Definition at line 227 of file lazy_query.h.

◆ _max_distance

template<class Result >
std::size_t liblevenshtein::LazyIterator< Result >::_max_distance
private

Maximum edit distance to consider when matching spelling candidates.

Definition at line 223 of file lazy_query.h.

◆ _term

template<class Result >
std::string liblevenshtein::LazyIterator< Result >::_term
private

Query term whose spelling candidates are to be matched.

Definition at line 220 of file lazy_query.h.

◆ min_distance

template<class Result >
DistanceFn liblevenshtein::LazyIterator< Result >::min_distance
private

Infers the Levenshtein distance between the query term and a spelling candidate.

Definition at line 235 of file lazy_query.h.

◆ transition

template<class Result >
TransitionFn liblevenshtein::LazyIterator< Result >::transition
private

Maps one Levenshtein State to another given the state and a characteristic vector.

Definition at line 231 of file lazy_query.h.


The documentation for this class was generated from the following files: