PocketSphinx  5prealpha
ps_search.h
Go to the documentation of this file.
1 /* -*- c-basic-offset:4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 2014 Alpha Cephei Inc.. 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 ALPHA CEPHEI INC. ``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  */
68 #ifndef __PS_SEARCH_H__
69 #define __PS_SEARCH_H__
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
75 #include <sphinxbase/fsg_model.h>
76 #include <sphinxbase/ngram_model.h>
77 
82 
83 
92 POCKETSPHINX_EXPORT
93 int ps_set_search(ps_decoder_t *ps, const char *name);
94 
100 POCKETSPHINX_EXPORT
101 const char* ps_get_search(ps_decoder_t *ps);
102 
113 POCKETSPHINX_EXPORT
114 int ps_unset_search(ps_decoder_t *ps, const char *name);
115 
121 POCKETSPHINX_EXPORT
123 
131 POCKETSPHINX_EXPORT
133 
139 POCKETSPHINX_EXPORT
140 const char* ps_search_iter_val(ps_search_iter_t *itor);
141 
147 POCKETSPHINX_EXPORT
149 
157 POCKETSPHINX_EXPORT
158 const char* ps_search_iter_val(ps_search_iter_t *itor);
159 
160 
172 POCKETSPHINX_EXPORT
173 ngram_model_t *ps_get_lm(ps_decoder_t *ps, const char *name);
174 
183 POCKETSPHINX_EXPORT
184 int ps_set_lm(ps_decoder_t *ps, const char *name, ngram_model_t *lm);
185 
193 POCKETSPHINX_EXPORT
194 int ps_set_lm_file(ps_decoder_t *ps, const char *name, const char *path);
195 
205 POCKETSPHINX_EXPORT
206 fsg_model_t *ps_get_fsg(ps_decoder_t *ps, const char *name);
207 
216 POCKETSPHINX_EXPORT
217 int ps_set_fsg(ps_decoder_t *ps, const char *name, fsg_model_t *fsg);
218 
226 POCKETSPHINX_EXPORT
227 int ps_set_jsgf_file(ps_decoder_t *ps, const char *name, const char *path);
228 
236 POCKETSPHINX_EXPORT
237 int ps_set_jsgf_string(ps_decoder_t *ps, const char *name, const char *jsgf_string);
238 
247 POCKETSPHINX_EXPORT
248 const char* ps_get_kws(ps_decoder_t *ps, const char *name);
249 
258 POCKETSPHINX_EXPORT
259 int ps_set_kws(ps_decoder_t *ps, const char *name, const char *keyfile);
260 
269 POCKETSPHINX_EXPORT
270 int ps_set_keyphrase(ps_decoder_t *ps, const char *name, const char *keyphrase);
271 
280 POCKETSPHINX_EXPORT
281 int ps_set_allphone(ps_decoder_t *ps, const char *name, ngram_model_t *lm);
282 
290 POCKETSPHINX_EXPORT
291 int ps_set_allphone_file(ps_decoder_t *ps, const char *name, const char *path);
292 
293 #ifdef __cplusplus
294 }
295 #endif
296 
297 #endif /* __PS_SEARCH_H__ */
POCKETSPHINX_EXPORT ngram_model_t * ps_get_lm(ps_decoder_t *ps, const char *name)
Get the language model set object for this decoder.
Definition: pocketsphinx.c:552
POCKETSPHINX_EXPORT const char * ps_get_kws(ps_decoder_t *ps, const char *name)
Get the current Key phrase to spot.
Definition: pocketsphinx.c:570
POCKETSPHINX_EXPORT int ps_set_fsg(ps_decoder_t *ps, const char *name, fsg_model_t *fsg)
Adds new search based on finite state grammar.
Definition: pocketsphinx.c:657
POCKETSPHINX_EXPORT int ps_set_kws(ps_decoder_t *ps, const char *name, const char *keyfile)
Adds keywords from a file to spotting.
Definition: pocketsphinx.c:641
POCKETSPHINX_EXPORT ps_search_iter_t * ps_search_iter(ps_decoder_t *ps)
Returns iterator over current searches.
Definition: pocketsphinx.c:528
POCKETSPHINX_EXPORT int ps_set_lm(ps_decoder_t *ps, const char *name, ngram_model_t *lm)
Adds new search based on N-gram language model.
Definition: pocketsphinx.c:595
Decoder object.
POCKETSPHINX_EXPORT int ps_set_jsgf_string(ps_decoder_t *ps, const char *name, const char *jsgf_string)
Adds new search using JSGF model.
Definition: pocketsphinx.c:704
POCKETSPHINX_EXPORT int ps_set_lm_file(ps_decoder_t *ps, const char *name, const char *path)
Adds new search based on N-gram language model.
Definition: pocketsphinx.c:603
POCKETSPHINX_EXPORT int ps_set_allphone_file(ps_decoder_t *ps, const char *name, const char *path)
Adds new search based on phone N-gram language model.
Definition: pocketsphinx.c:626
POCKETSPHINX_EXPORT int ps_unset_search(ps_decoder_t *ps, const char *name)
Unsets the search and releases related resources.
Definition: pocketsphinx.c:516
POCKETSPHINX_EXPORT ps_search_iter_t * ps_search_iter_next(ps_search_iter_t *itor)
Updates search iterator to point to the next position.
Definition: pocketsphinx.c:534
POCKETSPHINX_EXPORT int ps_set_jsgf_file(ps_decoder_t *ps, const char *name, const char *path)
Adds new search using JSGF model.
Definition: pocketsphinx.c:665
POCKETSPHINX_EXPORT fsg_model_t * ps_get_fsg(ps_decoder_t *ps, const char *name)
Get the finite-state grammar set object for this decoder.
Definition: pocketsphinx.c:561
POCKETSPHINX_EXPORT int ps_set_keyphrase(ps_decoder_t *ps, const char *name, const char *keyphrase)
Adds new keyword to spot.
Definition: pocketsphinx.c:649
POCKETSPHINX_EXPORT void ps_search_iter_free(ps_search_iter_t *itor)
Delete an unfinished search iterator.
Definition: pocketsphinx.c:546
POCKETSPHINX_EXPORT int ps_set_allphone(ps_decoder_t *ps, const char *name, ngram_model_t *lm)
Adds new search based on phone N-gram language model.
Definition: pocketsphinx.c:618
POCKETSPHINX_EXPORT const char * ps_search_iter_val(ps_search_iter_t *itor)
Retrieves the name of the search the iterator points to.
Definition: pocketsphinx.c:540
POCKETSPHINX_EXPORT const char * ps_get_search(ps_decoder_t *ps)
Returns name of curent search in decoder.
Definition: pocketsphinx.c:501
POCKETSPHINX_EXPORT int ps_set_search(ps_decoder_t *ps, const char *name)
Actives search with the provided name.
Definition: pocketsphinx.c:483