YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
fakeSpeechTranscription_test.cpp
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
7#include <yarp/os/Network.h>
10
11#include <catch2/catch_amalgamated.hpp>
12#include <harness.h>
13
14using namespace yarp::dev;
15using namespace yarp::os;
16
17TEST_CASE("dev::fakeSpeechTranscription", "[yarp::dev]")
18{
19 YARP_REQUIRE_PLUGIN("fakeSpeechTranscription", "device");
20
21 Network::setLocalMode(true);
22
23 SECTION("Checking fakeSpeechTranscription device")
24 {
27
28 //open the device
29 {
30
32 pdev_cfg.put("device", "fakeSpeechTranscription");
34 REQUIRE(ddfake.view(istr));
35 }
36
37 std::string lang = "eng";
38 CHECK(istr->getLanguage(lang));
39 CHECK(lang=="auto");
40
41 CHECK(istr->setLanguage("eng"));
42 CHECK(istr->getLanguage(lang));
43 CHECK(lang == "eng");
44
45 std::string transcript;
46 double score;
48 snd.resize(100, 2);
49 CHECK(istr->transcribe(snd,transcript, score));
50 CHECK(transcript=="hello world");
51 CHECK(score > 0.99);
52
53 //"Close all polydrivers and check"
54 {
57 }
58 }
59
60 Network::setLocalMode(false);
61}
A generic interface for speech transcription.
A container for a device driver.
Definition PolyDriver.h:23
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
Definition Property.h:33
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition Sound.h:25
void resize(size_t samples, size_t channels=1)
Set the sound size.
Definition Sound.cpp:270
TEST_CASE("dev::fakeSpeechTranscription", "[yarp::dev]")
For streams capable of holding different kinds of content, check what they actually have.
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
An interface to the operating system, including Port based communication.