![]() |
Vcsn
2.1
Be Rational
|
Build a trie automaton (prefix-tree-like automaton). More...
#include <trie.hh>
Public Types | |
using | context_t = Context |
using | automaton_t = mutable_automaton< context_t > |
The type of the result. More... | |
using | work_automaton_t = conditional_t< Dir==direction::forward, automaton_t, transpose_automaton< automaton_t >> |
The type of the automaton we work on. More... | |
using | labelset_t = labelset_t_of< context_t > |
using | letter_t = letter_t_of< context_t > |
using | word_t = word_t_of< context_t > |
using | weight_t = weight_t_of< context_t > |
using | state_t = state_t_of< automaton_t > |
using | polynomialset_t = word_polynomialset_t< context_t > |
using | polynomial_t = typename polynomialset_t::value_t |
using | monomial_t = typename polynomialset_t::monomial_t |
Public Member Functions | |
trie_builder (const context_t &c) | |
void | add (const word_t &l, const weight_t &w) |
Add a monomial. More... | |
void | add (const monomial_t &m) |
Add a monomial. More... | |
void | add (const polynomial_t &p) |
Add a polynomial. More... | |
template<direction D = Dir> | |
auto | result () -> enable_if_t< D==direction::forward, automaton_t > |
Get the result for the forward trie. More... | |
template<direction D = Dir> | |
auto | result () -> enable_if_t< D==direction::backward, automaton_t > |
Get the result for a backward trie. More... | |
Private Member Functions | |
void | add_ (const word_t &lbl, const weight_t &wgt) |
Add a monomial. More... | |
state_t | next_ (state_t s, letter_t l) |
Follow a transition, possibly creating it. More... | |
Private Attributes | |
work_automaton_t | res_ |
The automaton being built. More... | |
const context_t & | ctx_ = res_->context() |
The context of the automaton: letterized. More... | |
letterized_t< labelset_t >::value_t | padding_ = letterized_t<labelset_t>::one() |
Padding, in case it is needed. More... | |
Build a trie automaton (prefix-tree-like automaton).
Context | the context of the mutable_automaton to build. |
Dir | if forward build a trie (single initial state) otherwise (backward ) build a reversed trie (single final state, but many initial states). |
using vcsn::detail::trie_builder< Context, Dir >::automaton_t = mutable_automaton<context_t> |
using vcsn::detail::trie_builder< Context, Dir >::context_t = Context |
using vcsn::detail::trie_builder< Context, Dir >::labelset_t = labelset_t_of<context_t> |
using vcsn::detail::trie_builder< Context, Dir >::letter_t = letter_t_of<context_t> |
using vcsn::detail::trie_builder< Context, Dir >::monomial_t = typename polynomialset_t::monomial_t |
using vcsn::detail::trie_builder< Context, Dir >::polynomial_t = typename polynomialset_t::value_t |
using vcsn::detail::trie_builder< Context, Dir >::polynomialset_t = word_polynomialset_t<context_t> |
using vcsn::detail::trie_builder< Context, Dir >::state_t = state_t_of<automaton_t> |
using vcsn::detail::trie_builder< Context, Dir >::weight_t = weight_t_of<context_t> |
using vcsn::detail::trie_builder< Context, Dir >::word_t = word_t_of<context_t> |
using vcsn::detail::trie_builder< Context, Dir >::work_automaton_t = conditional_t<Dir == direction::forward, automaton_t, transpose_automaton<automaton_t>> |
|
inline |
|
inline |
Add a monomial.
l | the word to add. |
w | its associated weight. |
Definition at line 57 of file trie.hh.
References vcsn::detail::trie_builder< Context, Dir >::add_().
Referenced by vcsn::detail::trie_builder< Context, Dir >::add().
|
inline |
Add a monomial.
Definition at line 63 of file trie.hh.
References vcsn::detail::trie_builder< Context, Dir >::add(), vcsn::label_of(), and vcsn::weight_of().
|
inline |
Add a polynomial.
Definition at line 69 of file trie.hh.
References vcsn::detail::trie_builder< Context, Dir >::add().
|
inlineprivate |
Add a monomial.
Take the direction into account (i.e., transpose the word if needed).
lbl | the word to add. |
wgt | its associated weight. |
Definition at line 97 of file trie.hh.
References vcsn::detail::trie_builder< Context, Dir >::ctx_, vcsn::forward, vcsn::detail::trie_builder< Context, Dir >::next_(), vcsn::detail::trie_builder< Context, Dir >::padding_, and vcsn::detail::trie_builder< Context, Dir >::res_.
Referenced by vcsn::detail::trie_builder< Context, Dir >::add().
|
inlineprivate |
Follow a transition, possibly creating it.
Definition at line 113 of file trie.hh.
References vcsn::detail::front(), and vcsn::detail::trie_builder< Context, Dir >::res_.
Referenced by vcsn::detail::trie_builder< Context, Dir >::add_().
|
inline |
Get the result for the forward trie.
Definition at line 77 of file trie.hh.
References vcsn::detail::trie_builder< Context, Dir >::res_.
|
inline |
Get the result for a backward trie.
Definition at line 85 of file trie.hh.
References vcsn::detail::trie_builder< Context, Dir >::res_, and vcsn::transpose().
|
private |
The context of the automaton: letterized.
Definition at line 130 of file trie.hh.
Referenced by vcsn::detail::trie_builder< Context, Dir >::add_().
|
private |
Padding, in case it is needed.
Definition at line 133 of file trie.hh.
Referenced by vcsn::detail::trie_builder< Context, Dir >::add_().
|
private |
The automaton being built.
Definition at line 128 of file trie.hh.
Referenced by vcsn::detail::trie_builder< Context, Dir >::add_(), vcsn::detail::trie_builder< Context, Dir >::next_(), and vcsn::detail::trie_builder< Context, Dir >::result().