當前位置: 首頁>>代碼示例>>Java>>正文


Java SpeechRecognizer.ERROR_NO_MATCH屬性代碼示例

本文整理匯總了Java中android.speech.SpeechRecognizer.ERROR_NO_MATCH屬性的典型用法代碼示例。如果您正苦於以下問題:Java SpeechRecognizer.ERROR_NO_MATCH屬性的具體用法?Java SpeechRecognizer.ERROR_NO_MATCH怎麽用?Java SpeechRecognizer.ERROR_NO_MATCH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.speech.SpeechRecognizer的用法示例。


在下文中一共展示了SpeechRecognizer.ERROR_NO_MATCH屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onError

@Override
public void onError(int errorCode) {
    Log.d(TAG, "in onError");
    if ((errorCode == SpeechRecognizer.ERROR_NO_MATCH) || (errorCode == SpeechRecognizer.ERROR_SPEECH_TIMEOUT)) {
        stop();
        Log.d(TAG, "didn't recognize anything");
        // keep going
        try {
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        recognizeSpeechDirectly();
    } else {
        Log.d(TAG, "FAILED " + SpeechRecognitionUtil.diagnoseErrorCode(errorCode));
    }
}
 
開發者ID:Palo-IT,項目名稱:voice-IT,代碼行數:17,代碼來源:WordActivator.java

示例2: onError

/**
 * A network or recognition error occurred.
 *
 * @param error code is defined in {@link SpeechRecognizer}
 */
@Override
public void onError(final int error) {
    if (DEBUG) {
        MyLog.w(CLS_NAME, "onError: " + error);
        MyLog.w(CLS_NAME, "onError: doEndOfSpeech: " + doEndOfSpeech);
        MyLog.w(CLS_NAME, "onError: doError: " + doError);
        MyLog.i(CLS_NAME, "onError: doBeginningOfSpeech: " + doBeginningOfSpeech);
    }

    if (error != SpeechRecognizer.ERROR_NO_MATCH) {
        doError = true;
    }

    if (doError) {
        onRecognitionError(error);
    }
}
 
開發者ID:brandall76,項目名稱:Saiy-PS,代碼行數:22,代碼來源:SaiyRecognitionListener.java

示例3: onError

@Override
public void onError(int error) {
    String text = "error" + error;
    switch (error) {
        case SpeechRecognizer.ERROR_NO_MATCH:
            text = "Je n'ai pas compris";
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            if (isAwake) {
                text = "Essayez encore s'il vous plaît...";
            }
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:

    }
    try {
        speechRecognizer.stopListening();
        Thread.sleep(2000);
        speechRecognizer.startListening(intent);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    Log.d(TAG, text);
    textView.setText(text);
}
 
開發者ID:Palo-IT,項目名稱:voice-IT,代碼行數:25,代碼來源:SpeechToTextAction.java

示例4: getErrorText

private String getErrorText(int errorCode) {
    String message;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            return "Audio recording error";
        case SpeechRecognizer.ERROR_CLIENT:
            return "Client side error";
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            return "Insufficient permissions";
        case SpeechRecognizer.ERROR_NETWORK:
            return "Network error";
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            return "Network timeout";
        case SpeechRecognizer.ERROR_NO_MATCH:
            return "No match";
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            return "RecognitionService busy";
        case SpeechRecognizer.ERROR_SERVER:
            return "error from server";
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            return "No speech input";
        default:
            return "Didn't understand, please try again.";
    }
}
 
開發者ID:rafaelaaraujo,項目名稱:Face-detect-framework,代碼行數:25,代碼來源:Zoom.java

示例5: onError

@Override
public void onError(int error) {
    m_isListening = false;
    synchronized (MyASR.this) {
        switch (error) {
            case SpeechRecognizer.ERROR_NO_MATCH:
            case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
                new ToneGenerator(AudioManager.STREAM_MUSIC, ToneGenerator.MAX_VOLUME)
                        .startTone(ToneGenerator.TONE_PROP_BEEP2);
                break;
            default:
                break;
        }
    }
}
 
開發者ID:heremaps,項目名稱:here-android-sdk-examples,代碼行數:16,代碼來源:MyASR.java

示例6: onError

@Override
public void onError(int i) {
    Timber.d("voiceError %d", i);

    stopVoice();

    switch (i) {
        case SpeechRecognizer.ERROR_NETWORK:
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            sendErrorNotification(context.getString(R.string.voiceErrorNoInternet));
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            sendErrorNotification(context.getString(R.string.voiceErrorNoSpeech));
            break;
        default:
            sendErrorNotification(context.getString(R.string.voiceErrorUnknown));
            break;
    }
}
 
開發者ID:matejdro,項目名稱:PebbleAndroidCommons,代碼行數:20,代碼來源:PhoneVoiceProvider.java

示例7: recogError

public static String recogError(int errorCode){
    String message;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            message = "音頻問題";
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            message = "沒有語音輸入";
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            message = "其它客戶端錯誤";
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            message = "權限不足";
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            message = "網絡問題";
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            message = "沒有匹配的識別結果";
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            message =  "引擎忙";
            break;
        case SpeechRecognizer.ERROR_SERVER:
            message = "服務端錯誤";
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            message = "連接超時";
            break;
        default:
            message = "未知錯誤:" + errorCode;
            break;
    }
    return message;
}
 
開發者ID:yangyankai,項目名稱:Seconds,代碼行數:36,代碼來源:ErrorTranslation.java

示例8: getErrorText

public static String getErrorText(int errorCode) {
    String message;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            message = "Audio recording error";
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            message = "Client side error";
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            message = "Insufficient permissions";
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            message = "Network error";
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            message = "Network timeout";
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            message = "No match";
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            message = "RecognitionService busy";
            break;
        case SpeechRecognizer.ERROR_SERVER:
            message = "error from server";
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            message = "No speech input";
            break;
        default:
            message = "Didn't understand, please try again.";
            break;
    }
    return message;
}
 
開發者ID:inteliedoit,項目名稱:thesis-project,代碼行數:36,代碼來源:CriteriaFinaltermInputActivity.java

示例9: onError

@Override
public void onError(int error) {

    String reason = "";
    if (mResultCallback != null) {
        switch (error) {
            case SpeechRecognizer.ERROR_AUDIO:
                reason = "SpeechRecognizer.ERROR_AUDIO";
                break;
            case SpeechRecognizer.ERROR_CLIENT:
                reason = "SpeechRecognizer.ERROR_CLIENT";
                break;
            case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
                reason = "SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS";
                break;
            case SpeechRecognizer.ERROR_NETWORK:
                reason = "SpeechRecognizer.ERROR_NETWORK";
                break;
            case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
                reason = "SpeechRecognizer.ERROR_NETWORK_TIMEOUT";
                break;
            case SpeechRecognizer.ERROR_NO_MATCH:
                reason = "SpeechRecognizer.ERROR_NO_MATCH";
                break;
            case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
                reason = "SpeechRecognizer.ERROR_RECOGNIZER_BUSY";
                break;
            case SpeechRecognizer.ERROR_SERVER:
                reason = "SpeechRecognizer.ERROR_SERVER";
                break;
            case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
                reason = "SpeechRecognizer.ERROR_SPEECH_TIMEOUT";
                break;
        }

        mResultCallback.onError(reason, error);
    }

}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:39,代碼來源:SpeechRecognition.java

示例10: onError

@Override
public void onError(String error, int errorCode) {
    if (eventHandler != null)
        eventHandler.onError(error, errorCode);
    int errorSent = ERROR.SERVER;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            errorSent = ERROR.AUDIO;
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            errorSent = ERROR.NETWORK;
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            errorSent = ERROR.NETWORK_TIMEOUT;
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            errorSent = ERROR.NO_MATCH;
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            errorSent = ERROR.RECOGNIZER_BUSY;
            break;
        case SpeechRecognizer.ERROR_SERVER:
            errorSent = ERROR.SERVER;
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            errorSent = ERROR.SPEECH_TIMEOUT;
            break;

        default:
            break;
    }
    sf = new ShieldFrame(UIShield.SPEECH_RECOGNIZER_SHIELD.getId(),
            SEND_ERROR);
    sf.addArgument(1, errorSent);
    Log.d("Frame", sf.toString());
    sendShieldFrame(sf, true);
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:37,代碼來源:SpeechRecognitionShield.java

示例11: onError

@Override
public void onError(int error) {
    Log.d("TAG", "onError------>");
    StringBuilder sb = new StringBuilder();
    switch (error) {
        case SpeechRecognizer.ERROR_AUDIO:
            sb.append("音頻問題");
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            sb.append("囧..我聽不見在說什麽..大聲點吧!");
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            sb.append("其它客戶端錯誤");
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            sb.append("權限不足");
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            sb.append("網絡問題");
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            sb.append("囧..我聽不懂你在說什麽..");
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            sb.append("引擎忙");
            break;
        case SpeechRecognizer.ERROR_SERVER:
            sb.append("服務器錯誤");
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            sb.append("連接超時");
            break;
    }
    Toast.makeText(RobotActivity.this,
            "出錯了 :" + sb, Toast.LENGTH_SHORT).show();
}
 
開發者ID:AleGogogo,項目名稱:MaoMaoRobot,代碼行數:36,代碼來源:RobotActivity.java

示例12: onError

@Override
public void onError(int error) {
    Log.d("TAG", "onError------>");
    StringBuilder sb = new StringBuilder();
    switch (error) {
        case SpeechRecognizer.ERROR_AUDIO:
            sb.append("音頻問題");
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            sb.append("囧..我聽不見在說什麽..大聲點吧!");
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            sb.append("其它客戶端錯誤");
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            sb.append("權限不足");
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            sb.append("網絡問題");
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            sb.append("囧..我聽不懂你在說什麽..");
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            sb.append("引擎忙");
            break;
        case SpeechRecognizer.ERROR_SERVER:
            sb.append("服務器錯誤");
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            sb.append("連接超時");
            break;
    }
    Toast.makeText(MainActivity.this,
            "出錯了 :" + sb, Toast.LENGTH_SHORT).show();
}
 
開發者ID:AleGogogo,項目名稱:MaoMaoRobot,代碼行數:36,代碼來源:MainActivity.java

示例13: getErrorText

private String getErrorText(int errorCode) {
  String message;
  switch (errorCode) {
    case SpeechRecognizer.ERROR_AUDIO:
      message = "Audio recording error";
      break;
    case SpeechRecognizer.ERROR_CLIENT:
      message = "Client side error";
      break;
    case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
      message = "Insufficient permissions";
      break;
    case SpeechRecognizer.ERROR_NETWORK:
      message = "Network error";
      break;
    case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
      message = "Network timeout";
      break;
    case SpeechRecognizer.ERROR_NO_MATCH:
      message = "No match";
      break;
    case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
      message = "RecognitionService busy";
      break;
    case SpeechRecognizer.ERROR_SERVER:
      message = "error from server";
      break;
    case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
      message = "No speech input";
      break;
    default:
      message = "Didn't understand, please try again.";
      break;
  }
  return message;
}
 
開發者ID:pbakondy,項目名稱:cordova-plugin-speechrecognition,代碼行數:36,代碼來源:SpeechRecognition.java

示例14: getErrorMsg

public static String getErrorMsg(int errorCode) {
    String message;
    switch (errorCode) {
        case SpeechRecognizer.ERROR_AUDIO:
            message = "Soryy Audio recording error";
            break;
        case SpeechRecognizer.ERROR_CLIENT:
            message = "Sorry Client side error";
            break;
        case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
            message = "Soryy Insufficient permissions kindly grant all requred permisiion";
            break;
        case SpeechRecognizer.ERROR_NETWORK:
            message = "Sorry Network error";
            break;
        case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
            message = "sorry Network timeout";
            break;
        case SpeechRecognizer.ERROR_NO_MATCH:
            message = "Sorry No match";
            break;
        case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
            message = "Sorry RecognitionService busy";
            break;
        case SpeechRecognizer.ERROR_SERVER:
            message = "Sorry error from server";
            break;
        case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
            message = "sorry No speech input";
            break;
        default:
            message = "Sorry Didn't understand, please try again.";
            break;
    }
    return message;
}
 
開發者ID:cehsonu100,項目名稱:DroidAssistant,代碼行數:36,代碼來源:SpeechToTextService.java

示例15: translateError

protected String translateError(int error) {
    String message;
    switch (error) {
    case SpeechRecognizer.ERROR_AUDIO:
        message = "Audio recording error";
        break;
    case SpeechRecognizer.ERROR_CLIENT:
        message = "Client side error";
        break;
    case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
        message = "Insufficient permissions";
        break;
    case SpeechRecognizer.ERROR_NETWORK:
        message = "Network error";
        break;
    case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
        message = "Network timeout";
        break;
    case SpeechRecognizer.ERROR_NO_MATCH:
        message = "No match";
        break;
    case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
        message = "RecognitionService busy";
        break;
    case SpeechRecognizer.ERROR_SERVER:
        message = "error from server";
        break;
    case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
        message = "No speech input";
        break;
    default:
        message = "Not recognised";
        break;
    }
    return message;
}
 
開發者ID:vlinhd11,項目名稱:android-continuous-voice,代碼行數:36,代碼來源:AbstractAndroidRecognitionListener.java


注:本文中的android.speech.SpeechRecognizer.ERROR_NO_MATCH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。