Refactor test statistics, change buffer_size to mean bytes, and
add pocketsphinx calculation to precise-evalpull/10/head
parent
32a001511e
commit
2878e8f963
|
@ -35,11 +35,17 @@ class PocketsphinxListener:
|
|||
config.set_int('-nfft', 2048)
|
||||
config.set_string('-logfn', '/dev/null')
|
||||
self.key_phrase = key_phrase
|
||||
self.decoder = Decoder(config)
|
||||
self.buffer = b'\0' * pr.sample_depth * pr.buffer_samples
|
||||
self.pr = pr
|
||||
self.read_size = -1 if chunk_size == -1 else pr.sample_depth * chunk_size
|
||||
|
||||
try:
|
||||
self.decoder = Decoder(config)
|
||||
except RuntimeError:
|
||||
options = dict(key_phrase=key_phrase, dict_file=dict_file,
|
||||
hmm_folder=hmm_folder, threshold=threshold)
|
||||
raise RuntimeError('Invalid Pocketsphinx options: ' + str(options))
|
||||
|
||||
def _transcribe(self, byte_data):
|
||||
self.decoder.start_utt()
|
||||
self.decoder.process_raw(byte_data, False, False)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# limitations under the License.
|
||||
import json
|
||||
|
||||
from os.path import isfile, isdir
|
||||
from prettyparse import create_parser
|
||||
|
||||
from precise.network_runner import Listener
|
||||
|
@ -29,20 +30,20 @@ usage = '''
|
|||
:-t --use-train
|
||||
Evaluate training data instead of test data
|
||||
|
||||
:-pw --pocketsphinx-wake-word -
|
||||
:-pw --pocketsphinx-wake-word str -
|
||||
Optional wake word used to
|
||||
generate a Pocketsphinx data point
|
||||
|
||||
:-pd --pocketsphinx-dict -
|
||||
:-pd --pocketsphinx-dict str -
|
||||
Optional word dictionary used to
|
||||
generate a Pocketsphinx data point
|
||||
|
||||
:-pf --pocketsphinx-folder -
|
||||
:-pf --pocketsphinx-folder str -
|
||||
Optional hmm folder used to
|
||||
generate a Pocketsphinx data point.
|
||||
Format: wake-word.yy-mm-dd.hmm/
|
||||
|
||||
:-pth --pocketsphinx-threshold str 1e-90
|
||||
:-pth --pocketsphinx-threshold float 1e-90
|
||||
Optional threshold used to
|
||||
generate a Pocketsphinx data point
|
||||
|
||||
|
@ -72,6 +73,10 @@ def main():
|
|||
metrics = {}
|
||||
|
||||
if args.pocketsphinx_dict and args.pocketsphinx_folder and args.pocketsphinx_wake_word:
|
||||
if not isfile(args.pocketsphinx_dict):
|
||||
parser.error('No such file: ' + args.pocketsphinx_dict)
|
||||
if not isdir(args.pocketsphinx_folder):
|
||||
parser.error('No such folder: ' + args.pocketsphinx_folder)
|
||||
listener = PocketsphinxListener(
|
||||
args.pocketsphinx_wake_word, args.pocketsphinx_dict,
|
||||
args.pocketsphinx_folder, args.pocketsphinx_threshold
|
||||
|
|
Loading…
Reference in New Issue