Skip to content

Commit f562f93

Browse files
author
nshmyrev
committed
Merged KWS branch into trunk
git-svn-id: svn+ssh://svn.code.sf.net/p/cmusphinx/code/trunk/pocketsphinx@12145 94700074-3cef-4d97-a70e-9c8c206c02f5
1 parent b8cba67 commit f562f93

File tree

18 files changed

+954
-14
lines changed

18 files changed

+954
-14
lines changed

include/cmdln_macro.h

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@
4848
#define POCKETSPHINX_OPTIONS \
4949
waveform_to_cepstral_command_line_macro(), \
5050
cepstral_to_feature_command_line_macro(), \
51-
POCKETSPHINX_ACMOD_OPTIONS, \
51+
POCKETSPHINX_ACMOD_OPTIONS, \
5252
POCKETSPHINX_BEAM_OPTIONS, \
5353
POCKETSPHINX_SEARCH_OPTIONS, \
54-
POCKETSPHINX_DICT_OPTIONS, \
55-
POCKETSPHINX_NGRAM_OPTIONS, \
56-
POCKETSPHINX_FSG_OPTIONS, \
54+
POCKETSPHINX_DICT_OPTIONS, \
55+
POCKETSPHINX_NGRAM_OPTIONS, \
56+
POCKETSPHINX_FSG_OPTIONS, \
57+
POCKETSPHINX_KWS_OPTIONS, \
5758
POCKETSPHINX_DEBUG_OPTIONS
5859

5960
/** Options for debugging and logging. */
@@ -173,6 +174,21 @@
173174
"25", \
174175
"Window of frames in lattice to search for successor words in fwdflat search " }
175176

177+
/** Command-line options for keyword spotting */
178+
#define POCKETSPHINX_KWS_OPTIONS \
179+
{ "-kws", \
180+
ARG_STRING, \
181+
NULL, \
182+
"Keyphrase to spot"}, \
183+
{ "-kws_plp", \
184+
ARG_FLOAT64, \
185+
"1e-1", \
186+
"Phone loop probability for keyword spotting" }, \
187+
{ "-kws_threshold", \
188+
ARG_FLOAT64, \
189+
"1", \
190+
"Threshold for p(hyp)/p(alternatives) ratio" }
191+
176192
/** Command-line options for finite state grammars. */
177193
#define POCKETSPHINX_FSG_OPTIONS \
178194
{ "-fsg", \

include/pocketsphinx.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ extern "C" {
6464

6565
#define PS_DEFAULT_SEARCH "default"
6666

67+
#define PS_SEARCH_KWS "kws"
6768
#define PS_SEARCH_FSG "fsg"
6869
#define PS_SEARCH_NGRAM "ngram"
6970

@@ -219,7 +220,7 @@ ps_mllr_t *ps_update_mllr(ps_decoder_t *ps, ps_mllr_t *mllr);
219220
* Actives search with the provided name.
220221
*
221222
* Activates search with the provided name. The search must be added before
222-
* using either ps_set_fsg() or ps_set_lm().
223+
* using either ps_set_fsg(), ps_set_lm() or ps_set_kws().
223224
*
224225
* @see ps_set_fsg
225226
* @see ps_set_fsg
@@ -275,6 +276,28 @@ ps_get_fsg(ps_decoder_t *ps, const char *name);
275276
POCKETSPHINX_EXPORT int
276277
ps_set_fsg(ps_decoder_t *ps, const char *name, fsg_model_t *fsg);
277278

279+
/**
280+
* Get the current Key phrase to spot
281+
*
282+
* If KWS is not enabled, this returns NULL. Call
283+
* ps_update_kws() to enable it.
284+
*
285+
* @return The current keyphrase to spot
286+
*/
287+
POCKETSPHINX_EXPORT const char*
288+
ps_get_kws(ps_decoder_t *ps, const char *name);
289+
290+
/**
291+
* Adds new keyword to spot
292+
*
293+
* Associates KWS search with the provided name. The search can be activated
294+
* using ps_set_search().
295+
*
296+
* @see ps_set_search
297+
*/
298+
POCKETSPHINX_EXPORT int
299+
ps_set_kws(ps_decoder_t *ps, const char *name, const char *keyphrase);
300+
278301
/**
279302
* Reload the pronunciation dictionary from a file.
280303
*

pocketsphinx.sln

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 11.00
3-
# Visual C++ Express 2010
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
44
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pocketsphinx", "win32\pocketsphinx\pocketsphinx.vcxproj", "{94001A0E-A837-445C-8004-F918F10D0226}"
55
EndProject
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pocketsphinx_continuous", "win32\pocketsphinx_continuous\pocketsphinx_continuous.vcxproj", "{1380AF76-C926-44D0-8002-06C228AC869A}"
@@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pocketsphinx_batch", "win32
99
EndProject
1010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pocketsphinx_mdef_convert", "win32\pocketsphinx_mdef_convert\pocketsphinx_mdef_convert.vcxproj", "{AB08A7C9-D327-412E-AB38-1941949F5BE6}"
1111
EndProject
12+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pocketsphinx_kws", "win32\pocketsphinx_kws\pocketsphinx_kws.vcxproj", "{AEAB0D37-783D-4189-A3D2-D665764C8633}"
13+
EndProject
1214
Global
1315
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1416
Debug|Win32 = Debug|Win32
@@ -31,6 +33,10 @@ Global
3133
{AB08A7C9-D327-412E-AB38-1941949F5BE6}.Debug|Win32.Build.0 = Debug|Win32
3234
{AB08A7C9-D327-412E-AB38-1941949F5BE6}.Release|Win32.ActiveCfg = Release|Win32
3335
{AB08A7C9-D327-412E-AB38-1941949F5BE6}.Release|Win32.Build.0 = Release|Win32
36+
{AEAB0D37-783D-4189-A3D2-D665764C8633}.Debug|Win32.ActiveCfg = Debug|Win32
37+
{AEAB0D37-783D-4189-A3D2-D665764C8633}.Debug|Win32.Build.0 = Debug|Win32
38+
{AEAB0D37-783D-4189-A3D2-D665764C8633}.Release|Win32.ActiveCfg = Release|Win32
39+
{AEAB0D37-783D-4189-A3D2-D665764C8633}.Release|Win32.Build.0 = Release|Win32
3440
EndGlobalSection
3541
GlobalSection(SolutionProperties) = preSolution
3642
HideSolutionNode = FALSE

src/libpocketsphinx/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ libpocketsphinx_la_SOURCES = \
1313
fsg_history.c \
1414
fsg_lextree.c \
1515
fsg_search.c \
16+
kws_search.c \
1617
hmm.c \
1718
mdef.c \
1819
ms_gauden.c \
@@ -43,6 +44,7 @@ noinst_HEADERS = \
4344
fsg_history.h \
4445
fsg_lextree.h \
4546
fsg_search_internal.h \
47+
kws_search.h \
4648
hmm.h \
4749
mdef.h \
4850
ms_gauden.h \

0 commit comments

Comments
 (0)