如何使用gstreamer在pocketsphinx中设置配置选项(How to set configuration options in pocketsphinx using gstreamer)

编程入门 行业动态 更新时间:2024-10-27 17:11:32
如何使用gstreamer在pocketsphinx中设置配置选项(How to set configuration options in pocketsphinx using gstreamer) python

可能是一个非常愚蠢的问题,但我无法在任何地方找到解决方案。 当我运行'gst-inspect-1.0 pocketsphinx'时,我会得到类似的东西:

Current configuration: [NAME] [DEFLT] [VALUE] -agc none none -agcthresh 2.0 2.000000e+00 -allphone ... Element Properties: name : The name of the object flags: readable, writable String. Default: "pocketsphinx0" ...

我知道如何设置'元素属性'的值,但是如何设置其他配置选项的值? 例如,我想为'keyphrase'设置一个值,但是做类似的事情

asr.set_property("keyphrase", "test")

要么

asr.set_property("-keyphrase", "test")

回报

TypeError: object of type `GstPocketSphinx' does not have property `keyphrase'

Probably a very silly question, but I cannot find a solution anywhere. When I run 'gst-inspect-1.0 pocketsphinx' I get something like:

Current configuration: [NAME] [DEFLT] [VALUE] -agc none none -agcthresh 2.0 2.000000e+00 -allphone ... Element Properties: name : The name of the object flags: readable, writable String. Default: "pocketsphinx0" ...

I know how to set values for the 'element properties', but how do I set values for the other configuration options? e.g. I'd like to set a value for 'keyphrase' but doing something like

asr.set_property("keyphrase", "test")

or

asr.set_property("-keyphrase", "test")

returns

TypeError: object of type `GstPocketSphinx' does not have property `keyphrase'

最满意答案

您需要修改插件源以引入新属性:

g_object_class_install_property (gobject_class, PROP_KEYPHRASE, g_param_spec_string("keyphrase", "Keyspotting phrase", "Keyspotting phrase", NULL, G_PARAM_READWRITE)); .... case PROP_KEYPHRASE: gst_pocketsphinx_set_string(ps, "-keyphrase", value);

You need to modify plugin sources to introduce new properties:

g_object_class_install_property (gobject_class, PROP_KEYPHRASE, g_param_spec_string("keyphrase", "Keyspotting phrase", "Keyspotting phrase", NULL, G_PARAM_READWRITE)); .... case PROP_KEYPHRASE: gst_pocketsphinx_set_string(ps, "-keyphrase", value);

更多推荐

本文发布于:2023-07-29 18:25:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1318589.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   选项   gstreamer   options   pocketsphinx

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!