blob: b9b5db827e1126661818500e308cd35deec6130a [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Command to generate google_streaming_api.pb.h and google_streaming_api.pb.cc
// protoc --proto_path=. --cpp_out=. google_streaming_api.proto
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
// TODO(hans): Commented out due to compilation errors.
// option cc_api_version = 2;
package cobalt.speech.proto;
// SpeechRecognitionEvent is the only message type sent to client.
//
// The first SpeechRecognitionEvent is an empty (default) message to indicate
// as early as possible that the stream connection has been established.
message SpeechRecognitionEvent {
enum StatusCode {
// Note: in JavaScript API SpeechRecognitionError 0 is "OTHER" error.
STATUS_SUCCESS = 0;
STATUS_NO_SPEECH = 1;
STATUS_ABORTED = 2;
STATUS_AUDIO_CAPTURE = 3;
STATUS_NETWORK = 4;
STATUS_NOT_ALLOWED = 5;
STATUS_SERVICE_NOT_ALLOWED = 6;
STATUS_BAD_GRAMMAR = 7;
STATUS_LANGUAGE_NOT_SUPPORTED = 8;
}
optional StatusCode status = 1 [default = STATUS_SUCCESS];
// May contain zero or one final=true result (the newly settled portion).
// May also contain zero or more final=false results.
// (Note that this differs from JavaScript API resultHistory in that no more
// than one final=true result is returned, so client must accumulate
// resultHistory by concatenating the final=true results.)
repeated SpeechRecognitionResult result = 2;
enum EndpointerEventType {
START_OF_SPEECH = 0;
END_OF_SPEECH = 1;
END_OF_AUDIO = 2; // End of audio stream has been reached.
// End of utterance indicates that no more speech segments are expected.
END_OF_UTTERANCE = 3;
}
optional EndpointerEventType endpoint = 4;
};
message SpeechRecognitionResult {
repeated SpeechRecognitionAlternative alternative = 1;
// True if this is the final time the speech service will return this
// particular SpeechRecognitionResult. If false, then this represents an
// interim result that could still be changed.
optional bool final = 2 [default = false];
// An estimate of the probability that the recognizer will not change its
// guess about this interim result. Values range from 0.0 (completely
// unstable) to 1.0 (completely stable). Note that this is not the same as
// "confidence", which estimate the probability that a recognition result
// is correct. This field is only provided for interim (final=false) results.
optional float stability = 3;
};
// Item in N-best list.
message SpeechRecognitionAlternative {
// Spoken text.
optional string transcript = 1;
// The confidence estimate between 0.0 and 1.0. A higher number means the
// system is more confident that the recognition is correct.
// This field is typically provided only for the top hypothesis and only for
// final results.
optional float confidence = 2;
}