![]() |
Vcsn
2.1
Be Rational
|
Build an automaton with unknown context. More...
#include <edit-automaton.hh>
Public Types | |
| enum | labelset_type { labelset_type::empty, labelset_type::lal, labelset_type::lan, labelset_type::law } |
| Labelset types, increasing generality. More... | |
| enum | weightset_type { weightset_type::logarithmic, weightset_type::numerical, weightset_type::tropical } |
| Weightset types. More... | |
| using | string_t = automaton_editor::string_t |
| A hash-cons'ed string type. More... | |
Public Member Functions | |
| void | add_initial (string_t s, string_t w=string_t{}) |
| Add s as an initial state. More... | |
| void | add_final (string_t s, string_t w=string_t{}) |
| Add s as a final state. More... | |
| void | add_transition (string_t src, string_t dst, string_t lbl, string_t w=string_t{}) |
| Add an acceptor transition from src to dst, labeled by lbl. More... | |
| void | add_transition (string_t src, string_t dst, string_t lbl1, string_t lbl2, string_t w) |
| Add a transducer transition from src to dst, labeled by (lbl1, lbl2). More... | |
| std::string | result_context () const |
| Return the context that was inferred. More... | |
| dyn::automaton | result (const std::string &ctx={}) |
| Return the built automaton. More... | |
| bool | open (bool o) |
| Whether unknown letters should be added, or rejected. More... | |
| void | reset () |
| Get ready to build another automaton. More... | |
| void | weightset (weightset_type t) |
| Specify the weightset type. More... | |
Private Types | |
| using | transition_t = std::tuple< string_t, string_t, string_t, string_t > |
| The collected transitions: (Source, Destination, Label, Weight). More... | |
Private Member Functions | |
| void | register_weight_ (string_t w) |
| Record that this weight was seen. More... | |
Private Attributes | |
| std::vector< transition_t > | transitions_ |
| std::vector< std::pair< string_t, string_t > > | initial_states_ |
| The collected initial states: (State, Weight). More... | |
| std::vector< std::pair< string_t, string_t > > | final_states_ |
| The collected final states: (State, Weight). More... | |
| labelset_type | input_type_ = labelset_type::empty |
| Labelset type for input tape. More... | |
| labelset_type | output_type_ = labelset_type::empty |
| Labelset type for output tape. More... | |
| bool | weighted_ = false |
| Whether we saw a non-empty weight. More... | |
| bool | real_ = false |
| Whether we saw a period in a the weight. More... | |
| bool | open_ = false |
| Whether the labelset is open. More... | |
| weightset_type | weightset_type_ = weightset_type::numerical |
| The weightset scale. More... | |
Build an automaton with unknown context.
Record the transitions, initial and final states as strings, and once the automata completed, decide what is its context, and build a genuine automaton.
Definition at line 268 of file edit-automaton.hh.
A hash-cons'ed string type.
Definition at line 272 of file edit-automaton.hh.
|
private |
The collected transitions: (Source, Destination, Label, Weight).
Definition at line 322 of file edit-automaton.hh.
|
strong |
Labelset types, increasing generality.
| Enumerator | |
|---|---|
| empty | |
| lal | |
| lan | |
| law | |
Definition at line 275 of file edit-automaton.hh.
|
strong |
Weightset types.
| Enumerator | |
|---|---|
| logarithmic | |
| numerical | |
| tropical | |
Definition at line 278 of file edit-automaton.hh.
Add s as a final state.
Definition at line 38 of file edit-automaton.cc.
References final_states_, and register_weight_().
Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().
Add s as an initial state.
Definition at line 31 of file edit-automaton.cc.
References initial_states_, and register_weight_().
Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().
| void vcsn::lazy_automaton_editor::add_transition | ( | string_t | src, |
| string_t | dst, | ||
| string_t | lbl, | ||
| string_t | w = string_t{} |
||
| ) |
Add an acceptor transition from src to dst, labeled by lbl.
Add transitions from src to dst, labeled by entry.
Definition at line 114 of file edit-automaton.cc.
Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().
| void vcsn::lazy_automaton_editor::add_transition | ( | string_t | src, |
| string_t | dst, | ||
| string_t | lbl1, | ||
| string_t | lbl2, | ||
| string_t | w | ||
| ) |
Add a transducer transition from src to dst, labeled by (lbl1, lbl2).
Add transitions from src to dst, labeled by entry.
Definition at line 91 of file edit-automaton.cc.
References input_type_, output_type_, register_weight_(), transitions_, and vcsn::dyn::type().
| bool vcsn::lazy_automaton_editor::open | ( | bool | o | ) |
Whether unknown letters should be added, or rejected.
| o | whether to accept |
Definition at line 123 of file edit-automaton.cc.
References open_.
Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().
|
private |
Record that this weight was seen.
Examine it to see if it's a float etc.
Definition at line 19 of file edit-automaton.cc.
References real_, and weighted_.
Referenced by add_final(), add_initial(), and add_transition().
| void vcsn::lazy_automaton_editor::reset | ( | ) |
Get ready to build another automaton.
Definition at line 130 of file edit-automaton.cc.
References final_states_, initial_states_, and transitions_.
| dyn::automaton vcsn::lazy_automaton_editor::result | ( | const std::string & | ctx = {} | ) |
Return the built automaton.
| ctx | the context to load this automaton. Defaults to the result_context(). |
Definition at line 167 of file edit-automaton.cc.
References vcsn::rat::ctx(), final_states_, initial_states_, vcsn::dyn::make_automaton_editor(), vcsn::dyn::make_context(), open_, result_context(), and transitions_.
Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().
| std::string vcsn::lazy_automaton_editor::result_context | ( | ) | const |
Return the context that was inferred.
Definition at line 137 of file edit-automaton.cc.
References empty, input_type_, lal, logarithmic, numerical, output_type_, real_, vcsn::to_string(), tropical, weighted_, and weightset_type_.
Referenced by vcsn::dyn::read_efsm(), and result().
|
inline |
Specify the weightset type.
Definition at line 314 of file edit-automaton.hh.
References weightset_type_.
Referenced by vcsn::dyn::read_efsm().
The collected final states: (State, Weight).
Definition at line 327 of file edit-automaton.hh.
Referenced by add_final(), reset(), and result().
The collected initial states: (State, Weight).
Definition at line 325 of file edit-automaton.hh.
Referenced by add_initial(), reset(), and result().
|
private |
Labelset type for input tape.
Definition at line 329 of file edit-automaton.hh.
Referenced by add_transition(), and result_context().
|
private |
Whether the labelset is open.
Definition at line 337 of file edit-automaton.hh.
|
private |
Labelset type for output tape.
Definition at line 331 of file edit-automaton.hh.
Referenced by add_transition(), and result_context().
|
private |
Whether we saw a period in a the weight.
Definition at line 335 of file edit-automaton.hh.
Referenced by register_weight_(), and result_context().
|
private |
Definition at line 323 of file edit-automaton.hh.
Referenced by add_transition(), reset(), and result().
|
private |
Whether we saw a non-empty weight.
Definition at line 333 of file edit-automaton.hh.
Referenced by register_weight_(), and result_context().
|
private |
The weightset scale.
Definition at line 339 of file edit-automaton.hh.
Referenced by result_context(), and weightset().