YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
GoogleSpeechTranscription.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_GOOGLESPEECHTRANSCR_H
7#define YARP_GOOGLESPEECHTRANSCR_H
8
11#include <yarp/sig/Sound.h>
12#include <yarp/os/Network.h>
13#include <algorithm>
14#include <memory>
15#include <vector>
16
17#include "google/cloud/speech/v1/speech_client.h"
18#include "google/protobuf/repeated_ptr_field.h"
19#include "google/cloud/grpc_options.h"
20
22
23
39{
40public:
46 ~GoogleSpeechTranscription() override = default;
47
48 // DeviceDriver
49 bool open(yarp::os::Searchable& config) override;
50 bool close() override;
51
52 // yarp::dev::ISpeechTranscription
53 yarp::dev::ReturnValue setLanguage(const std::string& language="auto") override;
54 yarp::dev::ReturnValue getLanguage(std::string& language) override;
55 yarp::dev::ReturnValue transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score) override;
56
57private:
58
59 std::shared_ptr<google::cloud::speech_v1::SpeechClient> _getClient(google::cloud::Options opts);
60
61 bool m_offline{false};
62 google::cloud::speech::v1::RecognitionConfig m_audioConfig;
63};
64
65#endif // YARP_GOOGLESPEECHTRANSCR_H
This class is the parameters parser for class GoogleSpeechTranscription.
googleSpeechTranscription: A yarp device for speech transcription using google cloud cpp libraries
yarp::dev::ReturnValue setLanguage(const std::string &language="auto") override
Sets the language for speech transcription.
yarp::dev::ReturnValue getLanguage(std::string &language) override
Gets the current language set for speech transcription.
GoogleSpeechTranscription(const GoogleSpeechTranscription &)=delete
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue transcribe(const yarp::sig::Sound &sound, std::string &transcription, double &score) override
Performs the speech transcription.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
GoogleSpeechTranscription(GoogleSpeechTranscription &&) noexcept=delete
Interface implemented by all device drivers.
A generic interface for speech transcription.
STL namespace.
The main, catch-all namespace for YARP.
Definition dirs.h:16