Update decoder parameter names in native client

This commit is contained in:
Reuben Morais 2019-01-15 09:25:05 -02:00
parent f007e341b6
commit 366a82d7e7
5 changed files with 18 additions and 18 deletions

View File

@ -84,12 +84,12 @@ namespace DeepSpeechClient
/// <param name="aAlphabetConfigPath">The path to the configuration file specifying the alphabet used by the network.</param> /// <param name="aAlphabetConfigPath">The path to the configuration file specifying the alphabet used by the network.</param>
/// <param name="aLMPath">The path to the language model binary file.</param> /// <param name="aLMPath">The path to the language model binary file.</param>
/// <param name="aTriePath">The path to the trie file build from the same vocabulary as the language model binary.</param> /// <param name="aTriePath">The path to the trie file build from the same vocabulary as the language model binary.</param>
/// <param name="aLMWeight">The weight to give to the language model results when scoring.</param> /// <param name="aLMAlpha">The alpha hyperparameter of the CTC decoder. Language Model weight.</param>
/// <param name="aValidWordCountWeight">The weight (bonus) to give to beams when adding a new valid word to the decoding.</param> /// <param name="aLMBeta">The beta hyperparameter of the CTC decoder. Word insertion weight.</param>
/// <returns>Zero on success, non-zero on failure (invalid arguments).</returns> /// <returns>Zero on success, non-zero on failure (invalid arguments).</returns>
public unsafe int EnableDecoderWithLM(string aAlphabetConfigPath, public unsafe int EnableDecoderWithLM(string aAlphabetConfigPath,
string aLMPath, string aTriePath, string aLMPath, string aTriePath,
float aLMWeight, float aValidWordCountWeight) float aLMAlpha, float aLMBeta)
{ {
string exceptionMessage = null; string exceptionMessage = null;
if (string.IsNullOrWhiteSpace(aTriePath)) if (string.IsNullOrWhiteSpace(aTriePath))
@ -110,8 +110,8 @@ namespace DeepSpeechClient
aAlphabetConfigPath, aAlphabetConfigPath,
aLMPath, aLMPath,
aTriePath, aTriePath,
aLMWeight, aLMAlpha,
aValidWordCountWeight); aLMBeta);
} }
/// <summary> /// <summary>

View File

@ -12,8 +12,8 @@
unsafe int EnableDecoderWithLM(string aAlphabetConfigPath, unsafe int EnableDecoderWithLM(string aAlphabetConfigPath,
string aLMPath, string aLMPath,
string aTriePath, string aTriePath,
float aLMWeight, float aLMAlpha,
float aValidWordCountWeight); float aLMBeta);
unsafe string SpeechToText(short[] aBuffer, unsafe string SpeechToText(short[] aBuffer,
uint aBufferSize, uint aBufferSize,

View File

@ -25,8 +25,8 @@ namespace DeepSpeechClient
string aAlphabetConfigPath, string aAlphabetConfigPath,
string aLMPath, string aLMPath,
string aTriePath, string aTriePath,
float aLMWeight, float aLMAlpha,
float aValidWordCountWeight); float aLMBeta);
[DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl, [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi, SetLastError = true)] CharSet = CharSet.Ansi, SetLastError = true)]

View File

@ -609,11 +609,11 @@ DS_EnableDecoderWithLM(ModelState* aCtx,
const char* aAlphabetConfigPath, const char* aAlphabetConfigPath,
const char* aLMPath, const char* aLMPath,
const char* aTriePath, const char* aTriePath,
float aLMWeight, float aLMAlpha,
float aValidWordCountWeight) float aLMBeta)
{ {
try { try {
aCtx->scorer = new Scorer(aLMWeight, aValidWordCountWeight, aCtx->scorer = new Scorer(aLMAlpha, aLMBeta,
aLMPath ? aLMPath : "", aLMPath ? aLMPath : "",
aTriePath ? aTriePath : "", aTriePath ? aTriePath : "",
*aCtx->alphabet); *aCtx->alphabet);

View File

@ -57,10 +57,10 @@ void DS_DestroyModel(ModelState* ctx);
* @param aLMPath The path to the language model binary file. * @param aLMPath The path to the language model binary file.
* @param aTriePath The path to the trie file build from the same vocabu- * @param aTriePath The path to the trie file build from the same vocabu-
* lary as the language model binary. * lary as the language model binary.
* @param aLMWeight The weight to give to language model results when sco- * @param aLMAlpha The alpha hyperparameter of the CTC decoder. Language Model
* ring. weight.
* @param aValidWordCountWeight The weight (bonus) to give to beams when * @param aLMBeta The beta hyperparameter of the CTC decoder. Word insertion
* adding a new valid word to the decoding. weight.
* *
* @return Zero on success, non-zero on failure (invalid arguments). * @return Zero on success, non-zero on failure (invalid arguments).
*/ */
@ -69,8 +69,8 @@ int DS_EnableDecoderWithLM(ModelState* aCtx,
const char* aAlphabetConfigPath, const char* aAlphabetConfigPath,
const char* aLMPath, const char* aLMPath,
const char* aTriePath, const char* aTriePath,
float aLMWeight, float aLMAlpha,
float aValidWordCountWeight); float aLMBeta);
/** /**
* @brief Use the DeepSpeech model to perform Speech-To-Text. * @brief Use the DeepSpeech model to perform Speech-To-Text.