OnlineRecognizerConfig.cs
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang)
/// Copyright (c) 2023 by manyeyes
/// Copyright (c) 2024.5 by 东风破
using System.Runtime.InteropServices;
namespace SherpaOnnx
{
[StructLayout(LayoutKind.Sequential)]
public struct OnlineRecognizerConfig
{
public OnlineRecognizerConfig()
{
FeatConfig = new FeatureConfig();
ModelConfig = new OnlineModelConfig();
DecodingMethod = "greedy_search";
MaxActivePaths = 4;
EnableEndpoint = 0;
Rule1MinTrailingSilence = 1.2F;
Rule2MinTrailingSilence = 2.4F;
Rule3MinUtteranceLength = 20.0F;
HotwordsFile = "";
HotwordsScore = 1.5F;
CtcFstDecoderConfig = new OnlineCtcFstDecoderConfig();
RuleFsts = "";
RuleFars = "";
BlankPenalty = 0.0F;
HotwordsBuf = "";
HotwordsBufSize = 0;
Hr = new HomophoneReplacerConfig();
}
public FeatureConfig FeatConfig;
public OnlineModelConfig ModelConfig;
[MarshalAs(UnmanagedType.LPStr)]
public string DecodingMethod;
/// Used only when decoding_method is modified_beam_search
/// Example value: 4
public int MaxActivePaths;
/// 0 to disable endpoint detection.
/// A non-zero value to enable endpoint detection.
public int EnableEndpoint;
/// An endpoint is detected if trailing silence in seconds is larger than
/// this value even if nothing has been decoded.
/// Used only when enable_endpoint is not 0.
public float Rule1MinTrailingSilence;
/// An endpoint is detected if trailing silence in seconds is larger than
/// this value after something that is not blank has been decoded.
/// Used only when enable_endpoint is not 0.
public float Rule2MinTrailingSilence;
/// An endpoint is detected if the utterance in seconds is larger than
/// this value.
/// Used only when enable_endpoint is not 0.
public float Rule3MinUtteranceLength;
/// Path to the hotwords.
[MarshalAs(UnmanagedType.LPStr)]
public string HotwordsFile;
/// Bonus score for each token in hotwords.
public float HotwordsScore;
public OnlineCtcFstDecoderConfig CtcFstDecoderConfig;
[MarshalAs(UnmanagedType.LPStr)]
public string RuleFsts;
[MarshalAs(UnmanagedType.LPStr)]
public string RuleFars;
public float BlankPenalty;
[MarshalAs(UnmanagedType.LPStr)]
public string HotwordsBuf;
public int HotwordsBufSize;
public HomophoneReplacerConfig Hr;
}
}