diff --git a/native_client/client.cc b/native_client/client.cc index 7a4e971a..b63e5bec 100644 --- a/native_client/client.cc +++ b/native_client/client.cc @@ -350,7 +350,7 @@ JSONOutput(Metadata* metadata) std::vector words = WordsFromMetadata(metadata); std::ostringstream out_string; - out_string << R"({"metadata":{"confidence":)" << metadata->probability << R"(},"words":[)"; + out_string << R"({"metadata":{"confidence":)" << metadata->confidence << R"(},"words":[)"; for (int i = 0; i < words.size(); i++) { meta_word w = words[i]; diff --git a/native_client/ctcdecode/__init__.py b/native_client/ctcdecode/__init__.py index bf1871a8..b88b9464 100644 --- a/native_client/ctcdecode/__init__.py +++ b/native_client/ctcdecode/__init__.py @@ -51,14 +51,14 @@ def ctc_beam_search_decoder(probs_seq, :param scorer: External scorer for partially decoded sentence, e.g. word count or language model. :type scorer: Scorer - :return: List of tuples of log probability and sentence as decoding - results, in descending order of the probability. + :return: List of tuples of confidence and sentence as decoding + results, in descending order of the confidence. :rtype: list """ beam_results = swigwrapper.ctc_beam_search_decoder( probs_seq, alphabet.config_file(), beam_size, cutoff_prob, cutoff_top_n, scorer) - beam_results = [(res.probability, alphabet.decode(res.tokens)) for res in beam_results] + beam_results = [(res.confidence, alphabet.decode(res.tokens)) for res in beam_results] return beam_results @@ -93,15 +93,15 @@ def ctc_beam_search_decoder_batch(probs_seq, :param scorer: External scorer for partially decoded sentence, e.g. word count or language model. :type scorer: Scorer - :return: List of tuples of log probability and sentence as decoding - results, in descending order of the probability. + :return: List of tuples of confidence and sentence as decoding + results, in descending order of the confidence. :rtype: list """ batch_beam_results = swigwrapper.ctc_beam_search_decoder_batch( probs_seq, seq_lengths, alphabet.config_file(), beam_size, num_processes, cutoff_prob, cutoff_top_n, scorer) batch_beam_results = [ - [(res.probability, alphabet.decode(res.tokens)) for res in beam_results] + [(res.confidence, alphabet.decode(res.tokens)) for res in beam_results] for beam_results in batch_beam_results ] return batch_beam_results diff --git a/native_client/ctcdecode/decoder_utils.cpp b/native_client/ctcdecode/decoder_utils.cpp index b743d92c..445bfdb2 100644 --- a/native_client/ctcdecode/decoder_utils.cpp +++ b/native_client/ctcdecode/decoder_utils.cpp @@ -46,7 +46,7 @@ std::vector get_beam_search_result( for (size_t i = 0; i < top_paths && i < prefixes.size(); ++i) { Output output; prefixes[i]->get_path_vec(output.tokens, output.timesteps); - output.probability = -prefixes[i]->approx_ctc; + output.confidence = -prefixes[i]->approx_ctc; output_vecs.push_back(output); } diff --git a/native_client/ctcdecode/output.h b/native_client/ctcdecode/output.h index efa26518..10eb4228 100644 --- a/native_client/ctcdecode/output.h +++ b/native_client/ctcdecode/output.h @@ -7,7 +7,7 @@ * for each token in the beam search output */ struct Output { - double probability; + double confidence; std::vector tokens; std::vector timesteps; }; diff --git a/native_client/deepspeech.h b/native_client/deepspeech.h index cf0c4508..6c7fe08c 100644 --- a/native_client/deepspeech.h +++ b/native_client/deepspeech.h @@ -30,8 +30,8 @@ typedef struct MetadataItem { typedef struct Metadata { MetadataItem* items; int num_items; - // Approximated probability (confidence value) for this transcription. - double probability; + // Approximated confidence value for this transcription. + double confidence; } Metadata; enum DeepSpeech_Error_Codes diff --git a/native_client/dotnet/DeepSpeechClient/Extensions/NativeExtensions.cs b/native_client/dotnet/DeepSpeechClient/Extensions/NativeExtensions.cs index 741f51b1..6b7f4c6a 100644 --- a/native_client/dotnet/DeepSpeechClient/Extensions/NativeExtensions.cs +++ b/native_client/dotnet/DeepSpeechClient/Extensions/NativeExtensions.cs @@ -36,7 +36,7 @@ namespace DeepSpeechClient.Extensions var metaData = (Metadata)Marshal.PtrToStructure(intPtr, typeof(Metadata)); managedMetaObject.Items = new Models.MetadataItem[metaData.num_items]; - managedMetaObject.Probability = metaData.probability; + managedMetaObject.Confidence = metaData.confidence; //we need to manually read each item from the native ptr using its size diff --git a/native_client/dotnet/DeepSpeechClient/Models/Metadata.cs b/native_client/dotnet/DeepSpeechClient/Models/Metadata.cs index 4725c0d5..870eb162 100644 --- a/native_client/dotnet/DeepSpeechClient/Models/Metadata.cs +++ b/native_client/dotnet/DeepSpeechClient/Models/Metadata.cs @@ -6,9 +6,9 @@ public class Metadata { /// - /// Approximated probability (confidence value) for this transcription. + /// Approximated confidence value for this transcription. /// - public double Probability { get; set; } + public double Confidence { get; set; } /// /// List of metada items containing char, timespet, and time offset. /// diff --git a/native_client/dotnet/DeepSpeechClient/Structs/Metadata.cs b/native_client/dotnet/DeepSpeechClient/Structs/Metadata.cs index 14dd0f53..411da9f2 100644 --- a/native_client/dotnet/DeepSpeechClient/Structs/Metadata.cs +++ b/native_client/dotnet/DeepSpeechClient/Structs/Metadata.cs @@ -15,8 +15,8 @@ namespace DeepSpeechClient.Structs /// internal unsafe int num_items; /// - /// Approximated probability (confidence value) for this transcription. + /// Approximated confidence value for this transcription. /// - internal unsafe double probability; + internal unsafe double confidence; } } diff --git a/native_client/modelstate.cc b/native_client/modelstate.cc index 6bf346a0..72d74df0 100644 --- a/native_client/modelstate.cc +++ b/native_client/modelstate.cc @@ -49,7 +49,7 @@ ModelState::decode_metadata(const DecoderState& state) std::unique_ptr metadata(new Metadata()); metadata->num_items = out[0].tokens.size(); - metadata->probability = out[0].probability; + metadata->confidence = out[0].confidence; std::unique_ptr items(new MetadataItem[metadata->num_items]());