Home | History | Annotate | Download | only in proto
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 syntax = "proto2";
      6 option optimize_for = LITE_RUNTIME;
      7 
      8 // TODO(hans): Commented out due to compilation errors.
      9 // option cc_api_version = 2;
     10 
     11 package content.proto;
     12 
     13 // SpeechRecognitionEvent is the only message type sent to client.
     14 //
     15 // The first SpeechRecognitionEvent is an empty (default) message to indicate
     16 // as early as possible that the stream connection has been established.
     17 message SpeechRecognitionEvent {
     18   enum StatusCode {
     19     // Note: in JavaScript API SpeechRecognitionError 0 is "OTHER" error.
     20     STATUS_SUCCESS = 0;
     21     STATUS_NO_SPEECH = 1;
     22     STATUS_ABORTED = 2;
     23     STATUS_AUDIO_CAPTURE = 3;
     24     STATUS_NETWORK = 4;
     25     STATUS_NOT_ALLOWED = 5;
     26     STATUS_SERVICE_NOT_ALLOWED = 6;
     27     STATUS_BAD_GRAMMAR = 7;
     28     STATUS_LANGUAGE_NOT_SUPPORTED = 8;
     29   }
     30   optional StatusCode status = 1 [default = STATUS_SUCCESS];
     31 
     32   // May contain zero or one final=true result (the newly settled portion).
     33   // May also contain zero or more final=false results.
     34   // (Note that this differs from JavaScript API resultHistory in that no more
     35   // than one final=true result is returned, so client must accumulate
     36   // resultHistory by concatenating the final=true results.)
     37   repeated SpeechRecognitionResult result = 2;
     38 };
     39 
     40 message SpeechRecognitionResult {
     41   repeated SpeechRecognitionAlternative alternative = 1;
     42 
     43   // True if this is the final time the speech service will return this
     44   // particular SpeechRecognitionResult. If false, then this represents an
     45   // interim result that could still be changed.
     46   optional bool final = 2 [default = false];
     47 
     48   // An estimate of the probability that the recognizer will not change its
     49   // guess about this interim result.  Values range from 0.0 (completely
     50   // unstable) to 1.0 (completely stable).  Note that this is not the same as
     51   // "confidence", which estimate the probability that a recognition result
     52   // is correct. This field is only provided for interim (final=false) results.
     53   optional float stability = 3;
     54 };
     55 
     56 // Item in N-best list.
     57 message SpeechRecognitionAlternative {
     58   // Spoken text.
     59   optional string transcript = 1;
     60 
     61   // The confidence estimate between 0.0 and 1.0.  A higher number means the
     62   // system is more confident that the recognition is correct.
     63   // This field is typically provided only for the top hypothesis and only for
     64   // final results.
     65   optional float confidence = 2;
     66 }
     67