-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
46 lines (41 loc) · 1.35 KB
/
main.py
File metadata and controls
46 lines (41 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def main():
parser = argparse.ArgumentParser(description='Stream from microphone using VAD')
parser.add_argument('-m', '--model', required=True,
help='Path to the model (protocol buffer binary file, or entire directory containing all standard-named files for model)')
args = parser.parse_args()
stt_settings = {
'alphabet': 'alphabet.txt',
'beam_width': 500,
'device': None,
'lm': 'lm.binary',
'lm_alpha': 0.75,
'lm_beta': 1.85,
'model': args.model,
'n_context': 9,
'n_features': 26,
'nospinner': False,
'rate': 16000,
'savewav': None,
'trie': 'trie',
'vad_aggressiveness': 3
}
stt.init(SimpleNamespace(**stt_settings), on_speech)
"""
# Emergency plan Z
while True:
line = input('> ')
on_speech(line)
"""
# natty.text_to_token("hey oracle, what time is it in manhattan")
def on_speech(text):
print("Recognized: %s" % text)
natty.text_to_token(text)
if __name__ == '__main__':
from src import natural_language_processing as natty
from src import speech_to_text as stt
from src import text_to_speech as tts
from types import SimpleNamespace
import argparse
import multiprocessing
multiprocessing.set_start_method('spawn')
main()