diff --git a/CHANGELOG b/CHANGELOG index 116efa50d..5e3e3cb7b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2019-11-15 Version 1.36.183 +- Nlp Automl SDK. + 2019-11-15 Version 1.36.182 - Sync cdn APIs. diff --git a/VERSION b/VERSION index 8af1be87a..80aab0d51 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.182 \ No newline at end of file +1.36.183 \ No newline at end of file diff --git a/nlp-automl/CMakeLists.txt b/nlp-automl/CMakeLists.txt new file mode 100644 index 000000000..c01942a62 --- /dev/null +++ b/nlp-automl/CMakeLists.txt @@ -0,0 +1,90 @@ +# +# Copyright 2009-2017 Alibaba Cloud All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(nlp-automl_public_header + include/alibabacloud/nlp-automl/Nlp_automlClient.h + include/alibabacloud/nlp-automl/Nlp_automlExport.h ) + +set(nlp-automl_public_header_model + include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h + include/alibabacloud/nlp-automl/model/GetPredictResultResult.h + include/alibabacloud/nlp-automl/model/RunContactReviewRequest.h + include/alibabacloud/nlp-automl/model/RunContactReviewResult.h ) + +set(nlp-automl_src + src/Nlp-automlClient.cc + src/model/GetPredictResultRequest.cc + src/model/GetPredictResultResult.cc + src/model/RunContactReviewRequest.cc + src/model/RunContactReviewResult.cc ) + +add_library(nlp-automl ${LIB_TYPE} + ${nlp-automl_public_header} + ${nlp-automl_public_header_model} + ${nlp-automl_src}) + +set_target_properties(nlp-automl + PROPERTIES + LINKER_LANGUAGE CXX + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}nlp-automl + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(nlp-automl + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_NLP_AUTOML_LIBRARY) +endif() + +target_include_directories(nlp-automl + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(nlp-automl + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(nlp-automl + jsoncpp) + target_include_directories(nlp-automl + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(nlp-automl + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(nlp-automl + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(nlp-automl + PRIVATE /usr/include/jsoncpp) + target_link_libraries(nlp-automl + jsoncpp) +endif() + +install(FILES ${nlp-automl_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/nlp-automl) +install(FILES ${nlp-automl_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/nlp-automl/model) +install(TARGETS nlp-automl + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h new file mode 100644 index 000000000..10b92c51b --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_NLP_AUTOMLCLIENT_H_ +#define ALIBABACLOUD_NLP_AUTOML_NLP_AUTOMLCLIENT_H_ + +#include +#include +#include +#include +#include "Nlp_automlExport.h" +#include "model/GetPredictResultRequest.h" +#include "model/GetPredictResultResult.h" +#include "model/RunContactReviewRequest.h" +#include "model/RunContactReviewResult.h" + + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT Nlp_automlClient : public RpcServiceClient + { + public: + typedef Outcome GetPredictResultOutcome; + typedef std::future GetPredictResultOutcomeCallable; + typedef std::function&)> GetPredictResultAsyncHandler; + typedef Outcome RunContactReviewOutcome; + typedef std::future RunContactReviewOutcomeCallable; + typedef std::function&)> RunContactReviewAsyncHandler; + + Nlp_automlClient(const Credentials &credentials, const ClientConfiguration &configuration); + Nlp_automlClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + Nlp_automlClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~Nlp_automlClient(); + GetPredictResultOutcome getPredictResult(const Model::GetPredictResultRequest &request)const; + void getPredictResultAsync(const Model::GetPredictResultRequest& request, const GetPredictResultAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetPredictResultOutcomeCallable getPredictResultCallable(const Model::GetPredictResultRequest& request) const; + RunContactReviewOutcome runContactReview(const Model::RunContactReviewRequest &request)const; + void runContactReviewAsync(const Model::RunContactReviewRequest& request, const RunContactReviewAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RunContactReviewOutcomeCallable runContactReviewCallable(const Model::RunContactReviewRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_NLP_AUTOML_NLP_AUTOMLCLIENT_H_ diff --git a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlExport.h b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlExport.h new file mode 100644 index 000000000..7c1f78057 --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlExport.h @@ -0,0 +1,32 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_NLP_AUTOMLEXPORT_H_ +#define ALIBABACLOUD_NLP_AUTOML_NLP_AUTOMLEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_NLP_AUTOML_LIBRARY) +# define ALIBABACLOUD_NLP_AUTOML_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_NLP_AUTOML_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_NLP_AUTOML_EXPORT +#endif + +#endif // !ALIBABACLOUD_NLP_AUTOML_NLP_AUTOMLEXPORT_H_ \ No newline at end of file diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h new file mode 100644 index 000000000..02bc57a01 --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h @@ -0,0 +1,60 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTREQUEST_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + namespace Model + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT GetPredictResultRequest : public RpcServiceRequest + { + + public: + GetPredictResultRequest(); + ~GetPredictResultRequest(); + + int getTopK()const; + void setTopK(int topK); + int getModelId()const; + void setModelId(int modelId); + std::string getDetailTag()const; + void setDetailTag(const std::string& detailTag); + std::string getContent()const; + void setContent(const std::string& content); + std::string getModelVersion()const; + void setModelVersion(const std::string& modelVersion); + + private: + int topK_; + int modelId_; + std::string detailTag_; + std::string content_; + std::string modelVersion_; + + }; + } + } +} +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTREQUEST_H_ \ No newline at end of file diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultResult.h b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultResult.h new file mode 100644 index 000000000..64ade7b2a --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/GetPredictResultResult.h @@ -0,0 +1,57 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTRESULT_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + namespace Model + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT GetPredictResultResult : public ServiceResult + { + public: + + + GetPredictResultResult(); + explicit GetPredictResultResult(const std::string &payload); + ~GetPredictResultResult(); + std::string getMessage()const; + std::string getContent()const; + int getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::string content_; + int code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_GETPREDICTRESULTRESULT_H_ \ No newline at end of file diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/RunContactReviewRequest.h b/nlp-automl/include/alibabacloud/nlp-automl/model/RunContactReviewRequest.h new file mode 100644 index 000000000..afd055fe4 --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/RunContactReviewRequest.h @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_MODEL_RUNCONTACTREVIEWREQUEST_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_RUNCONTACTREVIEWREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + namespace Model + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT RunContactReviewRequest : public RpcServiceRequest + { + + public: + RunContactReviewRequest(); + ~RunContactReviewRequest(); + + std::string getContactScene()const; + void setContactScene(const std::string& contactScene); + std::string getContactPath()const; + void setContactPath(const std::string& contactPath); + + private: + std::string contactScene_; + std::string contactPath_; + + }; + } + } +} +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_RUNCONTACTREVIEWREQUEST_H_ \ No newline at end of file diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/RunContactReviewResult.h b/nlp-automl/include/alibabacloud/nlp-automl/model/RunContactReviewResult.h new file mode 100644 index 000000000..2e81455ed --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/RunContactReviewResult.h @@ -0,0 +1,74 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_NLP_AUTOML_MODEL_RUNCONTACTREVIEWRESULT_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_RUNCONTACTREVIEWRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + namespace Model + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT RunContactReviewResult : public ServiceResult + { + public: + struct ContactContent + { + struct ReviewResult + { + std::string type; + std::vector value; + std::string modificationSuggestion; + std::string riskLevel; + std::string reason; + std::vector startPosition; + std::vector endPosition; + }; + struct StructureResult + { + std::vector startPosition3; + std::string type; + std::vector endPosition2; + std::vector value1; + std::string name; + }; + std::vector structureResults; + std::vector reviewResults; + }; + + + RunContactReviewResult(); + explicit RunContactReviewResult(const std::string &payload); + ~RunContactReviewResult(); + ContactContent getContactContent()const; + + protected: + void parse(const std::string &payload); + private: + ContactContent contactContent_; + + }; + } + } +} +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_RUNCONTACTREVIEWRESULT_H_ \ No newline at end of file diff --git a/nlp-automl/src/Nlp-automlClient.cc b/nlp-automl/src/Nlp-automlClient.cc new file mode 100644 index 000000000..9db9c56bf --- /dev/null +++ b/nlp-automl/src/Nlp-automlClient.cc @@ -0,0 +1,125 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud; +using namespace AlibabaCloud::Location; +using namespace AlibabaCloud::Nlp_automl; +using namespace AlibabaCloud::Nlp_automl::Model; + +namespace +{ + const std::string SERVICE_NAME = "nlp-automl"; +} + +Nlp_automlClient::Nlp_automlClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "nlpautoml"); +} + +Nlp_automlClient::Nlp_automlClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "nlpautoml"); +} + +Nlp_automlClient::Nlp_automlClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "nlpautoml"); +} + +Nlp_automlClient::~Nlp_automlClient() +{} + +Nlp_automlClient::GetPredictResultOutcome Nlp_automlClient::getPredictResult(const GetPredictResultRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetPredictResultOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetPredictResultOutcome(GetPredictResultResult(outcome.result())); + else + return GetPredictResultOutcome(outcome.error()); +} + +void Nlp_automlClient::getPredictResultAsync(const GetPredictResultRequest& request, const GetPredictResultAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getPredictResult(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Nlp_automlClient::GetPredictResultOutcomeCallable Nlp_automlClient::getPredictResultCallable(const GetPredictResultRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getPredictResult(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +Nlp_automlClient::RunContactReviewOutcome Nlp_automlClient::runContactReview(const RunContactReviewRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RunContactReviewOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RunContactReviewOutcome(RunContactReviewResult(outcome.result())); + else + return RunContactReviewOutcome(outcome.error()); +} + +void Nlp_automlClient::runContactReviewAsync(const RunContactReviewRequest& request, const RunContactReviewAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, runContactReview(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Nlp_automlClient::RunContactReviewOutcomeCallable Nlp_automlClient::runContactReviewCallable(const RunContactReviewRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->runContactReview(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/nlp-automl/src/model/GetPredictResultRequest.cc b/nlp-automl/src/model/GetPredictResultRequest.cc new file mode 100644 index 000000000..30df834de --- /dev/null +++ b/nlp-automl/src/model/GetPredictResultRequest.cc @@ -0,0 +1,84 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Nlp_automl::Model::GetPredictResultRequest; + +GetPredictResultRequest::GetPredictResultRequest() : + RpcServiceRequest("nlp-automl", "2019-11-11", "GetPredictResult") +{ + setMethod(HttpRequest::Method::Post); +} + +GetPredictResultRequest::~GetPredictResultRequest() +{} + +int GetPredictResultRequest::getTopK()const +{ + return topK_; +} + +void GetPredictResultRequest::setTopK(int topK) +{ + topK_ = topK; + setCoreParameter("TopK", std::to_string(topK)); +} + +int GetPredictResultRequest::getModelId()const +{ + return modelId_; +} + +void GetPredictResultRequest::setModelId(int modelId) +{ + modelId_ = modelId; + setCoreParameter("ModelId", std::to_string(modelId)); +} + +std::string GetPredictResultRequest::getDetailTag()const +{ + return detailTag_; +} + +void GetPredictResultRequest::setDetailTag(const std::string& detailTag) +{ + detailTag_ = detailTag; + setCoreParameter("DetailTag", detailTag); +} + +std::string GetPredictResultRequest::getContent()const +{ + return content_; +} + +void GetPredictResultRequest::setContent(const std::string& content) +{ + content_ = content; + setCoreParameter("Content", content); +} + +std::string GetPredictResultRequest::getModelVersion()const +{ + return modelVersion_; +} + +void GetPredictResultRequest::setModelVersion(const std::string& modelVersion) +{ + modelVersion_ = modelVersion; + setCoreParameter("ModelVersion", modelVersion); +} + diff --git a/nlp-automl/src/model/GetPredictResultResult.cc b/nlp-automl/src/model/GetPredictResultResult.cc new file mode 100644 index 000000000..0a84779e0 --- /dev/null +++ b/nlp-automl/src/model/GetPredictResultResult.cc @@ -0,0 +1,72 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Nlp_automl; +using namespace AlibabaCloud::Nlp_automl::Model; + +GetPredictResultResult::GetPredictResultResult() : + ServiceResult() +{} + +GetPredictResultResult::GetPredictResultResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetPredictResultResult::~GetPredictResultResult() +{} + +void GetPredictResultResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Content"].isNull()) + content_ = value["Content"].asString(); + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +std::string GetPredictResultResult::getMessage()const +{ + return message_; +} + +std::string GetPredictResultResult::getContent()const +{ + return content_; +} + +int GetPredictResultResult::getCode()const +{ + return code_; +} + +bool GetPredictResultResult::getSuccess()const +{ + return success_; +} + diff --git a/nlp-automl/src/model/RunContactReviewRequest.cc b/nlp-automl/src/model/RunContactReviewRequest.cc new file mode 100644 index 000000000..470f18712 --- /dev/null +++ b/nlp-automl/src/model/RunContactReviewRequest.cc @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Nlp_automl::Model::RunContactReviewRequest; + +RunContactReviewRequest::RunContactReviewRequest() : + RpcServiceRequest("nlp-automl", "2019-11-11", "RunContactReview") +{ + setMethod(HttpRequest::Method::Post); +} + +RunContactReviewRequest::~RunContactReviewRequest() +{} + +std::string RunContactReviewRequest::getContactScene()const +{ + return contactScene_; +} + +void RunContactReviewRequest::setContactScene(const std::string& contactScene) +{ + contactScene_ = contactScene; + setCoreParameter("ContactScene", contactScene); +} + +std::string RunContactReviewRequest::getContactPath()const +{ + return contactPath_; +} + +void RunContactReviewRequest::setContactPath(const std::string& contactPath) +{ + contactPath_ = contactPath; + setCoreParameter("ContactPath", contactPath); +} + diff --git a/nlp-automl/src/model/RunContactReviewResult.cc b/nlp-automl/src/model/RunContactReviewResult.cc new file mode 100644 index 000000000..96fd54e5f --- /dev/null +++ b/nlp-automl/src/model/RunContactReviewResult.cc @@ -0,0 +1,92 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Nlp_automl; +using namespace AlibabaCloud::Nlp_automl::Model; + +RunContactReviewResult::RunContactReviewResult() : + ServiceResult() +{} + +RunContactReviewResult::RunContactReviewResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RunContactReviewResult::~RunContactReviewResult() +{} + +void RunContactReviewResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto contactContentNode = value["ContactContent"]; + auto allReviewResultsNode = contactContentNode["ReviewResults"]["ReviewResult"]; + for (auto contactContentNodeReviewResultsReviewResult : allReviewResultsNode) + { + ContactContent::ReviewResult reviewResultObject; + if(!contactContentNodeReviewResultsReviewResult["RiskLevel"].isNull()) + reviewResultObject.riskLevel = contactContentNodeReviewResultsReviewResult["RiskLevel"].asString(); + if(!contactContentNodeReviewResultsReviewResult["Reason"].isNull()) + reviewResultObject.reason = contactContentNodeReviewResultsReviewResult["Reason"].asString(); + if(!contactContentNodeReviewResultsReviewResult["Type"].isNull()) + reviewResultObject.type = contactContentNodeReviewResultsReviewResult["Type"].asString(); + if(!contactContentNodeReviewResultsReviewResult["ModificationSuggestion"].isNull()) + reviewResultObject.modificationSuggestion = contactContentNodeReviewResultsReviewResult["ModificationSuggestion"].asString(); + auto allValue = value["Value"]["Value"]; + for (auto value : allValue) + reviewResultObject.value.push_back(value.asString()); + auto allEndPosition = value["EndPosition"]["EndPosition"]; + for (auto value : allEndPosition) + reviewResultObject.endPosition.push_back(value.asString()); + auto allStartPosition = value["StartPosition"]["StartPosition"]; + for (auto value : allStartPosition) + reviewResultObject.startPosition.push_back(value.asString()); + contactContent_.reviewResults.push_back(reviewResultObject); + } + auto allStructureResultsNode = contactContentNode["StructureResults"]["StructureResult"]; + for (auto contactContentNodeStructureResultsStructureResult : allStructureResultsNode) + { + ContactContent::StructureResult structureResultObject; + if(!contactContentNodeStructureResultsStructureResult["Name"].isNull()) + structureResultObject.name = contactContentNodeStructureResultsStructureResult["Name"].asString(); + if(!contactContentNodeStructureResultsStructureResult["Type"].isNull()) + structureResultObject.type = contactContentNodeStructureResultsStructureResult["Type"].asString(); + auto allValue1 = value["Value"]["Value"]; + for (auto value : allValue1) + structureResultObject.value1.push_back(value.asString()); + auto allEndPosition2 = value["EndPosition"]["EndPosition"]; + for (auto value : allEndPosition2) + structureResultObject.endPosition2.push_back(value.asString()); + auto allStartPosition3 = value["StartPosition"]["StartPosition"]; + for (auto value : allStartPosition3) + structureResultObject.startPosition3.push_back(value.asString()); + contactContent_.structureResults.push_back(structureResultObject); + } + +} + +RunContactReviewResult::ContactContent RunContactReviewResult::getContactContent()const +{ + return contactContent_; +} +