前段時間有一個語音識別的項目,便輕輕地研究了一下,雖沒有達到預期的效果,但過程還是比較有趣。
題目是這樣的:給定一些潛在客戶,用 FreeSWITCH 自動呼叫,如果用戶應答,則轉(zhuǎn)至 IVR,播放歡迎信息甚至轉(zhuǎn)至人工座席;如果客戶不應答,則獲取不應答原因。
該想法想要達到的目標是:1)客戶關(guān)懷?蛻糇约纯墒盏疥P(guān)懷電話(當然前提是留下電話號碼。OK,發(fā)短信是另一種方式,但我這們里討論的是語音);2)過濾無效客戶。從不同渠道來的客戶數(shù)據(jù)良莠不齊,有的甚至50%以上都無法打通,所以,把這部分數(shù)據(jù)過濾掉顯然是很有意義的。
雖然我們在外呼中使用 SIP,但被叫用戶在PSTN,而PSTN信令網(wǎng)一個很令人討厭的地方就是返回的信令不準確,所以,你無法從信令層面獲取被叫用戶的狀態(tài)(空號,忙等),而只能從語音層面去“聽”。當然,聽,對于人來說是沒有問題的,但對于機器來說,就不輕松了,它需要使用語音識別(ASR,Automatic Sound Recognition)技術(shù)來實現(xiàn)。
Sphinx 應該是開源的語音識別公認的比較好的軟件。幸運的是 FreeSWITCH 帶了 pocket_sphinx 模塊。它即能進行連續(xù)的識別,也能針對關(guān)鍵詞進行識別,在測試階段,成功率還是比較高的。但實際上我們真正要測的數(shù)據(jù)太爛,所以沒有收到好的效果。
樣本
目前PSTN網(wǎng)上有各種語音數(shù)據(jù),除了各種各樣的彩鈴之外,便是五花八門的語音提示,而且,針對同一種掛機原因,有各種不同版本的語音提示。為了獲取樣本,我打了不同省市不同運營商的電話并錄音:
originate sofia/gateway/blah/139xxxxxxxx &record(/tmp/testx.wav)
作為測試,我選擇了以下幾種:
您撥的號碼是空號,請查證再撥....(無限循環(huán))
對不起,您撥叫的用戶不方便接聽您的電話,請稍后再撥。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)... 一個問題是 YOU 有必要強調(diào)嗎?)
號碼是空號,請查證后再撥。 Sorry, The number you have dialed is not in service, please check the number and dial again. (循環(huán))
如果你聽一下,你會發(fā)現(xiàn)真是太難聽了。那么大的電話公司,不能找個專業(yè)的人錄音嗎?(個人感覺 test4.wav 還是比較專業(yè))
test1.wav test2.wav test3.wav test4.wav
第一種方案,關(guān)鍵詞
我將幾個關(guān)鍵字寫進了 grammer中,如:
grammar hpcause;
<service> = [ service ];
<rejected> = [ convenient ];
<busy> = [ busy ];
<konghao> = [ konghao ];
<exist> = [ exist ];
public <hpcause> = [ <service> | <rejected> | <busy> | <konghao> | <exist> ];
實際測試中,我甚至將“空號”(konghao)作為關(guān)鍵詞加上去,的確有時候能識別出來。由于中英文混雜,識別率太低。純英文的環(huán)境比較理想。
第二種方案,連續(xù)識別
當然我也試過連續(xù)的語音識別,效果都不理想。pocket_sphinx 是支持中文的,但配置比較復雜,而且我也懷疑它在中英文混合識別方面的效果到底如何。
第三種方案,只錄音,采用外部程序識別
要想在 FreeSWITCH 中準確識別這么復雜的情況看來是不現(xiàn)實的。另一種想法就是只錄音,而采用外部程序(可能還是 Sphinx)來識別?梢葬槍χ杏⑽母髯R別一次,去掉不能識別的部分,我相信效果還是可以的。但沒有試過。
第四種方案,Google Voice
實際上 Google Voice 有一個很有趣的功能就是 Voice Mail,當你的電話無法接通時,它可以錄音,并能轉(zhuǎn)換成文本。我今天忽然想到,能否讓 Google Voice 來替我們做這項工作 ?如果行,對于每個 Voice Mail 我們都能收到一封電子郵件,豈不是絕了?
我趕緊試了以下命令:
originate {ignore_early_media=true}sofia/gateway/blah/1717673xxxx 'sleep:3,playback:/home/app/t/test4.wav' inline
上面,我呼叫我的 Google Voice 號碼,并撥放聲音文件,為了等待 Google Voice 啟動 Voice Mail,暫停了3秒。其中使用了 FreeSWITCH 的 inline dialplan。
不得不說,人家 Google Voice 的功力就是比較深,以下是呼叫結(jié)果(雖然它花了好長時間生成這些文本):
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.
由于第一條語音是純中文的,對比一下,可以發(fā)現(xiàn) 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.