Fix link errors

This commit is contained in:
Gregory John Casamento 2020-02-03 07:56:55 -05:00
parent 2f8e9656a3
commit 20fefae849
4 changed files with 31 additions and 4 deletions

View file

@ -19,7 +19,7 @@ GSSpeechRecognitionServer_OBJC_FILES = \
ifeq ($(GSSPEECHRECOGNITIONENGINE), Pocketsphinx)
POCKETSPHINX_BASE_LIBS = -lpocketsphinx
POCKETSPHINX_BASE_LIBS = -lpocketsphinx -lsphinxbase -lsphinxad
# Add includes and link dirs.... need to replace triplet.
GSSpeechRecognitionServer_OBJC_FILES += PocketsphinxSpeechRecognitionEngine.m

View file

@ -5,19 +5,44 @@
* Implementation of a speech engine using pocketsphinx. This should be the default
* for resource-constrained platforms.
*/
#define MODELDIR "/share/pocketsphinx/model"
/*
ps_decoder_t *ps = NULL;
cmd_ln_t *config = NULL;
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.bin",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
NULL);
*/
@interface PocketsphinxSpeechRecognitionEngine : GSSpeechRecognitionEngine
{
ps_decoder_t *ps;
cmd_ln_t *config;
}
@end
@implementation PocketsphinxSpeechRecognitionEngine
+ (void)initialize
{
}
- (id)init
{
if (nil == (self = [super init])) { return nil; }
if (nil != (self = [super init]))
{
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.bin",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
NULL);
ps = ps_init(config);
}
return self;
}
@ -32,8 +57,10 @@
@end
@implementation GSSpeechRecognitionEngine (Pocketsphinx)
+ (GSSpeechRecognitionEngine*)defaultSpeechRecognitionEngine
{
return [[[PocketsphinxSpeechRecognitionEngine alloc] init] autorelease];
}
@end

2
configure vendored
View file

@ -5736,7 +5736,7 @@ done
if test $have_pocketsphinx = yes -a $have_speech_recognizer = yes -a $enable_speech_recognizer = yes; then
BUILD_SPEECH_RECOGNIZER="speech_recognizer"
POCKETSPHINX_BASE_LIBS="-lpocketsphinx"
POCKETSPHINX_BASE_LIBS="-lpocketsphinx -lsphinxbase -lsphinxad"
fi

View file

@ -551,7 +551,7 @@ AC_CHECK_LIB(pocketsphinx, ps_start_utt, have_speech_recognizer=yes, have_speech
AC_CHECK_HEADERS(pocketsphinx/pocketsphinx_export.h, have_pocketsphinx=yes, have_pocketsphinx=no)
if test $have_pocketsphinx = yes -a $have_speech_recognizer = yes -a $enable_speech_recognizer = yes; then
BUILD_SPEECH_RECOGNIZER="speech_recognizer"
POCKETSPHINX_BASE_LIBS="-lpocketsphinx"
POCKETSPHINX_BASE_LIBS="-lpocketsphinx -lsphinxbase -lsphinxad"
fi
AC_SUBST(BUILD_SPEECH_RECOGNIZER)