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
21
22
38{
39public:
45 ~GoogleSpeechTranscription() override = default;
46
47 // DeviceDriver
48 bool open(yarp::os::Searchable& config) override;
49 bool close() override;
50
51 // yarp::dev::ISpeechTranscription
52 yarp::dev::ReturnValue setLanguage(const std::string& language="auto") override;
53 yarp::dev::ReturnValue getLanguage(std::string& language) override;
54 yarp::dev::ReturnValue transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score) override;
55
56private:
57 bool m_offline{false};
58 google::cloud::speech::v1::RecognitionConfig m_audioConfig;
59 std::shared_ptr<google::cloud::speech_v1::SpeechClient> m_client{nullptr};
60};
61
62#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