Skip to content

Commit

Permalink
Merge pull request #295 from cmusphinx/vade_retro_sphinxbase
Browse files Browse the repository at this point in the history
Vade retro sphinxbase
  • Loading branch information
dhdaines committed Sep 16, 2022
2 parents 5a1370c + 206ff35 commit 8f098b8
Show file tree
Hide file tree
Showing 281 changed files with 3,951 additions and 4,445 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

configure_file(config.h.in config.h)
configure_file(sphinx_config.h.in include/sphinxbase/sphinx_config.h)
configure_file(sphinx_config.h.in include/pocketsphinx/sphinx_config.h)
add_definitions(-DHAVE_CONFIG_H)

if(SKBUILD)
Expand Down Expand Up @@ -101,14 +101,14 @@ else()
add_subdirectory(src)
add_subdirectory(model)
add_subdirectory(doxygen)
add_subdirectory(include)
add_subdirectory(programs)
add_subdirectory(examples)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(test)
endif()
configure_file(pocketsphinx.pc.in pocketsphinx.pc @ONLY)
install(TARGETS pocketsphinx LIBRARY)
install(DIRECTORY include TYPE INCLUDE)
install(FILES ${CMAKE_BINARY_DIR}/pocketsphinx.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()

Expand Down
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,26 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

JSON parser (in src/jsmn.h):

Copyright (c) 2010 Serge A. Zaitsev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

123 changes: 68 additions & 55 deletions cython/_pocketsphinx.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Author: David Huggins-Daines <[email protected]>


cdef extern from "sphinxbase/err.h":
cdef extern from "pocketsphinx/err.h":
cdef enum err_e:
ERR_DEBUG,
ERR_INFO,
Expand All @@ -23,7 +23,7 @@ cdef extern from "sphinxbase/err.h":
const char *err_set_loglevel_str(const char *lvl)


cdef extern from "sphinxbase/logmath.h":
cdef extern from "pocketsphinx/logmath.h":
ctypedef struct logmath_t:
pass

Expand All @@ -44,12 +44,12 @@ cdef extern from "sphinxbase/logmath.h":

int logmath_get_zero(logmath_t *lmath)

cdef extern from "sphinxbase/fe.h":
cdef extern from "fe/fe.h":
ctypedef struct fe_t:
pass
int fe_get_output_size(fe_t *fe)

cdef extern from "sphinxbase/hash_table.h":
cdef extern from "util/hash_table.h":
ctypedef struct hash_table_t:
pass
ctypedef struct hash_entry_t:
Expand All @@ -61,57 +61,27 @@ cdef extern from "sphinxbase/hash_table.h":
const char *hash_entry_key(hash_entry_t *ent)


cdef extern from "sphinxbase/ckd_alloc.h":
cdef extern from "util/ckd_alloc.h":
void *ckd_alloc_2d_ptr(size_t d1,
size_t d2,
void *store,
size_t elem_size)
void ckd_free(void *ptr)


cdef extern from "sphinxbase/cmd_ln.h":
ctypedef struct arg_t:
const char *name
int type
const char *deflt
const char *doc
ctypedef struct cmd_ln_t:
cdef extern from "util/cmd_ln.h":
ctypedef struct pocketsphinx_config_t:
hash_table_t *ht
const arg_t *defn
cdef enum:
ARG_REQUIRED,
ARG_INTEGER,
ARG_FLOATING,
ARG_STRING,
ARG_BOOLEAN,
REQARG_INTEGER,
REQARG_FLOATING,
REQARG_STRING,
REQARG_BOOLEAN
ctypedef struct cmd_ln_val_t:
int type

cmd_ln_t *cmd_ln_parse_r(cmd_ln_t *inout_cmdln, arg_t *defn,
int argc, char **argv, int strict)
cmd_ln_t *cmd_ln_parse_file_r(cmd_ln_t *inout_cmdln, arg_t *defn,
const char *path, int strict)
cmd_ln_t *cmd_ln_retain(cmd_ln_t *cmdln)
int cmd_ln_free_r(cmd_ln_t *cmdln)

double cmd_ln_float_r(cmd_ln_t *cmdln, const char *name)
int cmd_ln_type_r(cmd_ln_t *cmdln, const char *name)
long cmd_ln_int_r(cmd_ln_t *cmdln, const char *name)
const char *cmd_ln_str_r(cmd_ln_t *cmdln, const char *name)
void cmd_ln_set_str_r(cmd_ln_t *cmdln, const char *name, const char *str)
void cmd_ln_set_str_extra_r(cmd_ln_t *cmdln, const char *name, const char *str)
void cmd_ln_set_int_r(cmd_ln_t *cmdln, const char *name, long iv)
void cmd_ln_set_float_r(cmd_ln_t *cmdln, const char *name, double fv)
cmd_ln_val_t *cmd_ln_access_r(cmd_ln_t *cmdln, const char *name)

int cmd_ln_exists_r(cmd_ln_t *cmdln, const char *name)


cdef extern from "sphinxbase/ngram_model.h":
void cmd_ln_set_str_extra_r(ps_config_t *config,
const char *name, const char *str)
ps_config_t *cmd_ln_parse_file_r(ps_config_t *inout_cmdln, arg_t *defn,
const char *path, int strict)


cdef extern from "lm/ngram_model.h":
cdef enum ngram_file_type_e:
NGRAM_INVALID,
NGRAM_AUTO,
Expand All @@ -128,7 +98,7 @@ cdef extern from "sphinxbase/ngram_model.h":
pass
ctypedef struct ngram_model_set_iter_t:
pass
ngram_model_t *ngram_model_read(cmd_ln_t *config,
ngram_model_t *ngram_model_read(ps_config_t *config,
const char *file_name,
ngram_file_type_t file_type,
logmath_t *lmath)
Expand Down Expand Up @@ -186,12 +156,12 @@ cdef extern from "sphinxbase/ngram_model.h":
const char *classname,
const char *word,
float weight)
ngram_model_t *ngram_model_set_init(cmd_ln_t *config,
ngram_model_t *ngram_model_set_init(ps_config_t *config,
ngram_model_t **models,
char **names,
const float *weights,
int n_models)
ngram_model_t *ngram_model_set_read(cmd_ln_t *config,
ngram_model_t *ngram_model_set_read(ps_config_t *config,
const char *lmctlfile,
logmath_t *lmath)
int ngram_model_set_count(ngram_model_t *set)
Expand Down Expand Up @@ -225,7 +195,7 @@ cdef extern from "sphinxbase/ngram_model.h":
void ngram_model_flush(ngram_model_t *lm)


cdef extern from "sphinxbase/fsg_model.h":
cdef extern from "lm/fsg_model.h":
ctypedef struct fsg_model_t:
int start_state
int final_state
Expand Down Expand Up @@ -256,7 +226,7 @@ cdef extern from "sphinxbase/fsg_model.h":
void fsg_model_writefile_symtab(fsg_model_t *fsg, const char *file)


cdef extern from "sphinxbase/jsgf.h":
cdef extern from "lm/jsgf.h":
ctypedef struct jsgf_t:
pass
ctypedef struct jsgf_rule_t:
Expand Down Expand Up @@ -329,20 +299,64 @@ cdef extern from "pocketsphinx/lattice.h":
int ps_lattice_n_frames(ps_lattice_t *dag)


# Still need this unfortunately
cdef extern from "util/cmd_ln.h":
ctypedef struct ps_config_t:
hash_table_t *ht
arg_t *defn
ps_config_t *ps_config_parse_args(const arg_t *defn, int argc, char **argv)

cdef extern from "pocketsphinx.h":
cdef enum ps_type_t:
ARG_REQUIRED,
ARG_INTEGER,
ARG_FLOATING,
ARG_STRING,
ARG_BOOLEAN,
REQARG_INTEGER,
REQARG_FLOATING,
REQARG_STRING,
REQARG_BOOLEAN
ctypedef struct arg_t:
const char *name
int type
const char *deflt
const char *doc
ctypedef struct ps_decoder_t:
pass
ctypedef struct ps_seg_t:
pass
ctypedef struct ps_nbest_t:
pass
ctypedef union anytype_t:
long i
float fl
void *ptr
ps_config_t *ps_config_init(const arg_t *defn)
ps_config_t *ps_config_retain(ps_config_t *config)
int ps_config_free(ps_config_t *config)
ps_config_t *ps_config_parse_json(ps_config_t *config, const char *json)
const char *ps_config_serialize_json(ps_config_t *config)
ps_type_t ps_config_typeof(ps_config_t *config, const char *name)
const anytype_t *ps_config_get(ps_config_t *config, const char *name)
const anytype_t *ps_config_set(ps_config_t *config, const char *name,
const anytype_t *val, ps_type_t t)
long ps_config_int(ps_config_t *config, const char *name)
int ps_config_bool(ps_config_t *config, const char *name)
double ps_config_float(ps_config_t *config, const char *name)
const char *ps_config_str(ps_config_t *config, const char *name)
const anytype_t *ps_config_set_int(ps_config_t *config, const char *name, long val)
const anytype_t *ps_config_set_bool(ps_config_t *config, const char *name, int val)
const anytype_t *ps_config_set_float(ps_config_t *config, const char *name, double val)
const anytype_t *ps_config_set_str(ps_config_t *config, const char *name, const char *val)
arg_t *ps_args()
ps_decoder_t *ps_init(cmd_ln_t *config)
ps_decoder_t *ps_init(ps_config_t *config)
int ps_free(ps_decoder_t *ps)
const char *ps_default_modeldir()
void ps_default_search_args(cmd_ln_t *config)
int ps_reinit(ps_decoder_t *ps, cmd_ln_t *config)
int ps_reinit_feat(ps_decoder_t *ps, cmd_ln_t *config)
void ps_default_search_args(ps_config_t *config)
void ps_expand_model_config(ps_config_t *config)
int ps_reinit(ps_decoder_t *ps, ps_config_t *config)
int ps_reinit_feat(ps_decoder_t *ps, ps_config_t *config)
const char *ps_get_cmn(ps_decoder_t *ps, int update)
int ps_set_cmn(ps_decoder_t *ps, const char *cmn)
logmath_t *ps_get_logmath(ps_decoder_t *ps)
Expand Down Expand Up @@ -378,9 +392,8 @@ cdef extern from "pocketsphinx.h":
double *out_ncpu, double *out_nwall)
void ps_get_all_time(ps_decoder_t *ps, double *out_nspeech,
double *out_ncpu, double *out_nwall)
fe_t *ps_get_fe(ps_decoder_t *ps)
int ps_get_n_frames(ps_decoder_t *ps)
cmd_ln_t *ps_get_config(ps_decoder_t *ps)
ps_config_t *ps_get_config(ps_decoder_t *ps)
int ps_load_dict(ps_decoder_t *ps, const char *dictfile,
const char *fdictfile, const char *format)
int ps_save_dict(ps_decoder_t *ps, const char *dictfile,
Expand Down
Loading

0 comments on commit 8f098b8

Please sign in to comment.