• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.common.speech;
18 
19 /**
20  * Utilities for voice recognition implementations.
21  *
22  * @see android.speech.RecognitionService
23  * @see android.speech.RecognizerIntent
24  */
25 public class Recognition {
26 
27     /**
28      * The key to the extra in the Bundle returned by
29      * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS
30      * which is an ArrayList of CharSequences which are hints that can be shown to
31      * the user for voice actions currently supported by voice search for the user's current
32      * language preference for voice search (i.e., the one defined in the extra
33      * android.speech.RecognizerIntent#EXTRA_LANGUAGE_PREFERENCE).
34      *
35      * If this is paired with EXTRA_HINT_CONTEXT, should return a set of hints that are
36      * appropriate for the provided context.
37      *
38      * The CharSequences are SpannedStrings and will contain segments wrapped in
39      * <annotation action="true"></annotation>. This is to indicate the section of the text
40      * which represents the voice action, to be highlighted in the UI if so desired.
41      */
42     public static final String EXTRA_HINT_STRINGS = "android.speech.extra.HINT_STRINGS";
43 
44     /**
45      * The key to an extra to be included in the request intent for
46      * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS.
47      * Should be an int of one of the values defined below. If an
48      * unknown int value is provided, it should be ignored.
49      */
50     public static final String EXTRA_HINT_CONTEXT = "android.speech.extra.HINT_CONTEXT";
51 
52     /**
53      * A set of values for EXTRA_HINT_CONTEXT.
54      */
55     public static final int HINT_CONTEXT_UNKNOWN = 0;
56     public static final int HINT_CONTEXT_VOICE_SEARCH_HELP = 1;
57     public static final int HINT_CONTEXT_CAR_HOME = 2;
58     public static final int HINT_CONTEXT_LAUNCHER = 3;
59 
Recognition()60     private Recognition() { }   // don't instantiate
61 }
62