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
8
#include "
liblevenshtein/collection/dawg_node.h
"
9
#include "
liblevenshtein/transducer/algorithm.h
"
10
#include "
liblevenshtein/transducer/intersection.h
"
11
#include "
liblevenshtein/transducer/lazy_query.h
"
12
13
namespace
liblevenshtein
{
14
17
using
Candidate
= std::pair<std::string, std::size_t>;
18
25
template
<Algorithm Type,
class
Result>
26
class
Transducer
{
27
public
:
28
35
Transducer
(
DawgNode
*root);
36
40
~Transducer
();
41
54
auto
operator()
(
const
std::string &
term
, std::size_t max_distance = 2)
55
->
LazyIterator<Result>
;
56
57
private
:
58
61
Intersection
*
_intersection
;
62
};
63
64
}
// namespace liblevenshtein
65
66
#endif
// LIBLEVENSHTEIN_TRANSDUCER_TRANSDUCER_H
algorithm.h
liblevenshtein::DawgNode
Represents a position within one or more terms of a DAWG dictionary.
Definition
dawg_node.h:20
liblevenshtein::Intersection
Represents an Intersection between a dictionary automaton and Levenshtein automaton,...
Definition
intersection.h:16
liblevenshtein::LazyIterator
Lazily traverses the intersection between the dictionary automaton and Levenshtein automaton,...
Definition
lazy_query.h:180
liblevenshtein::Transducer
Constructs a Levenshtein Transducer that, when given a dictionary automaton, query term,...
Definition
transducer.h:26
liblevenshtein::Transducer::~Transducer
~Transducer()
Frees any owned allocations.
Definition
transducer.cpp:21
liblevenshtein::Transducer::operator()
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...
Definition
transducer.cpp:26
liblevenshtein::Transducer::_intersection
Intersection * _intersection
Initial intersection between the Levenshtein automaton and dictionary automaton.
Definition
transducer.h:61
liblevenshtein::Transducer::Transducer
Transducer(DawgNode *root)
Constructs a Levenshtein Transducer around the root DawgNode of a Dawg dictionary.
Definition
transducer.cpp:14
dawg_node.h
intersection.h
lazy_query.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
liblevenshtein::Candidate
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
src
liblevenshtein
transducer
transducer.h
Generated by
1.10.0