【问题标题】:How to detect wake word or if any word was said如何检测唤醒词或是否说出任何词
【发布时间】:2019-07-11 18:17:20
【问题描述】:

还没有找到一种方法来运行 Pocketsphinx 包装器,它应该可以很容易地知道哪些词已经说过

提供的一些代码看起来很像这样

from pocketsphinx import LiveSpeech

speech = LiveSpeech(lm=False, keyphrase='forward', kws_threshold=1e-20)
for phrase in speech:
    print(phrase.segments(detailed=True))

但是没有任何效果,我的终端输出实际上什么也没说。只是空白。如何检测任何唤醒词?

【问题讨论】:

    标签: python pocketsphinx


    【解决方案1】:

    我的解决方法是将运行 Pocketsphinx 的命令变成一个子进程,并将输出通过管道传输到我的 python 脚本中。

    import subprocess
    p = subprocess.Popen("pocketsphinx_continuous -inmic yes", stdout=subprocess.PIPE, bufsize=1, shell=True)
    for line in iter(p.stdout.readline, b''):
        print line.upper(),
    p.stdout.close()
    p.wait()
    

    显示“print line.upper()”的行在终端中看起来像

    INFO: continuous.c(275): Ready...
    INFO: continuous.c(261): Listening...
    A lot of various pieces of information
    THE WORDS YOU SAID
    

    这是实时工作的!

    【讨论】:

      猜你喜欢
      • 2021-04-19
      • 1970-01-01
      • 2022-06-21
      • 1970-01-01
      • 2021-11-29
      • 2011-06-10
      • 1970-01-01
      • 1970-01-01
      • 2017-12-12
      相关资源
      最近更新 更多