Split online.cs and offline.csFile (#941)

Co-authored-by: 东风破 <birdfishs@163.com>
This commit is contained in:
东风破
2024-05-30 11:00:24 +08:00
committed by GitHub
parent e21caab759
commit 909148fe42
37 changed files with 1813 additions and 1440 deletions

View File

@@ -0,0 +1,70 @@
/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang)
/// Copyright (c) 2023 by manyeyes
/// Copyright (c) 2024.5 by 东风破
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System;
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();
}
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;
}
}