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
11#include <catch2/catch_amalgamated.hpp>
12#include <harness.h>
13
14#include <yarp/sig/Sound.h>
15
16using namespace yarp::dev;
17using namespace yarp::os;
18
19TEST_CASE("dev::speechTranscription_nwc_yarp", "[yarp::dev]")
20{
21 YARP_REQUIRE_PLUGIN("fakeSpeechTranscription", "device");
22 YARP_REQUIRE_PLUGIN("speechTranscription_nws_yarp", "device");
23 YARP_REQUIRE_PLUGIN("speechTranscription_nwc_yarp", "device");
24
25 Network::setLocalMode(true);
26
27 SECTION("Checking speechTranscription_nwc_yarp device")
28 {
33
35 {
37 pnws_cfg.put("device", "speechTranscription_nws_yarp");
38 pnws_cfg.put("name", "/speechTranscription_nws_yarp");
40
42 pdev_cfg.put("device", "fakeSpeechTranscription");
44
47 bool result_att = ww_nws->attach(&ddfake);
49
51 pclient_cfg.put("device", "speechTranscription_nwc_yarp");
52 pclient_cfg.put("local", "/speechTranscription_nwc_yarp");
53 pclient_cfg.put("remote", "/speechTranscription_nws_yarp");
55 REQUIRE(ddnwc.view(iSpeech));
56 }
57
59
60 CHECK (iSpeech->setLanguage("ita"));
61 std::string lang;
62 CHECK( iSpeech->getLanguage(lang));
63 CHECK(lang == "ita");
64
66 std::string text;
67 double score;
68 s.resize(100, 2);
69 CHECK(iSpeech->transcribe(s,text,score));
70 CHECK(text == "hello world");
71 CHECK(score == 1);
72
74 CHECK(!iSpeech->transcribe(s2,text,score));
75
76 //"Close all polydrivers and check"
77 {
78 CHECK(ddnwc.close());
79 CHECK(ddnws.close());
81 }
82 }
83
84 Network::setLocalMode(false);
85}
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: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
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]")