YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakePythonSpeechTranscription.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef FAKEPYTHONSPEECHTRANSCRIPTION_H
7#define FAKEPYTHONSPEECHTRANSCRIPTION_H
8
11#include <yarp/os/Bottle.h>
12#include <stdio.h>
13#include <list>
14
15#include "Python.h"
16
17using namespace yarp::os;
18
27{
28private:
29 bool m_verbose = true;
30 std::string m_language="auto";
31
32 std::string m_moduleName = "a"; // Name of the python file containing the functions/classes
33 std::string m_path = "b"; // Path where the file is located
34 std::string m_className = "c"; // Name of the class contained in @m_moduleName at @m_path
35
36 PyObject * m_classInstance; // Python object of the created class
37
46 bool functionWrapper(std::string moduleName, std::string functionName, PyObject* &pArgs, PyObject* &pValue);
47
56 bool classWrapper(PyObject* &pClassInstance, std::string methodName, PyObject* &pClassMethodArgs, PyObject* &pValue);
57
66 bool classInstanceCreator(std::string moduleName, std::string className, PyObject* &pClassArgs, PyObject* &pReturn);
67
74 bool stringWrapper(PyObject* &pValue, std::string &ret);
75
82 bool intWrapper(PyObject* &pValue, long &ret);
83
90 bool doubleWrapper(PyObject* &pValue, double &ret);
91
98 bool boolWrapper(PyObject* &pValue, bool &ret);
99
100public:
107
108 bool open(yarp::os::Searchable& config) override;
109 bool close() override;
110
111 virtual yarp::dev::ReturnValue setLanguage(const std::string& language) override;
112 virtual yarp::dev::ReturnValue getLanguage(std::string& language) override;
113 virtual yarp::dev::ReturnValue transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score) override;
114};
115
116#endif
bool ret
FakePythonSpeechTranscription: A fake implementation of a speech transcriber plugin using python embe...
FakePythonSpeechTranscription(const FakePythonSpeechTranscription &)=delete
virtual yarp::dev::ReturnValue transcribe(const yarp::sig::Sound &sound, std::string &transcription, double &score) override
Performs the speech transcription.
FakePythonSpeechTranscription(FakePythonSpeechTranscription &&)=delete
FakePythonSpeechTranscription & operator=(const FakePythonSpeechTranscription &)=delete
bool close() override
Close the DeviceDriver.
virtual yarp::dev::ReturnValue getLanguage(std::string &language) override
Gets the current language set for speech transcription.
virtual yarp::dev::ReturnValue setLanguage(const std::string &language) override
Sets the language for speech transcription.
FakePythonSpeechTranscription & operator=(FakePythonSpeechTranscription &&)=delete
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Interface implemented by all device drivers.
A generic interface for speech transcription.
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
Definition Searchable.h:31
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition Sound.h:25
An interface to the operating system, including Port based communication.