File: system_pocketsphinx

package info (click to toggle)
pocketsphinx-python 1%3A0.1.15-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 320 kB
  • sloc: python: 554; sh: 11; makefile: 9
file content (65 lines) | stat: -rw-r--r-- 2,536 bytes parent folder | download | duplicates (3)
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
61
62
63
64
65
We want to use the system-provided pocketsphinx files

---
 setup.py              |   23 ++++++++++++++---------
 tests/test_phoneme.py |    2 +-
 2 files changed, 15 insertions(+), 10 deletions(-)

--- a/setup.py
+++ b/setup.py
@@ -89,7 +89,10 @@ sb_include_dirs = [
     '/usr/share/sphinxbase/swig',
 ]
 
-ps_include_dirs = ['deps/pocketsphinx/include']
+ps_include_dirs = [
+    '/usr/include/pocketsphinx',
+    '/usr/share/pocketsphinx/swig',
+]
 
 define_macros = [
     ('SPHINXBASE_EXPORTS', None),
@@ -132,6 +135,7 @@ elif sys.platform.startswith('linux'):
         '-Wno-sign-compare',
         '-Wno-misleading-indentation'
     ])
+    extra_link_args.append('-lpocketsphinx')
 
 sb_swig_opts = (
     ['-modern', '-threads'] +
@@ -147,15 +151,16 @@ ps_swig_opts = (
     ['-outdir', 'pocketsphinx']
 )
 
-if not os.path.exists(os.path.join(os.path.dirname(__file__), 'pocketsphinx/model')):
-    copytree(os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx/model/en-us'),
-             os.path.join(os.path.dirname(__file__), 'pocketsphinx/model'),
-             ignore=ignore_patterns('en-us-phone.lm.bin'))
-if not os.path.exists(os.path.join(os.path.dirname(__file__), 'pocketsphinx/data')):
-    os.makedirs(os.path.join(os.path.dirname(__file__), 'pocketsphinx/data'))
-    copy(os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx/test/data/goforward.raw'),
-         os.path.join(os.path.dirname(__file__), 'pocketsphinx/data/goforward.raw'))
+if not os.path.exists(os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx')):
+    os.makedirs(os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx'))
 
+if not os.path.exists(os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx/test')):
+    os.symlink('/usr/share/pocketsphinx/test',
+               os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx/test'))
+
+if not os.path.exists(os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx/swig')):
+    copytree('/usr/share/pocketsphinx/swig',
+             os.path.join(os.path.dirname(__file__), 'deps/pocketsphinx/swig'))
 
 class build(_build):
     def run(self):
--- a/tests/test_phoneme.py
+++ b/tests/test_phoneme.py
@@ -38,7 +38,7 @@ class TestPhoneme(TestCase):
         self.ps = Pocketsphinx(
             lm=False,
             dic=False,
-            allphone='deps/pocketsphinx/model/en-us/en-us-phone.lm.bin',
+            allphone='/usr/share/pocketsphinx/model/en-us/en-us-phone.lm.bin',
             lw=2.0,
             pip=0.3,
             beam=1e-200,