Main Page
Classes
Files
File List
File Members
include
s3_decode.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/* ====================================================================
3
* Copyright (c) 1999-2004 Carnegie Mellon University. All rights
4
* reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
*
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
*
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in
15
* the documentation and/or other materials provided with the
16
* distribution.
17
*
18
* This work was supported in part by funding from the Defense Advanced
19
* Research Projects Agency and the National Science Foundation of the
20
* United States of America, and the CMU Sphinx Speech Consortium.
21
*
22
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*
34
* ====================================================================
35
*
36
*/
37
/*************************************************
38
* CMU ARPA Speech Project
39
*
40
* Copyright (c) 2000 Carnegie Mellon University.
41
* ALL RIGHTS RESERVED.
42
*************************************************
43
*
44
* May 14, 2004
45
* Created by Yitao Sun (yitao@cs.cmu.edu) based on the live.h created by
46
* Rita Singh. The Live Decode API is the new top level API for Sphinx3.
47
* The goal of the Live Decode API is to provide a well documented and
48
* comprehensive API to control all aspects of the Sphinx3 speech decoder
49
* engine.
50
*
51
* The return values, for example, hypothesis segments and string, unlike
52
* the rest of Sphinx3, are read-only, maintained internally, and clobbered
53
* by subsequent calls.
54
*/
55
56
/*
57
revision 1.9
58
date: 2004/09/03 21:45:26; author: yitao; state: Exp; lines: +2 -2
59
60
cleaning up remote_decode API by moving list operations into a list API
61
----------------------------
62
revision 1.8
63
date: 2004/09/03 16:50:56; author: yitao; state: Exp; lines: +108 -37
64
65
66
modified comments to suit the use of doc++-
67
----------------------------
68
revision 1.7
69
date: 2004/08/27 05:22:43; author: yitao; state: Exp; lines: +75 -105
70
71
72
removed remote-decode API from the linux compile. added doc++ comments for live_decod
73
e.h-
74
----------------------------
75
revision 1.6
76
date: 2004/08/25 20:44:31; author: yitao; state: Exp; lines: +13 -15
77
78
79
1. added code to record uttid in live-decode
80
2. added more code to flesh out remote-decode. not compiling yet.
81
----------------------------
82
revision 1.5
83
date: 2004/08/23 20:41:38; author: yitao; state: Exp; lines: +1 -11
84
85
basic implementation for remote-decode API. not compiling yet.
86
----------------------------
87
revision 1.4
88
date: 2004/08/19 19:12:50; author: yitao; state: Exp; lines: +1 -1
89
90
incompleted files remote-decode API.
91
----------------------------
92
revision 1.3
93
date: 2004/08/09 21:40:36; author: yitao; state: Exp; lines: +11 -20
94
95
1. fixed some bugs in Live-Decode API. changed kb.c, kb.h, utt.c, live_decode.c, liv
96
e_decode.h.
97
2. changed some filenames in src/programs/. now there are 2 sets of livedecode and l
98
ivepretend: one that uses the old API (livedecode and livepretend), and one that uses
99
the new API (livedecode2 and livepretend2).
100
3. modified Makefile.am to reflect the filename changes above.
101
----------------------------
102
revision 1.2
103
date: 2004/08/08 23:34:50; author: arthchan2003; state: Exp; lines: +1 -1
104
temporary fixes of live_decode.c and live_decode.h
105
----------------------------
106
revision 1.1
107
date: 2004/08/06 15:07:38; author: yitao; state: Exp;
108
*** empty log message ***
109
=============================================================================
110
111
*/
112
113
#include <cmd_ln.h>
114
#include <fe.h>
115
#include "
s3types.h
"
116
#include "
sphinx3_export.h
"
117
#include "
kb.h
"
118
#include "
kbcore.h
"
119
#include "
dag.h
"
120
#include "
search.h
"
121
122
#ifndef __S3_DECODE_H
123
#define __S3_DECODE_H
124
128
#ifdef __cplusplus
129
extern
"C"
{
130
#endif
131
#if 0
132
}
/* Fool Emacs into not indenting things. */
133
#endif
134
135
S3DECODER_EXPORT
136
extern
arg_t
S3_DECODE_ARG_DEFS
[];
137
138
#define S3_DECODE_SUCCESS 0
139
#define S3_DECODE_ERROR_OUT_OF_MEMORY -0x01
140
#define S3_DECODE_ERROR_NULL_POINTER -0x02
141
#define S3_DECODE_ERROR_INVALID_STATE -0x04
142
#define S3_DECODE_ERROR_INTERNAL -0x08
143
144
#define S3_DECODE_STATE_IDLE 0
145
#define S3_DECODE_STATE_DECODING 1
146
#define S3_DECODE_STATE_FINISHED 2
147
150
S3DECODER_EXPORT
151
typedef
struct
152
{
156
kb_t
kb
;
157
161
kbcore_t
*
kbcore
;
162
166
int32
phones_skip
;
167
171
int32
num_frames_decoded
;
172
176
int32
num_frames_entered
;
177
181
int32
state
;
182
186
char
*
uttid
;
187
191
int32
hyp_frame_num
;
192
197
char
*
hyp_str
;
198
203
hyp_t
**
hyp_segs
;
204
208
int32
swap
;
209
213
int32
phypdump
;
214
218
const
char
*
rawext
;
219
220
}
s3_decode_t
;
221
222
238
S3DECODER_EXPORT
239
int
s3_decode_init
(
s3_decode_t
*_decode, cmd_ln_t *_config);
240
249
S3DECODER_EXPORT
250
void
s3_decode_close
(
s3_decode_t
*_decode);
251
273
S3DECODER_EXPORT
274
int
s3_decode_begin_utt
(
s3_decode_t
*_decode,
char
*_uttid);
275
288
S3DECODER_EXPORT
289
void
s3_decode_end_utt
(
s3_decode_t
*_decode);
290
309
S3DECODER_EXPORT
310
int
s3_decode_process
(
s3_decode_t
*_decode,
311
float32 **_frames,
312
int32 _num_frames);
313
349
S3DECODER_EXPORT
350
int
s3_decode_hypothesis
(
s3_decode_t
*_decode,
char
**_uttid,
351
char
**_hyp_str,
hyp_t
***_hyp_segs);
352
361
S3DECODER_EXPORT
362
dag_t
*
s3_decode_word_graph
(
s3_decode_t
*_decode);
363
369
S3DECODER_EXPORT
370
void
s3_decode_set_lm
(
s3_decode_t
*_decode,
const
char
*lmname);
371
377
S3DECODER_EXPORT
378
void
s3_decode_delete_lm
(
s3_decode_t
*_decode,
const
char
*lmname);
379
380
387
S3DECODER_EXPORT
388
void
s3_decode_read_lm
(
s3_decode_t
*_decode,
389
const
char
*lmfile,
390
const
char
*lmname);
391
392
#if 0
393
{
/* Stop indent from complaining */
394
#endif
395
#ifdef __cplusplus
396
}
397
#endif
398
399
#endif
400
401
402
403
Generated by
1.8.3.1