Awali
Another Weighted Automata library
transducer.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2022 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 {
36  unsigned num_tapes (automaton_t tdc);
38  const std::vector<std::string>& labels);
39 
41  const std::vector<std::string>& labels);
42 
44  const std::vector<std::string>& labels);
45 
46 // // weight_t add_tdc_transition(automaton_t tdc, state_t src, state_t dst,
47 // const std::vector<std::string>& labels);
48 
50  const std::vector<std::string>& labels);
51 
53  const std::vector<std::string>& labels,
54  weight_t w);
55 
57  const std::vector<std::string>& labels,
58  weight_t w);
59 
60  std::vector<std::string> get_tdc_label(automaton_t tdc, transition_t tr);
61 
62  std::vector<state_t> tdc_successors(automaton_t tdc, state_t s,
63  const std::vector<std::string>& label);
64  std::vector<state_t> tdc_predecessors(automaton_t tdc, state_t s,
65  const std::vector<std::string>& label);
66  std::vector<transition_t> tdc_in(automaton_t tdc, state_t s,
67  const std::vector<std::string>& label);
68 
69  std::vector<transition_t> tdc_out(automaton_t tdc, state_t s,
70  const std::vector<std::string>& label);
71 
72  std::vector<char> input_alphabet(automaton_t tdc);
73 
74  std::vector<char> output_alphabet(automaton_t tdc);
75 
77  const std::string& output);
78 
79  std::string get_final_output(automaton_t tdc, state_t src);
80 
81 
82  std::vector<std::vector<char>> alphabets(automaton_t tdc);
83 
84  bool has_label(automaton_t tdc, unsigned i, std::string const& l);
85  bool has_input_label(automaton_t tdc, std::string const& l);
86 
87  bool has_output_label(automaton_t tdc, std::string const& l);
88 
90  } // end of namespace awali::dyn::internal
91 
99 
100 
108 
109 
118 
126 
129 
132 
139 
140 
143 
146 
147 
150 
153 
155  bool is_of_finite_image(automaton_t tdc, unsigned i=0);
156 
159 
162  }
163 }//end of ns awali::dyn
164 #endif
165 
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.
transducer_t subnormalize(transducer_t tdc)
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)
bool has_output_label(automaton_t tdc, std::string const &l)
transition_t get_tdc_transition(automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
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)
bool has_input_label(automaton_t tdc, std::string const &l)
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 const &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)
automaton_t make_nullable_under_lat(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)
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:59
Definition: transducer.hh:30