3 回答

TA貢獻1796條經(jīng)驗 獲得超4個贊
這是Google'Now'V6.0.23。*版本的一個錯誤,并且在最新的V6.1.28。*中仍然存在。
自V5.11.34。*版本發(fā)布以來,Google的實施SpeechRecognizer一直受到bug困擾。
您可以使用此要旨來復(fù)制其中的許多內(nèi)容。
您可以使用此BugRecognitionListener來解決其中的一些問題。
我已經(jīng)直接向Now團隊報告了這些內(nèi)容,因此他們知道了,但是目前還沒有任何修復(fù)的方法。Google Now沒有外部錯誤跟蹤器,因為它不是AOSP的一部分,所以恐怕您無濟于事。
正如您正確指出的那樣,您詳細介紹的最新錯誤幾乎使它們的實現(xiàn)無法使用,從而忽略了用于控制語音輸入時序的參數(shù)。根據(jù)文檔:
此外,根據(jù)識別器的實現(xiàn),這些值可能不會起作用。
這是我們應(yīng)該期待的……
如果您不講話或發(fā)出任何可檢測的聲音,則識別將無限期繼續(xù)。
我目前正在創(chuàng)建一個項目來復(fù)制此新錯誤以及所有其他錯誤,我將繼續(xù)轉(zhuǎn)發(fā)并在此處鏈接。
編輯 -我希望我可以創(chuàng)建一種變通辦法,使用部分或不穩(wěn)定結(jié)果的檢測作為觸發(fā)來知道用戶仍在講話。他們停止后,我可以recognizer.stopListening()在設(shè)定的時間段后手動致電。
不幸的是,stopListening()它也被破壞了并且實際上并沒有停止識別,因此沒有解決方法。
圍繞上述嘗試破壞銷毀識別器并僅依靠部分結(jié)果直到該點(未銷毀銷毀識別onResults()器時)都無法產(chǎn)生可靠的實現(xiàn),除非您只是使用關(guān)鍵字spotting即可。
在Google修復(fù)此問題之前,我們無能為力。您唯一的出路是給apps-help@google.com發(fā)送電子郵件,報告問題,并希望他們收到的數(shù)量能對他們有所幫助。

TA貢獻1852條經(jīng)驗 獲得超7個贊
注意!這僅在在線模式下有效。 啟用聽寫模式并禁用部分結(jié)果:
intent.putExtra("android.speech.extra.DICTATION_MODE", true);
intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, false);
在聽寫模式下,speechRecognizer仍會調(diào)用,onPartialResults()但是您應(yīng)該將部分作為最終結(jié)果。

TA貢獻1862條經(jīng)驗 獲得超7個贊
更新:
萬一有人在設(shè)置語音識別時遇到麻煩,您可以使用Droid語音庫,該庫是我為克服android中的語音超時問題而構(gòu)建的。
我的應(yīng)用完全依賴語音識別功能,而Google投下了炸彈。根據(jù)事物的外觀,我相信至少在不久的將來不會解決此問題。
就目前而言,我確實找到了一種解決方案,可以讓Google語音識別按預(yù)期提供語音結(jié)果。
注意:此方法與上述解決方案略有不同。
此方法的主要目的是確保用戶說出的整個單詞都在onPartialResults()處捕獲。
在正常情況下,如果用戶在給定的情況下說出多個單詞,則響應(yīng)時間太快,部分結(jié)果將常常不是只得到第一個單詞,而是得到全部結(jié)果。
因此,為確保每個單詞都被onPartialResults()捕獲,引入了一個處理程序來檢查用戶暫停延遲,然后過濾結(jié)果。還要注意,來自onPartialResults()的結(jié)果數(shù)組將經(jīng)常只有一個項目。
SpeechRecognizer userSpeech = SpeechRecognizer.createSpeechRecognizer(this);
Intent speechIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
speechIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
speechIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, this.getPackageName());
speechIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
speechIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, ModelData.MAX_VOICE_RESULTS);
Handler checkForUserPauseAndSpeak = new Handler();
Boolean speechResultsFound = false;
userSpeech.setRecognitionListener(new RecognitionListener(){
@Override
public void onRmsChanged(float rmsdB)
{
// NA
}
@Override
public void onResults(Bundle results)
{
if(speechResultsFound) return;
speechResultsFound = true;
// Speech engine full results (Do whatever you would want with the full results)
}
@Override
public void onReadyForSpeech(Bundle params)
{
// NA
}
@Override
public void onPartialResults(Bundle partialResults)
{
if(partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION).size() > 0 &&
partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION).get(0) != null &&
!partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION).get(0).trim().isEmpty())
{
checkForUserPauseAndSpeak.removeCallbacksAndMessages(null);
checkForUserPauseAndSpeak.postDelayed(new Runnable()
{
@Override
public void run()
{
if(speechResultsFound) return;
speechResultsFound = true;
// Stop the speech operations
userSpeech.destroy();
// Speech engine partial results (Do whatever you would want with the partial results)
}
}, 1000);
}
}
@Override
public void onEvent(int eventType, Bundle params)
{
// NA
}
@Override
public void onError(int error)
{
// Error related code
}
@Override
public void onEndOfSpeech()
{
// NA
}
@Override
public void onBufferReceived(byte[] buffer)
{
// NA
}
@Override
public void onBeginningOfSpeech()
{
// NA
}
});
userSpeech.startListening(speechIntent);
- 3 回答
- 0 關(guān)注
- 979 瀏覽
添加回答
舉報