@ -1,9 +0,0 @@
|
|||||||
# generated files
|
|
||||||
bin/
|
|
||||||
gen/
|
|
||||||
|
|
||||||
# Local configuration file (sdk path, etc)
|
|
||||||
project.properties
|
|
||||||
.settings/
|
|
||||||
.classpath
|
|
||||||
.project
|
|
||||||
@ -1,190 +0,0 @@
|
|||||||
|
|
||||||
Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
Chinese Vosk model for mobile
|
||||||
|
|
||||||
|
CER results
|
||||||
|
|
||||||
|
23.54% speechio_02
|
||||||
|
38.29% speechio_06
|
||||||
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
--use-energy=false
|
||||||
|
--sample-frequency=16000
|
||||||
|
--num-mel-bins=40
|
||||||
|
--num-ceps=40
|
||||||
|
--low-freq=40
|
||||||
|
--high-freq=-200
|
||||||
|
--allow-upsample=true
|
||||||
|
--allow-downsample=true
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
--min-active=200
|
||||||
|
--max-active=5000
|
||||||
|
--beam=12.0
|
||||||
|
--lattice-beam=4.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=1.0
|
||||||
|
--endpoint.rule4.min-trailing-silence=2.0
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,39 @@
|
|||||||
|
11845
|
||||||
|
11846
|
||||||
|
11847
|
||||||
|
11848
|
||||||
|
11849
|
||||||
|
11850
|
||||||
|
11851
|
||||||
|
11852
|
||||||
|
11853
|
||||||
|
11854
|
||||||
|
11855
|
||||||
|
11856
|
||||||
|
11857
|
||||||
|
11858
|
||||||
|
11859
|
||||||
|
11860
|
||||||
|
11861
|
||||||
|
11862
|
||||||
|
11863
|
||||||
|
11864
|
||||||
|
11865
|
||||||
|
11866
|
||||||
|
11867
|
||||||
|
11868
|
||||||
|
11869
|
||||||
|
11870
|
||||||
|
11871
|
||||||
|
11872
|
||||||
|
11873
|
||||||
|
11874
|
||||||
|
11875
|
||||||
|
11876
|
||||||
|
11877
|
||||||
|
11878
|
||||||
|
11879
|
||||||
|
11880
|
||||||
|
11881
|
||||||
|
11882
|
||||||
|
11883
|
||||||
@ -0,0 +1,646 @@
|
|||||||
|
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
|
||||||
|
231 begin
|
||||||
|
232 end
|
||||||
|
233 internal
|
||||||
|
234 singleton
|
||||||
|
235 begin
|
||||||
|
236 end
|
||||||
|
237 internal
|
||||||
|
238 singleton
|
||||||
|
239 begin
|
||||||
|
240 end
|
||||||
|
241 internal
|
||||||
|
242 singleton
|
||||||
|
243 begin
|
||||||
|
244 end
|
||||||
|
245 internal
|
||||||
|
246 singleton
|
||||||
|
247 begin
|
||||||
|
248 end
|
||||||
|
249 internal
|
||||||
|
250 singleton
|
||||||
|
251 begin
|
||||||
|
252 end
|
||||||
|
253 internal
|
||||||
|
254 singleton
|
||||||
|
255 begin
|
||||||
|
256 end
|
||||||
|
257 internal
|
||||||
|
258 singleton
|
||||||
|
259 begin
|
||||||
|
260 end
|
||||||
|
261 internal
|
||||||
|
262 singleton
|
||||||
|
263 begin
|
||||||
|
264 end
|
||||||
|
265 internal
|
||||||
|
266 singleton
|
||||||
|
267 begin
|
||||||
|
268 end
|
||||||
|
269 internal
|
||||||
|
270 singleton
|
||||||
|
271 begin
|
||||||
|
272 end
|
||||||
|
273 internal
|
||||||
|
274 singleton
|
||||||
|
275 begin
|
||||||
|
276 end
|
||||||
|
277 internal
|
||||||
|
278 singleton
|
||||||
|
279 begin
|
||||||
|
280 end
|
||||||
|
281 internal
|
||||||
|
282 singleton
|
||||||
|
283 begin
|
||||||
|
284 end
|
||||||
|
285 internal
|
||||||
|
286 singleton
|
||||||
|
287 begin
|
||||||
|
288 end
|
||||||
|
289 internal
|
||||||
|
290 singleton
|
||||||
|
291 begin
|
||||||
|
292 end
|
||||||
|
293 internal
|
||||||
|
294 singleton
|
||||||
|
295 begin
|
||||||
|
296 end
|
||||||
|
297 internal
|
||||||
|
298 singleton
|
||||||
|
299 begin
|
||||||
|
300 end
|
||||||
|
301 internal
|
||||||
|
302 singleton
|
||||||
|
303 begin
|
||||||
|
304 end
|
||||||
|
305 internal
|
||||||
|
306 singleton
|
||||||
|
307 begin
|
||||||
|
308 end
|
||||||
|
309 internal
|
||||||
|
310 singleton
|
||||||
|
311 begin
|
||||||
|
312 end
|
||||||
|
313 internal
|
||||||
|
314 singleton
|
||||||
|
315 begin
|
||||||
|
316 end
|
||||||
|
317 internal
|
||||||
|
318 singleton
|
||||||
|
319 begin
|
||||||
|
320 end
|
||||||
|
321 internal
|
||||||
|
322 singleton
|
||||||
|
323 begin
|
||||||
|
324 end
|
||||||
|
325 internal
|
||||||
|
326 singleton
|
||||||
|
327 begin
|
||||||
|
328 end
|
||||||
|
329 internal
|
||||||
|
330 singleton
|
||||||
|
331 begin
|
||||||
|
332 end
|
||||||
|
333 internal
|
||||||
|
334 singleton
|
||||||
|
335 begin
|
||||||
|
336 end
|
||||||
|
337 internal
|
||||||
|
338 singleton
|
||||||
|
339 begin
|
||||||
|
340 end
|
||||||
|
341 internal
|
||||||
|
342 singleton
|
||||||
|
343 begin
|
||||||
|
344 end
|
||||||
|
345 internal
|
||||||
|
346 singleton
|
||||||
|
347 begin
|
||||||
|
348 end
|
||||||
|
349 internal
|
||||||
|
350 singleton
|
||||||
|
351 begin
|
||||||
|
352 end
|
||||||
|
353 internal
|
||||||
|
354 singleton
|
||||||
|
355 begin
|
||||||
|
356 end
|
||||||
|
357 internal
|
||||||
|
358 singleton
|
||||||
|
359 begin
|
||||||
|
360 end
|
||||||
|
361 internal
|
||||||
|
362 singleton
|
||||||
|
363 begin
|
||||||
|
364 end
|
||||||
|
365 internal
|
||||||
|
366 singleton
|
||||||
|
367 begin
|
||||||
|
368 end
|
||||||
|
369 internal
|
||||||
|
370 singleton
|
||||||
|
371 begin
|
||||||
|
372 end
|
||||||
|
373 internal
|
||||||
|
374 singleton
|
||||||
|
375 begin
|
||||||
|
376 end
|
||||||
|
377 internal
|
||||||
|
378 singleton
|
||||||
|
379 begin
|
||||||
|
380 end
|
||||||
|
381 internal
|
||||||
|
382 singleton
|
||||||
|
383 begin
|
||||||
|
384 end
|
||||||
|
385 internal
|
||||||
|
386 singleton
|
||||||
|
387 begin
|
||||||
|
388 end
|
||||||
|
389 internal
|
||||||
|
390 singleton
|
||||||
|
391 begin
|
||||||
|
392 end
|
||||||
|
393 internal
|
||||||
|
394 singleton
|
||||||
|
395 begin
|
||||||
|
396 end
|
||||||
|
397 internal
|
||||||
|
398 singleton
|
||||||
|
399 begin
|
||||||
|
400 end
|
||||||
|
401 internal
|
||||||
|
402 singleton
|
||||||
|
403 begin
|
||||||
|
404 end
|
||||||
|
405 internal
|
||||||
|
406 singleton
|
||||||
|
407 begin
|
||||||
|
408 end
|
||||||
|
409 internal
|
||||||
|
410 singleton
|
||||||
|
411 begin
|
||||||
|
412 end
|
||||||
|
413 internal
|
||||||
|
414 singleton
|
||||||
|
415 begin
|
||||||
|
416 end
|
||||||
|
417 internal
|
||||||
|
418 singleton
|
||||||
|
419 begin
|
||||||
|
420 end
|
||||||
|
421 internal
|
||||||
|
422 singleton
|
||||||
|
423 begin
|
||||||
|
424 end
|
||||||
|
425 internal
|
||||||
|
426 singleton
|
||||||
|
427 begin
|
||||||
|
428 end
|
||||||
|
429 internal
|
||||||
|
430 singleton
|
||||||
|
431 begin
|
||||||
|
432 end
|
||||||
|
433 internal
|
||||||
|
434 singleton
|
||||||
|
435 begin
|
||||||
|
436 end
|
||||||
|
437 internal
|
||||||
|
438 singleton
|
||||||
|
439 begin
|
||||||
|
440 end
|
||||||
|
441 internal
|
||||||
|
442 singleton
|
||||||
|
443 begin
|
||||||
|
444 end
|
||||||
|
445 internal
|
||||||
|
446 singleton
|
||||||
|
447 begin
|
||||||
|
448 end
|
||||||
|
449 internal
|
||||||
|
450 singleton
|
||||||
|
451 begin
|
||||||
|
452 end
|
||||||
|
453 internal
|
||||||
|
454 singleton
|
||||||
|
455 begin
|
||||||
|
456 end
|
||||||
|
457 internal
|
||||||
|
458 singleton
|
||||||
|
459 begin
|
||||||
|
460 end
|
||||||
|
461 internal
|
||||||
|
462 singleton
|
||||||
|
463 begin
|
||||||
|
464 end
|
||||||
|
465 internal
|
||||||
|
466 singleton
|
||||||
|
467 begin
|
||||||
|
468 end
|
||||||
|
469 internal
|
||||||
|
470 singleton
|
||||||
|
471 begin
|
||||||
|
472 end
|
||||||
|
473 internal
|
||||||
|
474 singleton
|
||||||
|
475 begin
|
||||||
|
476 end
|
||||||
|
477 internal
|
||||||
|
478 singleton
|
||||||
|
479 begin
|
||||||
|
480 end
|
||||||
|
481 internal
|
||||||
|
482 singleton
|
||||||
|
483 begin
|
||||||
|
484 end
|
||||||
|
485 internal
|
||||||
|
486 singleton
|
||||||
|
487 begin
|
||||||
|
488 end
|
||||||
|
489 internal
|
||||||
|
490 singleton
|
||||||
|
491 begin
|
||||||
|
492 end
|
||||||
|
493 internal
|
||||||
|
494 singleton
|
||||||
|
495 begin
|
||||||
|
496 end
|
||||||
|
497 internal
|
||||||
|
498 singleton
|
||||||
|
499 begin
|
||||||
|
500 end
|
||||||
|
501 internal
|
||||||
|
502 singleton
|
||||||
|
503 begin
|
||||||
|
504 end
|
||||||
|
505 internal
|
||||||
|
506 singleton
|
||||||
|
507 begin
|
||||||
|
508 end
|
||||||
|
509 internal
|
||||||
|
510 singleton
|
||||||
|
511 begin
|
||||||
|
512 end
|
||||||
|
513 internal
|
||||||
|
514 singleton
|
||||||
|
515 begin
|
||||||
|
516 end
|
||||||
|
517 internal
|
||||||
|
518 singleton
|
||||||
|
519 begin
|
||||||
|
520 end
|
||||||
|
521 internal
|
||||||
|
522 singleton
|
||||||
|
523 begin
|
||||||
|
524 end
|
||||||
|
525 internal
|
||||||
|
526 singleton
|
||||||
|
527 begin
|
||||||
|
528 end
|
||||||
|
529 internal
|
||||||
|
530 singleton
|
||||||
|
531 begin
|
||||||
|
532 end
|
||||||
|
533 internal
|
||||||
|
534 singleton
|
||||||
|
535 begin
|
||||||
|
536 end
|
||||||
|
537 internal
|
||||||
|
538 singleton
|
||||||
|
539 begin
|
||||||
|
540 end
|
||||||
|
541 internal
|
||||||
|
542 singleton
|
||||||
|
543 begin
|
||||||
|
544 end
|
||||||
|
545 internal
|
||||||
|
546 singleton
|
||||||
|
547 begin
|
||||||
|
548 end
|
||||||
|
549 internal
|
||||||
|
550 singleton
|
||||||
|
551 begin
|
||||||
|
552 end
|
||||||
|
553 internal
|
||||||
|
554 singleton
|
||||||
|
555 begin
|
||||||
|
556 end
|
||||||
|
557 internal
|
||||||
|
558 singleton
|
||||||
|
559 begin
|
||||||
|
560 end
|
||||||
|
561 internal
|
||||||
|
562 singleton
|
||||||
|
563 begin
|
||||||
|
564 end
|
||||||
|
565 internal
|
||||||
|
566 singleton
|
||||||
|
567 begin
|
||||||
|
568 end
|
||||||
|
569 internal
|
||||||
|
570 singleton
|
||||||
|
571 begin
|
||||||
|
572 end
|
||||||
|
573 internal
|
||||||
|
574 singleton
|
||||||
|
575 begin
|
||||||
|
576 end
|
||||||
|
577 internal
|
||||||
|
578 singleton
|
||||||
|
579 begin
|
||||||
|
580 end
|
||||||
|
581 internal
|
||||||
|
582 singleton
|
||||||
|
583 begin
|
||||||
|
584 end
|
||||||
|
585 internal
|
||||||
|
586 singleton
|
||||||
|
587 begin
|
||||||
|
588 end
|
||||||
|
589 internal
|
||||||
|
590 singleton
|
||||||
|
591 begin
|
||||||
|
592 end
|
||||||
|
593 internal
|
||||||
|
594 singleton
|
||||||
|
595 begin
|
||||||
|
596 end
|
||||||
|
597 internal
|
||||||
|
598 singleton
|
||||||
|
599 begin
|
||||||
|
600 end
|
||||||
|
601 internal
|
||||||
|
602 singleton
|
||||||
|
603 begin
|
||||||
|
604 end
|
||||||
|
605 internal
|
||||||
|
606 singleton
|
||||||
|
607 begin
|
||||||
|
608 end
|
||||||
|
609 internal
|
||||||
|
610 singleton
|
||||||
|
611 begin
|
||||||
|
612 end
|
||||||
|
613 internal
|
||||||
|
614 singleton
|
||||||
|
615 begin
|
||||||
|
616 end
|
||||||
|
617 internal
|
||||||
|
618 singleton
|
||||||
|
619 begin
|
||||||
|
620 end
|
||||||
|
621 internal
|
||||||
|
622 singleton
|
||||||
|
623 begin
|
||||||
|
624 end
|
||||||
|
625 internal
|
||||||
|
626 singleton
|
||||||
|
627 begin
|
||||||
|
628 end
|
||||||
|
629 internal
|
||||||
|
630 singleton
|
||||||
|
631 begin
|
||||||
|
632 end
|
||||||
|
633 internal
|
||||||
|
634 singleton
|
||||||
|
635 begin
|
||||||
|
636 end
|
||||||
|
637 internal
|
||||||
|
638 singleton
|
||||||
|
639 begin
|
||||||
|
640 end
|
||||||
|
641 internal
|
||||||
|
642 singleton
|
||||||
|
643 begin
|
||||||
|
644 end
|
||||||
|
645 internal
|
||||||
|
646 singleton
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
1.117107e+11 -7.827721e+08 -1.101398e+10 -2.193934e+09 -1.347332e+10 -1.613916e+10 -1.199561e+10 -1.255081e+10 -1.638895e+10 -3.821099e+09 -1.372833e+10 -5.244242e+09 -1.098187e+10 -3.655235e+09 -9.364579e+09 -4.285302e+09 -6.296873e+09 -1.552953e+09 -3.176746e+09 -1.202976e+08 -9.857023e+08 2.316555e+08 -1.61059e+08 -5.891868e+07 3.465849e+08 -1.842054e+08 3.248211e+08 -1.483965e+08 3.739239e+08 -6.672061e+08 4.442288e+08 -9.274889e+08 5.142684e+08 4.292036e+07 2.206386e+08 -4.532715e+08 -2.092499e+08 -3.70488e+08 -8.079404e+07 -8.425977e+07 1.344125e+09
|
||||||
|
9.982632e+12 1.02635e+12 8.634624e+11 9.06451e+11 9.652096e+11 1.12772e+12 9.468372e+11 9.141218e+11 9.670484e+11 6.936961e+11 8.141006e+11 6.256321e+11 6.087707e+11 4.616898e+11 4.212042e+11 2.862872e+11 2.498089e+11 1.470856e+11 1.099197e+11 5.780894e+10 3.118114e+10 1.060667e+10 1.466199e+09 4.173056e+08 5.257362e+09 1.277714e+10 2.114478e+10 2.974502e+10 3.587691e+10 4.078971e+10 4.247745e+10 4.382608e+10 4.62521e+10 4.575282e+10 3.546206e+10 3.041531e+10 2.838562e+10 2.258604e+10 1.715295e+10 1.303227e+10 0 ]
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
--left-context=3
|
||||||
|
--right-context=3
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
## For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
#
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
# Default value: -Xmx1024m -XX:MaxPermSize=256m
|
||||||
|
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
|
#
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. For more details, visit
|
||||||
|
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
#Thu Dec 11 10:32:39 CST 2025
|
||||||
|
systemProp.http.proxyHost=
|
||||||
|
systemProp.http.proxyPort=80
|
||||||
|
systemProp.https.proxyHost=
|
||||||
|
systemProp.https.proxyPort=80
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. For more details, visit
|
||||||
|
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
|
android.nonFinalResIds=false
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
#Fri Nov 14 08:56:46 CST 2025
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.13-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
[versions]
|
||||||
|
agp = "8.13.0"
|
||||||
|
junit = "4.13.2"
|
||||||
|
junitVersion = "1.1.5"
|
||||||
|
espressoCore = "3.5.1"
|
||||||
|
appcompat = "1.6.1"
|
||||||
|
material = "1.10.0"
|
||||||
|
activity = "1.8.0"
|
||||||
|
constraintlayout = "2.1.4"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
|
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||||
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
## This file is automatically generated by Android Studio.
|
||||||
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
|
#
|
||||||
|
# This file should *NOT* be checked into Version Control Systems,
|
||||||
|
# as it contains information specific to your local configuration.
|
||||||
|
#
|
||||||
|
# Location of the SDK. This is only used by Gradle.
|
||||||
|
# For customization when using a Version Control System, please read the
|
||||||
|
# header note.
|
||||||
|
sdk.dir=D\:\\AndroidTools\\AndroidSDk
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven { url=uri( "https://maven.aliyun.com/repository/central") }
|
||||||
|
maven { url=uri( "https://maven.aliyun.com/repository/public") }
|
||||||
|
maven { url=uri( "https://maven.aliyun.com/repository/google") }
|
||||||
|
maven { url=uri( "https://maven.aliyun.com/repository/gradle-plugin") }
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = uri("https://jitpack.io") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "Notes-master"
|
||||||
|
include(":app")
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,361 @@
|
|||||||
|
// Copyright 2020-2021 Alpha Cephei Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
/* This header contains the C API for Vosk speech recognition system */
|
||||||
|
|
||||||
|
#ifndef VOSK_API_H
|
||||||
|
#define VOSK_API_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Model stores all the data required for recognition
|
||||||
|
* it contains static data and can be shared across processing
|
||||||
|
* threads. */
|
||||||
|
typedef struct VoskModel VoskModel;
|
||||||
|
|
||||||
|
|
||||||
|
/** Speaker model is the same as model but contains the data
|
||||||
|
* for speaker identification. */
|
||||||
|
typedef struct VoskSpkModel VoskSpkModel;
|
||||||
|
|
||||||
|
|
||||||
|
/** Recognizer object is the main object which processes data.
|
||||||
|
* Each recognizer usually runs in own thread and takes audio as input.
|
||||||
|
* Once audio is processed recognizer returns JSON object as a string
|
||||||
|
* which represent decoded information - words, confidences, times, n-best lists,
|
||||||
|
* speaker information and so on */
|
||||||
|
typedef struct VoskRecognizer VoskRecognizer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Batch model object
|
||||||
|
*/
|
||||||
|
typedef struct VoskBatchModel VoskBatchModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Batch recognizer object
|
||||||
|
*/
|
||||||
|
typedef struct VoskBatchRecognizer VoskBatchRecognizer;
|
||||||
|
|
||||||
|
|
||||||
|
/** Loads model data from the file and returns the model object
|
||||||
|
*
|
||||||
|
* @param model_path: the path of the model on the filesystem
|
||||||
|
* @returns model object or NULL if problem occured */
|
||||||
|
VoskModel *vosk_model_new(const char *model_path);
|
||||||
|
|
||||||
|
|
||||||
|
/** Releases the model memory
|
||||||
|
*
|
||||||
|
* The model object is reference-counted so if some recognizer
|
||||||
|
* depends on this model, model might still stay alive. When
|
||||||
|
* last recognizer is released, model will be released too. */
|
||||||
|
void vosk_model_free(VoskModel *model);
|
||||||
|
|
||||||
|
|
||||||
|
/** Check if a word can be recognized by the model
|
||||||
|
* @param word: the word
|
||||||
|
* @returns the word symbol if @param word exists inside the model
|
||||||
|
* or -1 otherwise.
|
||||||
|
* Reminding that word symbol 0 is for <epsilon> */
|
||||||
|
int vosk_model_find_word(VoskModel *model, const char *word);
|
||||||
|
|
||||||
|
|
||||||
|
/** Loads speaker model data from the file and returns the model object
|
||||||
|
*
|
||||||
|
* @param model_path: the path of the model on the filesystem
|
||||||
|
* @returns model object or NULL if problem occured */
|
||||||
|
VoskSpkModel *vosk_spk_model_new(const char *model_path);
|
||||||
|
|
||||||
|
|
||||||
|
/** Releases the model memory
|
||||||
|
*
|
||||||
|
* The model object is reference-counted so if some recognizer
|
||||||
|
* depends on this model, model might still stay alive. When
|
||||||
|
* last recognizer is released, model will be released too. */
|
||||||
|
void vosk_spk_model_free(VoskSpkModel *model);
|
||||||
|
|
||||||
|
/** Creates the recognizer object
|
||||||
|
*
|
||||||
|
* The recognizers process the speech and return text using shared model data
|
||||||
|
* @param model VoskModel containing static data for recognizer. Model can be
|
||||||
|
* shared across recognizers, even running in different threads.
|
||||||
|
* @param sample_rate The sample rate of the audio you going to feed into the recognizer.
|
||||||
|
* Make sure this rate matches the audio content, it is a common
|
||||||
|
* issue causing accuracy problems.
|
||||||
|
* @returns recognizer object or NULL if problem occured */
|
||||||
|
VoskRecognizer *vosk_recognizer_new(VoskModel *model, float sample_rate);
|
||||||
|
|
||||||
|
|
||||||
|
/** Creates the recognizer object with speaker recognition
|
||||||
|
*
|
||||||
|
* With the speaker recognition mode the recognizer not just recognize
|
||||||
|
* text but also return speaker vectors one can use for speaker identification
|
||||||
|
*
|
||||||
|
* @param model VoskModel containing static data for recognizer. Model can be
|
||||||
|
* shared across recognizers, even running in different threads.
|
||||||
|
* @param sample_rate The sample rate of the audio you going to feed into the recognizer.
|
||||||
|
* Make sure this rate matches the audio content, it is a common
|
||||||
|
* issue causing accuracy problems.
|
||||||
|
* @param spk_model speaker model for speaker identification
|
||||||
|
* @returns recognizer object or NULL if problem occured */
|
||||||
|
VoskRecognizer *vosk_recognizer_new_spk(VoskModel *model, float sample_rate, VoskSpkModel *spk_model);
|
||||||
|
|
||||||
|
|
||||||
|
/** Creates the recognizer object with the phrase list
|
||||||
|
*
|
||||||
|
* Sometimes when you want to improve recognition accuracy and when you don't need
|
||||||
|
* to recognize large vocabulary you can specify a list of phrases to recognize. This
|
||||||
|
* will improve recognizer speed and accuracy but might return [unk] if user said
|
||||||
|
* something different.
|
||||||
|
*
|
||||||
|
* Only recognizers with lookahead models support this type of quick configuration.
|
||||||
|
* Precompiled HCLG graph models are not supported.
|
||||||
|
*
|
||||||
|
* @param model VoskModel containing static data for recognizer. Model can be
|
||||||
|
* shared across recognizers, even running in different threads.
|
||||||
|
* @param sample_rate The sample rate of the audio you going to feed into the recognizer.
|
||||||
|
* Make sure this rate matches the audio content, it is a common
|
||||||
|
* issue causing accuracy problems.
|
||||||
|
* @param grammar The string with the list of phrases to recognize as JSON array of strings,
|
||||||
|
* for example "["one two three four five", "[unk]"]".
|
||||||
|
*
|
||||||
|
* @returns recognizer object or NULL if problem occured */
|
||||||
|
VoskRecognizer *vosk_recognizer_new_grm(VoskModel *model, float sample_rate, const char *grammar);
|
||||||
|
|
||||||
|
|
||||||
|
/** Adds speaker model to already initialized recognizer
|
||||||
|
*
|
||||||
|
* Can add speaker recognition model to already created recognizer. Helps to initialize
|
||||||
|
* speaker recognition for grammar-based recognizer.
|
||||||
|
*
|
||||||
|
* @param spk_model Speaker recognition model */
|
||||||
|
void vosk_recognizer_set_spk_model(VoskRecognizer *recognizer, VoskSpkModel *spk_model);
|
||||||
|
|
||||||
|
|
||||||
|
/** Reconfigures recognizer to use grammar
|
||||||
|
*
|
||||||
|
* @param recognizer Already running VoskRecognizer
|
||||||
|
* @param grammar Set of phrases in JSON array of strings or "[]" to use default model graph.
|
||||||
|
* See also vosk_recognizer_new_grm
|
||||||
|
*/
|
||||||
|
void vosk_recognizer_set_grm(VoskRecognizer *recognizer, char const *grammar);
|
||||||
|
|
||||||
|
|
||||||
|
/** Configures recognizer to output n-best results
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* {
|
||||||
|
* "alternatives": [
|
||||||
|
* { "text": "one two three four five", "confidence": 0.97 },
|
||||||
|
* { "text": "one two three for five", "confidence": 0.03 },
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param max_alternatives - maximum alternatives to return from recognition results
|
||||||
|
*/
|
||||||
|
void vosk_recognizer_set_max_alternatives(VoskRecognizer *recognizer, int max_alternatives);
|
||||||
|
|
||||||
|
|
||||||
|
/** Enables words with times in the output
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* "result" : [{
|
||||||
|
* "conf" : 1.000000,
|
||||||
|
* "end" : 1.110000,
|
||||||
|
* "start" : 0.870000,
|
||||||
|
* "word" : "what"
|
||||||
|
* }, {
|
||||||
|
* "conf" : 1.000000,
|
||||||
|
* "end" : 1.530000,
|
||||||
|
* "start" : 1.110000,
|
||||||
|
* "word" : "zero"
|
||||||
|
* }, {
|
||||||
|
* "conf" : 1.000000,
|
||||||
|
* "end" : 1.950000,
|
||||||
|
* "start" : 1.530000,
|
||||||
|
* "word" : "zero"
|
||||||
|
* }, {
|
||||||
|
* "conf" : 1.000000,
|
||||||
|
* "end" : 2.340000,
|
||||||
|
* "start" : 1.950000,
|
||||||
|
* "word" : "zero"
|
||||||
|
* }, {
|
||||||
|
* "conf" : 1.000000,
|
||||||
|
* "end" : 2.610000,
|
||||||
|
* "start" : 2.340000,
|
||||||
|
* "word" : "one"
|
||||||
|
* }],
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param words - boolean value
|
||||||
|
*/
|
||||||
|
void vosk_recognizer_set_words(VoskRecognizer *recognizer, int words);
|
||||||
|
|
||||||
|
/** Like above return words and confidences in partial results
|
||||||
|
*
|
||||||
|
* @param partial_words - boolean value
|
||||||
|
*/
|
||||||
|
void vosk_recognizer_set_partial_words(VoskRecognizer *recognizer, int partial_words);
|
||||||
|
|
||||||
|
/** Set NLSML output
|
||||||
|
* @param nlsml - boolean value
|
||||||
|
*/
|
||||||
|
void vosk_recognizer_set_nlsml(VoskRecognizer *recognizer, int nlsml);
|
||||||
|
|
||||||
|
|
||||||
|
/** Accept voice data
|
||||||
|
*
|
||||||
|
* accept and process new chunk of voice data
|
||||||
|
*
|
||||||
|
* @param data - audio data in PCM 16-bit mono format
|
||||||
|
* @param length - length of the audio data
|
||||||
|
* @returns 1 if silence is occured and you can retrieve a new utterance with result method
|
||||||
|
* 0 if decoding continues
|
||||||
|
* -1 if exception occured */
|
||||||
|
int vosk_recognizer_accept_waveform(VoskRecognizer *recognizer, const char *data, int length);
|
||||||
|
|
||||||
|
|
||||||
|
/** Same as above but the version with the short data for language bindings where you have
|
||||||
|
* audio as array of shorts */
|
||||||
|
int vosk_recognizer_accept_waveform_s(VoskRecognizer *recognizer, const short *data, int length);
|
||||||
|
|
||||||
|
|
||||||
|
/** Same as above but the version with the float data for language bindings where you have
|
||||||
|
* audio as array of floats */
|
||||||
|
int vosk_recognizer_accept_waveform_f(VoskRecognizer *recognizer, const float *data, int length);
|
||||||
|
|
||||||
|
|
||||||
|
/** Returns speech recognition result
|
||||||
|
*
|
||||||
|
* @returns the result in JSON format which contains decoded line, decoded
|
||||||
|
* words, times in seconds and confidences. You can parse this result
|
||||||
|
* with any json parser
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* {
|
||||||
|
* "text" : "what zero zero zero one"
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* If alternatives enabled it returns result with alternatives, see also vosk_recognizer_set_max_alternatives().
|
||||||
|
*
|
||||||
|
* If word times enabled returns word time, see also vosk_recognizer_set_word_times().
|
||||||
|
*/
|
||||||
|
const char *vosk_recognizer_result(VoskRecognizer *recognizer);
|
||||||
|
|
||||||
|
|
||||||
|
/** Returns partial speech recognition
|
||||||
|
*
|
||||||
|
* @returns partial speech recognition text which is not yet finalized.
|
||||||
|
* result may change as recognizer process more data.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* {
|
||||||
|
* "partial" : "cyril one eight zero"
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
const char *vosk_recognizer_partial_result(VoskRecognizer *recognizer);
|
||||||
|
|
||||||
|
|
||||||
|
/** Returns speech recognition result. Same as result, but doesn't wait for silence
|
||||||
|
* You usually call it in the end of the stream to get final bits of audio. It
|
||||||
|
* flushes the feature pipeline, so all remaining audio chunks got processed.
|
||||||
|
*
|
||||||
|
* @returns speech result in JSON format.
|
||||||
|
*/
|
||||||
|
const char *vosk_recognizer_final_result(VoskRecognizer *recognizer);
|
||||||
|
|
||||||
|
|
||||||
|
/** Resets the recognizer
|
||||||
|
*
|
||||||
|
* Resets current results so the recognition can continue from scratch */
|
||||||
|
void vosk_recognizer_reset(VoskRecognizer *recognizer);
|
||||||
|
|
||||||
|
|
||||||
|
/** Releases recognizer object
|
||||||
|
*
|
||||||
|
* Underlying model is also unreferenced and if needed released */
|
||||||
|
void vosk_recognizer_free(VoskRecognizer *recognizer);
|
||||||
|
|
||||||
|
/** Set log level for Kaldi messages
|
||||||
|
*
|
||||||
|
* @param log_level the level
|
||||||
|
* 0 - default value to print info and error messages but no debug
|
||||||
|
* less than 0 - don't print info messages
|
||||||
|
* greather than 0 - more verbose mode
|
||||||
|
*/
|
||||||
|
void vosk_set_log_level(int log_level);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init, automatically select a CUDA device and allow multithreading.
|
||||||
|
* Must be called once from the main thread.
|
||||||
|
* Has no effect if HAVE_CUDA flag is not set.
|
||||||
|
*/
|
||||||
|
void vosk_gpu_init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init CUDA device in a multi-threaded environment.
|
||||||
|
* Must be called for each thread.
|
||||||
|
* Has no effect if HAVE_CUDA flag is not set.
|
||||||
|
*/
|
||||||
|
void vosk_gpu_thread_init();
|
||||||
|
|
||||||
|
/** Creates the batch recognizer object
|
||||||
|
*
|
||||||
|
* @returns model object or NULL if problem occured */
|
||||||
|
VoskBatchModel *vosk_batch_model_new(const char *model_path);
|
||||||
|
|
||||||
|
/** Releases batch model object */
|
||||||
|
void vosk_batch_model_free(VoskBatchModel *model);
|
||||||
|
|
||||||
|
/** Wait for the processing */
|
||||||
|
void vosk_batch_model_wait(VoskBatchModel *model);
|
||||||
|
|
||||||
|
/** Creates batch recognizer object
|
||||||
|
* @returns recognizer object or NULL if problem occured */
|
||||||
|
VoskBatchRecognizer *vosk_batch_recognizer_new(VoskBatchModel *model, float sample_rate);
|
||||||
|
|
||||||
|
/** Releases batch recognizer object */
|
||||||
|
void vosk_batch_recognizer_free(VoskBatchRecognizer *recognizer);
|
||||||
|
|
||||||
|
/** Accept batch voice data */
|
||||||
|
void vosk_batch_recognizer_accept_waveform(VoskBatchRecognizer *recognizer, const char *data, int length);
|
||||||
|
|
||||||
|
/** Set NLSML output
|
||||||
|
* @param nlsml - boolean value
|
||||||
|
*/
|
||||||
|
void vosk_batch_recognizer_set_nlsml(VoskBatchRecognizer *recognizer, int nlsml);
|
||||||
|
|
||||||
|
/** Closes the stream */
|
||||||
|
void vosk_batch_recognizer_finish_stream(VoskBatchRecognizer *recognizer);
|
||||||
|
|
||||||
|
/** Return results */
|
||||||
|
const char *vosk_batch_recognizer_front_result(VoskBatchRecognizer *recognizer);
|
||||||
|
|
||||||
|
/** Release and free first retrieved result */
|
||||||
|
void vosk_batch_recognizer_pop(VoskBatchRecognizer *recognizer);
|
||||||
|
|
||||||
|
/** Get amount of pending chunks for more intelligent waiting */
|
||||||
|
int vosk_batch_recognizer_get_pending_chunks(VoskBatchRecognizer *recognizer);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* VOSK_API_H */
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<style name="NoteTheme" parent="@android:style/Theme.Material.Light">
|
||||||
|
<item name="android:actionBarStyle">@android:style/Widget.Material.Light.ActionBar</item>
|
||||||
|
<item name="android:displayOptions">showHome|showTitle|useLogo</item>
|
||||||
|
<item name="android:windowActionBar">true</item>
|
||||||
|
<item name="android:windowNoTitle">false</item>
|
||||||
|
<item name="android:windowSoftInputMode">adjustResize</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">true</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
Chinese Vosk model for mobile
|
||||||
|
|
||||||
|
CER results
|
||||||
|
|
||||||
|
23.54% speechio_02
|
||||||
|
38.29% speechio_06
|
||||||
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
--use-energy=false
|
||||||
|
--sample-frequency=16000
|
||||||
|
--num-mel-bins=40
|
||||||
|
--num-ceps=40
|
||||||
|
--low-freq=40
|
||||||
|
--high-freq=-200
|
||||||
|
--allow-upsample=true
|
||||||
|
--allow-downsample=true
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
--min-active=200
|
||||||
|
--max-active=5000
|
||||||
|
--beam=12.0
|
||||||
|
--lattice-beam=4.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=1.0
|
||||||
|
--endpoint.rule4.min-trailing-silence=2.0
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,39 @@
|
|||||||
|
11845
|
||||||
|
11846
|
||||||
|
11847
|
||||||
|
11848
|
||||||
|
11849
|
||||||
|
11850
|
||||||
|
11851
|
||||||
|
11852
|
||||||
|
11853
|
||||||
|
11854
|
||||||
|
11855
|
||||||
|
11856
|
||||||
|
11857
|
||||||
|
11858
|
||||||
|
11859
|
||||||
|
11860
|
||||||
|
11861
|
||||||
|
11862
|
||||||
|
11863
|
||||||
|
11864
|
||||||
|
11865
|
||||||
|
11866
|
||||||
|
11867
|
||||||
|
11868
|
||||||
|
11869
|
||||||
|
11870
|
||||||
|
11871
|
||||||
|
11872
|
||||||
|
11873
|
||||||
|
11874
|
||||||
|
11875
|
||||||
|
11876
|
||||||
|
11877
|
||||||
|
11878
|
||||||
|
11879
|
||||||
|
11880
|
||||||
|
11881
|
||||||
|
11882
|
||||||
|
11883
|
||||||
@ -0,0 +1,646 @@
|
|||||||
|
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
|
||||||
|
231 begin
|
||||||
|
232 end
|
||||||
|
233 internal
|
||||||
|
234 singleton
|
||||||
|
235 begin
|
||||||
|
236 end
|
||||||
|
237 internal
|
||||||
|
238 singleton
|
||||||
|
239 begin
|
||||||
|
240 end
|
||||||
|
241 internal
|
||||||
|
242 singleton
|
||||||
|
243 begin
|
||||||
|
244 end
|
||||||
|
245 internal
|
||||||
|
246 singleton
|
||||||
|
247 begin
|
||||||
|
248 end
|
||||||
|
249 internal
|
||||||
|
250 singleton
|
||||||
|
251 begin
|
||||||
|
252 end
|
||||||
|
253 internal
|
||||||
|
254 singleton
|
||||||
|
255 begin
|
||||||
|
256 end
|
||||||
|
257 internal
|
||||||
|
258 singleton
|
||||||
|
259 begin
|
||||||
|
260 end
|
||||||
|
261 internal
|
||||||
|
262 singleton
|
||||||
|
263 begin
|
||||||
|
264 end
|
||||||
|
265 internal
|
||||||
|
266 singleton
|
||||||
|
267 begin
|
||||||
|
268 end
|
||||||
|
269 internal
|
||||||
|
270 singleton
|
||||||
|
271 begin
|
||||||
|
272 end
|
||||||
|
273 internal
|
||||||
|
274 singleton
|
||||||
|
275 begin
|
||||||
|
276 end
|
||||||
|
277 internal
|
||||||
|
278 singleton
|
||||||
|
279 begin
|
||||||
|
280 end
|
||||||
|
281 internal
|
||||||
|
282 singleton
|
||||||
|
283 begin
|
||||||
|
284 end
|
||||||
|
285 internal
|
||||||
|
286 singleton
|
||||||
|
287 begin
|
||||||
|
288 end
|
||||||
|
289 internal
|
||||||
|
290 singleton
|
||||||
|
291 begin
|
||||||
|
292 end
|
||||||
|
293 internal
|
||||||
|
294 singleton
|
||||||
|
295 begin
|
||||||
|
296 end
|
||||||
|
297 internal
|
||||||
|
298 singleton
|
||||||
|
299 begin
|
||||||
|
300 end
|
||||||
|
301 internal
|
||||||
|
302 singleton
|
||||||
|
303 begin
|
||||||
|
304 end
|
||||||
|
305 internal
|
||||||
|
306 singleton
|
||||||
|
307 begin
|
||||||
|
308 end
|
||||||
|
309 internal
|
||||||
|
310 singleton
|
||||||
|
311 begin
|
||||||
|
312 end
|
||||||
|
313 internal
|
||||||
|
314 singleton
|
||||||
|
315 begin
|
||||||
|
316 end
|
||||||
|
317 internal
|
||||||
|
318 singleton
|
||||||
|
319 begin
|
||||||
|
320 end
|
||||||
|
321 internal
|
||||||
|
322 singleton
|
||||||
|
323 begin
|
||||||
|
324 end
|
||||||
|
325 internal
|
||||||
|
326 singleton
|
||||||
|
327 begin
|
||||||
|
328 end
|
||||||
|
329 internal
|
||||||
|
330 singleton
|
||||||
|
331 begin
|
||||||
|
332 end
|
||||||
|
333 internal
|
||||||
|
334 singleton
|
||||||
|
335 begin
|
||||||
|
336 end
|
||||||
|
337 internal
|
||||||
|
338 singleton
|
||||||
|
339 begin
|
||||||
|
340 end
|
||||||
|
341 internal
|
||||||
|
342 singleton
|
||||||
|
343 begin
|
||||||
|
344 end
|
||||||
|
345 internal
|
||||||
|
346 singleton
|
||||||
|
347 begin
|
||||||
|
348 end
|
||||||
|
349 internal
|
||||||
|
350 singleton
|
||||||
|
351 begin
|
||||||
|
352 end
|
||||||
|
353 internal
|
||||||
|
354 singleton
|
||||||
|
355 begin
|
||||||
|
356 end
|
||||||
|
357 internal
|
||||||
|
358 singleton
|
||||||
|
359 begin
|
||||||
|
360 end
|
||||||
|
361 internal
|
||||||
|
362 singleton
|
||||||
|
363 begin
|
||||||
|
364 end
|
||||||
|
365 internal
|
||||||
|
366 singleton
|
||||||
|
367 begin
|
||||||
|
368 end
|
||||||
|
369 internal
|
||||||
|
370 singleton
|
||||||
|
371 begin
|
||||||
|
372 end
|
||||||
|
373 internal
|
||||||
|
374 singleton
|
||||||
|
375 begin
|
||||||
|
376 end
|
||||||
|
377 internal
|
||||||
|
378 singleton
|
||||||
|
379 begin
|
||||||
|
380 end
|
||||||
|
381 internal
|
||||||
|
382 singleton
|
||||||
|
383 begin
|
||||||
|
384 end
|
||||||
|
385 internal
|
||||||
|
386 singleton
|
||||||
|
387 begin
|
||||||
|
388 end
|
||||||
|
389 internal
|
||||||
|
390 singleton
|
||||||
|
391 begin
|
||||||
|
392 end
|
||||||
|
393 internal
|
||||||
|
394 singleton
|
||||||
|
395 begin
|
||||||
|
396 end
|
||||||
|
397 internal
|
||||||
|
398 singleton
|
||||||
|
399 begin
|
||||||
|
400 end
|
||||||
|
401 internal
|
||||||
|
402 singleton
|
||||||
|
403 begin
|
||||||
|
404 end
|
||||||
|
405 internal
|
||||||
|
406 singleton
|
||||||
|
407 begin
|
||||||
|
408 end
|
||||||
|
409 internal
|
||||||
|
410 singleton
|
||||||
|
411 begin
|
||||||
|
412 end
|
||||||
|
413 internal
|
||||||
|
414 singleton
|
||||||
|
415 begin
|
||||||
|
416 end
|
||||||
|
417 internal
|
||||||
|
418 singleton
|
||||||
|
419 begin
|
||||||
|
420 end
|
||||||
|
421 internal
|
||||||
|
422 singleton
|
||||||
|
423 begin
|
||||||
|
424 end
|
||||||
|
425 internal
|
||||||
|
426 singleton
|
||||||
|
427 begin
|
||||||
|
428 end
|
||||||
|
429 internal
|
||||||
|
430 singleton
|
||||||
|
431 begin
|
||||||
|
432 end
|
||||||
|
433 internal
|
||||||
|
434 singleton
|
||||||
|
435 begin
|
||||||
|
436 end
|
||||||
|
437 internal
|
||||||
|
438 singleton
|
||||||
|
439 begin
|
||||||
|
440 end
|
||||||
|
441 internal
|
||||||
|
442 singleton
|
||||||
|
443 begin
|
||||||
|
444 end
|
||||||
|
445 internal
|
||||||
|
446 singleton
|
||||||
|
447 begin
|
||||||
|
448 end
|
||||||
|
449 internal
|
||||||
|
450 singleton
|
||||||
|
451 begin
|
||||||
|
452 end
|
||||||
|
453 internal
|
||||||
|
454 singleton
|
||||||
|
455 begin
|
||||||
|
456 end
|
||||||
|
457 internal
|
||||||
|
458 singleton
|
||||||
|
459 begin
|
||||||
|
460 end
|
||||||
|
461 internal
|
||||||
|
462 singleton
|
||||||
|
463 begin
|
||||||
|
464 end
|
||||||
|
465 internal
|
||||||
|
466 singleton
|
||||||
|
467 begin
|
||||||
|
468 end
|
||||||
|
469 internal
|
||||||
|
470 singleton
|
||||||
|
471 begin
|
||||||
|
472 end
|
||||||
|
473 internal
|
||||||
|
474 singleton
|
||||||
|
475 begin
|
||||||
|
476 end
|
||||||
|
477 internal
|
||||||
|
478 singleton
|
||||||
|
479 begin
|
||||||
|
480 end
|
||||||
|
481 internal
|
||||||
|
482 singleton
|
||||||
|
483 begin
|
||||||
|
484 end
|
||||||
|
485 internal
|
||||||
|
486 singleton
|
||||||
|
487 begin
|
||||||
|
488 end
|
||||||
|
489 internal
|
||||||
|
490 singleton
|
||||||
|
491 begin
|
||||||
|
492 end
|
||||||
|
493 internal
|
||||||
|
494 singleton
|
||||||
|
495 begin
|
||||||
|
496 end
|
||||||
|
497 internal
|
||||||
|
498 singleton
|
||||||
|
499 begin
|
||||||
|
500 end
|
||||||
|
501 internal
|
||||||
|
502 singleton
|
||||||
|
503 begin
|
||||||
|
504 end
|
||||||
|
505 internal
|
||||||
|
506 singleton
|
||||||
|
507 begin
|
||||||
|
508 end
|
||||||
|
509 internal
|
||||||
|
510 singleton
|
||||||
|
511 begin
|
||||||
|
512 end
|
||||||
|
513 internal
|
||||||
|
514 singleton
|
||||||
|
515 begin
|
||||||
|
516 end
|
||||||
|
517 internal
|
||||||
|
518 singleton
|
||||||
|
519 begin
|
||||||
|
520 end
|
||||||
|
521 internal
|
||||||
|
522 singleton
|
||||||
|
523 begin
|
||||||
|
524 end
|
||||||
|
525 internal
|
||||||
|
526 singleton
|
||||||
|
527 begin
|
||||||
|
528 end
|
||||||
|
529 internal
|
||||||
|
530 singleton
|
||||||
|
531 begin
|
||||||
|
532 end
|
||||||
|
533 internal
|
||||||
|
534 singleton
|
||||||
|
535 begin
|
||||||
|
536 end
|
||||||
|
537 internal
|
||||||
|
538 singleton
|
||||||
|
539 begin
|
||||||
|
540 end
|
||||||
|
541 internal
|
||||||
|
542 singleton
|
||||||
|
543 begin
|
||||||
|
544 end
|
||||||
|
545 internal
|
||||||
|
546 singleton
|
||||||
|
547 begin
|
||||||
|
548 end
|
||||||
|
549 internal
|
||||||
|
550 singleton
|
||||||
|
551 begin
|
||||||
|
552 end
|
||||||
|
553 internal
|
||||||
|
554 singleton
|
||||||
|
555 begin
|
||||||
|
556 end
|
||||||
|
557 internal
|
||||||
|
558 singleton
|
||||||
|
559 begin
|
||||||
|
560 end
|
||||||
|
561 internal
|
||||||
|
562 singleton
|
||||||
|
563 begin
|
||||||
|
564 end
|
||||||
|
565 internal
|
||||||
|
566 singleton
|
||||||
|
567 begin
|
||||||
|
568 end
|
||||||
|
569 internal
|
||||||
|
570 singleton
|
||||||
|
571 begin
|
||||||
|
572 end
|
||||||
|
573 internal
|
||||||
|
574 singleton
|
||||||
|
575 begin
|
||||||
|
576 end
|
||||||
|
577 internal
|
||||||
|
578 singleton
|
||||||
|
579 begin
|
||||||
|
580 end
|
||||||
|
581 internal
|
||||||
|
582 singleton
|
||||||
|
583 begin
|
||||||
|
584 end
|
||||||
|
585 internal
|
||||||
|
586 singleton
|
||||||
|
587 begin
|
||||||
|
588 end
|
||||||
|
589 internal
|
||||||
|
590 singleton
|
||||||
|
591 begin
|
||||||
|
592 end
|
||||||
|
593 internal
|
||||||
|
594 singleton
|
||||||
|
595 begin
|
||||||
|
596 end
|
||||||
|
597 internal
|
||||||
|
598 singleton
|
||||||
|
599 begin
|
||||||
|
600 end
|
||||||
|
601 internal
|
||||||
|
602 singleton
|
||||||
|
603 begin
|
||||||
|
604 end
|
||||||
|
605 internal
|
||||||
|
606 singleton
|
||||||
|
607 begin
|
||||||
|
608 end
|
||||||
|
609 internal
|
||||||
|
610 singleton
|
||||||
|
611 begin
|
||||||
|
612 end
|
||||||
|
613 internal
|
||||||
|
614 singleton
|
||||||
|
615 begin
|
||||||
|
616 end
|
||||||
|
617 internal
|
||||||
|
618 singleton
|
||||||
|
619 begin
|
||||||
|
620 end
|
||||||
|
621 internal
|
||||||
|
622 singleton
|
||||||
|
623 begin
|
||||||
|
624 end
|
||||||
|
625 internal
|
||||||
|
626 singleton
|
||||||
|
627 begin
|
||||||
|
628 end
|
||||||
|
629 internal
|
||||||
|
630 singleton
|
||||||
|
631 begin
|
||||||
|
632 end
|
||||||
|
633 internal
|
||||||
|
634 singleton
|
||||||
|
635 begin
|
||||||
|
636 end
|
||||||
|
637 internal
|
||||||
|
638 singleton
|
||||||
|
639 begin
|
||||||
|
640 end
|
||||||
|
641 internal
|
||||||
|
642 singleton
|
||||||
|
643 begin
|
||||||
|
644 end
|
||||||
|
645 internal
|
||||||
|
646 singleton
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
1.117107e+11 -7.827721e+08 -1.101398e+10 -2.193934e+09 -1.347332e+10 -1.613916e+10 -1.199561e+10 -1.255081e+10 -1.638895e+10 -3.821099e+09 -1.372833e+10 -5.244242e+09 -1.098187e+10 -3.655235e+09 -9.364579e+09 -4.285302e+09 -6.296873e+09 -1.552953e+09 -3.176746e+09 -1.202976e+08 -9.857023e+08 2.316555e+08 -1.61059e+08 -5.891868e+07 3.465849e+08 -1.842054e+08 3.248211e+08 -1.483965e+08 3.739239e+08 -6.672061e+08 4.442288e+08 -9.274889e+08 5.142684e+08 4.292036e+07 2.206386e+08 -4.532715e+08 -2.092499e+08 -3.70488e+08 -8.079404e+07 -8.425977e+07 1.344125e+09
|
||||||
|
9.982632e+12 1.02635e+12 8.634624e+11 9.06451e+11 9.652096e+11 1.12772e+12 9.468372e+11 9.141218e+11 9.670484e+11 6.936961e+11 8.141006e+11 6.256321e+11 6.087707e+11 4.616898e+11 4.212042e+11 2.862872e+11 2.498089e+11 1.470856e+11 1.099197e+11 5.780894e+10 3.118114e+10 1.060667e+10 1.466199e+09 4.173056e+08 5.257362e+09 1.277714e+10 2.114478e+10 2.974502e+10 3.587691e+10 4.078971e+10 4.247745e+10 4.382608e+10 4.62521e+10 4.575282e+10 3.546206e+10 3.041531e+10 2.838562e+10 2.258604e+10 1.715295e+10 1.303227e+10 0 ]
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
--left-context=3
|
||||||
|
--right-context=3
|
||||||
@ -0,0 +1,344 @@
|
|||||||
|
package net.micode.notes.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.media.AudioFormat;
|
||||||
|
import android.media.AudioRecord;
|
||||||
|
import android.media.MediaRecorder;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.vosk.Model;
|
||||||
|
import org.vosk.Recognizer;
|
||||||
|
import org.vosk.LibVosk;
|
||||||
|
import org.vosk.LogLevel;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class VoskRecognitionService {
|
||||||
|
private static final String TAG = "VoskRecognitionService";
|
||||||
|
private static final String MODEL_DIR = "vosk-model-small-cn-0.22";
|
||||||
|
private static final int SAMPLE_RATE = 16000;
|
||||||
|
private static final int CHANNEL_IN = AudioFormat.CHANNEL_IN_MONO;
|
||||||
|
private static final int ENCODING = AudioFormat.ENCODING_PCM_16BIT;
|
||||||
|
private static final int BUFFER_SIZE_FACTOR = 2;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private Model mModel;
|
||||||
|
private Recognizer mRecognizer;
|
||||||
|
private AudioRecord mAudioRecord;
|
||||||
|
private ExecutorService mExecutor;
|
||||||
|
private Handler mMainHandler;
|
||||||
|
|
||||||
|
private boolean mIsListening = false;
|
||||||
|
private boolean mIsInitialized = false;
|
||||||
|
|
||||||
|
private List<RecognitionListener> mListeners;
|
||||||
|
|
||||||
|
public interface RecognitionListener {
|
||||||
|
void onReadyForSpeech();
|
||||||
|
void onBeginningOfSpeech();
|
||||||
|
void onEndOfSpeech();
|
||||||
|
void onResult(String text);
|
||||||
|
void onPartialResult(String text);
|
||||||
|
void onError(String error);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoskRecognitionService(Context context) {
|
||||||
|
mContext = context.getApplicationContext();
|
||||||
|
mExecutor = Executors.newSingleThreadExecutor();
|
||||||
|
mMainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
mListeners = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(RecognitionListener listener) {
|
||||||
|
if (listener != null && !mListeners.contains(listener)) {
|
||||||
|
mListeners.add(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(RecognitionListener listener) {
|
||||||
|
mListeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initialize() {
|
||||||
|
mExecutor.execute(() -> {
|
||||||
|
try {
|
||||||
|
LibVosk.setLogLevel(LogLevel.INFO);
|
||||||
|
|
||||||
|
String modelPath = getModelPath();
|
||||||
|
if (modelPath == null) {
|
||||||
|
copyModelFromAssets();
|
||||||
|
modelPath = getModelPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modelPath != null && new File(modelPath).exists()) {
|
||||||
|
mModel = new Model(modelPath);
|
||||||
|
mRecognizer = new Recognizer(mModel, SAMPLE_RATE);
|
||||||
|
mRecognizer.setMaxAlternatives(0);
|
||||||
|
mRecognizer.setWords(true);
|
||||||
|
mIsInitialized = true;
|
||||||
|
Log.i(TAG, "Vosk recognition initialized successfully");
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Model path not found: " + modelPath);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "Failed to initialize Vosk: " + e.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getModelPath() {
|
||||||
|
File modelDir = new File(mContext.getFilesDir(), MODEL_DIR);
|
||||||
|
if (modelDir.exists()) {
|
||||||
|
return modelDir.getAbsolutePath();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyModelFromAssets() {
|
||||||
|
try {
|
||||||
|
String[] files = mContext.getAssets().list("");
|
||||||
|
boolean modelExists = false;
|
||||||
|
|
||||||
|
if (files != null) {
|
||||||
|
for (String file : files) {
|
||||||
|
if (file.equals(MODEL_DIR)) {
|
||||||
|
modelExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modelExists) {
|
||||||
|
Log.w(TAG, "Model not found in assets. Please download the model manually.");
|
||||||
|
Log.w(TAG, "Download from: https://alphacephei.com/vosk/models/vosk-model-small-cn-0.22.zip");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File modelDir = new File(mContext.getFilesDir(), MODEL_DIR);
|
||||||
|
if (!modelDir.exists()) {
|
||||||
|
modelDir.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
copyAssets(MODEL_DIR, modelDir.getAbsolutePath());
|
||||||
|
Log.i(TAG, "Model copied from assets to: " + modelDir.getAbsolutePath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "Failed to copy model from assets: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyAssets(String assetDir, String outDir) throws IOException {
|
||||||
|
String[] files = mContext.getAssets().list(assetDir);
|
||||||
|
if (files != null) {
|
||||||
|
for (String file : files) {
|
||||||
|
String fullAssetPath = assetDir + "/" + file;
|
||||||
|
String fullOutPath = outDir + "/" + file;
|
||||||
|
|
||||||
|
File outFile = new File(fullOutPath);
|
||||||
|
|
||||||
|
if (mContext.getAssets().list(fullAssetPath).length > 0) {
|
||||||
|
outFile.mkdirs();
|
||||||
|
copyAssets(fullAssetPath, fullOutPath);
|
||||||
|
} else {
|
||||||
|
InputStream in = mContext.getAssets().open(fullAssetPath);
|
||||||
|
OutputStream out = new FileOutputStream(outFile);
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int read;
|
||||||
|
while ((read = in.read(buffer)) != -1) {
|
||||||
|
out.write(buffer, 0, read);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startListening() {
|
||||||
|
if (!mIsInitialized) {
|
||||||
|
notifyError("语音识别未初始化,请确保模型文件已正确放置");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mIsListening) {
|
||||||
|
stopListening();
|
||||||
|
}
|
||||||
|
|
||||||
|
mExecutor.execute(() -> {
|
||||||
|
try {
|
||||||
|
int minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, CHANNEL_IN, ENCODING);
|
||||||
|
int bufferSize = minBufferSize * BUFFER_SIZE_FACTOR;
|
||||||
|
|
||||||
|
mAudioRecord = new AudioRecord(
|
||||||
|
MediaRecorder.AudioSource.MIC,
|
||||||
|
SAMPLE_RATE,
|
||||||
|
CHANNEL_IN,
|
||||||
|
ENCODING,
|
||||||
|
bufferSize
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mAudioRecord.getState() != AudioRecord.STATE_INITIALIZED) {
|
||||||
|
notifyError("无法初始化录音设备");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mIsListening = true;
|
||||||
|
mAudioRecord.startRecording();
|
||||||
|
|
||||||
|
mMainHandler.post(() -> notifyReadyForSpeech());
|
||||||
|
|
||||||
|
byte[] buffer = new byte[bufferSize];
|
||||||
|
|
||||||
|
while (mIsListening && mAudioRecord != null) {
|
||||||
|
int readSize = mAudioRecord.read(buffer, 0, buffer.length);
|
||||||
|
|
||||||
|
if (readSize > 0) {
|
||||||
|
if (mRecognizer.acceptWaveForm(buffer, readSize)) {
|
||||||
|
String result = mRecognizer.getResult();
|
||||||
|
String text = parseResultText(result);
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
mMainHandler.post(() -> notifyResult(text));
|
||||||
|
}
|
||||||
|
} else if (mRecognizer.getPartialResult() != null) {
|
||||||
|
String partialResult = mRecognizer.getPartialResult();
|
||||||
|
String text = parsePartialResultText(partialResult);
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
mMainHandler.post(() -> notifyPartialResult(text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "Error during recognition: " + e.getMessage());
|
||||||
|
notifyError("语音识别错误: " + e.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopListening() {
|
||||||
|
mIsListening = false;
|
||||||
|
|
||||||
|
if (mAudioRecord != null) {
|
||||||
|
try {
|
||||||
|
mAudioRecord.stop();
|
||||||
|
mAudioRecord.release();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "Error stopping audio record: " + e.getMessage());
|
||||||
|
}
|
||||||
|
mAudioRecord = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mRecognizer != null) {
|
||||||
|
String finalResult = mRecognizer.getFinalResult();
|
||||||
|
if (finalResult != null && !finalResult.isEmpty()) {
|
||||||
|
String text = parseResultText(finalResult);
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
notifyResult(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mMainHandler.post(() -> notifyEndOfSpeech());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isListening() {
|
||||||
|
return mIsListening;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return mIsInitialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String parseResultText(String json) {
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject(json);
|
||||||
|
if (jsonObject.has("text") && !jsonObject.isNull("text")) {
|
||||||
|
return jsonObject.getString("text").trim();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "Error parsing result: " + e.getMessage());
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String parsePartialResultText(String json) {
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject(json);
|
||||||
|
if (jsonObject.has("partial") && !jsonObject.isNull("partial")) {
|
||||||
|
return jsonObject.getString("partial").trim();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "Error parsing partial result: " + e.getMessage());
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyReadyForSpeech() {
|
||||||
|
for (RecognitionListener listener : mListeners) {
|
||||||
|
listener.onReadyForSpeech();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyBeginningOfSpeech() {
|
||||||
|
for (RecognitionListener listener : mListeners) {
|
||||||
|
listener.onBeginningOfSpeech();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyEndOfSpeech() {
|
||||||
|
for (RecognitionListener listener : mListeners) {
|
||||||
|
listener.onEndOfSpeech();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyResult(String text) {
|
||||||
|
for (RecognitionListener listener : mListeners) {
|
||||||
|
listener.onResult(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyPartialResult(String text) {
|
||||||
|
for (RecognitionListener listener : mListeners) {
|
||||||
|
listener.onPartialResult(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyError(String error) {
|
||||||
|
for (RecognitionListener listener : mListeners) {
|
||||||
|
listener.onError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release() {
|
||||||
|
stopListening();
|
||||||
|
|
||||||
|
if (mRecognizer != null) {
|
||||||
|
mRecognizer.close();
|
||||||
|
mRecognizer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mModel != null) {
|
||||||
|
mModel.close();
|
||||||
|
mModel = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mExecutor != null) {
|
||||||
|
mExecutor.shutdown();
|
||||||
|
mExecutor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
mIsInitialized = false;
|
||||||
|
Log.i(TAG, "Vosk recognition released");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,32 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "Checking Android project structure..."
|
|
||||||
|
|
||||||
# Check if this is an Android project
|
|
||||||
if [ -f "AndroidManifest.xml" ]; then
|
|
||||||
echo "Found AndroidManifest.xml"
|
|
||||||
else
|
|
||||||
echo "Error: No AndroidManifest.xml found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if src directory exists
|
|
||||||
if [ -d "src" ]; then
|
|
||||||
echo "Found src directory"
|
|
||||||
else
|
|
||||||
echo "Error: No src directory found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if res directory exists
|
|
||||||
if [ -d "res" ]; then
|
|
||||||
echo "Found res directory"
|
|
||||||
else
|
|
||||||
echo "Error: No res directory found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Project structure is valid!"
|
|
||||||
echo "The project should be ready to build with Android SDK tools."
|
|
||||||
echo "You can use the following command to build the project:"
|
|
||||||
echo "android update project -p . && ant debug"
|
|
||||||
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in new issue