Vcsn
2.1
Be Rational
|
Compute the derived-term automaton from an expression. More...
#include <derived-term.hh>
Public Types | |
using | expressionset_t = ExpSet |
using | expression_t = typename expressionset_t::value_t |
using | context_t = context_t_of< expressionset_t > |
using | weightset_t = weightset_t_of< context_t > |
using | automaton_t = expression_automaton< mutable_automaton< context_t >> |
using | state_t = state_t_of< automaton_t > |
Public Member Functions | |
derived_termer (const expressionset_t &rs, derived_term_algo algo) | |
automaton_t | operator() (const expression_t &expression) |
Compute the derived-term automaton. More... | |
automaton_t | via_derivation (const expression_t &expression) |
Compute the derived-term automaton via derivation. More... | |
automaton_t | via_expansion (const expression_t &expression) |
Compute the derived-term automaton via expansion. More... | |
Private Types | |
using | polynomialset_t = rat::expression_polynomialset_t< expressionset_t > |
The polynomialset for expressions. More... | |
Private Member Functions | |
void | init_ (const expression_t &expression) |
Private Attributes | |
expressionset_t | rs_ |
The expression's set. More... | |
weightset_t | ws_ = *rs_.weightset() |
Its weightset. More... | |
polynomialset_t | ps_ = make_expression_polynomialset(rs_) |
derived_term_algo | algo_ |
How derived terms are computed. More... | |
automaton_t | res_ |
The resulting automaton. More... | |
Compute the derived-term automaton from an expression.
Supports derivation/expansion as its core computation, with breaking/non breaking flavors for both.
The handling of initial and final states can be simplified by working on a delimited rational expression ($r$
with $
being the special label), and mapping $r$
to pre()
, and \e
to post()
. Then, there is no special treatment needed to handle the initial split in the case of a breaking derivation, and there is no special need to handle the final transitions.
However there are two problems.
One is that derivation loops over the alphabets, so we have to add $, the special label, to the alphabet. But then, the handling of complement starts making idiotic things by trying to add $-labels in inner transitions. This is a real problem, with no clear work-around.
But this is not an issue for expansion-based construction. However it means that the states are no longer labeled by the expressions as the user would expect them: there is always the terminating $. Not showing it does not address the issue, which is why we'd rather not have it at all.
So, after experimentation, as of 2014-10, I prefer not to use the pre/post based construct in either case.
Definition at line 102 of file derived-term.hh.
using vcsn::detail::derived_termer< ExpSet >::automaton_t = expression_automaton<mutable_automaton<context_t>> |
Definition at line 110 of file derived-term.hh.
using vcsn::detail::derived_termer< ExpSet >::context_t = context_t_of<expressionset_t> |
Definition at line 107 of file derived-term.hh.
using vcsn::detail::derived_termer< ExpSet >::expression_t = typename expressionset_t::value_t |
Definition at line 105 of file derived-term.hh.
using vcsn::detail::derived_termer< ExpSet >::expressionset_t = ExpSet |
Definition at line 104 of file derived-term.hh.
|
private |
The polynomialset for expressions.
Definition at line 208 of file derived-term.hh.
using vcsn::detail::derived_termer< ExpSet >::state_t = state_t_of<automaton_t> |
Definition at line 111 of file derived-term.hh.
using vcsn::detail::derived_termer< ExpSet >::weightset_t = weightset_t_of<context_t> |
Definition at line 108 of file derived-term.hh.
|
inline |
Definition at line 113 of file derived-term.hh.
References vcsn::detail::derived_termer< ExpSet >::rs_.
|
inlineprivate |
Definition at line 194 of file derived-term.hh.
References vcsn::detail::derived_termer< ExpSet >::algo_, vcsn::detail::derived_term_algo::breaking, vcsn::label_of(), vcsn::detail::derived_termer< ExpSet >::res_, vcsn::detail::derived_termer< ExpSet >::rs_, vcsn::split(), vcsn::weight_of(), and vcsn::detail::derived_termer< ExpSet >::ws_.
Referenced by vcsn::detail::derived_termer< ExpSet >::via_derivation(), and vcsn::detail::derived_termer< ExpSet >::via_expansion().
|
inline |
Compute the derived-term automaton.
Definition at line 120 of file derived-term.hh.
References vcsn::detail::derived_term_algo::algo, vcsn::detail::derived_termer< ExpSet >::algo_, vcsn::detail::derived_term_algo::derivation, vcsn::detail::derived_termer< ExpSet >::via_derivation(), and vcsn::detail::derived_termer< ExpSet >::via_expansion().
|
inline |
Compute the derived-term automaton via derivation.
Definition at line 129 of file derived-term.hh.
References vcsn::detail::derived_termer< ExpSet >::algo_, vcsn::detail::derived_term_algo::breaking, vcsn::constant_term(), vcsn::derivation(), vcsn::detail::derived_term_algo::determinize, vcsn::detail::derived_termer< ExpSet >::init_(), vcsn::label_of(), vcsn::detail::derived_termer< ExpSet >::ps_, vcsn::detail::derived_termer< ExpSet >::res_, vcsn::detail::derived_termer< ExpSet >::rs_, and vcsn::weight_of().
Referenced by vcsn::detail::derived_termer< ExpSet >::operator()().
|
inline |
Compute the derived-term automaton via expansion.
Definition at line 158 of file derived-term.hh.
References vcsn::detail::derived_termer< ExpSet >::algo_, vcsn::detail::derived_term_algo::breaking, vcsn::detail::derived_term_algo::determinize, vcsn::detail::derived_termer< ExpSet >::init_(), vcsn::label_of(), vcsn::detail::derived_termer< ExpSet >::ps_, vcsn::detail::derived_termer< ExpSet >::res_, vcsn::detail::derived_termer< ExpSet >::rs_, vcsn::split(), vcsn::to_expansion(), vcsn::weight_of(), and vcsn::detail::derived_termer< ExpSet >::ws_.
Referenced by vcsn::detail::derived_termer< ExpSet >::operator()().
|
private |
How derived terms are computed.
Definition at line 211 of file derived-term.hh.
Referenced by vcsn::detail::derived_termer< ExpSet >::init_(), vcsn::detail::derived_termer< ExpSet >::operator()(), vcsn::detail::derived_termer< ExpSet >::via_derivation(), and vcsn::detail::derived_termer< ExpSet >::via_expansion().
|
private |
Definition at line 209 of file derived-term.hh.
Referenced by vcsn::detail::derived_termer< ExpSet >::via_derivation(), and vcsn::detail::derived_termer< ExpSet >::via_expansion().
|
private |
The resulting automaton.
Definition at line 213 of file derived-term.hh.
Referenced by vcsn::detail::derived_termer< ExpSet >::init_(), vcsn::detail::derived_termer< ExpSet >::via_derivation(), and vcsn::detail::derived_termer< ExpSet >::via_expansion().
|
private |
The expression's set.
Definition at line 204 of file derived-term.hh.
Referenced by vcsn::detail::derived_termer< ExpSet >::derived_termer(), vcsn::detail::derived_termer< ExpSet >::init_(), vcsn::detail::derived_termer< ExpSet >::via_derivation(), and vcsn::detail::derived_termer< ExpSet >::via_expansion().
|
private |
Its weightset.
Definition at line 206 of file derived-term.hh.
Referenced by vcsn::detail::derived_termer< ExpSet >::init_(), and vcsn::detail::derived_termer< ExpSet >::via_expansion().