blob: 526b3a6af42e8b5c514bc27b0141bd60babf99d4 [file] [log] [blame]
// Copyright 2015 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.
[DartPackage="mojo_services", JavaPackage="org.chromium.mojo.speech_recognizer"]
module speech_recognizer;
enum Error {
NETWORK_TIMEOUT = 1,
NETWORK = 2,
AUDIO = 3,
SERVER = 4,
CLIENT = 5,
SPEECH_TIMEOUT = 6,
NO_MATCH = 7,
RECOGNIZER_BUSY = 8,
INSUFFICIENT_PERMISSIONS = 9
};
struct UtteranceCandidate {
// Utterance text candidate returned by speech recognition service.
string text;
// Confidence score in [0,1].
float confidence_score;
};
union ResultOrError {
Error error_code;
array<UtteranceCandidate> results;
};
// |SpeechRecognizerService| provides access to a speech recognition service.
// It is responsible for reading microphone input, deciding when the user is
// done speaking, and performing speech recognition on the result.
interface SpeechRecognizerService {
// Starts listening to the user. When listening has finished or an error
// occurs, returns |result_or_error|. Any call to Listen() made while another
// is in progress will immediately return an error.
Listen() => (ResultOrError result_or_error);
// Stops the SpeechRecognizer from listening and finishes any previous call
// to Listen() causing it to return.
StopListening();
};