语音识别 - 剪切,复制,粘贴C# [英] Speech recognition - cut, copy, paste in C#
问题描述
我正在开发一个使用语音识别的Windows应用程序。现在我想添加复制,粘贴和剪切到我的应用程序。我的意思是,当我选择一个单词或句子并说复制时,应用程序副本,当我说粘贴时,粘贴它。怎么做?另外一件事,我怎样才能在语音窗口之间进行更改?(alt + tab with voice)
我尝试过的事情:
i在互联网上找不到任何相关信息。我找到一些复制和粘贴的代码,但我不知道如何使用它进行语音识别。
你可以做的比从一些基础知识开始更糟糕微软
语音识别入门 [ ^ ]
做一些游戏并改进你需要知道的东西。
请参阅我对该问题的评论;这是你的主要答案。
所有你需要使用语音识别的地方在这里: System.Speech.Recognition Namespace [ ^ ]。
没有任何特殊的秘密:阅读,理解,尝试,设计,实施。小心:目前,与Windows捆绑在一起的语音识别功能使您的保真度极差(与竞争对手的产品相比)。但它适用于小型语法。所以,我的主要建议只有一个:创建尽可能小的语法。完全发音的话。
这是你使用系统剪贴板所需要的:
剪贴板类(System.Windows.Forms) [ ^ ] 。
或剪贴板类(System.Windows) [ ^ ]。
其他系统范围的命令会更难。在Windows之间切换将使用您可以通过P / Invoke使用的原始Windows API。没什么太难的:窗口功能(Windows) [ ^ ]:
显然,你需要掌握P / Invoke:
平台调用服务 - 维基百科,免费的百科全书 [ ^ ]。
此CodeProject文章也很有用: http://www.codeproject.com/csharp/EssentialPInvoke.asp [ ^ ]。
不幸的是,这将严重损害您的平台com适用性:您的应用程序仅适用于Windows。但是为了你的目的,我猜你不介意。
就是这样。
-SA
I'm developing an windows application that using speech recognition.now i want to add copy, paste and cut to my application. i mean, when i select a word or sentence and say copy, the application copy that and when i say paste, paste it. how to do that? another thing, how can i change between windows with speech ?(alt+tab with voice)
What I have tried:
i can't find anything about this in internet. i find some code for copy and pasting but i don't know how to use it for speech recognition.
Well you could do worse than starting with some basics from Microsoft
Get Started with Speech Recognition[^]
Do some playing and refine what you need to know.
Please see my comment to the question; this is the main answer for you.
All you need to use voice recognition is here: System.Speech.Recognition Namespace[^].
There are no any special secrets: read, understand, try out, design, implement. Be careful: presently, speech recognition bundled with Windows gives you amazingly poor fidelity (in contrast to competitor's products). But it will work with small grammars. So, my main advice is only one: create as small grammar as possible. Thoroughly pronounce words.
This is what you need to work with system clipboard:
Clipboard Class (System.Windows.Forms)[^].
or Clipboard Class (System.Windows)[^].
Other system-wide commands will be much harder. Switching between windows will take using raw Windows API you can use through P/Invoke. Nothing too hard though: Window Functions (Windows)[^]:
Apparently, you will need to master P/Invoke:
Platform Invocation Services — Wikipedia, the free encyclopedia[^].
This CodeProject article can also be useful: http://www.codeproject.com/csharp/EssentialPInvoke.asp[^].
Unfortunately, this will badly compromise your platform compatibility: your application will work only in Windows. But for you purpose, I guess you won't mind.
That's all.
—SA
这篇关于语音识别 - 剪切,复制,粘贴C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!