Quelqu'un peut-il m'expliquer comment je peux convertir mon discours en texte en utilisant pocketsphinx? J'essaie ceci:Le mot-clé n'est pas détecté à l'aide de pocketsphinx sur android
import com.example.speechtutor.SpeechRecognizerRecorder;
import com.example.speechtutor.SpeechRecognizerRecorderSetup;
import edu.cmu.pocketsphinx.Hypothesis;
import edu.cmu.pocketsphinx.RecognitionListener;
import static edu.cmu.pocketsphinx.Assets.syncAssets;
public class SpeakActivity extends Activity implements RecognitionListener {
SpeechRecognizerRecorder recognizer;
private File appDir;
String filePath;
private static final String KWS_SEARCH_NAME = "wakeup";
private static final String FORECAST_SEARCH = "forecast";
private static final String DIGITS_SEARCH = "digits";
private static final String MENU_SEARCH = "menu";
private static final String KEYPHRASE = "hello";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_speak);
try {
Log.d("Tag","before trying to sync assets");
appDir = syncAssets(getApplicationContext());
} catch (IOException e) {
throw new RuntimeException("failed to synchronize assets", e);
}
Log.d("TAG","before recognizer instantiaiton");
recognizer = SpeechRecognizerRecorderSetup.defaultSetup()
.setAcousticModel(new File(appDir, "models/hmm/en-us-semi"))
.setDictionary(new File(appDir, "models/lm/cmu07a.dic"))
.setRawLogDir(appDir)
.setKeywordThreshold(200)
.setAudioStorageDirectory("SpeechTutor")
.getRecognizer();
filePath = recognizer.getAudioStorageFilePath();
recognizer.addListener(this);
// Create keyword-activation search.
File fillers = new File(appDir, "models/grammar/menu.gram");
recognizer.addKeywordSearch(KWS_SEARCH_NAME, fillers.getPath());
// Create grammar-based searches.
//File menuGrammar = new File(appDir, "models/grammar/menu.gram");
//recognizer.addGrammarSearch(MENU_SEARCH, menuGrammar);
File digitsGrammar = new File(appDir, "models/grammar/digits.gram");
recognizer.addGrammarSearch(DIGITS_SEARCH, digitsGrammar);
// Create language model search.
//digitsGrammar.File languageModel = new File(appDir, "models/lm/weather.dmp");
//recognizer.addNgramSearch(FORECAST_SEARCH, languageModel);
recognizer.startListening(KEYPHRASE);
}
@Override
public void onPartialResult(Hypothesis arg0) {
String text = results.getHypstr();
Log.d("Spoken text",text);
}
@Override
public void onBeginningOfSpeech() {
}
}
Ce code fonctionne sans erreur, mais onPartialResult
appel quand je dis « bonjour ». Mon application doit convertir chaque voix en texte. S'il vous plaît donnez-moi un échantillon.
Je suis tellement satisfait que trouver développeur iranien qui font poche sphinix. jambon shoma être donble rahi baraye tarif "bonjour" budin. mishe lotfan farayandesho être manam commencer? kheyli recherche kardam o rahhaye zyadi emtehan kardam vali javab nadadan. http://stackoverflow.com/q/37629636/3671748 –