【发布时间】:2018-08-22 12:37:45
【问题描述】:
我正在为论文开发一个语音识别应用程序,可以识别字母表中的字母。我设法对文本进行语音识别,但我不知道如何才能只识别字母而不识别单词。就像我说“A”一样,应用程序应该显示字母 A 的图片。你们能帮帮我吗? 下面是我的语音识别应用程序在 youtube 的帮助下的示例代码,我通过将字符串“apple”与语音到文本识别进行比较来做到这一点。
final SpeechRecognizer mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
final Intent mSpeechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,
Locale.getDefault());
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
textview.setText(bundle.getString("letterA"));
if (textview.getText().toString().equalsIgnoreCase("apple")){
q="apple";
Glide.with(Voice_view.this).load(R.drawable.apple).into(imageView);
letter.setText("A");
【问题讨论】:
标签: android speech-recognition speech-to-text android-studio-3.0 voice-recognition