PocketSphinx
5prealpha
Main Page
Data Structures
Files
File List
Globals
kws_search.h
1
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/* ====================================================================
3
* Copyright (c) 2013 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
*
19
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
20
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
23
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
*
31
* ====================================================================
32
*
33
*/
34
35
/*
36
* kws_search.h -- Search structures for keyword spotting.
37
*/
38
39
#ifndef __KWS_SEARCH_H__
40
#define __KWS_SEARCH_H__
41
42
/* SphinxBase headers. */
43
#include <sphinxbase/glist.h>
44
#include <sphinxbase/cmd_ln.h>
45
46
/* Local headers. */
47
#include "
pocketsphinx_internal.h
"
48
#include "kws_detections.h"
49
#include "
hmm.h
"
50
54
typedef
struct
kws_seg_s
{
55
ps_seg_t
base
;
56
gnode_t *
detection
;
57
frame_idx_t
last_frame
;
58
}
kws_seg_t
;
59
60
typedef
struct
kws_keyword_s
{
61
char
* word;
62
int32 threshold;
63
hmm_t
* hmms;
64
int32 n_hmms;
65
}
kws_keyword_t
;
66
70
typedef
struct
kws_search_s
{
71
ps_search_t
base;
72
73
hmm_context_t
*
hmmctx
;
75
kws_detections_t
*
detections
;
76
kws_keyword_t
*
keyphrases
;
77
int
n_keyphrases
;
78
frame_idx_t
frame
;
80
int32 beam;
81
82
int32
plp
;
83
int32
bestscore
;
84
int32
def_threshold
;
85
int32
delay
;
87
int32
n_pl
;
88
hmm_t
*
pl_hmms
;
89
}
kws_search_t
;
90
95
ps_search_t
*kws_search_init(
const
char
*name,
96
const
char
*keyphrase,
97
const
char
*keyfile,
98
cmd_ln_t * config,
99
acmod_t
* acmod,
100
dict_t
* dict,
dict2pid_t
* d2p);
101
105
void
kws_search_free(
ps_search_t
* search);
106
110
int
kws_search_reinit(
ps_search_t
* kwss,
dict_t
* dict,
dict2pid_t
* d2p);
111
116
int
kws_search_start(
ps_search_t
* search);
117
121
int
kws_search_step(
ps_search_t
* search,
int
frame_idx);
122
126
int
kws_search_finish(
ps_search_t
* search);
127
131
char
const
*kws_search_hyp(
ps_search_t
* search, int32 * out_score,
132
int32 * out_is_final);
136
char
* kws_search_get_keywords(
ps_search_t
* search);
137
138
#endif
/* __KWS_SEARCH_H__ */
pocketsphinx_internal.h
Internal implementation of PocketSphinx decoder.
kws_seg_s::last_frame
frame_idx_t last_frame
Last frame to raise the detection.
Definition:
kws_search.h:57
ps_search_s
Base structure for search module.
Definition:
pocketsphinx_internal.h:98
hmm_t
An individual HMM among the HMM search space.
kws_seg_s::detection
gnode_t * detection
Keyword detection correspondent to segment.
Definition:
kws_search.h:56
kws_search_s::plp
int32 plp
Phone loop probability.
Definition:
kws_search.h:82
kws_search_s::def_threshold
int32 def_threshold
default threshold for p(hyp)/p(altern) ratio
Definition:
kws_search.h:84
kws_keyword_s
Definition:
kws_search.h:60
kws_seg_s
Segmentation "iterator" for KWS history.
Definition:
kws_search.h:54
kws_search_s::bestscore
int32 bestscore
For beam pruning.
Definition:
kws_search.h:83
hmm.h
Implementation of HMM base structure.
kws_search_s::pl_hmms
hmm_t * pl_hmms
Phone loop hmms - hmms of CI phones.
Definition:
kws_search.h:88
kws_search_s::keyphrases
kws_keyword_t * keyphrases
Keyphrases to spot.
Definition:
kws_search.h:76
kws_search_s::hmmctx
hmm_context_t * hmmctx
HMM context.
Definition:
kws_search.h:73
kws_search_s::delay
int32 delay
Delay to wait for best detection score.
Definition:
kws_search.h:85
hmm_context_t
Shared information between a set of HMMs.
kws_seg_s::base
ps_seg_t base
Base structure.
Definition:
kws_search.h:55
dict_t
a structure for a dictionary.
Definition:
dict.h:76
kws_search_s::frame
frame_idx_t frame
Frame index.
Definition:
kws_search.h:78
kws_search_s::n_pl
int32 n_pl
Number of CI phones.
Definition:
kws_search.h:87
frame_idx_t
int32 frame_idx_t
Type for frame index values.
Definition:
hmm.h:64
kws_search_s::n_keyphrases
int n_keyphrases
Keyphrases amount.
Definition:
kws_search.h:77
kws_detections_s
Definition:
kws_detections.h:57
kws_search_s
Implementation of KWS search structure.
Definition:
kws_search.h:70
kws_search_s::detections
kws_detections_t * detections
Keyword spotting history.
Definition:
kws_search.h:75
ps_seg_s
Base structure for hypothesis segmentation iterator.
Definition:
pocketsphinx_internal.h:178
acmod_s
Acoustic model structure.
Definition:
acmod.h:148
dict2pid_t
Building composite triphone (as well as word internal triphones) with the dictionary.
Definition:
dict2pid.h:84
src
libpocketsphinx
kws_search.h
Generated by
1.8.9.1