Nlp Automl SDK.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2019-11-15 Version 1.36.183
|
||||
- Nlp Automl SDK.
|
||||
|
||||
2019-11-15 Version 1.36.182
|
||||
- Sync cdn APIs.
|
||||
|
||||
|
||||
90
nlp-automl/CMakeLists.txt
Normal file
90
nlp-automl/CMakeLists.txt
Normal file
@@ -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}
|
||||
)
|
||||
@@ -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 <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#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<Error, Model::GetPredictResultResult> GetPredictResultOutcome;
|
||||
typedef std::future<GetPredictResultOutcome> GetPredictResultOutcomeCallable;
|
||||
typedef std::function<void(const Nlp_automlClient*, const Model::GetPredictResultRequest&, const GetPredictResultOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetPredictResultAsyncHandler;
|
||||
typedef Outcome<Error, Model::RunContactReviewResult> RunContactReviewOutcome;
|
||||
typedef std::future<RunContactReviewOutcome> RunContactReviewOutcomeCallable;
|
||||
typedef std::function<void(const Nlp_automlClient*, const Model::RunContactReviewRequest&, const RunContactReviewOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RunContactReviewAsyncHandler;
|
||||
|
||||
Nlp_automlClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
Nlp_automlClient(const std::shared_ptr<CredentialsProvider> &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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
|
||||
RunContactReviewOutcomeCallable runContactReviewCallable(const Model::RunContactReviewRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_NLP_AUTOML_NLP_AUTOMLCLIENT_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 <alibabacloud/core/Global.h>
|
||||
|
||||
#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_
|
||||
@@ -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 <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
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_
|
||||
@@ -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 <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
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_
|
||||
@@ -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 <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
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_
|
||||
@@ -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 <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
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<std::string> value;
|
||||
std::string modificationSuggestion;
|
||||
std::string riskLevel;
|
||||
std::string reason;
|
||||
std::vector<std::string> startPosition;
|
||||
std::vector<std::string> endPosition;
|
||||
};
|
||||
struct StructureResult
|
||||
{
|
||||
std::vector<std::string> startPosition3;
|
||||
std::string type;
|
||||
std::vector<std::string> endPosition2;
|
||||
std::vector<std::string> value1;
|
||||
std::string name;
|
||||
};
|
||||
std::vector<StructureResult> structureResults;
|
||||
std::vector<ReviewResult> 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_
|
||||
125
nlp-automl/src/Nlp-automlClient.cc
Normal file
125
nlp-automl/src/Nlp-automlClient.cc
Normal file
@@ -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 <alibabacloud/nlp-automl/Nlp_automlClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
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<SimpleCredentialsProvider>(credentials), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "nlpautoml");
|
||||
}
|
||||
|
||||
Nlp_automlClient::Nlp_automlClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(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<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(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<const AsyncCallerContext>& 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<std::packaged_task<GetPredictResultOutcome()>>(
|
||||
[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<const AsyncCallerContext>& 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<std::packaged_task<RunContactReviewOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->runContactReview(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
84
nlp-automl/src/model/GetPredictResultRequest.cc
Normal file
84
nlp-automl/src/model/GetPredictResultRequest.cc
Normal file
@@ -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 <alibabacloud/nlp-automl/model/GetPredictResultRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
72
nlp-automl/src/model/GetPredictResultResult.cc
Normal file
72
nlp-automl/src/model/GetPredictResultResult.cc
Normal file
@@ -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 <alibabacloud/nlp-automl/model/GetPredictResultResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
51
nlp-automl/src/model/RunContactReviewRequest.cc
Normal file
51
nlp-automl/src/model/RunContactReviewRequest.cc
Normal file
@@ -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 <alibabacloud/nlp-automl/model/RunContactReviewRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
92
nlp-automl/src/model/RunContactReviewResult.cc
Normal file
92
nlp-automl/src/model/RunContactReviewResult.cc
Normal file
@@ -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 <alibabacloud/nlp-automl/model/RunContactReviewResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user