Add suuport for english

This commit is contained in:
Mauricio Baeza 2022-05-25 23:10:15 -05:00
parent 1aab8f8cdd
commit 57eeb5ce30
50 changed files with 756 additions and 59 deletions

View File

@ -19,3 +19,6 @@ Arch
```
pip install --user vosk
```
Gracias a:
https://alphacephei.com/vosk/

View File

@ -8,7 +8,7 @@ Support for English and Spanish.
Dependencies:
Ubuntu and derivates.
Ubuntu and derivatives.
```
sudo apt install libreoffice-script-provider-python python3-pip
sudo pip3 install --upgrade pip wheel
@ -19,3 +19,7 @@ Arch
```
pip install --user vosk
```
Thanks to:
https://alphacephei.com/vosk/

12
conf.py
View File

@ -112,7 +112,7 @@ MENUS = (
{
'title': {'en': 'Start', 'es': 'Iniciar'},
'argument': 'start',
'context': 'writer',
'context': 'writer,calc',
'icon': 'start',
'toolbar': True,
'shortcut': 'S_SHIFT_MOD1_MOD2',
@ -120,19 +120,11 @@ MENUS = (
{
'title': {'en': 'End', 'es': 'Terminar'},
'argument': 'end',
'context': 'writer',
'context': 'writer,calc',
'icon': 'end',
'toolbar': True,
'shortcut': 'E_SHIFT_MOD1_MOD2',
},
{
'title': {'en': 'Config...', 'es': 'Configurar...'},
'argument': 'config',
'context': 'writer',
'icon': 'config',
'toolbar': True,
'shortcut': '',
},
)

Binary file not shown.

View File

@ -17,7 +17,7 @@
<value xml:lang="es">Iniciar</value>
</prop>
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
<value>com.sun.star.text.TextDocument,com.sun.star.sheet.SpreadsheetDocument</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>service:net.elmau.zaz.talk?start</value>
@ -35,7 +35,7 @@
<value xml:lang="es">Terminar</value>
</prop>
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
<value>com.sun.star.text.TextDocument,com.sun.star.sheet.SpreadsheetDocument</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>service:net.elmau.zaz.talk?end</value>
@ -47,24 +47,6 @@
<value>%origin%/images/end</value>
</prop>
</node>
<node oor:name="m2" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Config...</value>
<value xml:lang="es">Configurar...</value>
</prop>
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>service:net.elmau.zaz.talk?config</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value>%origin%/images/config</value>
</prop>
</node>
</node>
</node>
</node>
@ -76,7 +58,7 @@
<value xml:lang="es">Iniciar</value>
</prop>
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
<value>com.sun.star.text.TextDocument,com.sun.star.sheet.SpreadsheetDocument</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>service:net.elmau.zaz.talk?start</value>
@ -94,7 +76,7 @@
<value xml:lang="es">Terminar</value>
</prop>
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
<value>com.sun.star.text.TextDocument,com.sun.star.sheet.SpreadsheetDocument</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>service:net.elmau.zaz.talk?end</value>
@ -106,24 +88,6 @@
<value>%origin%/images/end</value>
</prop>
</node>
<node oor:name="t2" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Config...</value>
<value xml:lang="es">Configurar...</value>
</prop>
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>service:net.elmau.zaz.talk?config</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value>%origin%/images/config</value>
</prop>
</node>
</node>
</node>
</node>

View File

@ -9,6 +9,13 @@
</prop>
</node>
</node>
<node oor:name="com.sun.star.sheet.SpreadsheetDocument">
<node oor:name="S_SHIFT_MOD1_MOD2" oor:op="fuse">
<prop oor:name="Command">
<value xml:lang="en-US">service:net.elmau.zaz.talk?start</value>
</prop>
</node>
</node>
<node oor:name="com.sun.star.text.TextDocument">
<node oor:name="E_SHIFT_MOD1_MOD2" oor:op="fuse">
<prop oor:name="Command">
@ -16,6 +23,13 @@
</prop>
</node>
</node>
<node oor:name="com.sun.star.sheet.SpreadsheetDocument">
<node oor:name="E_SHIFT_MOD1_MOD2" oor:op="fuse">
<prop oor:name="Command">
<value xml:lang="en-US">service:net.elmau.zaz.talk?end</value>
</prop>
</node>
</node>
</node>
</node>
</oor:component-data>

View File

@ -18,7 +18,7 @@ class ZazTalk2Me(unohelper.Base, XJobExecutor):
@app.run_in_thread
def _start(self):
path_ext = app.paths.from_id(ID_EXTENSION)
path_model = app.paths.join(path_ext, 'model')
path_model = app.paths.join(path_ext, 'model', app.LANG)
nd.main_begin(vosk_model_dir=path_model, config_override=None)
return

9
source/model/en/README Normal file
View File

@ -0,0 +1,9 @@
US English model for mobile Vosk applications
Copyright 2020 Alpha Cephei Inc
Accuracy: 10.38 (tedlium test) 9.85 (librispeech test-clean)
Speed: 0.11xRT (desktop)
Latency: 0.15s (right context)

Binary file not shown.

View File

@ -0,0 +1,7 @@
--sample-frequency=16000
--use-energy=false
--num-mel-bins=40
--num-ceps=40
--low-freq=20
--high-freq=7600
--allow-downsample=true

View File

@ -0,0 +1,10 @@
--min-active=200
--max-active=3000
--beam=10.0
--lattice-beam=2.0
--acoustic-scale=1.0
--frame-subsampling-factor=3
--endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10
--endpoint.rule2.min-trailing-silence=0.5
--endpoint.rule3.min-trailing-silence=0.75
--endpoint.rule4.min-trailing-silence=1.0

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,17 @@
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031

View File

@ -0,0 +1,166 @@
1 nonword
2 begin
3 end
4 internal
5 singleton
6 nonword
7 begin
8 end
9 internal
10 singleton
11 begin
12 end
13 internal
14 singleton
15 begin
16 end
17 internal
18 singleton
19 begin
20 end
21 internal
22 singleton
23 begin
24 end
25 internal
26 singleton
27 begin
28 end
29 internal
30 singleton
31 begin
32 end
33 internal
34 singleton
35 begin
36 end
37 internal
38 singleton
39 begin
40 end
41 internal
42 singleton
43 begin
44 end
45 internal
46 singleton
47 begin
48 end
49 internal
50 singleton
51 begin
52 end
53 internal
54 singleton
55 begin
56 end
57 internal
58 singleton
59 begin
60 end
61 internal
62 singleton
63 begin
64 end
65 internal
66 singleton
67 begin
68 end
69 internal
70 singleton
71 begin
72 end
73 internal
74 singleton
75 begin
76 end
77 internal
78 singleton
79 begin
80 end
81 internal
82 singleton
83 begin
84 end
85 internal
86 singleton
87 begin
88 end
89 internal
90 singleton
91 begin
92 end
93 internal
94 singleton
95 begin
96 end
97 internal
98 singleton
99 begin
100 end
101 internal
102 singleton
103 begin
104 end
105 internal
106 singleton
107 begin
108 end
109 internal
110 singleton
111 begin
112 end
113 internal
114 singleton
115 begin
116 end
117 internal
118 singleton
119 begin
120 end
121 internal
122 singleton
123 begin
124 end
125 internal
126 singleton
127 begin
128 end
129 internal
130 singleton
131 begin
132 end
133 internal
134 singleton
135 begin
136 end
137 internal
138 singleton
139 begin
140 end
141 internal
142 singleton
143 begin
144 end
145 internal
146 singleton
147 begin
148 end
149 internal
150 singleton
151 begin
152 end
153 internal
154 singleton
155 begin
156 end
157 internal
158 singleton
159 begin
160 end
161 internal
162 singleton
163 begin
164 end
165 internal
166 singleton

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
[
1.682383e+11 -1.1595e+10 -1.521733e+10 4.32034e+09 -2.257938e+10 -1.969666e+10 -2.559265e+10 -1.535687e+10 -1.276854e+10 -4.494483e+09 -1.209085e+10 -5.64008e+09 -1.134847e+10 -3.419512e+09 -1.079542e+10 -4.145463e+09 -6.637486e+09 -1.11318e+09 -3.479773e+09 -1.245932e+08 -1.386961e+09 6.560655e+07 -2.436518e+08 -4.032432e+07 4.620046e+08 -7.714964e+07 9.551484e+08 -4.119761e+08 8.208582e+08 -7.117156e+08 7.457703e+08 -4.3106e+08 1.202726e+09 2.904036e+08 1.231931e+09 3.629848e+08 6.366939e+08 -4.586172e+08 -5.267629e+08 -3.507819e+08 1.679838e+09
1.741141e+13 8.92488e+11 8.743834e+11 8.848896e+11 1.190313e+12 1.160279e+12 1.300066e+12 1.005678e+12 9.39335e+11 8.089614e+11 7.927041e+11 6.882427e+11 6.444235e+11 5.151451e+11 4.825723e+11 3.210106e+11 2.720254e+11 1.772539e+11 1.248102e+11 6.691599e+10 3.599804e+10 1.207574e+10 1.679301e+09 4.594778e+08 5.821614e+09 1.451758e+10 2.55803e+10 3.43277e+10 4.245286e+10 4.784859e+10 4.988591e+10 4.925451e+10 5.074584e+10 4.9557e+10 4.407876e+10 3.421443e+10 3.138606e+10 2.539716e+10 1.948134e+10 1.381167e+10 0 ]

View File

@ -0,0 +1 @@
# configuration file for apply-cmvn-online, used in the script ../local/run_online_decoding.sh

View File

@ -0,0 +1,2 @@
--left-context=3
--right-context=3

BIN
source/model/pt/Gr.fst Normal file

Binary file not shown.

BIN
source/model/pt/HCLr.fst Normal file

Binary file not shown.

1
source/model/pt/README Normal file
View File

@ -0,0 +1 @@
Portuguese model for android

View File

@ -0,0 +1,9 @@
11381
11382
11383
11384
11385
11386
11387
11388
11389

BIN
source/model/pt/final.mdl Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
[
5.621864e+09 -3.61508e+08 8.637199e+07 3.324517e+08 -3.323625e+08 -3.969682e+08 -5.677247e+08 -3.363187e+08 -2.560426e+08 -5.828718e+07 -5.735994e+07 -1.727248e+08 -1.921315e+08 -243469.1 -1.114188e+08 -1.499579e+08 -2.986899e+07 -2.723944e+07 -3.31755e+07 758787.7 7.084189e+07
4.552163e+11 1.696032e+10 1.358537e+10 1.90937e+10 1.775472e+10 1.721642e+10 1.958017e+10 1.442598e+10 1.461493e+10 1.236114e+10 9.68765e+09 9.376157e+09 7.71376e+09 5.798623e+09 4.252169e+09 3.14616e+09 1.832301e+09 1.183567e+09 7.921606e+08 4.095449e+08 0 ]

View File

@ -0,0 +1 @@
# configuration file for apply-cmvn-online, used in the script ../local/run_online_decoding.sh

View File

@ -0,0 +1,2 @@
--left-context=3
--right-context=3

View File

@ -0,0 +1,8 @@
--sample-frequency=16000
--use-energy=false
--num-mel-bins=20
--num-ceps=20
--low-freq=20
--high-freq=7600
--allow-upsample=true
--allow-downsample=true

240
source/model/pt/phones.txt Normal file
View File

@ -0,0 +1,240 @@
<eps> 0
SIL 1
SIL_B 2
SIL_E 3
SIL_I 4
SIL_S 5
GBG 6
GBG_B 7
GBG_E 8
GBG_I 9
GBG_S 10
E_B 11
E_E 12
E_I 13
E_S 14
J_B 15
J_E 16
J_I 17
J_S 18
L_B 19
L_E 20
L_I 21
L_S 22
O_B 23
O_E 24
O_I 25
O_S 26
R_B 27
R_E 28
R_I 29
R_S 30
S_B 31
S_E 32
S_I 33
S_S 34
X_B 35
X_E 36
X_I 37
X_S 38
Z_B 39
Z_E 40
Z_I 41
Z_S 42
a_B 43
a_E 44
a_I 45
a_S 46
aa_B 47
aa_E 48
aa_I 49
aa_S 50
a~_B 51
a~_E 52
a~_I 53
a~_S 54
b_B 55
b_E 56
b_I 57
b_S 58
d_B 59
d_E 60
d_I 61
d_S 62
dZ_B 63
dZ_E 64
dZ_I 65
dZ_S 66
dz_B 67
dz_E 68
dz_I 69
dz_S 70
e_B 71
e_E 72
e_I 73
e_S 74
ee_B 75
ee_E 76
ee_I 77
ee_S 78
em_B 79
em_E 80
em_I 81
em_S 82
e~_B 83
e~_E 84
e~_I 85
e~_S 86
f_B 87
f_E 88
f_I 89
f_S 90
g_B 91
g_E 92
g_I 93
g_S 94
i_B 95
i_E 96
i_I 97
i_S 98
ii_B 99
ii_E 100
ii_I 101
ii_S 102
i~_B 103
i~_E 104
i~_I 105
i~_S 106
j_B 107
j_E 108
j_I 109
j_S 110
jj_B 111
jj_E 112
jj_I 113
jj_S 114
jm_B 115
jm_E 116
jm_I 117
jm_S 118
j~_B 119
j~_E 120
j~_I 121
j~_S 122
k_B 123
k_E 124
k_I 125
k_S 126
l_B 127
l_E 128
l_I 129
l_S 130
lm_B 131
lm_E 132
lm_I 133
lm_S 134
m_B 135
m_E 136
m_I 137
m_S 138
n_B 139
n_E 140
n_I 141
n_S 142
o_B 143
o_E 144
o_I 145
o_S 146
om_B 147
om_E 148
om_I 149
om_S 150
oo_B 151
oo_E 152
oo_I 153
oo_S 154
o~_B 155
o~_E 156
o~_I 157
o~_S 158
p_B 159
p_E 160
p_I 161
p_S 162
r_B 163
r_E 164
r_I 165
r_S 166
rm_B 167
rm_E 168
rm_I 169
rm_S 170
s_B 171
s_E 172
s_I 173
s_S 174
sm_B 175
sm_E 176
sm_I 177
sm_S 178
t_B 179
t_E 180
t_I 181
t_S 182
tS_B 183
tS_E 184
tS_I 185
tS_S 186
ts_B 187
ts_E 188
ts_I 189
ts_S 190
u_B 191
u_E 192
u_I 193
u_S 194
uu_B 195
uu_E 196
uu_I 197
uu_S 198
u~_B 199
u~_E 200
u~_I 201
u~_S 202
v_B 203
v_E 204
v_I 205
v_S 206
w_B 207
w_E 208
w_I 209
w_S 210
ww_B 211
ww_E 212
ww_I 213
ww_S 214
w~_B 215
w~_E 216
w~_I 217
w~_S 218
xm_B 219
xm_E 220
xm_I 221
xm_S 222
z_B 223
z_E 224
z_I 225
z_S 226
zm_B 227
zm_E 228
zm_I 229
zm_S 230
#0 231
#1 232
#2 233
#3 234
#4 235
#5 236
#6 237
#7 238
#8 239

View File

@ -0,0 +1,230 @@
1 nonword
2 begin
3 end
4 internal
5 singleton
6 nonword
7 begin
8 end
9 internal
10 singleton
11 begin
12 end
13 internal
14 singleton
15 begin
16 end
17 internal
18 singleton
19 begin
20 end
21 internal
22 singleton
23 begin
24 end
25 internal
26 singleton
27 begin
28 end
29 internal
30 singleton
31 begin
32 end
33 internal
34 singleton
35 begin
36 end
37 internal
38 singleton
39 begin
40 end
41 internal
42 singleton
43 begin
44 end
45 internal
46 singleton
47 begin
48 end
49 internal
50 singleton
51 begin
52 end
53 internal
54 singleton
55 begin
56 end
57 internal
58 singleton
59 begin
60 end
61 internal
62 singleton
63 begin
64 end
65 internal
66 singleton
67 begin
68 end
69 internal
70 singleton
71 begin
72 end
73 internal
74 singleton
75 begin
76 end
77 internal
78 singleton
79 begin
80 end
81 internal
82 singleton
83 begin
84 end
85 internal
86 singleton
87 begin
88 end
89 internal
90 singleton
91 begin
92 end
93 internal
94 singleton
95 begin
96 end
97 internal
98 singleton
99 begin
100 end
101 internal
102 singleton
103 begin
104 end
105 internal
106 singleton
107 begin
108 end
109 internal
110 singleton
111 begin
112 end
113 internal
114 singleton
115 begin
116 end
117 internal
118 singleton
119 begin
120 end
121 internal
122 singleton
123 begin
124 end
125 internal
126 singleton
127 begin
128 end
129 internal
130 singleton
131 begin
132 end
133 internal
134 singleton
135 begin
136 end
137 internal
138 singleton
139 begin
140 end
141 internal
142 singleton
143 begin
144 end
145 internal
146 singleton
147 begin
148 end
149 internal
150 singleton
151 begin
152 end
153 internal
154 singleton
155 begin
156 end
157 internal
158 singleton
159 begin
160 end
161 internal
162 singleton
163 begin
164 end
165 internal
166 singleton
167 begin
168 end
169 internal
170 singleton
171 begin
172 end
173 internal
174 singleton
175 begin
176 end
177 internal
178 singleton
179 begin
180 end
181 internal
182 singleton
183 begin
184 end
185 internal
186 singleton
187 begin
188 end
189 internal
190 singleton
191 begin
192 end
193 internal
194 singleton
195 begin
196 end
197 internal
198 singleton
199 begin
200 end
201 internal
202 singleton
203 begin
204 end
205 internal
206 singleton
207 begin
208 end
209 internal
210 singleton
211 begin
212 end
213 internal
214 singleton
215 begin
216 end
217 internal
218 singleton
219 begin
220 end
221 internal
222 singleton
223 begin
224 end
225 internal
226 singleton
227 begin
228 end
229 internal
230 singleton

View File

@ -70,13 +70,24 @@ def run_xdotool(subcommand: str, payload: List[str]) -> None:
try:
# ~ print(cmd)
# ~ type or key
rango = app.selection.goto_end()
if subcommand == 'type':
word = payload[-1]
rango.string = word
else:
rango.go_left(count=len(payload), expand=True).string = ''
# ~ subprocess.check_output(cmd)
app_name = app.active.type
if app_name == 'writer':
rango = app.selection.goto_end()
if subcommand == 'type':
word = payload[-1]
rango.string = word
else:
rango.go_left(count=len(payload), expand=True).string = ''
elif app_name == 'calc':
rango = app.selection
current = rango.value or ''
if subcommand == 'type':
word = payload[-1]
rango.str = current + word
else:
current = current[:len(payload)*-1]
rango.str = current
# ~ subprocess.check_output(cmd)
except FileNotFoundError as ex:
print("Command {!r} not found: {!s}".format(cmd_base, ex))
sys.exit(1)