1/*---------------------------------------------------------------------------*
2 *  srec_eosd.h  *
3 *                                                                           *
4 *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5 *                                                                           *
6 *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7 *  you may not use this file except in compliance with the License.         *
8 *                                                                           *
9 *  You may obtain a copy of the License at                                  *
10 *      http://www.apache.org/licenses/LICENSE-2.0                           *
11 *                                                                           *
12 *  Unless required by applicable law or agreed to in writing, software      *
13 *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 *  See the License for the specific language governing permissions and      *
16 *  limitations under the License.                                           *
17 *                                                                           *
18 *---------------------------------------------------------------------------*/
19
20#ifndef __SREC_EOSD_H__
21#define __SREC_EOSD_H__
22
23#include"sizes.h"
24/* all values <=0 will continue recognition. >0 stops it */
25typedef enum { VALID_SPEECH_NOT_YET_DETECTED = -1, VALID_SPEECH_CONTINUING = 0, SPEECH_ENDED, SPEECH_ENDED_WITH_ERROR, SPEECH_TOO_LONG, SPEECH_MAYBE_ENDED, SPEECH_ENDED_BY_LEVEL_TIMEOUT } EOSrc;
26
27typedef struct srec_eos_detector_parms_t
28{
29  costdata eos_costdelta;
30  costdata opt_eos_costdelta;
31
32  frameID endnode_timeout;
33  frameID optendnode_timeout;
34  frameID internalnode_timeout;
35  frameID inspeech_timeout;
36}
37srec_eos_detector_parms;
38
39typedef struct srec_eos_detector_state_t
40{
41  frameID endnode_frmcnt;
42  frameID optendnode_frmcnt;
43  frameID internalnode_frmcnt;
44  frameID inspeech_frmcnt;
45
46  nodeID  internalnode_node_index;
47}
48srec_eos_detector_state;
49
50void srec_eosd_allocate(srec_eos_detector_parms** eosd_parms,
51                        int eos_costdelta,
52                        int opt_eos_costdelta,
53                        int endnode_timeout,
54                        int optendnode_timeout,
55                        int internalnode_timeout,
56                        int inspeech_timeout);
57
58void srec_eosd_destroy(srec_eos_detector_parms* eosd_parms);
59
60void srec_eosd_state_reset(srec_eos_detector_state* eosd_state);
61EOSrc srec_check_end_of_speech(srec_eos_detector_parms* eosd_parms, srec* rec);
62EOSrc srec_check_end_of_speech_end(srec* rec);
63
64#endif
65