Fix #29 (for real)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -58,7 +58,8 @@ class CommonModel extends EventTarget {
|
||||
// Caching already handled explicitly
|
||||
res = await fetch(url, { cache: 'no-store' });
|
||||
if (!res.ok) throw 'Unable to fetch model, status: ' + res.status;
|
||||
await cache.put(storepath + '?' + id, new Response(res.body.pipeThrough(new DecompressionStream('gzip'))));
|
||||
await cache.put(storepath + '?' + id,
|
||||
new Response(res.clone().body.pipeThrough(new DecompressionStream('gzip'))));
|
||||
}
|
||||
else res = await cache.match(req)
|
||||
let tar = await res.arrayBuffer();
|
||||
|
||||
79
Vosklet.js
79
Vosklet.js
File diff suppressed because one or more lines are too long
@@ -80,7 +80,7 @@ index 035ffee..18edcd3 100644
|
||||
#endif
|
||||
|
||||
diff --git a/src/recognizer.cc b/src/recognizer.cc
|
||||
index 55d9991..c111038 100644
|
||||
index 55d9991..44ac113 100644
|
||||
--- a/src/recognizer.cc
|
||||
+++ b/src/recognizer.cc
|
||||
@@ -17,6 +17,7 @@
|
||||
@@ -98,8 +98,7 @@ index 55d9991..c111038 100644
|
||||
-
|
||||
+const v128_t _32768fx4{wasm_f32x4_const_splat(32768.0f)};
|
||||
bool Recognizer::AcceptWaveform(const float *fdata, int len)
|
||||
-{
|
||||
+{
|
||||
{
|
||||
Vector<BaseFloat> wave;
|
||||
wave.Resize(len, kUndefined);
|
||||
- for (int i = 0; i < len; i++)
|
||||
@@ -116,3 +115,12 @@ index 55d9991..c111038 100644
|
||||
return AcceptWaveform(wave);
|
||||
}
|
||||
|
||||
@@ -844,7 +852,7 @@ const char* Recognizer::PartialResult()
|
||||
|
||||
clat = decoder_->GetLattice(decoder_->NumFramesInLattice(), false);
|
||||
if (model_->winfo_) {
|
||||
- WordAlignLatticePartial(clat, *model_->trans_model_, *model_->winfo_, 0, &aligned_lat);
|
||||
+ WordAlignLattice(clat, *model_->trans_model_, *model_->winfo_, 0, &aligned_lat);
|
||||
} else {
|
||||
CopyLatticeForMbr(clat, &aligned_lat);
|
||||
}
|
||||
|
||||
8
src/make
8
src/make
@@ -87,15 +87,11 @@ cd "$SRC" &&
|
||||
voskletFiles="Util.o CommonModel.o Recognizer.o Bindings.o"
|
||||
voskletFlags="$SHARED_FLAGS -fno-rtti -sSTRICT -sWASM_WORKERS=2"
|
||||
voskletLDFlags="-sWASMFS -sMODULARIZE -sTEXTDECODER=2 -sEVAL_CTORS=2 -sALLOW_UNIMPLEMENTED_SYSCALLS -sINITIAL_MEMORY=$INITIAL_MEMORY -sALLOW_MEMORY_GROWTH -sPOLYFILL=0 -sEXIT_RUNTIME=0 -sINVOKE_RUN=0 -sSUPPORT_LONGJMP=0 -sINCOMING_MODULE_JS_API=wasmMemory,instantiateWasm,wasm -sEXPORT_NAME=loadVosklet -sMALLOC=emmalloc -sENVIRONMENT=web,worker -L$KALDI/src -l:online2/kaldi-online2.a -l:decoder/kaldi-decoder.a -l:ivector/kaldi-ivector.a -l:gmm/kaldi-gmm.a -l:tree/kaldi-tree.a -l:feat/kaldi-feat.a -l:cudamatrix/kaldi-cudamatrix.a -l:lat/kaldi-lat.a -l:lm/kaldi-lm.a -l:rnnlm/kaldi-rnnlm.a -l:hmm/kaldi-hmm.a -l:nnet3/kaldi-nnet3.a -l:transform/kaldi-transform.a -l:matrix/kaldi-matrix.a -l:fstext/kaldi-fstext.a -l:util/kaldi-util.a -l:base/kaldi-base.a -L$OPENFST/lib -l:libfst.a -l:libfstngram.a -L$OPENBLAS -l:lib/libopenblas.a -L$VOSK/src -l:vosk.a -lembind --no-entry --closure 1 --pre-js"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
em++ ${voskletFiles//.o/.cc} $voskletFlags -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -DMAX_WORKERS="$MAX_THREADS" -fno-exceptions -std=c++23 -c -I. -I"$VOSK"/src &&
|
||||
|
||||
em++ $voskletFiles $voskletFlags $voskletLDFlags Wrapper.js -o ../Vosklet.js
|
||||
# shellcheck disable=SC2086
|
||||
em++ $voskletFiles $voskletFlags $voskletLDFlags ../Examples/Wrapper.js -o ../Examples/Vosklet.js
|
||||
|
||||
rm -f $voskletFiles
|
||||
cd .. &&
|
||||
|
||||
tr -d '\n' < Vosklet.js | tr -s ' ' > /tmp/hehe && mv /tmp/hehe Vosklet.js &&
|
||||
tr -d '\n' < Examples/Vosklet.js | tr -s ' ' > /tmp/hahe && mv /tmp/hahe Examples/Vosklet.js
|
||||
cd ..
|
||||
Reference in New Issue
Block a user