Fix building for Pascal (#2305)
This commit is contained in:
@@ -7,3 +7,13 @@ for how to build the project in this directory.
|
|||||||
You can find pre-built APPs from this directory at
|
You can find pre-built APPs from this directory at
|
||||||
https://k2-fsa.github.io/sherpa/onnx/lazarus/pre-built-app.html
|
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`.
|
||||||
|
|||||||
@@ -193,6 +193,24 @@ def get_models():
|
|||||||
|
|
||||||
ls -lh
|
ls -lh
|
||||||
|
|
||||||
|
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
|
popd
|
||||||
""",
|
""",
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -195,6 +195,13 @@ type
|
|||||||
class operator Initialize({$IFDEF FPC}var{$ELSE}out{$ENDIF} Dest: TSherpaOnnxOnlineCtcFstDecoderConfig);
|
class operator Initialize({$IFDEF FPC}var{$ELSE}out{$ENDIF} Dest: TSherpaOnnxOnlineCtcFstDecoderConfig);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TSherpaOnnxHomophoneReplacerConfig = record
|
||||||
|
DictDir: AnsiString;
|
||||||
|
Lexicon: AnsiString;
|
||||||
|
RuleFsts: AnsiString;
|
||||||
|
function ToString: AnsiString;
|
||||||
|
end;
|
||||||
|
|
||||||
TSherpaOnnxOnlineRecognizerConfig = record
|
TSherpaOnnxOnlineRecognizerConfig = record
|
||||||
FeatConfig: TSherpaOnnxFeatureConfig;
|
FeatConfig: TSherpaOnnxFeatureConfig;
|
||||||
ModelConfig: TSherpaOnnxOnlineModelConfig;
|
ModelConfig: TSherpaOnnxOnlineModelConfig;
|
||||||
@@ -212,6 +219,7 @@ type
|
|||||||
BlankPenalty: Single;
|
BlankPenalty: Single;
|
||||||
HotwordsBuf: AnsiString;
|
HotwordsBuf: AnsiString;
|
||||||
HotwordsBufSize: Integer;
|
HotwordsBufSize: Integer;
|
||||||
|
Hr: TSherpaOnnxHomophoneReplacerConfig;
|
||||||
function ToString: AnsiString;
|
function ToString: AnsiString;
|
||||||
class operator Initialize({$IFDEF FPC}var{$ELSE}out{$ENDIF} Dest: TSherpaOnnxOnlineRecognizerConfig);
|
class operator Initialize({$IFDEF FPC}var{$ELSE}out{$ENDIF} Dest: TSherpaOnnxOnlineRecognizerConfig);
|
||||||
end;
|
end;
|
||||||
@@ -352,6 +360,7 @@ type
|
|||||||
RuleFsts: AnsiString;
|
RuleFsts: AnsiString;
|
||||||
RuleFars: AnsiString;
|
RuleFars: AnsiString;
|
||||||
BlankPenalty: Single;
|
BlankPenalty: Single;
|
||||||
|
Hr: TSherpaOnnxHomophoneReplacerConfig;
|
||||||
class operator Initialize({$IFDEF FPC}var{$ELSE}out{$ENDIF} Dest: TSherpaOnnxOfflineRecognizerConfig);
|
class operator Initialize({$IFDEF FPC}var{$ELSE}out{$ENDIF} Dest: TSherpaOnnxOfflineRecognizerConfig);
|
||||||
function ToString: AnsiString;
|
function ToString: AnsiString;
|
||||||
end;
|
end;
|
||||||
@@ -601,6 +610,7 @@ const
|
|||||||
{$linklib sherpa-onnx-kaldifst-core}
|
{$linklib sherpa-onnx-kaldifst-core}
|
||||||
{$linklib sherpa-onnx-fstfar}
|
{$linklib sherpa-onnx-fstfar}
|
||||||
{$linklib sherpa-onnx-fst}
|
{$linklib sherpa-onnx-fst}
|
||||||
|
{$linklib kissfft-float}
|
||||||
{$linklib kaldi-native-fbank-core}
|
{$linklib kaldi-native-fbank-core}
|
||||||
{$linklib piper_phonemize}
|
{$linklib piper_phonemize}
|
||||||
{$linklib espeak-ng}
|
{$linklib espeak-ng}
|
||||||
@@ -668,6 +678,13 @@ type
|
|||||||
Graph: PAnsiChar;
|
Graph: PAnsiChar;
|
||||||
MaxActive: cint32;
|
MaxActive: cint32;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
SherpaOnnxHomophoneReplacerConfig = record
|
||||||
|
DictDir: PAnsiChar;
|
||||||
|
Lexicon: PAnsiChar;
|
||||||
|
RuleFsts: PAnsiChar;
|
||||||
|
end;
|
||||||
|
|
||||||
SherpaOnnxOnlineRecognizerConfig = record
|
SherpaOnnxOnlineRecognizerConfig = record
|
||||||
FeatConfig: SherpaOnnxFeatureConfig;
|
FeatConfig: SherpaOnnxFeatureConfig;
|
||||||
ModelConfig: SherpaOnnxOnlineModelConfig;
|
ModelConfig: SherpaOnnxOnlineModelConfig;
|
||||||
@@ -685,6 +702,7 @@ type
|
|||||||
BlankPenalty: cfloat;
|
BlankPenalty: cfloat;
|
||||||
HotwordsBuf: PAnsiChar;
|
HotwordsBuf: PAnsiChar;
|
||||||
HotwordsBufSize: cint32;
|
HotwordsBufSize: cint32;
|
||||||
|
Hr: SherpaOnnxHomophoneReplacerConfig;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PSherpaOnnxOnlineRecognizerConfig = ^SherpaOnnxOnlineRecognizerConfig;
|
PSherpaOnnxOnlineRecognizerConfig = ^SherpaOnnxOnlineRecognizerConfig;
|
||||||
@@ -763,6 +781,7 @@ type
|
|||||||
RuleFsts: PAnsiChar;
|
RuleFsts: PAnsiChar;
|
||||||
RuleFars: PAnsiChar;
|
RuleFars: PAnsiChar;
|
||||||
BlankPenalty: cfloat;
|
BlankPenalty: cfloat;
|
||||||
|
Hr: SherpaOnnxHomophoneReplacerConfig;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PSherpaOnnxOfflineRecognizerConfig = ^SherpaOnnxOfflineRecognizerConfig;
|
PSherpaOnnxOfflineRecognizerConfig = ^SherpaOnnxOfflineRecognizerConfig;
|
||||||
@@ -1238,6 +1257,12 @@ begin
|
|||||||
[Self.Graph, Self.MaxActive]);
|
[Self.Graph, Self.MaxActive]);
|
||||||
end;
|
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;
|
function TSherpaOnnxOnlineRecognizerConfig.ToString: AnsiString;
|
||||||
begin
|
begin
|
||||||
Result := Format('TSherpaOnnxOnlineRecognizerConfig(FeatConfig := %s, ' +
|
Result := Format('TSherpaOnnxOnlineRecognizerConfig(FeatConfig := %s, ' +
|
||||||
@@ -1253,7 +1278,8 @@ begin
|
|||||||
'CtcFstDecoderConfig := %s, ' +
|
'CtcFstDecoderConfig := %s, ' +
|
||||||
'RuleFsts := %s, ' +
|
'RuleFsts := %s, ' +
|
||||||
'RuleFars := %s, ' +
|
'RuleFars := %s, ' +
|
||||||
'BlankPenalty := %.1f' +
|
'BlankPenalty := %.1f, ' +
|
||||||
|
'Hr := %s' +
|
||||||
')'
|
')'
|
||||||
,
|
,
|
||||||
[Self.FeatConfig.ToString, Self.ModelConfig.ToString,
|
[Self.FeatConfig.ToString, Self.ModelConfig.ToString,
|
||||||
@@ -1261,7 +1287,7 @@ begin
|
|||||||
Self.Rule1MinTrailingSilence, Self.Rule2MinTrailingSilence,
|
Self.Rule1MinTrailingSilence, Self.Rule2MinTrailingSilence,
|
||||||
Self.Rule3MinUtteranceLength, Self.HotwordsFile, Self.HotwordsScore,
|
Self.Rule3MinUtteranceLength, Self.HotwordsFile, Self.HotwordsScore,
|
||||||
Self.CtcFstDecoderConfig.ToString, Self.RuleFsts, Self.RuleFars,
|
Self.CtcFstDecoderConfig.ToString, Self.RuleFsts, Self.RuleFars,
|
||||||
Self.BlankPenalty
|
Self.BlankPenalty, Self.Hr.ToString
|
||||||
]);
|
]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1336,6 +1362,9 @@ begin
|
|||||||
C.RuleFsts := PAnsiChar(Config.RuleFsts);
|
C.RuleFsts := PAnsiChar(Config.RuleFsts);
|
||||||
C.RuleFars := PAnsiChar(Config.RuleFars);
|
C.RuleFars := PAnsiChar(Config.RuleFars);
|
||||||
C.BlankPenalty := Config.BlankPenalty;
|
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.Handle := SherpaOnnxCreateOnlineRecognizer(@C);
|
||||||
Self._Config := Config;
|
Self._Config := Config;
|
||||||
@@ -1574,12 +1603,13 @@ begin
|
|||||||
'HotwordsScore := %.1f, ' +
|
'HotwordsScore := %.1f, ' +
|
||||||
'RuleFsts := %s, ' +
|
'RuleFsts := %s, ' +
|
||||||
'RuleFars := %s, ' +
|
'RuleFars := %s, ' +
|
||||||
'BlankPenalty := %1.f' +
|
'BlankPenalty := %1.f, ' +
|
||||||
|
'Hr := %s' +
|
||||||
')',
|
')',
|
||||||
[Self.FeatConfig.ToString, Self.ModelConfig.ToString,
|
[Self.FeatConfig.ToString, Self.ModelConfig.ToString,
|
||||||
Self.LMConfig.ToString, Self.DecodingMethod, Self.MaxActivePaths,
|
Self.LMConfig.ToString, Self.DecodingMethod, Self.MaxActivePaths,
|
||||||
Self.HotwordsFile, Self.HotwordsScore, Self.RuleFsts, Self.RuleFars,
|
Self.HotwordsFile, Self.HotwordsScore, Self.RuleFsts, Self.RuleFars,
|
||||||
Self.BlankPenalty
|
Self.BlankPenalty, Self.Hr.ToString
|
||||||
]);
|
]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1640,6 +1670,10 @@ begin
|
|||||||
C.RuleFars := PAnsiChar(Config.RuleFars);
|
C.RuleFars := PAnsiChar(Config.RuleFars);
|
||||||
C.BlankPenalty := Config.BlankPenalty;
|
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.Handle := SherpaOnnxCreateOfflineRecognizer(@C);
|
||||||
Self._Config := Config;
|
Self._Config := Config;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user