TLSphinx 介绍
TLSphinx 是一个围绕着 Pocketsphinx
的封装器,一个基于 CMU Sphinx
的便携库,允许应用程序执行的语音识别而无需将音频移出设备。
示例:
import TLSphinx let hmm = ... // Path to the acustic model let lm = ... // Path to the languaje model let dict = ... // Path to the languaje dictionary if let config = Config(args: ("-hmm", hmm), ("-lm", lm), ("-dict", dict)) { if let decoder = Decoder(config:config) { let audioFile = ... // Path to an audio file decoder.decodeSpeechAtPath(audioFile) { if let hyp: Hypotesis = $0 { // Print the decoder text and score println("Text: \(hyp.text) - score: \(hyp.score)") } else { // Can't decode any speech because an error } } } else { // Handle Decoder() fail } } else { // Handle Config() fail }
TLSphinx 官网
https://github.com/tryolabs/TLSphinx
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。