Browse Source

Nlp Automl SDK.

sdk-team 6 years ago
parent
commit
2863a2c99a

+ 3 - 0
ChangeLog.txt

@@ -1,3 +1,6 @@
+2019-11-15 Version: 1.60.248
+- Nlp Automl SDK.
+
 2019-11-15 Version: 1.60.247
 - Support tags.
 - Support create pre paid alikafka instance.

+ 129 - 0
services/nlp_automl/client.go

@@ -0,0 +1,129 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"reflect"
+
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider"
+)
+
+// Client is the sdk client struct, each func corresponds to an OpenAPI
+type Client struct {
+	sdk.Client
+}
+
+// SetClientProperty Set Property by Reflect
+func SetClientProperty(client *Client, propertyName string, propertyValue interface{}) {
+	v := reflect.ValueOf(client).Elem()
+	if v.FieldByName(propertyName).IsValid() && v.FieldByName(propertyName).CanSet() {
+		v.FieldByName(propertyName).Set(reflect.ValueOf(propertyValue))
+	}
+}
+
+// SetEndpointDataToClient Set EndpointMap and ENdpointType
+func SetEndpointDataToClient(client *Client) {
+	SetClientProperty(client, "EndpointMap", GetEndpointMap())
+	SetClientProperty(client, "EndpointType", GetEndpointType())
+}
+
+// NewClient creates a sdk client with environment variables
+func NewClient() (client *Client, err error) {
+	client = &Client{}
+	err = client.Init()
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithProvider creates a sdk client with providers
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) {
+	client = &Client{}
+	var pc provider.Provider
+	if len(providers) == 0 {
+		pc = provider.DefaultChain
+	} else {
+		pc = provider.NewProviderChain(providers)
+	}
+	err = client.InitWithProviderChain(regionId, pc)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential
+// this is the common api to create a sdk client
+func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithOptions(regionId, config, credential)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithAccessKey is a shortcut to create sdk client with accesskey
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithAccessKey(regionId, accessKeyId, accessKeySecret)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithStsToken is a shortcut to create sdk client with sts token
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn and policy
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithEcsRamRole(regionId, roleName)
+	SetEndpointDataToClient(client)
+	return
+}
+
+// NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair
+// usage: https://github.com/aliyun/alibaba-cloud-sdk-go/blob/master/docs/2-Client-EN.md
+func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error) {
+	client = &Client{}
+	err = client.InitWithRsaKeyPair(regionId, publicKeyId, privateKey, sessionExpiration)
+	SetEndpointDataToClient(client)
+	return
+}

+ 20 - 0
services/nlp_automl/endpoint.go

@@ -0,0 +1,20 @@
+package nlp_automl
+
+// EndpointMap Endpoint Data
+var EndpointMap map[string]string
+
+// EndpointType regional or central
+var EndpointType = "regional"
+
+// GetEndpointMap Get Endpoint Data Map
+func GetEndpointMap() map[string]string {
+	if EndpointMap == nil {
+		EndpointMap = map[string]string{}
+	}
+	return EndpointMap
+}
+
+// GetEndpointType Get Endpoint Type Value
+func GetEndpointType() string {
+	return EndpointType
+}

+ 111 - 0
services/nlp_automl/get_predict_result.go

@@ -0,0 +1,111 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// GetPredictResult invokes the nlp_automl.GetPredictResult API synchronously
+// api document: https://help.aliyun.com/api/nlp-automl/getpredictresult.html
+func (client *Client) GetPredictResult(request *GetPredictResultRequest) (response *GetPredictResultResponse, err error) {
+	response = CreateGetPredictResultResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// GetPredictResultWithChan invokes the nlp_automl.GetPredictResult API asynchronously
+// api document: https://help.aliyun.com/api/nlp-automl/getpredictresult.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetPredictResultWithChan(request *GetPredictResultRequest) (<-chan *GetPredictResultResponse, <-chan error) {
+	responseChan := make(chan *GetPredictResultResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.GetPredictResult(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// GetPredictResultWithCallback invokes the nlp_automl.GetPredictResult API asynchronously
+// api document: https://help.aliyun.com/api/nlp-automl/getpredictresult.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) GetPredictResultWithCallback(request *GetPredictResultRequest, callback func(response *GetPredictResultResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *GetPredictResultResponse
+		var err error
+		defer close(result)
+		response, err = client.GetPredictResult(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// GetPredictResultRequest is the request struct for api GetPredictResult
+type GetPredictResultRequest struct {
+	*requests.RpcRequest
+	TopK         requests.Integer `position:"Body" name:"TopK"`
+	ModelId      requests.Integer `position:"Body" name:"ModelId"`
+	DetailTag    string           `position:"Body" name:"DetailTag"`
+	Content      string           `position:"Body" name:"Content"`
+	ModelVersion string           `position:"Body" name:"ModelVersion"`
+}
+
+// GetPredictResultResponse is the response struct for api GetPredictResult
+type GetPredictResultResponse struct {
+	*responses.BaseResponse
+	RequestId string `json:"RequestId" xml:"RequestId"`
+	Content   string `json:"Content" xml:"Content"`
+	Code      int    `json:"Code" xml:"Code"`
+	Message   string `json:"Message" xml:"Message"`
+	Success   bool   `json:"Success" xml:"Success"`
+}
+
+// CreateGetPredictResultRequest creates a request to invoke GetPredictResult API
+func CreateGetPredictResultRequest() (request *GetPredictResultRequest) {
+	request = &GetPredictResultRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("nlp-automl", "2019-11-11", "GetPredictResult", "nlpautoml", "openAPI")
+	return
+}
+
+// CreateGetPredictResultResponse creates a response to parse from GetPredictResult response
+func CreateGetPredictResultResponse() (response *GetPredictResultResponse) {
+	response = &GetPredictResultResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 105 - 0
services/nlp_automl/run_contact_review.go

@@ -0,0 +1,105 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
+	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
+)
+
+// RunContactReview invokes the nlp_automl.RunContactReview API synchronously
+// api document: https://help.aliyun.com/api/nlp-automl/runcontactreview.html
+func (client *Client) RunContactReview(request *RunContactReviewRequest) (response *RunContactReviewResponse, err error) {
+	response = CreateRunContactReviewResponse()
+	err = client.DoAction(request, response)
+	return
+}
+
+// RunContactReviewWithChan invokes the nlp_automl.RunContactReview API asynchronously
+// api document: https://help.aliyun.com/api/nlp-automl/runcontactreview.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) RunContactReviewWithChan(request *RunContactReviewRequest) (<-chan *RunContactReviewResponse, <-chan error) {
+	responseChan := make(chan *RunContactReviewResponse, 1)
+	errChan := make(chan error, 1)
+	err := client.AddAsyncTask(func() {
+		defer close(responseChan)
+		defer close(errChan)
+		response, err := client.RunContactReview(request)
+		if err != nil {
+			errChan <- err
+		} else {
+			responseChan <- response
+		}
+	})
+	if err != nil {
+		errChan <- err
+		close(responseChan)
+		close(errChan)
+	}
+	return responseChan, errChan
+}
+
+// RunContactReviewWithCallback invokes the nlp_automl.RunContactReview API asynchronously
+// api document: https://help.aliyun.com/api/nlp-automl/runcontactreview.html
+// asynchronous document: https://help.aliyun.com/document_detail/66220.html
+func (client *Client) RunContactReviewWithCallback(request *RunContactReviewRequest, callback func(response *RunContactReviewResponse, err error)) <-chan int {
+	result := make(chan int, 1)
+	err := client.AddAsyncTask(func() {
+		var response *RunContactReviewResponse
+		var err error
+		defer close(result)
+		response, err = client.RunContactReview(request)
+		callback(response, err)
+		result <- 1
+	})
+	if err != nil {
+		defer close(result)
+		callback(nil, err)
+		result <- 0
+	}
+	return result
+}
+
+// RunContactReviewRequest is the request struct for api RunContactReview
+type RunContactReviewRequest struct {
+	*requests.RpcRequest
+	ContactScene string `position:"Body" name:"ContactScene"`
+	ContactPath  string `position:"Body" name:"ContactPath"`
+}
+
+// RunContactReviewResponse is the response struct for api RunContactReview
+type RunContactReviewResponse struct {
+	*responses.BaseResponse
+	RequestId      string         `json:"RequestId" xml:"RequestId"`
+	ContactContent ContactContent `json:"ContactContent" xml:"ContactContent"`
+}
+
+// CreateRunContactReviewRequest creates a request to invoke RunContactReview API
+func CreateRunContactReviewRequest() (request *RunContactReviewRequest) {
+	request = &RunContactReviewRequest{
+		RpcRequest: &requests.RpcRequest{},
+	}
+	request.InitWithApiInfo("nlp-automl", "2019-11-11", "RunContactReview", "nlpautoml", "openAPI")
+	return
+}
+
+// CreateRunContactReviewResponse creates a response to parse from RunContactReview response
+func CreateRunContactReviewResponse() (response *RunContactReviewResponse) {
+	response = &RunContactReviewResponse{
+		BaseResponse: &responses.BaseResponse{},
+	}
+	return
+}

+ 22 - 0
services/nlp_automl/struct_contact_content.go

@@ -0,0 +1,22 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// ContactContent is a nested struct in nlp_automl response
+type ContactContent struct {
+	ReviewResults    []ReviewResult    `json:"ReviewResults" xml:"ReviewResults"`
+	StructureResults []StructureResult `json:"StructureResults" xml:"StructureResults"`
+}

+ 21 - 0
services/nlp_automl/struct_end_position_in_run_contact_review.go

@@ -0,0 +1,21 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// EndPositionInRunContactReview is a nested struct in nlp_automl response
+type EndPositionInRunContactReview struct {
+	EndPosition []string `json:"EndPosition" xml:"EndPosition"`
+}

+ 27 - 0
services/nlp_automl/struct_review_result.go

@@ -0,0 +1,27 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// ReviewResult is a nested struct in nlp_automl response
+type ReviewResult struct {
+	RiskLevel              string   `json:"RiskLevel" xml:"RiskLevel"`
+	Reason                 string   `json:"Reason" xml:"Reason"`
+	Type                   string   `json:"Type" xml:"Type"`
+	ModificationSuggestion string   `json:"ModificationSuggestion" xml:"ModificationSuggestion"`
+	Value                  []string `json:"Value" xml:"Value"`
+	EndPosition            []string `json:"EndPosition" xml:"EndPosition"`
+	StartPosition          []string `json:"StartPosition" xml:"StartPosition"`
+}

+ 21 - 0
services/nlp_automl/struct_review_results.go

@@ -0,0 +1,21 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// ReviewResults is a nested struct in nlp_automl response
+type ReviewResults struct {
+	ReviewResult []ReviewResult `json:"ReviewResult" xml:"ReviewResult"`
+}

+ 21 - 0
services/nlp_automl/struct_start_position_in_run_contact_review.go

@@ -0,0 +1,21 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// StartPositionInRunContactReview is a nested struct in nlp_automl response
+type StartPositionInRunContactReview struct {
+	StartPosition []string `json:"StartPosition" xml:"StartPosition"`
+}

+ 25 - 0
services/nlp_automl/struct_structure_result.go

@@ -0,0 +1,25 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// StructureResult is a nested struct in nlp_automl response
+type StructureResult struct {
+	Name          string   `json:"Name" xml:"Name"`
+	Type          string   `json:"Type" xml:"Type"`
+	Value         []string `json:"Value" xml:"Value"`
+	EndPosition   []string `json:"EndPosition" xml:"EndPosition"`
+	StartPosition []string `json:"StartPosition" xml:"StartPosition"`
+}

+ 21 - 0
services/nlp_automl/struct_structure_results.go

@@ -0,0 +1,21 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// StructureResults is a nested struct in nlp_automl response
+type StructureResults struct {
+	StructureResult []StructureResult `json:"StructureResult" xml:"StructureResult"`
+}

+ 21 - 0
services/nlp_automl/struct_value_in_run_contact_review.go

@@ -0,0 +1,21 @@
+package nlp_automl
+
+//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.
+//
+// Code generated by Alibaba Cloud SDK Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// ValueInRunContactReview is a nested struct in nlp_automl response
+type ValueInRunContactReview struct {
+	Value []string `json:"Value" xml:"Value"`
+}