pocketsphinx-go icon indicating copy to clipboard operation
pocketsphinx-go copied to clipboard

How to retrieve the CommandLn from Config

Open colinarticulate opened this issue 4 years ago • 2 comments

Hi,

I'm trying to get the command line from a config as in the code below:

  cfg := sphinx.NewConfig(
    sphinx.HMMDirOption("/usr/local/share/pocketsphinx/model/en-us/en-us"),
    sphinx.DictFileOption("test/art_db.phone"),
    sphinx.LMFileOption("/usr/local/share/pocketsphinx/model/en-us/en-us.lm.bin"),
  )
  fmt.Println("cfg =", cfg)
  cmdLn := cfg.CommandLn()
  fmt.Println("cmdLn =", cmdLn)

which produces:

cfg = &{map[-dict:test/art_db.phone -hmm:/usr/local/share/pocketsphinx/model/en-us/en-us -lm:/usr/local/share/pocketsphinx/model/en-us/en-us.lm.bin] <nil>}
cmdLn = &{}

It looks like the configuration options are there but the call to CommandLn comes up empty. I guess I must be missing something here so how should I get the command line?

The reason I want the command line is because I'd like to call DefaultSearchArgs to get the -hmm and -lm settings rather than doing it explicitly as I've shown here, and that call expects a []CommandLn parameter

Any help would be welcome. Thanks...

colinarticulate avatar Jul 23 '21 08:07 colinarticulate

Try calling .Deref() on the object

xlab avatar Jul 23 '21 15:07 xlab

Thanks for getting back promptly. Not sure what you mean though, .Deref() on what object, Config, CommandLn? As far as I can see .Deref() is defined on Arg, FsgLink and JSGFRuleIter.

colinarticulate avatar Jul 23 '21 17:07 colinarticulate