Is there a Java or C++ Open Speech Recognition Libraries?
Answer 1, Authority 100%
Look at CMU Sphinx (Open Source Toolkit For Speech Recognition).
Open source product for speech recognition, which includes a recognition library written in C, modifiable, a variable recognizer is written in Java.
Answer 2
Where to get the speech recognition engines themselves?
In Windows 7, they are not for the Russian version.
# include & lt; iostream & gt;
#Include "SPHELPER.H"
Short Main ()
{
STD :: SYSTEM ("CHCP 1251");
// Declare Local Identifiers:
HRESULT HR = S_OK;
CCOMPTR & LT; ISPRECOCOLONTEXT & GT; CPRECOCOLONTEXT;
CCOMPTR & LT; ISPVOICE & GT; CPVoice;
If (Failed (:: CoinItialize (NULL))) {
STD :: COUT & LT; & LT; "N1) COM object initialization is not fulfilled!";
} else {
STD :: COUT & LT; & LT; "N1) The initialization of the COM object is completed!";
}
hr = s_ok;
unsigned long num_engines = 0;
//
if (succeeded (hr))
{
STD :: COUT & LT; & LT; "\ N 1) We get engaging engines:";
HR = SPENUMTOKENS (SPCAT_RECOGNIZERS, NULL, NULL, & AMP; TOKEN);
}
if (succeeded (hr))
{
hr = token- & gt; getcount (& amp; num_engines);
STD :: COUT & LT; & LT; "\ N 2) Total engine:" & lt; & lt; num_engines;
}
// CREATE A SHARED RECOGNITION CONTEXT.
hr = cprecocontext.cocreateInstance (CLSID_SPSHAREDRECOGNIZER); // CLSID_SPINPROCRECCOCONTEXT CLSID_SPSHAREDRECOCOLONTEXT.
If (succeeded (hr)) {
// Create A Voice From The Context (With
// SAME AUDIO FORMAT AS CONTEXT)
HR = CPRECOCOCONTEXT- & GT; GetVoice (& amp; CPVoice);
} else {
STD :: COUT & LT; & LT; "Nudevice is not created";
}
If (succeeded (hr)) {
// TELL THE ASSOCIATED VOICE TO STOP SPEAKING WHEN
// The SR Engine Hears a Recognizable Sound.
HR = CPRECOCOCONTEXT- & GT; SETVoicePurgeEvent (SPFEI (SPEI_SOUND_START));
} else {
STD :: COUT & LT; & LT; "NgetVoice () did not work";
}
If (succeeded (hr)) {
// Do Stuff Here.
STD :: COUT & LT; & LT; "N. SPECIAL";
} else {
STD :: COUT & LT; & LT; "NNE successful";
}
}
Answer 3
You can try vosk . Advantages of the library:
- supports 8 languages - Russian, English, German, French,
Portuguese, Spanish, Chinese, Vietnamese. Soon
Other - works without access to the network even on
Mobile devices – Raspberry Pi, Android, iOS - models for each language take up only 50mb, but there is much more
Accurate large models for more accurate recognition - is done for streaming sound, which allows you to implement instantaneous
Reaction to Teams - supports several popular programming languages - C++, C, Java, C #, JavaScript
- allows you to quickly customize the recognition dictionary to improve the recognition accuracy
- allows you to identify the speaker
will be added.
Example of work on Java such :
package test;
Import java.io.file;
Import java.io.fileInputStream;
Import java.io.fileoutputstream;
Import java.io.dataoutputstream;
Import java.io.ioException;
Import java.net.url;
Import java.nio. *;
Import org.kaldi.kaldirecognizer;
Import org.kaldi.Model;
import org.kaldi.spkmodel;
Public Class DecodeRTest {
static {
System.loadLibrary ("vosk_jni");
}
Public Static Void Main (String Args []) Throws IoException {
FileInputStream AIS = NEW FileInputStream (New File ("/ Python / Example / Test.wav"));
Model Model = NEW Model ("Model-EN");
SPKModel SPKModel = New SPKModel ("Model-SPK");
KALDIRECOGNIZER REC = New Kaldirecognizer (Model, SPKModel, 16000.0F);
INT NBYETES;
BYTE [] B = New Byte [4096];
While ((nbytes = ais.read (b)) & gt; = 0) {
if (rec.acceptwaveform (b)) {
System.out.PrintLN (rec.result ());
} else {
System.Out.PrintLN (rec.partialResult ());
}
}
System.Out.printLN (rec.finalResult ());
}
}