Android - 语音识别 [英] Android - Voice recognition

查看:41
本文介绍了Android - 语音识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找适用于 Android 的语音识别库.我只需要它来理解是/否"的答案(使用不同的语言 - 如英语、德语、法语).

I am looking for a voice recognition library for Android. I only need it to understand "Yes/No" answers ( in different languages - like English, German, French ).

有什么建议吗?

推荐答案

不确定 VR 库,因为 Play 商店最大应用程序大小为 50megs,而这些语音包每个大约 15 到 20 megs,因此不可能包含多种语言直接进入应用程序.

Not sure about V-R libraries because the Play Store max App size is 50megs and those voice packages are about 15 to 20 megs each so it will impossible to include multiple languages directly into the App.

可能有在线服务可以使用,但您需要在网上搜索.

There may be an online service to use but you need to search the net for that.

大多数人使用的是内置的 Android 语音识别 Intent.对于不同的语言,对于您想要的语言应该没问题,因为它们已包含在内.但是,我不确定例如在法国,当您购买手机或平板电脑时,默认 VR 语言是法语而不是英语,因此用户需要进入语言设置并下载法语 VR 包.

What most people use is the inbuilt Android voice recognition Intent. For different languages should be ok for the ones you want as they are included. However i'm not sure if for example in France when you buy a phone or a tablet the default V-R language will be French and not English, therefore the user will need to go into Language settings and Download the French V-R package.

要在 Android 中启动 V-R,您需要

To start V-R in Android you do

    startVoiceRecognitionActivity();

       private void startVoiceRecognitionActivity() {
            Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);

            intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getClass().getPackage().getName());

            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);

            intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);

            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");

            startActivityForResult(intent, 1234);
        }

//To get the Voice data back as Text string

   @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == Activity.RESULT_OK) {
            //pull all of the matches
            ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);

            String topResult = matches.get(0);

}};

String topResult 是文本中的语音

这篇关于Android - 语音识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆