在.NET中有两个类似的名称空间和程序集用于语音识别.我试图了解这些差异以及何时适合使用其中一种.
从程序集System.Speech(在System.Speech.dll中)有System.Speech.Recognition.System.Speech.dll是.NET Framework类库3.0及更高版本中的核心DLL
还有Microsoft.Speech.Recognition来自程序集Microsoft.Speech(在microsoft.speech.dll中).Microsoft.Speech.dll是UCMA 2.0 SDK的一部分
我发现文档令人困惑,我有以下问题:
System.Speech.Recognition表示它适用于"Windows桌面语音技术",这是否意味着它不能用于服务器操作系统或不能用于大规模应用程序?
UCMA 2.0 Speech SDK(http://msdn.microsoft.com/en-us/library/dd266409%28v=office.13%29.aspx)表示它需要Microsoft Office Communications Server 2007 R2作为先决条件.但是,我在会议和会议上被告知,如果我不需要存在和工作流等OCS功能,我可以使用没有OCS的UCMA 2.0 Speech API.这是真的?
如果我正在为服务器应用程序构建一个简单的识别应用程序(假设我想自动转录语音邮件)而且我不需要OCS的功能,那么两个API之间有什么区别?
我需要将模板与数据合并以在运行时创建唯一的字符串.有人建议我查看ASP.NET MVC 3 中的Razor模板视图引擎.看起来很棒,但我需要在MVC视图创建之外使用它.
我知道我可以直接使用核心Razor引擎,但我也发现了一些使Razor更容易使用的项目.喜欢:
有没有人有任何关于在MVC之外使用Razor作为独立模板引擎的指导?有这些包装项目的经验吗?我应该研究其他Razor托管实现吗?
我正在尝试使用,System.Dynamic.ExpandoObject所以我可以在运行时动态创建属性.稍后,我需要传递此对象的实例,并且使用的机制需要序列化.
当然,当我尝试序列化我的动态对象时,我得到了异常:
System.Runtime.Serialization.SerializationException未处理.
在Assembly'System.Core中输入'System.Dynamic.ExpandoObject',Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'未标记为可序列化.
我可以序列化ExpandoObject吗?是否有另一种方法来创建可序列化的动态对象?也许使用DynamicObject包装器?
我创建了一个非常简单的Windows窗体示例来复制错误:
using System;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Dynamic;
namespace DynamicTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
dynamic dynamicContext = new ExpandoObject();
dynamicContext.Greeting = "Hello";
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("MyFile.bin", FileMode.Create,
FileAccess.Write, FileShare.None);
formatter.Serialize(stream, dynamicContext);
stream.Close();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我使用以下代码在Android中启动语音识别:
PackageManager pm = getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() == 0) {
displayWarning("This device does not support speech recognition");
return;
}
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)
这很好用.但是,它似乎不接受来自使用"电话音频"配置文件配对和连接的蓝牙耳机的语音输入.
我可以使用名为SoundAbout的应用程序将"Media Audio"强制为"Bluetooth(mono)(SCO)".有了这个应用程序集,我的语音识别现在可以从我的耳机输入语音输入.
如何使用RecognizerIntent并从蓝牙耳机获取语音输入?
我在API级别16中看到有一个新的意图操作ACTION_VOICE_SEARCH_HANDS_FREE.这对我来说太新了,但这会解决我的问题吗?
我是否必须在AudioManager(就像我假设SoundAbout正在做)中使用setBluetoothScoOn()或startBluetoothSco()来路由音频输入?
我想列出手机上安装的软件包的活动意图过滤器.这只是为了学习体验,我想了解哪些应用程序可以使用隐式意图启动,以及如何设置意图过滤器.
Google在http://developer.android.com/guide/appendix/g-app-intents.html上提供了他们提供的应用程序表.我想为其他应用程序创建一个类似的列表.
我可以使用PackageManager并在代码中挖掘这些信息吗?有谁知道现有的应用程序可以做到这一点?有人能指出我现有的例子来做我想要的吗?
很抱歉,如果这是类似问题的重复,例如列出应用程序的活动和intent-filters?和Android - 如何获取所有可用的意图过滤器列表?
我的Android应用可以找到它所连接的Wifi接入点的MAC地址吗?
android.net.wifi.WifiInfo getMacAddress()的文档不提供任何详细信息.请参阅http://developer.android.com/reference/android/net/wifi/WifiInfo.html#getMacAddress().我假设这是我手机的Mac地址.我可以找到接入点的Mac地址吗?
Google提供可在手机上使用的语音识别服务(Android内置,iPhone用户可以使用Google应用程序) - http://www.google.com/mobile/.我们在http://waxy.org/2008/11/deconstructing_google_mobiles_voice_search_on_the_iphone/找到了一篇文章,其中有人试图对该服务进行逆向工程.
我们希望在使用Android的RecognizerIntent时更好地了解网络上发生的情况.有没有人有经验在网上使用这项服务或知道可能解释其运作的其他文章?
我正在添加一些调试代码来测试一些东西,然后调试代码没有按预期运行.以下示例是用于演示我的问题的简化代码.
这是在.NET 4中并使用WebApi,我试图在调试代码中打印出http请求的主体.为此,我寻找输入流并读取流.它第一次工作正常,但如果我再次尝试读取它,我会得到一个空字符串.
为什么我不能再次寻找并读取InputStream?在下面的示例中,body2始终为空.在第二组中,CanSeek仍为true,第二次调用ReadToEnd()会返回一个空字符串,覆盖默认值.
using System.IO;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
public class TestController : ApiController
{
public class TestOutuput
{
public string firstRead;
public string secondRead;
}
public HttpResponseMessage Post()
{
string body1 = "default for one";
string body2 = "default for two";
if (HttpContext.Current.Request.InputStream.CanSeek)
{
HttpContext.Current.Request.InputStream.Seek(0, System.IO.SeekOrigin.Begin);
}
using (var reader = new StreamReader(HttpContext.Current.Request.InputStream))
{
body1 = reader.ReadToEnd();
}
if (HttpContext.Current.Request.InputStream.CanSeek)
{
HttpContext.Current.Request.InputStream.Seek(0, System.IO.SeekOrigin.Begin);
}
using (var reader2 = new StreamReader(HttpContext.Current.Request.InputStream))
{
// this is …Run Code Online (Sandbox Code Playgroud) 我们使用WCF和C#为现有的SOAP Web服务构建了一个客户端.最近,Web服务已更新,我们的客户端停止工作.我看到的问题最好在这篇博文中解释 - 互操作性问题: Yaron Naveh 的XML元素顺序.
我会借用Yaron的例子来解答我的问题.最初,wsdl看起来像:
<s:element name="root">
<s:complexType>
<s:sequence>
<s:element name="elem1" type="s:string" />
<s:element name="elem2" type="s:string" />
</s:sequence>
</s:complexType>
</s:element">
Run Code Online (Sandbox Code Playgroud)
WCF生成的代理使用显式元素排序,如:
[XmlElement(Order=0)]
public string Elem1
{
...
}
[XmlElement(Order=1)]
public string Elem2
{
...
}
Run Code Online (Sandbox Code Playgroud)
在更新中,向该类型添加了一个新元素,但此元素已添加到序列的中间.
<s:element name="root">
<s:complexType>
<s:sequence>
<s:element name="elem1" type="s:string" />
<s:element name="NewElement" type="s:string" />
<s:element name="elem2" type="s:string" />
</s:sequence>
</s:complexType>
</s:element">
Run Code Online (Sandbox Code Playgroud)
我的WCF代理无法反序列化在添加的NewElement之后排序的任何元素.
Web服务提供商希望此更改与旧客户端向后兼容.显然,我的客户是唯一停止工作的客户.
这是WSDL中的重大变化吗?
是否应将新元素添加到序列的末尾以防止破坏现有客户端?这会使这种向后兼容吗?
如果我删除XmlElement属性上的order参数,我的代理会为这样的未来更改做好更充分的准备吗?如果我删除订单,我会放弃什么?
我继承了一些代码,它在xml configuraiton的根目录下使用了priority元素.这就像http://iserialized.com/log4net-for-noobs/上的示例所示:
<root>
<priority value="ALL" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="ConsoleAppender"/>
</root>
Run Code Online (Sandbox Code Playgroud)
但是,http: //logging.apache.org/log4net/release/manual/configuration.html上的log4net配置示例始终使用level元素显示它:
<root>
<level value="DEBUG" />
<appender-ref ref="A1" />
</root>
Run Code Online (Sandbox Code Playgroud)
在这种类型的配置是
<priority>
Run Code Online (Sandbox Code Playgroud)
同样的
<level>
Run Code Online (Sandbox Code Playgroud)
?
有人能指出我在解释这个问题的文档中的某个地方吗?