Awali
Another Weighted Automata library
transducer.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2021 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
3 //
4 // Awali is a free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef DYN_MODULES_TRANSDUCER_HH
18 #define DYN_MODULES_TRANSDUCER_HH
19 
22 
23 namespace awali {
24  namespace dyn {
25 
26  //to move in module 'context' for consistency ?
27 // transducer_t make_transducer(std::vector<std::string> alphabets,
28 // std::string semiring = "B");
29 // transducer_t make_transducer(std::vector<std::string> alphabets);
30 
31 
32  // "internal" functions takes automaton_t while "public" functions takes
33  // transducer_t
34  namespace internal {
35  unsigned num_tapes (automaton_t tdc);
37  const std::vector<std::string>& labels);
38 
40  const std::vector<std::string>& labels);
41 
43  const std::vector<std::string>& labels);
44 
45 // // weight_t add_tdc_transition(automaton_t tdc, state_t src, state_t dst,
46 // const std::vector<std::string>& labels);
47 
49  const std::vector<std::string>& labels);
50 
52  const std::vector<std::string>& labels,
53  weight_t w);
54 
56  const std::vector<std::string>& labels,
57  weight_t w);
58 
59  std::vector<std::string> get_tdc_label(automaton_t tdc, transition_t tr);
60 
61  std::vector<state_t> tdc_successors(automaton_t tdc, state_t s,
62  const std::vector<std::string>& label);
63  std::vector<state_t> tdc_predecessors(automaton_t tdc, state_t s,
64  const std::vector<std::string>& label);
65  std::vector<transition_t> tdc_in(automaton_t tdc, state_t s,
66  const std::vector<std::string>& label);
67 
68  std::vector<transition_t> tdc_out(automaton_t tdc, state_t s,
69  const std::vector<std::string>& label);
70 
71  std::vector<char> input_alphabet(automaton_t tdc);
72 
73  std::vector<char> output_alphabet(automaton_t tdc);
74 
76  const std::string& output);
77 
78  std::string get_final_output(automaton_t tdc, state_t src);
79 
80 
81  std::vector<std::vector<char>> alphabets(automaton_t tdc);
82 
83  bool has_label(automaton_t tdc, unsigned i, std::string l);
84  bool has_input_label(automaton_t tdc, std::string l);
85 
86  bool has_output_label(automaton_t tdc, std::string l);
87 
89  } // end of namespace awali::dyn::internal
90 
98 
99 
107 
108 
117 
125 
128 
131 
138 
139 
142 
145 
148 
151 
153  bool is_of_finite_image(automaton_t tdc, unsigned i=0);
154 
157 
158  }
159 }//end of ns awali::dyn
160 #endif
161 
An automaton_t is essentially a shared pointer to an abstract_automaton_t, but also contains static f...
Definition: automaton.hh:93
bool is_of_finite_image(automaton_t tdc, unsigned i=0)
transducer_t inverse(transducer_t tdc)
transducer_t synchronize(transducer_t tdc)
transducer_t images(transducer_t tdc)
Projects out the very first tape of the transducer.
automaton_t letterize_tape(automaton_t tdc, unsigned i=1)
transducer_t compose(transducer_t tdc1, transducer_t tdc2)
automaton_t domain(transducer_t tdc)
Returns the automaton corresponding to the second tape of the transducer.
bool is_realtime(transducer_t tdc)
bool is_synchronizable(transducer_t tdc)
automaton_t image(transducer_t tdc)
Returns the automaton corresponding to the second tape of the transducer.
transducer_t realtime(transducer_t tdc)
std::vector< transition_t > tdc_in(automaton_t tdc, state_t s, const std::vector< std::string > &label)
bool has_tdc_transition(automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
transition_t get_tdc_transition(automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
bool has_output_label(automaton_t tdc, std::string l)
std::vector< std::string > get_tdc_label(automaton_t tdc, transition_t tr)
automaton_t lift_tdc(automaton_t tdc)
void set_final_output(automaton_t tdc, state_t src, const std::string &output)
std::vector< state_t > tdc_predecessors(automaton_t tdc, state_t s, const std::vector< std::string > &label)
std::vector< transition_t > tdc_out(automaton_t tdc, state_t s, const std::vector< std::string > &label)
std::string get_final_output(automaton_t tdc, state_t src)
transition_t set_tdc_transition(automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
std::vector< char > output_alphabet(automaton_t tdc)
std::vector< std::vector< char > > alphabets(automaton_t tdc)
bool has_label(automaton_t tdc, unsigned i, std::string l)
void del_tdc_transition(automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
std::vector< char > input_alphabet(automaton_t tdc)
unsigned num_tapes(automaton_t tdc)
std::vector< state_t > tdc_successors(automaton_t tdc, state_t s, const std::vector< std::string > &label)
weight_t add_tdc_transition(automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels, weight_t w)
bool has_input_label(automaton_t tdc, std::string l)
unsigned transition_t
Type representing automata transitions; currently simply identifiers of type unsigned,...
Definition: typedefs.hh:33
automaton_t projection(transducer_t tdc, unsigned i)
Projects tdc on the tape i.
bool is_functional(transducer_t tdc)
Tests whether tdc is functional.
unsigned state_t
Type representing automata states; currently simply identifiers of type unsigned, but this might chan...
Definition: typedefs.hh:28
Main namespace of Awali.
Definition: ato.hh:22
Structure used to erase the type of labels/weights at the dyn layer.
Definition: any.hh:52
Definition: transducer.hh:30