Edinburgh Speech Tools
2.4-release
All
Classes
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
EST_Utterance.h
1
/*************************************************************************/
2
/* */
3
/* Centre for Speech Technology Research */
4
/* University of Edinburgh, UK */
5
/* Copyright (c) 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 1995 (redone May 1998) */
35
/*-----------------------------------------------------------------------*/
36
/* EST_Utterance Class header file */
37
/* */
38
/*=======================================================================*/
39
#ifndef __Utterance_H__
40
#define __Utterance_H__
41
42
#include "EST_String.h"
43
#include "EST_TList.h"
44
#include "ling_class/EST_Relation.h"
45
#include "ling_class/EST_Item.h"
46
#include "EST_Features.h"
47
48
/** A class that contains <link linkend="est-item">EST_Items</link>
49
and <link linkend="est-relation">EST_Relations</link> between them.
50
Used for holding interrelated linguistic structures.
51
52
*/
53
54
class
EST_Utterance
{
55
private
:
56
void
copy(
const
EST_Utterance
&u);
57
int
highest_id;
58
public
:
59
/**@name Constructor and initialisation Functions */
60
//@{
61
/// default constructor
62
EST_Utterance
();
63
EST_Utterance
(
const
EST_Utterance
&u) { copy(u); }
64
~
EST_Utterance
() {
clear
();}
65
//@}
66
///
67
68
/**@name Utility Functions */
69
//@{
70
/// initialise utterance
71
void
init
();
72
73
/// remove everything in utterance
74
void
clear
();
75
76
/// clear the contents of the relations only
77
void
clear_relations
();
78
79
/// set the next id to be <parameter>n</parameter>
80
void
set_highest_id
(
int
n) {highest_id=n;}
81
/// return the id of the next item
82
int
next_id
();
83
//@}
84
85
/**@name File i/o */
86
//@{
87
/** load an utterance from an ascii file
88
*/
89
EST_read_status
load
(
const
EST_String
&filename);
90
/** load an utterance from a already opened token stream
91
*/
92
EST_read_status
load
(
EST_TokenStream
&ts);
93
94
/** save an utterance to an ascii file
95
*/
96
EST_write_status
save
(
const
EST_String
&filename,
97
const
EST_String
&type=
"est_ascii"
)
const
;
98
99
/** save an utterance to an ostream
100
*/
101
EST_write_status
save
(ostream &outf,
const
EST_String
&type)
const
;
102
//@}
103
104
EST_Utterance
&operator=(
const
EST_Utterance
&s);
105
friend
ostream& operator << (ostream &s,
const
EST_Utterance
&u);
106
EST_Relation
* operator() (
const
EST_String
&name)
107
{
return
relation
(name);}
108
109
/** Utterance access
110
*/
111
//@{
112
113
/// Utterance level features
114
EST_Features
f
;
115
116
/// Evaluate all feature functions in utterance
117
void
evaluate_all_features
();
118
119
/// The list of named relations
120
EST_Features
relations
;
121
122
/// number of relations in this utterance
123
int
num_relations
()
const
{
return
relations
.
length
(); }
124
125
/** returns true if utterance contains named relations.
126
{\bf name} can be either a single string or a bracketed list
127
of strings e.g. "(Word Phone Syl)". */
128
bool
relation_present
(
const
EST_String
name)
const
;
129
130
/** returns true if utterance contains all the relations
131
named in the list {\bf name}. */
132
bool
relation_present
(
EST_StrList
&names)
const
;
133
134
/// get relation by name
135
EST_Relation
*
relation
(
const
char
*name,
int
err_on_not_found=1)
const
;
136
137
/// return EST_Item whose id is <parameter>n</parameter>.
138
EST_Item
*
id
(
const
EST_String
&n)
const
;
139
140
/// create a new relation called <parameter>n</parameter>.
141
EST_Relation
*
create_relation
(
const
EST_String
&relname);
142
143
/// remove the relation called <parameter>n</parameter>.
144
void
remove_relation
(
const
EST_String
&relname);
145
146
void
sub_utterance(
EST_Item
*i);
147
};
148
149
void
utt_2_flat_repr(
const
EST_Utterance
&utt,
150
EST_String
&flat_repr );
151
152
int
utterance_merge(
EST_Utterance
&utt,
153
EST_Utterance
&sub_utt,
154
EST_Item
*utt_root,
155
EST_Item
*sub_root);
156
157
int
utterance_merge(
EST_Utterance
&utt,
158
EST_Utterance
&extra,
159
EST_String
feature);
160
161
void
sub_utterance(
EST_Utterance
&sub,
EST_Item
*i);
162
163
#endif
include
ling_class
EST_Utterance.h
Generated on Wed Dec 24 2014 09:16:35 for Edinburgh Speech Tools by
1.8.3.1