liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
transducer.h
Go to the documentation of this file.
1#ifndef LIBLEVENSHTEIN_TRANSDUCER_TRANSDUCER_H
2#define LIBLEVENSHTEIN_TRANSDUCER_TRANSDUCER_H
3
4#include <cstddef>
5#include <string>
6#include <utility>
7
12
13namespace liblevenshtein {
14
17using Candidate = std::pair<std::string, std::size_t>;
18
25template <Algorithm Type, class Result>
27public:
28
35 Transducer(DawgNode *root);
36
41
54 auto operator()(const std::string &term, std::size_t max_distance = 2)
56
57private:
58
62};
63
64} // namespace liblevenshtein
65
66#endif // LIBLEVENSHTEIN_TRANSDUCER_TRANSDUCER_H
Represents a position within one or more terms of a DAWG dictionary.
Definition dawg_node.h:20
Represents an Intersection between a dictionary automaton and Levenshtein automaton,...
Lazily traverses the intersection between the dictionary automaton and Levenshtein automaton,...
Definition lazy_query.h:180
Constructs a Levenshtein Transducer that, when given a dictionary automaton, query term,...
Definition transducer.h:26
~Transducer()
Frees any owned allocations.
auto operator()(const std::string &term, std::size_t max_distance=2) -> LazyIterator< Result >
Transduces the query term and max_distance into the set of all spelling candidates from the dictionar...
Intersection * _intersection
Initial intersection between the Levenshtein automaton and dictionary automaton.
Definition transducer.h:61
Transducer(DawgNode *root)
Constructs a Levenshtein Transducer around the root DawgNode of a Dawg dictionary.
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
std::pair< std::string, std::size_t > Candidate
Spelling candidate that includes both the dictionary term and its edit distance from the query term.
Definition transducer.h:17