为什么使用 ArrayList 来接收 RecognizerIntent.EXTRA_RESULTS

Why use an ArrayList to receive RecognizerIntent.EXTRA_RESULTS

正如标题所说,似乎 RecognizerIntent.EXTRA_RESULTS 只 returns 一个字符串,所以为什么我们需要一个数组列表?

提前致谢

阅读此 link and this link 以获得答案

public static final String EXTRA_RESULTS

Added in API level 3

An ArrayList of the recognition results when performing ACTION_RECOGNIZE_SPEECH. Generally this list should be ordered in descending order of speech recognizer confidence. (See EXTRA_CONFIDENCE_SCORES). Returned in the results; not to be specified in the recognition request. Only present when RESULT_OK is returned in an activity result. In a PendingIntent, the lack of this extra indicates failure.

常数值:“android.speech.extra.RESULTS”

public static final String EXTRA_CONFIDENCE_SCORES

Added in API level 14

A float array of confidence scores of the recognition results when performing ACTION_RECOGNIZE_SPEECH. The array should be the same size as the ArrayList returned in EXTRA_RESULTS, and should contain values ranging from 0.0 to 1.0, or -1 to represent an unavailable confidence score.

Confidence values close to 1.0 indicate high confidence (the speech recognizer is confident that the recognition result is correct), while values close to 0.0 indicate low confidence.

Returned in the results; not to be specified in the recognition request. This extra is optional and might not be provided. Only present when RESULT_OK is returned in an activity result.

常数值:“android.speech.extra.CONFIDENCE_SCORES”