Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
wfst_aux.h
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1997 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author : Alan W Black */
34 /* Date : November 1997 */
35 /*-----------------------------------------------------------------------*/
36 /* */
37 /* Some internal classes for Weighted Finite State Transducers */
38 /* */
39 /*=======================================================================*/
40 #ifndef __WFST_AUX_H__
41 #define __WFST_AUX_H__
42 
43 // Used in minimization
44 
45 class wfst_marks {
46  private:
47  int p_x;
48  char **p_mark_table; // triangular matrix
49  char val(int p,int q)
50  { if (p < q) return p_mark_table[q][p];
51  else return p_mark_table[p][q]; }
52  void set_val(int p,int q,char e)
53  { if (p < q) p_mark_table[q][p] = e;
54  else p_mark_table[p][q] = e; }
55  public:
56  wfst_marks(int x);
57  ~wfst_marks();
58 
59  int distinguished(int p, int q) { return val(p,q) == 'd'; }
60  int undistinguished(int p, int q)
61  { return val(p,q) == 'u'; }
62  void distinguish(int p, int q) { set_val(p,q,'d'); }
63  void undistinguish(int p, int q) { set_val(p,q,'u'); }
64  void find_state_map(EST_IVector &state_map,int &num_new_states);
65 
66 };
67 
69 void mark_undistinguished(wfst_marks &marks,wfst_assumes &assumptions);
70 int equivalent_to(int y,int z,wfst_assumes &assumptions);
71 void add_assumption(int y,int z,wfst_assumes &assumptions);
72 
73 #endif