- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试构建可以帮助我像 Google 语音搜索一样调用联系人的应用程序,但是通过 RecognizerIntent 使用 Google 语音使用捷克语。
怎么了,它好像没有浏览我的联系人列表。
假设联系人姓名是“Rebro”[或不属于字典的任何内容,例如“Schwarzenegger 等]
无论选择什么语言,或者如果我使用英语发音或捷克语发音,它都不会在调用时出现在结果集中 data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
这甚至有可能吗?如果是,我该如何实现?提前致谢
编辑:添加代码...这是我在网上某处找到的代码
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends Activity implements OnClickListener {
private static final int VOICE_RECOGNITION_REQUEST_CODE = 1234;
private ListView mList;
/**
* Called with the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button speakButton = (Button) findViewById(R.id.button1);
mList = (ListView) findViewById(R.id.listView1);
PackageManager pm = getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() != 0) {
speakButton.setOnClickListener(this);
} else {
speakButton.setEnabled(false);
speakButton.setText("Recognizer not present");
}
}
/**
* Handle the click on the start recognition button.
*/
public void onClick(View v) {
if (v.getId() == R.id.button1) {
startVoiceRecognitionActivity();
}
}
/**
* Fire an intent to start the speech recognition activity.
*/
private void startVoiceRecognitionActivity() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
// intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
}
/**
* Handle the results from the recognition activity.
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) {
// Fill the list view with the strings the recognizer thought it could have heard
ArrayList<String> matches = data.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS);
mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
matches));
}
super.onActivityResult(requestCode, resultCode, data);
}
}
最佳答案
我认为 Google 语音搜索不会(也不能)通过 RecognizerIntent
公开其所有功能,即它只会执行一般语音转录而不支持任何语音命令(call ...
, text ...
) 或关于地址簿内容的知识。遗憾的是,RecognizerIntent
API 不允许您指定语法或允许的单词列表。
解决方案是忽略 Google 的语音识别器并实现您自己的语音识别器。看例如进入Pocketsphinx .你需要有捷克声学模型,除非你想用英语发音名字(你可以使用 CMU Sphinx 自带的英语声学模型)。
我已经为爱沙尼亚语实现了一个基于 Pocketsphinx 的开源联系人搜索应用程序,请参阅 Inimesed .
关于Android - RecognizerIntent 搜索联系人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11286469/
对于我的应用程序的一部分,我需要在选择该选项时显示所有联系人的列表(带有电话号码)。 这是按下按钮时调用的 Activity : package com.example.prototype01; im
我正在尝试使用 Google Contact API (C#) 将“生日”值添加到 Google Contact。谁能帮我解决这个问题。 我正在使用 Google 数据 API 设置 (1.4.0.2
如何使用 Google Contact API (c#) 在 Google Contact 中创建新的“自定义字段”? 我用过: ExtendedProperty obj_ExtendedProper
我正在 iPhone 应用程序中使用地址簿框架,并且我想获取项目公司名称。我在 AddressBookUI_Framework.pdf 中找不到此信息,有人可以解释一下吗? 问候 AddressBoo
我正在开发一个数据库来管理一家小公司的客户数据。客户是公司和机构(学校等),当然还有人/联系人。会有更多的范围及时添加,但现在我正在寻找关于核心设计本身的任何输入,如果有任何我在这里遗漏的东西可能会导
我正在使用 Swift Contacts 并尝试确定是否可以将 contacts.phoneNumbers 转换为 NSDictionary?即可以通过以下方式在 contacts.phoneNumb
我想要我的联系人的 ListView。我使用谷歌示例代码。问题是我一遍又一遍地获得相同的联系人: 吉姆 吉姆 吉姆 吉姆 吉姆 安娜 安娜 安娜 安娜 ... 如何获得我的联系人的 DISTINCT
对于我的应用程序,我需要导入 Gmail 地址簿,我可以按照“Gmail Contact API”进行操作。 最近 Gmail 添加了一些不属于 xml 的新字段(即生日、网站等)。 gmail ap
在 NetSuite 中编辑记录时,我有一个按钮需要能够获取所有联系人的名字、姓氏、电子邮件和可能的 Angular 色,以便我可以将其附加到我已经编写的其他代码中。我似乎无法弄清楚如何提取与记录关联
我们需要一种使用 Delphi/Pascal 代码读取(并且可以选择写入).vcf 文件的方法。带有源代码的免费库将是完美的。 最佳答案 AceVCard是delphi 2009的免费开放组件,兼容V
我正在模拟一个电话簿,其中有 ArrayList 。如何覆盖toString()函数为了拥有像这样的东西,我们正在做 System.out.println(phonebook) ? Name: nam
我正在尝试构建一个搜索 XML 表达式以与 Java 中的 Exchange Web 服务一起使用。我试图实现的是我可以通过电子邮件地址搜索所有联系人。我已经浏览了他们的文档,但未能使其正常工作。这是
我有一个项目正在进行,我想自动发送 SMS,并有时间和日期将 SMS 推送给特定的联系人。那么如何以简洁高效的方式从手机中提取联系人呢?基本上我希望用户按下一个按钮,然后应用程序转到联系人列表,然后用
我有一个表格 View ,显示所有联系人都使用 RealmSwift。如何使用谓词按电话号码过滤 Realm 联系人? class Contact: Object { @obj
我正在尝试使用 CNContactVCardSerialization 将联系人保存为 vcf,效果相对较好。我确实发现苹果不包含注释或图像作为 VCF 的一部分。我确实使用了 stackoverfl
我正在读取手机中的所有联系人,如下所示: Cursor cursor = MainApp.get().getContentResolver().query( C
我有具有 list 权限的应用程序 我的 Activity 尝试加载联系人: eDeviceRecordsLoader contactsLoader = new eDeviceRec
我正在尝试编辑组标题和注释, 编辑标题适用于系统组 和用户创建的组, 虽然注释列只有在系统组(例如“联系人”、“ friend ”、“家庭”、“同事”)时才会保留,我假设它不会为用户创建的组保存注释,
在我的应用中,我想将联系人与其他数据相关联。对联系人的引用必须尽可能持久,否则关联的数据将变成垃圾。 首先,我应该使用 ContactsContract.Contact.LOOKUP_KEY 访问聚合
我正在做一个应用程序,因为我显示从设备到 ListView 的所有联系人(姓名、号码、图像)。我想使用工具栏搜索从 ListView 中搜索联系人。我添加了工具栏搜索,但我不知道如何从列表中过滤联系人
我是一名优秀的程序员,十分优秀!