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 #include <sphinxbase/fsg_model.h>
72 #include <sphinxbase/ngram_model.h>
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 #if 0
78 }
79 #endif
80 
85 
86 
95 POCKETSPHINX_EXPORT
96 int ps_set_search(ps_decoder_t *ps, const char *name);
97 
103 POCKETSPHINX_EXPORT
104 const char* ps_get_search(ps_decoder_t *ps);
105 
116 POCKETSPHINX_EXPORT
117 int ps_unset_search(ps_decoder_t *ps, const char *name);
118 
124 POCKETSPHINX_EXPORT
126 
134 POCKETSPHINX_EXPORT
136 
142 POCKETSPHINX_EXPORT
143 const char* ps_search_iter_val(ps_search_iter_t *itor);
144 
150 POCKETSPHINX_EXPORT
152 
160 POCKETSPHINX_EXPORT
161 const char* ps_search_iter_val(ps_search_iter_t *itor);
162 
163 
175 POCKETSPHINX_EXPORT
176 ngram_model_t *ps_get_lm(ps_decoder_t *ps, const char *name);
177 
186 POCKETSPHINX_EXPORT
187 int ps_set_lm(ps_decoder_t *ps, const char *name, ngram_model_t *lm);
188 
196 POCKETSPHINX_EXPORT
197 int ps_set_lm_file(ps_decoder_t *ps, const char *name, const char *path);
198 
208 POCKETSPHINX_EXPORT
209 fsg_model_t *ps_get_fsg(ps_decoder_t *ps, const char *name);
210 
219 POCKETSPHINX_EXPORT
220 int ps_set_fsg(ps_decoder_t *ps, const char *name, fsg_model_t *fsg);
221 
229 POCKETSPHINX_EXPORT
230 int ps_set_jsgf_file(ps_decoder_t *ps, const char *name, const char *path);
231 
239 POCKETSPHINX_EXPORT
240 int ps_set_jsgf_string(ps_decoder_t *ps, const char *name, const char *jsgf_string);
241 
250 POCKETSPHINX_EXPORT
251 const char* ps_get_kws(ps_decoder_t *ps, const char *name);
252 
261 POCKETSPHINX_EXPORT
262 int ps_set_kws(ps_decoder_t *ps, const char *name, const char *keyfile);
263 
272 POCKETSPHINX_EXPORT
273 int ps_set_keyphrase(ps_decoder_t *ps, const char *name, const char *keyphrase);
274 
283 POCKETSPHINX_EXPORT
284 int ps_set_allphone(ps_decoder_t *ps, const char *name, ngram_model_t *lm);
285 
293 POCKETSPHINX_EXPORT
294 int ps_set_allphone_file(ps_decoder_t *ps, const char *name, const char *path);
295 
296 #ifdef __cplusplus
297 }
298 #endif
299 
300 #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:543
POCKETSPHINX_EXPORT const char * ps_get_kws(ps_decoder_t *ps, const char *name)
Get the current Key phrase to spot.
Definition: pocketsphinx.c:561
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:648
POCKETSPHINX_EXPORT int ps_set_kws(ps_decoder_t *ps, const char *name, const char *keyfile)
Adds keyphrases from a file to spotting.
Definition: pocketsphinx.c:632
POCKETSPHINX_EXPORT ps_search_iter_t * ps_search_iter(ps_decoder_t *ps)
Returns iterator over current searches.
Definition: pocketsphinx.c:519
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:586
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:695
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:594
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:617
POCKETSPHINX_EXPORT int ps_unset_search(ps_decoder_t *ps, const char *name)
Unsets the search and releases related resources.
Definition: pocketsphinx.c:507
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:525
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:656
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:552
POCKETSPHINX_EXPORT int ps_set_keyphrase(ps_decoder_t *ps, const char *name, const char *keyphrase)
Adds new keyphrase to spot.
Definition: pocketsphinx.c:640
POCKETSPHINX_EXPORT void ps_search_iter_free(ps_search_iter_t *itor)
Delete an unfinished search iterator.
Definition: pocketsphinx.c:537
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:609
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:531
POCKETSPHINX_EXPORT const char * ps_get_search(ps_decoder_t *ps)
Returns name of curent search in decoder.
Definition: pocketsphinx.c:492
POCKETSPHINX_EXPORT int ps_set_search(ps_decoder_t *ps, const char *name)
Actives search with the provided name.
Definition: pocketsphinx.c:467