TLSphix是一个围绕着Pocketsphix的封装器,一个基于CMUSphix的便携库,允许应用程序执行的语音识别而无需将音频移出设备。
示例:
import TLSphixlet hmm = ... // Path to the acustic modellet lm = ... // Path to the laguaje modellet dict = ... // Path to the laguaje dictioaryif let cofig = Cofig(args: ("-hmm", hmm), ("-lm", lm), ("-dict", dict)) { if let decoder = Decoder(cofig:cofig) { let audioFile = ... // Path to a audio file decoder.decodeSpeechAtPath(audioFile) { if let hyp: Hypotesis = $0 { // Prit the decoder text ad score pritl("Text: \(hyp.text) - Score: \(hyp.score)") } else { // Ca't decode ay speech because a error } } } else { // Hadle Decoder() fail }} else { // Hadle Cofig() fail }









评论