Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2025-06-20 11:10:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2025-06-20 11:10:07 +0800
Commit
a6095f5f64d81388c37f35bb50f6acc2c29e79f1
a6095f5f
1 parent
59d118c2
Fix building for Pascal (#2305)
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
66 行增加
和
4 行删除
lazarus-examples/generate_subtitles/README.md
scripts/lazarus/generate-subtitles.py
sherpa-onnx/pascal-api/sherpa_onnx.pas
lazarus-examples/generate_subtitles/README.md
查看文件 @
a6095f5
...
...
@@ -7,3 +7,13 @@ for how to build the project in this directory.
You can find pre-built APPs from this directory at
https://k2-fsa.github.io/sherpa/onnx/lazarus/pre-built-app.html
## notes for developers
By default, it uses static libs for Linux and macOS. To change that,
open Lazarus IDE, select
`Project`, `Project options`, `Compiler options`
,
change the
`Build modes` to `Release-Linux`
.
The
`Release-Linux` mode is defined in the file `generate_subtitles.lpi`
.
It defines a macro
`SHERPA_ONNX_USE_SHARED_LIBS`
.
...
...
scripts/lazarus/generate-subtitles.py
查看文件 @
a6095f5
...
...
@@ -196,6 +196,24 @@ def get_models():
popd
"""
,
),
Model
(
model_name
=
"sherpa-onnx-nemo-parakeet-tdt-0.6b-v2-int8"
,
lang
=
"en"
,
short_name
=
"parakeet_tdt_0.6b_v2"
,
cmd
=
"""
pushd $model_name
rm -rfv test_wavs
mv -v encoder.int8.onnx nemo-transducer-encoder.onnx
mv -v decoder.int8.onnx nemo-transducer-decoder.onnx
mv -v joiner.int8.onnx nemo-transducer-joiner.onnx
ls -lh
popd
"""
,
),
]
return
models
...
...
sherpa-onnx/pascal-api/sherpa_onnx.pas
查看文件 @
a6095f5
...
...
@@ -195,6 +195,13 @@ type
class
operator
Initialize(
{
$IFDEF
FPC
}
var
{
$ELSE
}
out
{
$ENDIF
}
Dest:
TSherpaOnnxOnlineCtcFstDecoderConfig);
end;
TSherpaOnnxHomophoneReplacerConfig
=
record
DictDir:
AnsiString;
Lexicon:
AnsiString;
RuleFsts:
AnsiString;
function
ToString:
AnsiString;
end;
TSherpaOnnxOnlineRecognizerConfig
=
record
FeatConfig:
TSherpaOnnxFeatureConfig;
ModelConfig:
TSherpaOnnxOnlineModelConfig;
...
...
@@ -212,6 +219,7 @@ type
BlankPenalty:
Single;
HotwordsBuf:
AnsiString;
HotwordsBufSize:
Integer;
Hr:
TSherpaOnnxHomophoneReplacerConfig;
function
ToString:
AnsiString;
class
operator
Initialize(
{
$IFDEF
FPC
}
var
{
$ELSE
}
out
{
$ENDIF
}
Dest:
TSherpaOnnxOnlineRecognizerConfig);
end;
...
...
@@ -352,6 +360,7 @@ type
RuleFsts:
AnsiString;
RuleFars:
AnsiString;
BlankPenalty:
Single;
Hr:
TSherpaOnnxHomophoneReplacerConfig;
class
operator
Initialize(
{
$IFDEF
FPC
}
var
{
$ELSE
}
out
{
$ENDIF
}
Dest:
TSherpaOnnxOfflineRecognizerConfig);
function
ToString:
AnsiString;
end;
...
...
@@ -601,6 +610,7 @@ const
{
$linklib
sherpa-onnx-kaldifst-core
}
{
$linklib
sherpa-onnx-fstfar
}
{
$linklib
sherpa-onnx-fst
}
{
$linklib
kissfft-float
}
{
$linklib
kaldi-native-fbank-core
}
{
$linklib
piper_phonemize
}
{
$linklib
espeak-ng
}
...
...
@@ -668,6 +678,13 @@ type
Graph:
PAnsiChar;
MaxActive:
cint
32
;
end;
SherpaOnnxHomophoneReplacerConfig
=
record
DictDir:
PAnsiChar;
Lexicon:
PAnsiChar;
RuleFsts:
PAnsiChar;
end;
SherpaOnnxOnlineRecognizerConfig
=
record
FeatConfig:
SherpaOnnxFeatureConfig;
ModelConfig:
SherpaOnnxOnlineModelConfig;
...
...
@@ -685,6 +702,7 @@ type
BlankPenalty:
cfloat;
HotwordsBuf:
PAnsiChar;
HotwordsBufSize:
cint
32
;
Hr:
SherpaOnnxHomophoneReplacerConfig;
end;
PSherpaOnnxOnlineRecognizerConfig
=
^SherpaOnnxOnlineRecognizerConfig;
...
...
@@ -763,6 +781,7 @@ type
RuleFsts:
PAnsiChar;
RuleFars:
PAnsiChar;
BlankPenalty:
cfloat;
Hr:
SherpaOnnxHomophoneReplacerConfig;
end;
PSherpaOnnxOfflineRecognizerConfig
=
^SherpaOnnxOfflineRecognizerConfig;
...
...
@@ -1238,6 +1257,12 @@ begin
[
Self.Graph
,
Self.MaxActive
]
);
end;
function
TSherpaOnnxHomophoneReplacerConfig.ToString:
AnsiString;
begin
Result
:=
Format('TSherpaOnnxHomophoneReplacerConfig(DictDir
:=
%s,
Lexicon
:=
%s,
RuleFsts
:=
%s)',
[
Self.DictDir
,
Self.Lexicon
,
Self.RuleFsts
]
);
end;
function
TSherpaOnnxOnlineRecognizerConfig.ToString:
AnsiString;
begin
Result
:=
Format('TSherpaOnnxOnlineRecognizerConfig(FeatConfig
:=
%s,
'
+
...
...
@@ -1253,7 +1278,8 @@ begin
'CtcFstDecoderConfig
:=
%s,
'
+
'RuleFsts
:=
%s,
'
+
'RuleFars
:=
%s,
'
+
'BlankPenalty
:=
%.
1
f'
+
'BlankPenalty
:=
%.
1
f,
'
+
'Hr
:=
%s'
+
')'
,
[
Self.FeatConfig.ToString
,
Self.ModelConfig.ToString
,
...
...
@@ -1261,7 +1287,7 @@ begin
Self.Rule
1
MinTrailingSilence
,
Self.Rule
2
MinTrailingSilence
,
Self.Rule
3
MinUtteranceLength
,
Self.HotwordsFile
,
Self.HotwordsScore
,
Self.CtcFstDecoderConfig.ToString
,
Self.RuleFsts
,
Self.RuleFars
,
Self.BlankPenalty
Self.BlankPenalty
,
Self.Hr.ToString
]
);
end;
...
...
@@ -1336,6 +1362,9 @@ begin
C.RuleFsts
:=
PAnsiChar(Config.RuleFsts);
C.RuleFars
:=
PAnsiChar(Config.RuleFars);
C.BlankPenalty
:=
Config.BlankPenalty;
C.Hr.DictDir
:=
PAnsiChar(Config.Hr.DictDir);
C.Hr.Lexicon
:=
PAnsiChar(Config.Hr.Lexicon);
C.Hr.RuleFsts
:=
PAnsiChar(Config.Hr.RuleFsts);
Self.Handle
:=
SherpaOnnxCreateOnlineRecognizer(@C);
Self._Config
:=
Config;
...
...
@@ -1574,12 +1603,13 @@ begin
'HotwordsScore
:=
%.
1
f,
'
+
'RuleFsts
:=
%s,
'
+
'RuleFars
:=
%s,
'
+
'BlankPenalty
:=
%
1
.f'
+
'BlankPenalty
:=
%
1
.f,
'
+
'Hr
:=
%s'
+
')',
[
Self.FeatConfig.ToString
,
Self.ModelConfig.ToString
,
Self.LMConfig.ToString
,
Self.DecodingMethod
,
Self.MaxActivePaths
,
Self.HotwordsFile
,
Self.HotwordsScore
,
Self.RuleFsts
,
Self.RuleFars
,
Self.BlankPenalty
Self.BlankPenalty
,
Self.Hr.ToString
]
);
end;
...
...
@@ -1640,6 +1670,10 @@ begin
C.RuleFars
:=
PAnsiChar(Config.RuleFars);
C.BlankPenalty
:=
Config.BlankPenalty;
C.Hr.DictDir
:=
PAnsiChar(Config.Hr.DictDir);
C.Hr.Lexicon
:=
PAnsiChar(Config.Hr.Lexicon);
C.Hr.RuleFsts
:=
PAnsiChar(Config.Hr.RuleFsts);
Self.Handle
:=
SherpaOnnxCreateOfflineRecognizer(@C);
Self._Config
:=
Config;
end;
...
...
请
注册
或
登录
后发表评论