YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
speechTranscription_nwc_yarp_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
6#include <yarp/os/Network.h>
10
12#include <catch2/catch_amalgamated.hpp>
13#include <harness.h>
14
15#include <yarp/sig/Sound.h>
16
17using namespace yarp::dev;
18using namespace yarp::os;
19
20TEST_CASE("dev::speechTranscription_nwc_yarp", "[yarp::dev]")
21{
22 YARP_REQUIRE_PLUGIN("fakeSpeechTranscription", "device");
23 YARP_REQUIRE_PLUGIN("speechTranscription_nws_yarp", "device");
24 YARP_REQUIRE_PLUGIN("speechTranscription_nwc_yarp", "device");
25
26 Network::setLocalMode(true);
27
28 SECTION("Checking speechTranscription_nwc_yarp device")
29 {
34
36 {
38 pnws_cfg.put("device", "speechTranscription_nws_yarp");
39 pnws_cfg.put("name", "/speechTranscription_nws_yarp");
41
43 pdev_cfg.put("device", "fakeSpeechTranscription");
45
48 bool result_att = ww_nws->attach(&ddfake);
50
52 pclient_cfg.put("device", "speechTranscription_nwc_yarp");
53 pclient_cfg.put("local", "/speechTranscription_nwc_yarp");
54 pclient_cfg.put("remote", "/speechTranscription_nws_yarp");
57
58 REQUIRE(ddnwc.view(iSpeech));
59 }
60
62
63 CHECK (iSpeech->setLanguage("ita"));
64 std::string lang;
65 CHECK( iSpeech->getLanguage(lang));
66 CHECK(lang == "ita");
67
69 std::string text;
70 double score;
71 s.resize(100, 2);
72 CHECK(iSpeech->transcribe(s,text,score));
73 CHECK(text == "hello world");
74 CHECK(score == 1);
75
77 CHECK(!iSpeech->transcribe(s2,text,score));
78
79 //"Close all polydrivers and check"
80 {
81 CHECK(ddnwc.close());
82 CHECK(ddnws.close());
84 }
85 }
86
87 Network::setLocalMode(false);
88}
A generic interface for speech transcription.
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
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:32
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition Sound.h:39
void resize(size_t samples, size_t channels=1)
Set the sound size.
Definition Sound.cpp:267
void exec_params_test(yarp::dev::PolyDriver *pdrv)
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.
TEST_CASE("dev::speechTranscription_nwc_yarp", "[yarp::dev]")