ich einen Code von einer Website kopiert bestimmte Wörter in Python mit pocketsphinx.It obwohl läuft zu hören, gibt aber nie das Schlüsselwort als expected.This mein Code:pocket in Python kehrt zufällige Wörter in Keyword-Suche
import sys, os
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
import pyaudio
# modeldir = "../../../model"
# datadir = "../../../test/data"
modeldir="C://Users//hp//AppData//Local//Programs//Python//Python35//Lib//site-packages//pocketsphinx//model//en-us"
dictdir="C://Users//hp//AppData//Local//Programs//Python//Python35//Lib//site-packages//pocketsphinx//model//cmudict-en-us.dict"
lmdir="C://Users//hp//AppData//Local//Programs//Python//Python35//Lib//site-packages//pocketsphinx//model//en-us.lm.bin"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', modeldir)
config.set_string('-lm', lmdir)
config.set_string('-dict', dictdir)
config.set_string('-keyphrase', 'forward')
config.set_float('-kws_threshold', 1e+20)
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024)
stream.start_stream()
# Process audio chunk by chunk. On keyword detected perform action and restart search
decoder = Decoder(config)
decoder.start_utt()
while True:
buf = stream.read(1024)
if buf:
decoder.process_raw(buf, False, False)
else:
break
if decoder.hyp() != None:
#print(decoder.hyp().hypstr)
if decoder.hyp().hypstr == 'forward':
print ([(seg.word, seg.prob, seg.start_frame, seg.end_frame) for seg in decoder.seg()])
print ("Detected keyword, restarting search")
decoder.end_utt()
decoder.start_utt()
auch wenn ich print(decoder.hyp().hypstr)
es gibt nur zufällige Wörter, wenn ich anything.For ex sprechen, wenn ich ein Wort oder eine Zeile sprechen es gibt:
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the
the da
the head
the bed
the bedding
the heading of
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and
the bedding and well
the bedding and well
the bedding and well
the bedding and butler
the bedding and what lingus
the bedding and what lingus
the bedding and what lingus
the bedding and what lingus ha
the bedding and blessed are
the bedding and blessed are
the bedding and what lingus on
the bedding and what lingus want
the bedding and what lingus want
the bedding and what lingus want
the bedding and what lingus want
the bedding and what lingus want or
the bedding and what lingus want to talk
the bedding and what lingus current top
the bedding and what lingus want to talk
the bedding and what lingus want to talk
the bedding and what lingus want to talk
the bedding and what lingus want to talk
the bedding and what lingus want to talk to her
the bedding and what lingus want to talk to her
the bedding and what lingus want to talk to her
the bedding and what lingus want to talk to her
Bitte helfen Sie mir dabei. Ich bin nur ein Neuling in Python.
Danke für die Antwort.Aber dieser Code ist auch keine Hilfe Bruder.Es erkennt nie Wort "weiter" in der Sprache und druckt nur zufällige Wort, wenn ich mit ihm sprechen.Ist es etwas, was ich in dem Modell fehlt? – TechieBoy101
Wenn ich sage 'Vorwärts' dies ist die Ausgabe oh oh oh aber oh aber oh aber oh aber oh aber oh oh aber oh oh aber oh oh aber oh oh aber oh oh, aber oh oh aber oh oh aber oh oh aber oh Apfel oder Anwalt oh aber oh Apfel rick oh aber oh Apfel befreien oh aber oh Apfel rick aber oh aber oh Apfel rick vor oh aber oh Apfel rick Ball oh aber oh Apfel oder Lord Butler oh aber oh Apfel rick Ball oh aber oh Apfel rick Bar waren oh aber oh Apfel rick vor unserer Arbeit oh aber oh apple rick vor unserem Wort
Kein Zeichen von 'Detected keywo ...' was bedeutet, dass es das Schlüsselwort nie identifiziert. – TechieBoy101
All dies bedeutet, dass die "Übersetzung" von Taschensphinx nicht sehr genau ist mit den Daten, die Sie hineinlegen. Deshalb, wie ich schon sagte, müssen Sie einige (viele) Male versuchen, bevor pocketsphinx Ihr Wort richtig erkennt. Ich verstehe, wie unbefriedigend das ist. Sie müssen dann sehen, ** die Genauigkeit ** Ihrer Anerkennung zu erhöhen, und ** richtig implementieren "heißen Wort hören". Die Links dazu finden Sie in meiner ursprünglichen Antwort. –