前段時(shí)間有一個(gè)語(yǔ)音識別的項目,便輕輕地研究了一下,雖沒(méi)有達到預期的效果,但過(guò)程還是比較有趣。
題目是這樣的:給定一些潛在客戶(hù),用 FreeSWITCH 自動(dòng)呼叫,如果用戶(hù)應答,則轉至 IVR,播放歡迎信息甚至轉至人工座席;如果客戶(hù)不應答,則獲取不應答原因。
該想法想要達到的目標是:1)客戶(hù)關(guān)懷。客戶(hù)注冊即可收到關(guān)懷電話(huà)(當然前提是留下電話(huà)號碼。OK,發(fā)短信是另一種方式,但我這們里討論的是語(yǔ)音);2)過(guò)濾無(wú)效客戶(hù)。從不同渠道來(lái)的客戶(hù)數據良莠不齊,有的甚至50%以上都無(wú)法打通,所以,把這部分數據過(guò)濾掉顯然是很有意義的。
雖然我們在外呼中使用 SIP,但被叫用戶(hù)在PSTN,而PSTN信令網(wǎng)一個(gè)很令人討厭的地方就是返回的信令不準確,所以,你無(wú)法從信令層面獲取被叫用戶(hù)的狀態(tài)(空號,忙等),而只能從語(yǔ)音層面去“聽(tīng)”。當然,聽(tīng),對于人來(lái)說(shuō)是沒(méi)有問(wèn)題的,但對于機器來(lái)說(shuō),就不輕松了,它需要使用語(yǔ)音識別(ASR,Automatic Sound Recognition)技術(shù)來(lái)實(shí)現。
Sphinx 應該是開(kāi)源的語(yǔ)音識別公認的比較好的軟件。幸運的是 FreeSWITCH 帶了 pocket_sphinx 模塊。它即能進(jìn)行連續的識別,也能針對關(guān)鍵詞進(jìn)行識別,在測試階段,成功率還是比較高的。但實(shí)際上我們真正要測的數據太爛,所以沒(méi)有收到好的效果。
樣本
目前PSTN網(wǎng)上有各種語(yǔ)音數據,除了各種各樣的彩鈴之外,便是五花八門(mén)的語(yǔ)音提示,而且,針對同一種掛機原因,有各種不同版本的語(yǔ)音提示。為了獲取樣本,我打了不同省市不同運營(yíng)商的電話(huà)并錄音:
originate sofia/gateway/blah/139xxxxxxxx &record(/tmp/testx.wav)
作為測試,我選擇了以下幾種:
您撥的號碼是空號,請查證再撥....(無(wú)限循環(huán))
對不起,您撥叫的用戶(hù)不方便接聽(tīng)您的電話(huà),請稍后再撥。Sorry, the subscriber you have dialed is not convenient to answer now, please dial again later. (循環(huán)...)
您好,您所撥打的號碼是空號,請核對后再撥。您好,您所撥打的號碼是空號,請核對后再撥。Sorry, the number YOU dialed doesn't exist, please check it and dial again.(循環(huán)... 一個(gè)問(wèn)題是 YOU 有必要強調嗎?)
號碼是空號,請查證后再撥。 Sorry, The number you have dialed is not in service, please check the number and dial again. (循環(huán))
如果你聽(tīng)一下,你會(huì )發(fā)現真是太難聽(tīng)了。那么大的電話(huà)公司,不能找個(gè)專(zhuān)業(yè)的人錄音嗎?(個(gè)人感覺(jué) test4.wav 還是比較專(zhuān)業(yè))
test1.wav test2.wav test3.wav test4.wav
第一種方案,關(guān)鍵詞
我將幾個(gè)關(guān)鍵字寫(xiě)進(jìn)了 grammer中,如:
grammar hpcause;
<service> = [ service ];
<rejected> = [ convenient ];
<busy> = [ busy ];
<konghao> = [ konghao ];
<exist> = [ exist ];
public <hpcause> = [ <service> | <rejected> | <busy> | <konghao> | <exist> ];
實(shí)際測試中,我甚至將“空號”(konghao)作為關(guān)鍵詞加上去,的確有時(shí)候能識別出來(lái)。由于中英文混雜,識別率太低。純英文的環(huán)境比較理想。
第二種方案,連續識別
當然我也試過(guò)連續的語(yǔ)音識別,效果都不理想。pocket_sphinx 是支持中文的,但配置比較復雜,而且我也懷疑它在中英文混合識別方面的效果到底如何。
第三種方案,只錄音,采用外部程序識別
要想在 FreeSWITCH 中準確識別這么復雜的情況看來(lái)是不現實(shí)的。另一種想法就是只錄音,而采用外部程序(可能還是 Sphinx)來(lái)識別。可以針對中英文各識別一次,去掉不能識別的部分,我相信效果還是可以的。但沒(méi)有試過(guò)。
第四種方案,Google Voice
實(shí)際上 Google Voice 有一個(gè)很有趣的功能就是 Voice Mail,當你的電話(huà)無(wú)法接通時(shí),它可以錄音,并能轉換成文本。我今天忽然想到,能否讓 Google Voice 來(lái)替我們做這項工作 ?如果行,對于每個(gè) Voice Mail 我們都能收到一封電子郵件,豈不是絕了?
我趕緊試了以下命令:
originate {ignore_early_media=true}sofia/gateway/blah/1717673xxxx 'sleep:3,playback:/home/app/t/test4.wav' inline
上面,我呼叫我的 Google Voice 號碼,并撥放聲音文件,為了等待 Google Voice 啟動(dòng) Voice Mail,暫停了3秒。其中使用了 FreeSWITCH 的 inline dialplan。
不得不說(shuō),人家 Google Voice 的功力就是比較深,以下是呼叫結果(雖然它花了好長(cháng)時(shí)間生成這些文本):
But how much you called her some cat content, a lot. But how much you called her some cat content walk. But how much you called her chin cat content walk. But how much you called her some cat content water. But how much you called her some cat content walk. But how much you called her team cat content walk. But how much you called her teams have content walk. But how much you called her team cat content walk. But how much you called her team captain sample. But how much you called her some cat content. Blah. But how much you called her team packing 10 o'clock. But.
由于第一條語(yǔ)音是純中文的,對比一下,可以發(fā)現 GV 的想象力是比較豐富的。
您 撥的 號 碼是 空 號
But How much Called her
Dave, date which he didn't full full time. Thank you can. Looking for some sure. Okay well, sorry the subscriber to get that out. If not, yes right now. Please check it out later, date which he didn't hopeful. I think you can. Looking for some chance. Okay well, sorry. The subscriber to get that out. If not, yes uncertain, so. Please straight out later. If You Keep Doing phone found antiquing employer some chocolates as well. Sorry. The subscriber you have dialed is not company as uncertain. So please straight out later. Hey Vicky, but I think in full full time. Thank you been looking for. So, I'm sure. Okay well, sorry. The subscriber you have dialed is house company as of right now lease without a later Hello. Hey Vicky, like, I can hopeful. I think you can get them some chocolates at. Well, sorry. The subscriber you have dialed is not come again it's on sale now. Please straight out later. Hey Vicky, but I don't know 4 phone so I think you can get some fire some chocolate at 40 sorry. The subscriber you have dialed is not come again it's on sat. Now, Please, straight out later.
"not convenient" 跟 "not come again" 相比意思應該差不多吧?哈
Com critical table, the com the job without the how much you can call team critical examples of the the number in the Dells doesn't exist. Please check it and Dale again the com job without a, how much you can call few critical table, the com the job without a, how much you can call team critical to thank both of these, the number in the Dells doesn't exist. Please check it and down again.