PocketSphinx  0.6
fsg_set.h
Go to the documentation of this file.
1 /* -*- c-basic-offset:4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 1999-2008 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  */
38 #ifndef __FSG_SET_H__
39 #define __FSG_SET_H__
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 #if 0
45 }
46 #endif
47 
48 /* SphinxBase headers we need. */
49 #include <sphinxbase/fsg_model.h>
50 #include <sphinxbase/hash_table.h>
51 #include <sphinxbase/jsgf.h>
52 
53 /* PocketSphinx headers. */
54 #include <pocketsphinx_export.h>
55 
59 typedef struct fsg_search_s fsg_set_t;
60 
64 typedef hash_iter_t fsg_set_iter_t;
65 
69 POCKETSPHINX_EXPORT
71 
75 POCKETSPHINX_EXPORT
77 
81 POCKETSPHINX_EXPORT
82 fsg_model_t *fsg_set_iter_fsg(fsg_set_iter_t *itor);
83 
87 POCKETSPHINX_EXPORT
89 
95 POCKETSPHINX_EXPORT
96 fsg_model_t *fsg_set_get_fsg(fsg_set_t *fsgs, char const *name);
97 
110 POCKETSPHINX_EXPORT
111 fsg_model_t *fsg_set_add(fsg_set_t *fsgs, char const *name, fsg_model_t *wfsg);
112 
116 POCKETSPHINX_EXPORT
117 fsg_model_t *fsg_set_remove(fsg_set_t *fsgs, fsg_model_t *wfsg);
118 
122 POCKETSPHINX_EXPORT
123 fsg_model_t *fsg_set_remove_byname(fsg_set_t *fsgs, char const *name);
124 
130 POCKETSPHINX_EXPORT
131 fsg_model_t *fsg_set_select(fsg_set_t *fsgs, const char *name);
132 
133 #ifdef __cplusplus
134 } /* extern "C" */
135 #endif
136 
137 #endif /* __FSG_SET_H__ */
Implementation of FSG search (and "FSG set") structure.
POCKETSPHINX_EXPORT fsg_model_t * fsg_set_select(fsg_set_t *fsgs, const char *name)
Switch to a new FSG (identified by its string name).
Definition: fsg_search.c:455
POCKETSPHINX_EXPORT fsg_set_iter_t * fsg_set_iter_next(fsg_set_iter_t *itor)
Advance an iterator to the next grammar in the set.
Definition: fsg_search.c:475
hash_iter_t fsg_set_iter_t
Iterator over finite-state grammars.
Definition: fsg_set.h:64
POCKETSPHINX_EXPORT fsg_model_t * fsg_set_remove(fsg_set_t *fsgs, fsg_model_t *wfsg)
Delete the given FSG from the known collection.
Definition: fsg_search.c:428
POCKETSPHINX_EXPORT fsg_model_t * fsg_set_add(fsg_set_t *fsgs, char const *name, fsg_model_t *wfsg)
Add the given FSG to the collection of FSGs known to this search object.
Definition: fsg_search.c:381
hash_table_t * fsgs
Table of all FSGs loaded.
POCKETSPHINX_EXPORT fsg_set_iter_t * fsg_set_iter(fsg_set_t *fsgs)
Get an iterator over all finite-state grammars in a set.
Definition: fsg_search.c:469
POCKETSPHINX_EXPORT fsg_model_t * fsg_set_remove_byname(fsg_set_t *fsgs, char const *name)
Like fsg_set_del_fsg(), but identifies the FSG by its name.
Definition: fsg_search.c:402
POCKETSPHINX_EXPORT fsg_model_t * fsg_set_iter_fsg(fsg_set_iter_t *itor)
Get the current rule in an FSG iterator.
Definition: fsg_search.c:481
POCKETSPHINX_EXPORT fsg_model_t * fsg_set_get_fsg(fsg_set_t *fsgs, char const *name)
Lookup the FSG associated with the given name.
Definition: fsg_search.c:371
POCKETSPHINX_EXPORT void fsg_set_iter_free(fsg_set_iter_t *itor)
Free an FSG iterator (if the end hasn&#39;t been reached).
Definition: fsg_search.c:487