Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_relation_aux.h
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1994,1995,1996 */
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 : Paul Taylor */
34 /* Date : May 1994 */
35 /* Release: 0.9 */
36 /*-----------------------------------------------------------------------*/
37 /* Auxiliary Label Routines header file */
38 /* */
39 /*=======================================================================*/
40 
41 #ifndef __EST_RELATION_AUX_H__
42 #define __EST_RELATION_AUX_H__
43 
44 #include "EST_String.h"
45 #include "EST_Track.h"
46 #include "ling_class/EST_Utterance.h"
47 #include "EST_Option.h"
48 #include "EST_THash.h"
49 
52 
53 EST_String options_relation_filetypes(void);
54 
55 
56 void convert_to_broad(EST_Relation &seg, EST_StrList &pos_list,
57  EST_String broad_name ="", int polarity = 1);
58 void convert_to_broad_class(EST_Relation &seg, const EST_String &class_type,
59  EST_Option &options);
60 
61 int merge_label(EST_Relation &seg, const EST_String &labtype);
62 
63 void change_label(EST_Relation &seg, const EST_String &oname, const EST_String &nname);
64 
65 void merge_all_label(EST_Relation &seg, const EST_String &labtype);
66 
67 void track_to_label(const EST_Track &tr, EST_Relation &lab, float thresh=0.0);
68 void track_to_pm(const EST_Track &tr, int sample_rate, EST_Relation &lab);
69 
70 void label_to_track(const EST_Relation &lab,
71  const EST_Option &al,
72  const EST_Option &op,
73  EST_Track &tr);
74 void label_to_track(const EST_Relation &lab, EST_Track &tr,
75  float shift, float offset=0.0,
76  float range = 1.0, float req_length = -1.0,
77  const EST_String &pad="low");
78 
79 void shift_label(EST_Relation &seg, float shift);
80 void label_map(EST_Relation &seg, EST_Option &map);
81 void quantize(EST_Relation &a, float q);
82 int edit_labels(EST_Relation &a, EST_String sedfile);
83 
84 void RelationList_select(EST_RelationList &mlf, EST_StrList filenames, bool
85  exact_match);
86 EST_Relation RelationList_extract(EST_RelationList &mlf,
87  const EST_String &filename,
88  bool base);
89 EST_Relation RelationList_combine(EST_RelationList &mlf);
90 EST_Relation RelationList_combine(EST_RelationList &mlf, EST_Relation &key);
91 
92 int relation_divide(EST_RelationList &mlf, EST_Relation &lab,
93  EST_Relation &keylab, EST_String ext);
94 
95 int relation_divide(EST_RelationList &mlf, EST_Relation &lab,
96  EST_Relation &keylab,
97  EST_StrList &list, EST_String ext);
98 
99 EST_Litem *RelationList_ptr_extract(EST_RelationList &mlf,
100  const EST_String &filename,
101  bool base);
102 
103 void relation_convert(EST_Relation &lab, EST_Option &al, EST_Option &op);
104 
105 EST_read_status load_RelationList(const EST_String &filename,
106  EST_RelationList &plist);
107 EST_write_status save_RelationList(const EST_String& filename,
108  const EST_RelationList &plist);
109 EST_write_status save_RelationList(const EST_String &filename,
110  const EST_RelationList &plist,
111  int time=1, int path = 1);
112 EST_write_status save_ind_RelationList(const EST_String &filename,
113  const EST_RelationList &plist,
114  const EST_String &features,
115  int path);
116 
117 EST_write_status save_WordList(const EST_String &filename,
118  const EST_RelationList &plist,
119  int n);
120 
121 EST_write_status save_SentenceList(EST_String filename,
122  EST_RelationList &plist, int n);
123 
124 
125 
126 EST_read_status read_RelationList(EST_RelationList &mlf,
127  EST_StrList &files, EST_Option &al);
128 
129 float start(EST_Item *n);
130 float duration(EST_Item *n);
131 
132 /// hashed relation lists for super speed
133 void build_RelationList_hash_table(EST_RelationList &mlf,
134  EST_hashedRelationList &hash_table,
135  const bool base);
136 
137 bool hashed_RelationList_extract(EST_Relation* &rel,
138  const EST_hashedRelationList &hash_table,
139  const EST_String &filename, bool base);
140 
141 
142 #endif /* __EST_RELATION_AUX_H__ */