Skip to content

Commit

Permalink
Merge pull request #28 from robotology/fix-language-googleDialog
Browse files Browse the repository at this point in the history
Fixed the setting of the language in googleDialog
  • Loading branch information
lauracavaliere authored Oct 15, 2020
2 parents 186f5ca + 34cf239 commit 8665e67
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions speechInteraction/modules/googleDialog/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,20 @@ class Processing : public yarp::os::BufferedPort<yarp::os::Bottle>
std::string moduleName;
std::string session_id;
std::string project_id;
std::string language_code;
yarp::os::RpcServer handlerPort;
yarp::os::BufferedPort<yarp::os::Bottle> targetPort;

public:
/********************************************************/

Processing( const std::string &moduleName, const std::string project_id)
Processing( const std::string &moduleName, const std::string project_id, const std::string language_code)
{
this->moduleName = moduleName;
this->session_id = getRandSession();
this->project_id = project_id;
this->language_code = language_code;

}

/********************************************************/
Expand Down Expand Up @@ -126,7 +129,7 @@ class Processing : public yarp::os::BufferedPort<yarp::os::Bottle>
google::cloud::dialogflow::cx::v3beta1::TextInput text_input;
google::cloud::dialogflow::cx::v3beta1::QueryInput query_input;

std::string language_code = "en-English";
//std::string language_code = "en-English";
text_input.set_text(text.c_str());
query_input.set_allocated_text(&text_input);
query_input.set_language_code(language_code);
Expand Down Expand Up @@ -206,17 +209,19 @@ class Module : public yarp::os::RFModule, public googleDialog_IDL
this->rf=&rf;
std::string moduleName = rf.check("name", yarp::os::Value("googleDialog"), "module name (string)").asString();
std::string project_id = rf.check("project", yarp::os::Value("1"), "id of the project").asString();
std::string language_code = rf.check("language", yarp::os::Value("en-US"), "language of the dialogflow").asString();

yDebug() << "this is the project" << rf.check("project");
yDebug() << "Module name" << moduleName;
yDebug() << "project id" << project_id;
yDebug() << "language of the dialog" << language_code;
setName(moduleName.c_str());

rpcPort.open(("/"+getName("/rpc")).c_str());

closing = false;

processing = new Processing( moduleName, project_id );
processing = new Processing( moduleName, project_id, language_code);

/* now start the thread to do the work */
processing->open();
Expand Down

0 comments on commit 8665e67

Please sign in to comment.