问题描述
在OSX Mavericks中,现在包括语音听写,并且非常有用.我正在尝试使用听写功能来创建自己的数字生活助手,但是我找不到如何使用识别功能在应用程序而不是文本框中获取语音的方法.
In OSX Mavericks, speech dictation is now included, and is very useful. I am trying to use the dictation capability to create my own digital life assistant, but I can't find how to use the recognition functionality to get the speech in an application rather than a text box.
我研究了NSSpeechRecognizer,但这似乎是针对使用预定义的语法而不是听写命令来编写可口的命令.我使用哪种编程语言都没关系,但是Python或Java会很好...
I have looked into NSSpeechRecognizer, but that seems to be geared toward programming speakable commands with a pre-defined grammar rather than dictation. It doesn't matter what programming language I use, but Python or Java would be nice...
感谢您的帮助!
推荐答案
您可以使用 SFSpeechRecognizer (镜像)(需要 macOS 10.15 +):用于语音识别.
You can use SFSpeechRecognizer (mirror) (requires macOS 10.15+): this is made for speech recognition.
正如您在问题 NSSpeechRecognizer (镜像)确实提供了命令和控制语音识别系统的风格(命令短语必须在收听之前定义,这与听写系统不受约束的听写系统相反.
Whereas as you have noted in the question NSSpeechRecognizer (mirror) indeed provides a "command and control" style of voice recognition system (the command phrases must be defined prior to listening, in contrast to a dictation system where the recognized text is unconstrained).
来自 https://developer.apple.com/videos/play/wwdc2019/256/(镜像):
另一种方法是直接使用Mac Dictation,但据我所知,唯一的方法是重新定向音频源,这不是很整齐,例如参见 http://www.showcasemarketing.com/ideablog/transcribe-mp3-audio-to-text-mac-os/(镜像).
Another way is to directly use Mac Dictation, but as far as I know the only way is to rerdirect audio feeds, which isn't very neat, e.g. see http://www.showcasemarketing.com/ideablog/transcribe-mp3-audio-to-text-mac-os/ (mirror).
这篇关于将Mac OSX听写与语音API结合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!