From 4d726e820df6110f63062848ea5747f6bfb9e996 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Tue, 4 Aug 2020 17:29:07 +0200 Subject: [PATCH] More renames --- .../Interfaces/IModel.cs | 130 ------------------ .../MozillaVoiceSttClient/MozillaVoiceStt.cs | 6 +- .../voice/stt/MozillaVoiceSttModel.java | 4 +- .../project.pbxproj | 6 +- .../xcschemes/mozilla_voice_stt_test.xcscheme | 98 +++++++++++++ 5 files changed, 105 insertions(+), 139 deletions(-) delete mode 100644 native_client/dotnet/MozillaVoiceSttClient/Interfaces/IModel.cs create mode 100644 native_client/swift/mozilla_voice_stt_test.xcodeproj/xcshareddata/xcschemes/mozilla_voice_stt_test.xcscheme diff --git a/native_client/dotnet/MozillaVoiceSttClient/Interfaces/IModel.cs b/native_client/dotnet/MozillaVoiceSttClient/Interfaces/IModel.cs deleted file mode 100644 index bd8a62e1..00000000 --- a/native_client/dotnet/MozillaVoiceSttClient/Interfaces/IModel.cs +++ /dev/null @@ -1,130 +0,0 @@ -using MozillaVoiceSttClient.Models; -using System; -using System.IO; - -namespace MozillaVoiceSttClient.Interfaces -{ - /// - /// Client interface of Mozilla Voice STT. - /// - public interface IModel : IDisposable - { - /// - /// Return version of this library. The returned version is a semantic version - /// (SemVer 2.0.0). - /// - unsafe string Version(); - - /// - /// Return the sample rate expected by the model. - /// - /// Sample rate. - unsafe int GetModelSampleRate(); - - /// - /// Get beam width value used by the model. If SetModelBeamWidth was not - /// called before, will return the default value loaded from the model - /// file. - /// - /// Beam width value used by the model. - unsafe uint GetModelBeamWidth(); - - /// - /// Set beam width value used by the model. - /// - /// The beam width used by the decoder. A larger beam width value generates better results at the cost of decoding time. - /// Thrown on failure. - unsafe void SetModelBeamWidth(uint aBeamWidth); - - /// - /// Enable decoding using an external scorer. - /// - /// The path to the external scorer file. - /// Thrown when the native binary failed to enable decoding with an external scorer. - /// Thrown when cannot find the scorer file. - unsafe void EnableExternalScorer(string aScorerPath); - - /// - /// Disable decoding using an external scorer. - /// - /// Thrown when an external scorer is not enabled. - unsafe void DisableExternalScorer(); - - /// - /// Set hyperparameters alpha and beta of the external scorer. - /// - /// The alpha hyperparameter of the decoder. Language model weight. - /// The beta hyperparameter of the decoder. Word insertion weight. - /// Thrown when an external scorer is not enabled. - unsafe void SetScorerAlphaBeta(float aAlpha, float aBeta); - - /// - /// Use the Mozilla Voice STT model to perform Speech-To-Text. - /// - /// A 16-bit, mono raw audio signal at the appropriate sample rate (matching what the model was trained on). - /// The number of samples in the audio signal. - /// The STT result. Returns NULL on error. - unsafe string SpeechToText(short[] aBuffer, - uint aBufferSize); - - /// - /// Use the Mozilla Voice STT model to perform Speech-To-Text, return results including metadata. - /// - /// A 16-bit, mono raw audio signal at the appropriate sample rate (matching what the model was trained on). - /// The number of samples in the audio signal. - /// Maximum number of candidate transcripts to return. Returned list might be smaller than this. - /// The extended metadata. Returns NULL on error. - unsafe Metadata SpeechToTextWithMetadata(short[] aBuffer, - uint aBufferSize, - uint aNumResults); - - /// - /// Destroy a streaming state without decoding the computed logits. - /// This can be used if you no longer need the result of an ongoing streaming - /// inference and don't want to perform a costly decode operation. - /// - unsafe void FreeStream(MozillaVoiceSttStream stream); - - /// - /// Creates a new streaming inference state. - /// - unsafe MozillaVoiceSttStream CreateStream(); - - /// - /// Feeds audio samples to an ongoing streaming inference. - /// - /// Instance of the stream to feed the data. - /// An array of 16-bit, mono raw audio samples at the appropriate sample rate (matching what the model was trained on). - unsafe void FeedAudioContent(MozillaVoiceSttStream stream, short[] aBuffer, uint aBufferSize); - - /// - /// Computes the intermediate decoding of an ongoing streaming inference. - /// - /// Instance of the stream to decode. - /// The STT intermediate result. - unsafe string IntermediateDecode(MozillaVoiceSttStream stream); - - /// - /// Computes the intermediate decoding of an ongoing streaming inference, including metadata. - /// - /// Instance of the stream to decode. - /// Maximum number of candidate transcripts to return. Returned list might be smaller than this. - /// The extended metadata result. - unsafe Metadata IntermediateDecodeWithMetadata(MozillaVoiceSttStream stream, uint aNumResults); - - /// - /// Closes the ongoing streaming inference, returns the STT result over the whole audio signal. - /// - /// Instance of the stream to finish. - /// The STT result. - unsafe string FinishStream(MozillaVoiceSttStream stream); - - /// - /// Closes the ongoing streaming inference, returns the STT result over the whole audio signal, including metadata. - /// - /// Instance of the stream to finish. - /// Maximum number of candidate transcripts to return. Returned list might be smaller than this. - /// The extended metadata result. - unsafe Metadata FinishStreamWithMetadata(MozillaVoiceSttStream stream, uint aNumResults); - } -} diff --git a/native_client/dotnet/MozillaVoiceSttClient/MozillaVoiceStt.cs b/native_client/dotnet/MozillaVoiceSttClient/MozillaVoiceStt.cs index f2b67fb7..dc881fcc 100644 --- a/native_client/dotnet/MozillaVoiceSttClient/MozillaVoiceStt.cs +++ b/native_client/dotnet/MozillaVoiceSttClient/MozillaVoiceStt.cs @@ -1,12 +1,12 @@ -using MozillaVoiceStt.Interfaces; -using MozillaVoiceStt.Extensions; +using MozillaVoiceSttClient.Interfaces; +using MozillaVoiceSttClient.Extensions; using System; using System.IO; using MozillaVoiceStt.Enums; using MozillaVoiceStt.Models; -namespace MozillaVoiceStt +namespace MozillaVoiceSttClient { /// /// Concrete implementation of . diff --git a/native_client/java/libmozillavoicestt/src/main/java/org/mozilla/voice/stt/MozillaVoiceSttModel.java b/native_client/java/libmozillavoicestt/src/main/java/org/mozilla/voice/stt/MozillaVoiceSttModel.java index fda91b88..23aea5ab 100644 --- a/native_client/java/libmozillavoicestt/src/main/java/org/mozilla/voice/stt/MozillaVoiceSttModel.java +++ b/native_client/java/libmozillavoicestt/src/main/java/org/mozilla/voice/stt/MozillaVoiceSttModel.java @@ -15,8 +15,8 @@ public class MozillaVoiceSttModel { private SWIGTYPE_p_ModelState _msp; private void evaluateErrorCode(int errorCode) { - STT_Error_Codes code = STT_Error_Codes.swigToEnum(errorCode); - if (code != STT_Error_Codes.ERR_OK) { + Error_Codes code = Error_Codes.swigToEnum(errorCode); + if (code != Error_Codes.ERR_OK) { throw new RuntimeException("Error: " + impl.ErrorCodeToErrorMessage(errorCode) + " (0x" + Integer.toHexString(errorCode) + ")."); } } diff --git a/native_client/swift/mozilla_voice_stt_test.xcodeproj/project.pbxproj b/native_client/swift/mozilla_voice_stt_test.xcodeproj/project.pbxproj index 99d0a910..c894ea67 100644 --- a/native_client/swift/mozilla_voice_stt_test.xcodeproj/project.pbxproj +++ b/native_client/swift/mozilla_voice_stt_test.xcodeproj/project.pbxproj @@ -8,11 +8,11 @@ /* Begin PBXBuildFile section */ 502AED2D24D9676500E9A4AD /* mozilla_voice_stt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 502AED2C24D9676500E9A4AD /* mozilla_voice_stt.framework */; }; - 502AED3024D9677B00E9A4AD /* mozilla_voice_stt.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 502AED2E24D9677000E9A4AD /* mozilla_voice_stt.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 504EC34324CF4EFD0073C22E /* SpeechRecognitionImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC34124CF4EFD0073C22E /* SpeechRecognitionImpl.swift */; }; 504EC34424CF4EFD0073C22E /* AudioContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC34224CF4EFD0073C22E /* AudioContext.swift */; }; 507CD3A324B61FEB00409BBB /* libmozilla_voice_stt.so in Frameworks */ = {isa = PBXBuildFile; fileRef = 507CD3A224B61FEA00409BBB /* libmozilla_voice_stt.so */; }; 507CD3A424B61FFC00409BBB /* libmozilla_voice_stt.so in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 507CD3A224B61FEA00409BBB /* libmozilla_voice_stt.so */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 509DF81924D9B2C200D1026D /* mozilla_voice_stt.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 502AED2C24D9676500E9A4AD /* mozilla_voice_stt.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 50F787F32497683900D52237 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50F787F22497683900D52237 /* AppDelegate.swift */; }; 50F787F52497683900D52237 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50F787F42497683900D52237 /* SceneDelegate.swift */; }; 50F787F72497683900D52237 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50F787F62497683900D52237 /* ContentView.swift */; }; @@ -45,7 +45,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 502AED3024D9677B00E9A4AD /* mozilla_voice_stt.framework in Embed Frameworks */, + 509DF81924D9B2C200D1026D /* mozilla_voice_stt.framework in Embed Frameworks */, 507CD3A424B61FFC00409BBB /* libmozilla_voice_stt.so in Embed Frameworks */, ); name = "Embed Frameworks"; @@ -55,7 +55,6 @@ /* Begin PBXFileReference section */ 502AED2C24D9676500E9A4AD /* mozilla_voice_stt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = mozilla_voice_stt.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 502AED2E24D9677000E9A4AD /* mozilla_voice_stt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mozilla_voice_stt.framework; path = "DerivedData/mozilla_voice_stt/Build/Products/Debug-iphoneos/mozilla_voice_stt.framework"; sourceTree = ""; }; 504EC34124CF4EFD0073C22E /* SpeechRecognitionImpl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpeechRecognitionImpl.swift; sourceTree = ""; }; 504EC34224CF4EFD0073C22E /* AudioContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioContext.swift; sourceTree = ""; }; 507CD3A224B61FEA00409BBB /* libmozilla_voice_stt.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libmozilla_voice_stt.so; sourceTree = ""; }; @@ -110,7 +109,6 @@ 50F787E62497683900D52237 = { isa = PBXGroup; children = ( - 502AED2E24D9677000E9A4AD /* mozilla_voice_stt.framework */, 50F787F12497683900D52237 /* mozilla_voice_stt_test */, 50F787F02497683900D52237 /* Products */, 50F2B0FC2498D6C7007CD876 /* Frameworks */, diff --git a/native_client/swift/mozilla_voice_stt_test.xcodeproj/xcshareddata/xcschemes/mozilla_voice_stt_test.xcscheme b/native_client/swift/mozilla_voice_stt_test.xcodeproj/xcshareddata/xcschemes/mozilla_voice_stt_test.xcscheme new file mode 100644 index 00000000..644ef52a --- /dev/null +++ b/native_client/swift/mozilla_voice_stt_test.xcodeproj/xcshareddata/xcschemes/mozilla_voice_stt_test.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +