I did a lot for research and tried a stand-alone pocket sphinx, but it accepts the surrounding voice, which it accepts and reacts differently to my application. Is there an application for Google offline applications for the above kitkat 4.4 .. I have been trying it since 2 weeks. Thank you for your valuable reply.
Details: When the action begins, the first text should read the content (text to speech) after it is completed, voice recognition recognition should receive the voice and according to the ex command: (next, previous, forward, option, 1, 2, 3, 4, etc. d.). On command, it should recognize and respond to it in the onresult method.
Error: I get an error after accepting a vote
06-18 19:54:00.159: V/onBeginningOfSpeech(3360): onBeginningOfSpeech 06-18 19:54:01.024: V/onPartialResult(3360): option 06-18 19:54:01.109: I/cmusphinx(3360): INFO: fsg_search.c(843): 105 frames, 5333 HMMs (50/fr), 7748 senones (73/fr), 371 history entries (3/fr) 06-18 19:54:01.110: I/SpeechRecognizer(3360): Stop recognition 06-18 19:54:01.110: E/cmusphinx(3360): ERROR: "fsg_search.c", line 913: Final result does not match the grammar in frame 105 06-18 19:54:01.111: V/onPartialResult
Android hive offline link
But if I turn off the Internet, it will not work offline.
In pocketsphinx, it does not respond to the correct word. If I say βnextβ, it approaches the voice content of another, adds a βkeyβ, and this gives me a lot of problems. Is there any solution or library to use offline. Any offline voice support offline.
Below is my code that is verified
package com.example.sample1; import static edu.cmu.pocketsphinx.SpeechRecognizerSetup.defaultSetup; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Locale; import edu.cmu.pocketsphinx.RecognitionListener; import android.app.Activity; import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnUtteranceCompletedListener; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; import android.widget.ExpandableListView.OnGroupClickListener; import android.widget.ExpandableListView.OnGroupExpandListener; import android.widget.TextView; import android.widget.Toast; import edu.cmu.pocketsphinx.Assets; import edu.cmu.pocketsphinx.Hypothesis; import edu.cmu.pocketsphinx.SpeechRecognizer; public class Sam extends Activity implements RecognitionListener, TextToSpeech.OnInitListener { private static final String DIGITS_SEARCH = "digits"; private SpeechRecognizer recognizer; private HashMap<String, Integer> captions; private TextView caption_text; private TextView result_text; ArrayList<String> result1; private Button buttonLeft; private Button buttonRight; int count = 0; private ArrayList<DataAnswer> dummyListTemp; private ArrayList<DataAnswer> dummyList; AnswerDataAdapter listAdapter = null; int conteo = 0; Handler a = new Handler(); private TextToSpeech tts; String readIt =""; HashMap<String, String> params = new HashMap<String, String>(); @Override public void onCreate(Bundle state) { super.onCreate(state); Log.v("onCreate", "onCreate");
And in digit.gram
#JSGF V1.0; grammar digits; <digit> = option one | option two | option three | option four | back | previous | next; public <digits> = <digit>+;
Above is my code, if someone worked on it please let me know the solution Here is my xml quiz.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/linearLayout1" android:orientation="vertical" > <ExpandableListView android:id="@+id/listViewAnswer" android:layout_width="match_parent" android:layout_height="301dp" android:focusable="false" android:focusableInTouchMode="false" android:childDivider="#334455" > </ExpandableListView> </LinearLayout> <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/linearLayout2" android:layout_marginTop="10dip" android:orientation="horizontal" > <Button android:id="@+id/buttonRight" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginRight="10dip" android:text="Next" /> <Button android:id="@+id/buttonLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dip" android:text="Previous" /> </RelativeLayout> <RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/relativeLayout1" > <TextView android:id="@+id/result_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#556677" /> <TextView android:id="@+id/caption_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/result_text" android:layout_alignParentLeft="true" android:textColor="#443399" /> </RelativeLayout> </RelativeLayout>
Update:
if u uses addKeywordSearch
File digitsGrammar = new File(context.getFilesDir(), "digits.gram"); recognizer.addKeywordSearch(DIGITS_SEARCH, digitsGrammar);
then only write in digit.gram
option one /1e-1/ option two /1e-1/ option three /1e-1/ option four /1e-1/ back /1e-1/ previous /1e-1/ next /1e-1/
or
if you use addGrammarSearch
File digitsGrammar = new File(context.getFilesDir(), "digits.gram"); recognizer.addGrammarSearch(DIGITS_SEARCH, digitsGrammar);
then in digit.gram
#JSGF V1.0; grammar digits; <digit> = option one | option two | option three | option four | back | previous | next; public <digits> = <digit>+;