Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the setting of the language in googleDialog #28

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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