Exception when word is missing in the dictionary - pocketsphinx-android

I tried the demo app, it works fine but when I tried to integrate my own .jsgf grammar file it is giving error when I tried same thing using .lm file for the same dictionary it is working fine .
I referred to PocketSphinx android demo runtime exception link but it didn't help me out
Following is the code snippet:
private void setupRecognizer(File assetsDir) throws IOException {
// The recognizer can be configured to perform multiple searches
// of different kind and switch between them
File modelsDir = new File(assetsDir, "models");
mRecognizer = defaultSetup()
.setAcousticModel(new File(assetsDir, "en-us-ptm"))
.setDictionary(new File(assetsDir, "cmudict-en-us.dict"))
.setRawLogDir(assetsDir)
.setKeywordThreshold(1e-10f)
.setFloat("-beam", 1e-30f)
.setBoolean("-allphone_ci", true)
.getRecognizer();
mRecognizer.addListener(this);
File languageModel = new File(assetsDir, "commands_gram.gram");
mRecognizer.addGrammarSearch(COMMANDS, languageModel);
}
Following is the error
E/cmusphinx: ERROR: "fsg_search.c", line 141: The word 'next' is missing in the dictionary
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.RuntimeException: Decoder_setJsgfFile returned -1
at edu.cmu.pocketsphinx.PocketSphinxJNI.Decoder_setJsgfFile(Native Method)
at edu.cmu.pocketsphinx.Decoder.setJsgfFile(Decoder.java:139)
at edu.cmu.pocketsphinx.SpeechRecognizer.addGrammarSearch(SpeechRecognizer.java:234)
at com.package.ui.SphinxSpeechRecognizerActivity.setupRecognizer(SphinxSpeechRecognizerActivity.java:284)
at com.package.ui.SphinxSpeechRecognizerActivity.access$400(SphinxSpeechRecognizerActivity.java:29)
at com.package.ui.SphinxSpeechRecognizerActivity$3.doInBackground(SphinxSpeechRecognizerActivity.java:239)
at com.package.ui.SphinxSpeechRecognizerActivity$3.doInBackground(SphinxSpeechRecognizerActivity.java:233)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818) 
Also I realized that any .jsgf grammar file I am using it is not detecting the last word from the dictionary. before it was working fine after I changed to my own .jsgf grammar file it is giving exception

This line:
E/cmusphinx: ERROR: "fsg_search.c", line 141: The word 'next' is missing in the dictionary
tells you need to add the word 'next' to the dictionary. You used this word in your JSGF grammar, but it was missing in the dictionary. Words are case-sensitive, so you need to make sure you use proper case.

I maybe know your problem.
Your have to make the grammar in correct form,like your space and tab.
I suggest you checking your grammar for block or tab.
Sorry my poor English.

Related

Liquidsoap Icecast request.dynamic error

I would like to create dynamic playlist with liquidesoap and icecast. I've just copied the tutorial from the liquidsoap website but unfortunately it does not work.
This is my code:
def get_next() =
result = list.hd(get_process_lines("/var/www/radiod/yii program-generator/next-track 1"))
# Create and return a request using this result
request.create(result)
end
# Create the source
s = request.dynamic(id="s", get_next)
# Output
source = output.icecast(%mp3, host="localhost", port=8000, mount="opera.mp3", password="asd123", s)
I get this error message when I run the check command:
Invalid value at line 9, char 20-37: That source is fallible.
So, the problem will be around this line:
s = request.dynamic(id="s", get_next)
Can you help me what could be the failure?
Thanking you in advance!
http://savonet.sourceforge.net/doc-svn/quick_start.html covers "That source is fallible." in detail. Might want to go through the whole page.

Bitbake the latest Gstreamer in Yocto Morty

I would like to bitbake the latest Gstreamer in Yocto Morty, but the error has occured and could not implement the Gstreamer.
I found the gstreamer 1.12.2 recipe at https://github.com/dv1/meta-gstreamer1.0.
So I put meta-gstreamer1.0 directory in sources directory and add BBLAYERS += " ${BSPDIR}/sources/meta-gstreamer1.0 " to build_fb/bblayers.conf.
Then I bitbaked fsl-image-gui and following errors are occured.
ERROR: /home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12.2.bb: Error executing a python function in <code>:
The stack trace of python calls that resulted in this exception/failure was:
File: '<code>', lineno: 13, function: <module>
0009:__anon_35__home_***_var_fslc_yocto_sources_poky_meta_classes_devshell_bbclass(d)
0010:__anon_108__home_***_var_fslc_yocto_sources_poky_meta_classes_sstate_bbclass(d)
0011:__anon_45__home_***_var_fslc_yocto_sources_poky_meta_classes_blacklist_bbclass(d)
0012:__anon_158__home_***_var_fslc_yocto_sources_poky_meta_classes_siteinfo_bbclass(d)
*** 0013:__anon_30__home_***_var_fslc_yocto_sources_meta_gstreamer1_0_recipes_multimedia_gstreamer_gstreamer1_0_omx_inc(d)
File: '/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-omx.inc', lineno: 22, function: __anon_30__home_***_var_fslc_yocto_sources_meta_gstreamer1_0_recipes_multimedia_gstreamer_gstreamer1_0_omx_inc
0018:EXTRA_OECONF += "--disable-valgrind --with-omx-target=${GSTREAMER_1_0_OMX_TARGET}"
0019:
0020:python __anonymous () {
0021: omx_target = d.getVar("GSTREAMER_1_0_OMX_TARGET")
*** 0022: if omx_target in ['generic', 'bellagio']:
0023: # Bellagio headers are incomplete (they are missing the OMX_VERSION_MAJOR,#
0024: # OMX_VERSION_MINOR, OMX_VERSION_REVISION, and OMX_VERSION_STEP macros);
0025: # appending a directory path to gst-omx' internal OpenMAX IL headers fixes this
0026: d.appendVar("CFLAGS", " -I${S}/omx/openmax")
Exception: TypeError: getVar() missing 1 required positional argument: 'expand'
ERROR: ExpansionError during parsing /home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.12.2.bb
Traceback (most recent call last):
File "/home/***/var-fslc-yocto/sources/poky/meta/classes/base.bbclass", line 375, in __anon_656__home_***_var_fslc_yocto_sources_poky_meta_classes_base_bbclass(d=<bb.data_smart.DataSmart object at 0x7fb7a8dcff98>):
pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
> pn = d.getVar("PN", True)
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 569, in DataSmart.getVar(var='PACKAGECONFIG', expand=True, noweakdefault=False, parsing=False):
def getVar(self, var, expand, noweakdefault=False, parsing=False):
> return self.getVarFlag(var, "_content", expand, noweakdefault, parsing)
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 737, in DataSmart.getVarFlag(var='PACKAGECONFIG', flag='_content', expand=True, noweakdefault=False, parsing=False):
cachename = var + "[" + flag + "]"
> value = self.expand(value, cachename)
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 410, in DataSmart.expand(s=" ${GSTREAMER_ORC} ${PACKAGECONFIG_GL} ${#bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} ${#bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan', d)} ${#bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp ", varname='PACKAGECONFIG'):
def expand(self, s, varname = None):
> return self.expandWithRefs(s, varname).value
File "/home/***/var-fslc-yocto/sources/poky/bitbake/lib/bb/data_smart.py", line 400, in DataSmart.expandWithRefs(s=" orc gles2 egl ${#bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} ${#bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan', d)} ${#bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp ", varname='PACKAGECONFIG'):
except Exception as exc:
> raise ExpansionError(varname, s, exc) from exc
bb.data_smart.ExpansionError: Failure expanding variable PACKAGECONFIG, expression was orc gles2 egl ${#bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} ${#bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan', d)} ${#bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp which triggered exception AttributeError: module 'bb.utils' has no attribute 'filter'
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
I found the error "Exception: TypeError: getVar() missing 1 required positional argument: 'expand'" is fixed in Yocto 2.3(Pyro) at https://bugzilla.yoctoproject.org/show_bug.cgi?id=3314.
Furthermore, YP core says gstreamer version for Yocto Morty is 1.8.3 (see https://www.yoctoproject.org/downloads/core/morty22 updates tab).
Do these things mean that we cannot implement gstreamer 1.12.2 or later version in Yocto Morty? Are there any way to do it? Do we have to use Yocto Pyro or later version if we want to implement gstreamer 1.12?
Environment
Yocto Morty (2.2.1) https://github.com/varigit/variscite-bsp-platform/tree/morty#variscite-release-notes
PS:
I rewrite getVar and bitbake proceeded.However I got following error.Would someone help me?
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_populate_sysroot: The recipe gstreamer1.0-plugins-base is trying to install files into a shared area when those files already exist. Those files and their manifest location are:
/home/***/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/lib/gstreamer-1.0/libgstrawparse.la
Matched in b'manifest-imx6ul-var-dart-gstreamer1.0-plugins-bad.populate_sysroot'
/home/***/var-fslc-yocto/build_fb/tmp/sysroots/imx6ul-var-dart/usr/lib/gstreamer-1.0/libgstrawparse.so
Matched in b'manifest-imx6ul-var-dart-gstreamer1.0-plugins-bad.populate_sysroot'
Please verify which recipe should provide the above files.
The build has stopped as continuing in this scenario WILL break things, if not now, possibly in the future (we've seen builds fail several months later). If the system knew how to recover from this automatically it would however there are several different scenarios which can result in this and we don't know which one this is. It may be you have switched providers of something like virtual/kernel (e.g. from linux-yocto to linux-yocto-dev), in that case you need to execute the clean task for both recipes and it will resolve this error. It may be you changed DISTRO_FEATURES from systemd to udev or vice versa. Cleaning those recipes should again resolve this error however switching DISTRO_FEATURES on an existing build directory is not supported, you should really clean out tmp and rebuild (reusing sstate should be safe). It could be the overlapping files detected are harmless in which case adding them to SSTATE_DUPWHITELIST may be the correct solution. It could also be your build is including two different conflicting versions of things (e.g. bluez 4 and bluez 5 and the correct solution for that would be to resolve the conflict. If in doubt, please ask on the mailing list, sharing the error and filelist above.
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_populate_sysroot: If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_populate_sysroot: Function failed: sstate_task_postfunc
ERROR: Logfile of failure stored in: /home/***/var-fslc-yocto/build_fb/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/gstreamer1.0-plugins-base/1.12.2-r0/temp/log.do_populate_sysroot.99466
ERROR: Task (/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.12.2.bb:do_populate_sysroot) failed with exit code '1'
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_package: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:split_gstreamer10_packages(d)
0003:
File: '/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gst-plugins-package.inc', lineno: 6, function: split_gstreamer10_packages
0002:PACKAGESPLITFUNCS_append = " set_metapkg_rdepends "
0003:
0004:python split_gstreamer10_packages () {
0005: gst_libdir = d.expand('${libdir}/gstreamer-${LIBV}')
*** 0006: postinst = d.getVar('plugin_postinst')
0007: glibdir = d.getVar('libdir')
0008:
0009: do_split_packages(d, glibdir, '^lib(.*)\.so\.*', 'lib%s', 'gstreamer %s library', extra_depends='', allow_links=True)
0010: do_split_packages(d, gst_libdir, 'libgst(.*)\.so$', d.expand('${PN}-%s'), 'GStreamer plugin for %s', postinst=postinst, extra_depends='')
Exception: TypeError: getVar() missing 1 required positional argument: 'expand'
ERROR: gstreamer1.0-plugins-base-1.12.2-r0 do_package: Function failed: split_gstreamer10_packages
ERROR: Logfile of failure stored in: /home/***/var-fslc-yocto/build_fb/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/gstreamer1.0-plugins-base/1.12.2-r0/temp/log.do_package.99465
ERROR: Task (/home/***/var-fslc-yocto/sources/meta-gstreamer1.0/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.12.2.bb:do_package) failed with exit code '1'
Since you are migrating recipe for older version of Yocto into a newer, you must be facing consequences of this change in Yocto: expand parameter (the second one) to getVar() and getVarFlag() has become mandatory (from bitbake user manual for morty), previously it was defaulted to False. So, you should correct all occurrences of these operations and add at least False as a second argument.

Bug in error handling logic in google.cloud.ml.dataflow.batch_prediction.PredictionDoFn

I'm looking at the latest version (obtained from gs://cloud-ml/sdk/cloudml-0.1.9-alpha.dataflow.tar.gz)
On lines 153-159 of google/cloud/ml/dataflow/batch_prediction.py, we have the following code:
except Exception as e: # pylint: disable=broad-except
logging.error("Got an unknown exception: [%s].", traceback.format_exc())
if self._cloud_logger:
self._cloud_logger.write_error_message(
str(e), self._create_snippet(context.element))
yield beam.pvalue.SideOutputValue("errors",
(e.error_message, context.element))
However, the Exception object e may not have the attribute error_message. This occasionally gives me errors like the following:
AttributeError: 'exceptions.RuntimeError' object has no attribute 'error_message' [while running 'Evaluate/ParDo(PredictionDoFn)']
AttributeError: 'exceptions.KeyError' object has no attribute 'error_message' [while running 'Evaluate/ParDo(PredictionDoFn)']
etc
I assume these errors should not be raised, because the whole point of the except block is to catch those errors and pass them out of the ParDo as a side output.
Thanks for reporting this! We've fixed it and a good version should be available in next release very soon.

pxssh.pxssh() is producing error in python

I got the following errors when I run pxssh.pxssh() in python. Please let me know what I am missing here.
Exception AttributeError: "'pxssh' object has no attribute 'closed'" in <bound method pxssh.__del__ of <pexpect.pxssh.pxssh object at 0x10d98e910>> ignored
.........
File "/Users/any_user/system/somelibrary_lib.py", line 377, in login
ssh = pxssh.pxssh(maxread=read_buffer, ignore_sighup=False)
TypeError: __init__() got an unexpected keyword argument 'ignore_sighup'
.........
I faced the same problem. the solution was like this :
s = pxssh.pxssh(timeout=time_out, maxread=2000000)
s.SSH_OPTS += " -o StrictHostKeyChecking=no"
s.SSH_OPTS += " -o UserKnownHostsFile=/dev/null"
You should add this two options
I faced the same problem. Solution I found was to use SSH_OPTS property of pxssh object instead of options ctor (__init__) argument.
So my code looks like this:
s = pxssh.pxssh()
s.SSH_OPTS += " -o StrictHostKeyChecking=no"
s.force_password = True
s.login(ip, user, passwd)
It doesn't throw AttributeError exception on module initialization and TypeError too.
But it still doesn't work for me. If the remote server has MOTD or some shell initialization on startup, it would break the logic of pxssh. I made the following trick:
s.login(ip, user, passwd, original_prompt = "Last login:")
Shell writes on each successful login line like Last login: %date% from %ip%. I used it to verify successful logon. Now, using s you can execute remote commands.
Original (default) value for original_prompt is r"[#$]". May be you need somehow to combine them for correct pxssh work. May be you need to add > to original_prompt if you are connecting to SQL shell or Cisco devices.

Weka 3-7 CSVLoader do not work with ";" (semicolon) as field separator

I think that i found a bug in weka 3.7,
When I try to load a csv file using weka.core.converters.CSVLoader with separator ";", I get the following error:
Exception in thread "main" java.io.IOException: number expected, read Token[1;2], line 1
at weka.core.converters.ArffLoader$ArffReader.errorMessage(ArffLoader.java:294)
at weka.core.converters.ArffLoader$ArffReader.getInstanceFull(ArffLoader.java:656)
at weka.core.converters.ArffLoader$ArffReader.getInstance(ArffLoader.java:477)
at weka.core.converters.ArffLoader$ArffReader.readInstance(ArffLoader.java:445)
at weka.core.converters.ArffLoader$ArffReader.readInstance(ArffLoader.java:430)
at weka.core.converters.ArffLoader$ArffReader.(ArffLoader.java:202)
at weka.core.converters.CSVLoader.getDataSet(CSVLoader.java:803)
at de.tuhh.thesis.repower.pcanalysis.BinningWindSpeed.from_CSV_to_ARFF(BinningWindSpeed.java:99)
at de.tuhh.thesis.repower.pcanalysis.Main.main(Main.java:49)
My csv file is:
a;b
1;2
my code is:
CSVLoader loader = new CSVLoader();
File inputFile = new File(csvFileName);
loader.setSource(inputFile);
loader.setFieldSeparator(";");
data = loader.getDataSet();
if I try the same code but changing ";" for "," and using the following file, the program succeeds
a,b
1,2
I really need to work with ";"
Thanks and regards
There is (at least by now) an option to set the field separator:
CSVLoader loader = new CSVLoader();
loader.setFieldSeparator(";");
Just in case someone else stumbles upon this question..