summaryrefslogtreecommitdiffstats
path: root/common/java/com/android/common/speech/Recognition.java
blob: bf60c9a1b531483da926e6a6360c749c8f0f16a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.common.speech;

/**
 * Utilities for voice recognition implementations.
 *
 * @see android.speech.RecognitionService
 * @see android.speech.RecognizerIntent
 */
public class Recognition {

    /**
     * The extra key used in an intent to the speech recognizer for voice search. Not
     * generally to be used by developers. The system search dialog uses this, for example,
     * to set a calling package for identification by a voice search API. If this extra
     * is set by anyone but the system process, it should be overridden by the voice search
     * implementation.
     */
    public static final String EXTRA_CALLING_PACKAGE = "calling_package";
    
    /**
     * The key to the extra in the Bundle returned by
     * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS
     * which is an ArrayList of CharSequences which are hints that can be shown to
     * the user for voice actions currently supported by voice search for the user's current
     * language preference for voice search (i.e., the one defined in the extra
     * android.speech.RecognizerIntent#EXTRA_LANGUAGE_PREFERENCE).
     *
     * If this is paired with EXTRA_HINT_CONTEXT, should return a set of hints that are
     * appropriate for the provided context.
     *
     * The CharSequences are SpannedStrings and will contain segments wrapped in
     * <annotation action="true"></annotation>. This is to indicate the section of the text
     * which represents the voice action, to be highlighted in the UI if so desired.
     */
    public static final String EXTRA_HINT_STRINGS = "android.speech.extra.HINT_STRINGS";
    
    /**
     * The key to an extra to be included in the request intent for
     * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS.
     * Should be an int of one of the values defined below. If an
     * unknown int value is provided, it should be ignored.
     */
    public static final String EXTRA_HINT_CONTEXT = "android.speech.extra.HINT_CONTEXT";
    
    /**
     * A set of values for EXTRA_HINT_CONTEXT.
     */
    public static final int HINT_CONTEXT_UNKNOWN = 0;
    public static final int HINT_CONTEXT_VOICE_SEARCH_HELP = 1;
    public static final int HINT_CONTEXT_CAR_HOME = 2;

    private Recognition() { }   // don't instantiate
}