liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
liblevenshtein::Intersection Class Reference

Represents an Intersection between a dictionary automaton and Levenshtein automaton, guided by the query term. More...

#include <intersection.h>

Collaboration diagram for liblevenshtein::Intersection:

Public Member Functions

 Intersection (char label, DawgNode *node, State *state, Intersection *parent=nullptr)
 Constructs a new Intersection between a dictionary automaton and Levenshtein automaton, guided by the query term.
 
 ~Intersection ()
 Frees all owned members.
 
auto node () const -> DawgNode *
 Returns the dictionary DawgNode from the Intersection.
 
auto state () const -> State *
 Returns the Levenshtein State from the Intersection.
 
auto str () const -> std::string
 Concatenates all subsequent character labels from the Intersection nodes beginning at the root of the dictionary up to here.
 

Private Attributes

char _label
 Transition annotation from the outgoing edge to the given DawgNode.
 
DawgNode_node
 Placeholder in the dictionary automaton.
 
State_state
 Levenshtein transducer State.
 
Intersection_parent
 The preceding Intersection node along the current path.
 

Friends

auto operator<< (std::ostream &out, const Intersection &intersection) -> std::ostream &
 Specifies the ostream operator may access all the members.
 

Detailed Description

Represents an Intersection between a dictionary automaton and Levenshtein automaton, guided by the query term.

Definition at line 16 of file intersection.h.

Constructor & Destructor Documentation

◆ Intersection()

liblevenshtein::Intersection::Intersection ( char label,
DawgNode * node,
State * state,
Intersection * parent = nullptr )

Constructs a new Intersection between a dictionary automaton and Levenshtein automaton, guided by the query term.

Parameters
labelTransition annotation from the outgoing edge to the given DawgNode.
nodePlaceholder in the dictionary automaton.
stateLevenshtein transducer State.
parentThe preceding Intersection node along the current path.

Definition at line 7 of file intersection.cpp.

9 _label(label),
10 _node(node),
11 _state(state) {}
char _label
Transition annotation from the outgoing edge to the given DawgNode.
State * _state
Levenshtein transducer State.
Intersection * _parent
The preceding Intersection node along the current path.
DawgNode * _node
Placeholder in the dictionary automaton.
auto state() const -> State *
Returns the Levenshtein State from the Intersection.
auto node() const -> DawgNode *
Returns the dictionary DawgNode from the Intersection.
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition main.cpp:25

◆ ~Intersection()

liblevenshtein::Intersection::~Intersection ( )

Frees all owned members.

Definition at line 13 of file intersection.cpp.

13 {
14 delete _state;
15}

References _state.

Member Function Documentation

◆ node()

auto liblevenshtein::Intersection::node ( ) const -> DawgNode *

Returns the dictionary DawgNode from the Intersection.

Returns
Dictionary node from the Intersection.

Definition at line 17 of file intersection.cpp.

17 {
18 return _node;
19}

References _node.

◆ state()

auto liblevenshtein::Intersection::state ( ) const -> State *

Returns the Levenshtein State from the Intersection.

Returns
The Levenshtein State from the Intersection.

Definition at line 21 of file intersection.cpp.

21 {
22 return _state;
23}

References _state.

◆ str()

auto liblevenshtein::Intersection::str ( ) const -> std::string

Concatenates all subsequent character labels from the Intersection nodes beginning at the root of the dictionary up to here.

Returns
Prefix of the current dictionary term that ends at this Intersection node.

Definition at line 25 of file intersection.cpp.

25 {
26 std::stringstream ss;
27 ss << *this;
28 return ss.str();
29}

References query().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

auto operator<< ( std::ostream & out,
const Intersection & intersection ) -> std::ostream &
friend

Specifies the ostream operator may access all the members.

Definition at line 31 of file intersection.cpp.

32 {
33 if (intersection._parent != nullptr) {
34 out << *(intersection._parent) << intersection._label;
35 }
36 return out;
37}

Member Data Documentation

◆ _label

char liblevenshtein::Intersection::_label
private

Transition annotation from the outgoing edge to the given DawgNode.

Definition at line 65 of file intersection.h.

◆ _node

DawgNode* liblevenshtein::Intersection::_node
private

Placeholder in the dictionary automaton.

Definition at line 68 of file intersection.h.

Referenced by node().

◆ _parent

Intersection* liblevenshtein::Intersection::_parent
private

The preceding Intersection node along the current path.

Definition at line 74 of file intersection.h.

◆ _state

State* liblevenshtein::Intersection::_state
private

Levenshtein transducer State.

Definition at line 71 of file intersection.h.

Referenced by state(), and ~Intersection().


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