forked from appeacock/jasperbuster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjasper.patch
More file actions
60 lines (56 loc) · 2.19 KB
/
jasper.patch
File metadata and controls
60 lines (56 loc) · 2.19 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff -Naur '--exclude=*.pyc' jasper/client/diagnose.py ../jasper/client/diagnose.py
--- jasper/client/diagnose.py 2020-01-22 22:26:27.812592840 +0000
+++ ../jasper/client/diagnose.py 2020-01-22 22:11:18.222767985 +0000
@@ -6,7 +6,7 @@
import subprocess
import pkgutil
import logging
-import pip.req
+import pip
import jasperpath
if sys.version_info < (3, 3):
from distutils.spawn import find_executable
diff -Naur '--exclude=*.pyc' jasper/client/stt.py ../jasper/client/stt.py
--- jasper/client/stt.py 2020-01-22 22:26:27.812592840 +0000
+++ ../jasper/client/stt.py 2020-01-22 22:23:01.632637684 +0000
@@ -122,8 +122,14 @@
"hmm_dir in your profile.",
hmm_dir, ', '.join(missing_hmm_files))
- self._decoder = ps.Decoder(hmm=hmm_dir, logfn=self._logfile,
- **vocabulary.decoder_kwargs)
+ #self._decoder = ps.Decoder(hmm=hmm_dir, logfn=self._logfile,
+ # **vocabulary.decoder_kwargs)
+ psConfig = ps.Decoder.default_config()
+ psConfig.set_string('-hmm', hmm_dir)
+
+ psConfig.set_string('-lm', vocabulary.decoder_kwargs['lm'])
+ psConfig.set_string('-dict', vocabulary.decoder_kwargs['dict'])
+ self._decoder = ps.Decoder(psConfig)
def __del__(self):
os.remove(self._logfile)
@@ -163,16 +169,22 @@
self._decoder.process_raw(data, False, True)
self._decoder.end_utt()
- result = self._decoder.get_hyp()
+ #result = self._decoder.get_hyp()
+ result = self._decoder.hyp()
with open(self._logfile, 'r+') as f:
- for line in f:
- self._logger.debug(line.strip())
+ # for line in f:
+ # self._logger.debug(line.strip())
f.truncate()
-
- transcribed = [result[0]]
+
+ #transcribed = [result[0]]
+ if result is None:
+ transcribed = []
+ else:
+ transcribed = result.hypstr.split()
self._logger.info('Transcribed: %r', transcribed)
return transcribed
+
@classmethod
def is_available(cls):
return diagnose.check_python_import('pocketsphinx')