docs: add basic example documentation

This commit is contained in:
David Huggins-Daines
2022-08-16 11:48:32 -04:00
parent 1cc4fc4473
commit cc4febfba1
2 changed files with 31 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
PocketSphinx Examples
=====================
This directory contains some examples of basic PocketSphinx library
usage in C and Python. To compile the C example, you can either use
the library directly in-place:
cmake -DBUILD_SHARED_LIBS=OFF .. && make
cc -o simple simple.c -I../include -Iinclude -L. -lpocketsphinx -lm
Or if PocketSphinx is installed:
cc -o simple simple.c $(pkg-config --static --libs --cflags pocketsphinx)
By default it assumes you are running it from this directory,
otherwise you could define `MODELDIR` when compiling, e.g.:
cc -o simple simple.c -DMODELDIR=/my/models \
$(pkg-config --static --libs --cflags pocketsphinx)
The Python script, assuming you have installed the `pocketsphinx5`
module (see [the top-leve README](../README.md) for instructions), can
just be run as-is:
python simple.py
Now speak. It should start printing partial results, and not stop,
until you interrupt it with Control-C, whereupon it will print one
last final result.
+2
View File
@@ -19,7 +19,9 @@ main(int argc, char *argv[])
short buf[BUFLEN];
size_t len;
#ifndef MODELDIR
#define MODELDIR "../model"
#endif
if ((config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.bin",