The purchase decision analysis service for product reviews in the automotive realm helps you analyze purchase decision information, such as user motivations, usage scenarios, feature requests, and questions. This analysis can help you improve products, enhance the user experience, segment user profiles, and conduct targeted marketing. If the currently supported realms and industries do not meet your needs, you can join the NLP Self-Learning Platform Q&A DingTalk group (Group ID: 44619071) to discuss collaboration.
This service is provided by the NLP Self-Learning Platform. You can use this service by directly calling the API.
Service activation and resource plan purchase
Before you start, ensure that the service is activated. After activation, you can purchase a resource plan.
Activate service: Activation page
Purchase resource plan: Purchase page
Service invocation and testing
For information about how to call the model, see Model invocation.
For software development kit (SDK) examples, see SDK examples.
Debugging
Configure access credentials (AK/SK) using environment variables
Notes:
An AccessKey that belongs to an Alibaba Cloud account has full access permissions for all APIs. This poses a high security threat. We strongly recommend that you create and use a Resource Access Management (RAM) user to make API calls or perform routine operations and maintenance (O&M). To create a RAM user, you can log on to the RAM console.
We strongly recommend that you do not hard-code your AccessKey ID and AccessKey secret in your code. This can lead to security threats if the keys are leaked. Instead, you can configure environment variables to store and access your AccessKey pair.
Configure on Linux and macOS
export NLP_AK_ENV=<access_key_id> export NLP_SK_ENV=<access_key_secret>Replace <access_key_id> with your AccessKey ID and <access_key_secret> with your AccessKey secret. For information about how to obtain an AccessKey ID and an AccessKey secret, see Step 2: Obtain an AccessKey for an account.
Configure on Windows
Create a file for environment variables. Add the
NLP_AK_ENVandNLP_SK_ENVenvironment variables. Then, set these variables to your AccessKey ID and AccessKey secret.Restart your Windows system.
Java code example
/**
* An AccessKey of an Alibaba Cloud account has full access permissions to all APIs. This poses a high security threat. We strongly recommend that you create and use a RAM user to make API calls or perform routine O&M. To create a RAM user, log on to the RAM console.
* This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
* We strongly recommend that you do not hard-code your AccessKey ID and AccessKey secret into your code. This can lead to security threats if the keys are leaked.
*/
String accessKeyId = System.getenv("NLP_AK_ENV");
String accessKeySecret = System.getenv("NLP_SK_ENV");
DefaultProfile defaultProfile = DefaultProfile.getProfile("cn-hangzhou",accessKeyId,accessKeySecret);
IAcsClient client = new DefaultAcsClient(defaultProfile);
RunPreTrainServiceRequest request = new RunPreTrainServiceRequest();
request.setServiceName("NLP_ner_pretrained_review_multidim_car");
request.setPredictContent("The interior workmanship and materials are a bit stiff, and the details need improvement. It has an interface for a child safety seat. It's a pity that the grab handles are not configured.");
RunPreTrainServiceResponse response = client.getAcsResponse(request);
System.out.println(response.getPredictResult());Python code example
# Install dependencies
pip install aliyun-python-sdk-core
pip install aliyun-python-sdk-nlp-automl# -*- coding: utf8 -*-
import json
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdknlp_automl.request.v20191111 import RunPreTrainServiceRequest
# An AccessKey of an Alibaba Cloud account has full access permissions to all APIs. This poses a high security threat. We strongly recommend that you create and use a RAM user to make API calls or perform routine O&M. To create a RAM user, log on to the RAM console.
# This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
# We strongly recommend that you do not hard-code your AccessKey ID and AccessKey secret into your code. This can lead to security threats if the keys are leaked.
access_key_id = os.environ['NLP_AK_ENV']
access_key_secret = os.environ['NLP_SK_ENV']
# Initialize AcsClient instance
client = AcsClient(
access_key_id,
access_key_secret,
"cn-hangzhou"
);
content = 'The interior workmanship and materials are a bit stiff, and the details need improvement. It has an interface for a child safety seat. It\'s a pity that the grab handles are not configured.'
# Initialize a request and set parameters
request = RunPreTrainServiceRequest.RunPreTrainServiceRequest()
request.set_ServiceName('NLP_ner_pretrained_review_multidim_car')
request.set_PredictContent(content)
# Print the response
response = client.do_action_with_exception(request)
resp_obj = json.loads(response)
predict_result = json.loads(resp_obj['PredictResult'])
print(json.dumps(predict_result['data'],ensure_ascii=False))Request parameters
Parameter | Description | Example |
ServiceName | The service name. This parameter is required. | NLP_ner_pretrained_review_multidim_car |
PredictContent | The content of the product review. This parameter is required. | The interior workmanship and materials are a bit stiff, and the details need improvement. It has an interface for a child safety seat. It's a pity that the grab handles are not configured. |
Example of PredictResult content
{
"records": {
"User expectation/suggestion": [
{
"prob": 1.0,
"offset": [9, 17],
"span": "details need improvement"
}
],
"Feature request": [
{
"prob": 1.0,
"offset": [27, 41],
"span": "grab handles are not configured, what a pity"
}
]
},
"content": "The interior workmanship and materials are a bit stiff, and the details need improvement. It has an interface for a child safety seat. It's a pity that the grab handles are not configured."
}Response parameters
Field | Description | Example |
content | The user input. | |
records | The set of labels extracted by the algorithm. This is a dictionary where the key is the label name and the value is the extracted information. | |
span | The segment extracted from the user input. | child |
offset | The start (inclusive) and end (exclusive) positions of the extracted segment in the user input. | [0, 2] |
prob | The confidence level. This is a probability value between 0 and 1. | 0.9865950644016266 |
List of supported purchase decision labels
Label | Description | Example |
Functional requirements | The user expects the product to meet more needs or provide more features. | Can the cup holder in the car be made a little bigger? |
User expectation/suggestion | It would be great if it had a panoramic camera. | |
Purchase motivation^Audience | A Qixi Festival gift for my wife. | |
Purchase motivation^Holiday | Birthday gift. | |
Purchase motivation^Scenario | ||
Purchase motivation^Other | I've always wanted to buy one. | |
Comparison | Comparisons between products, purchase channels, and so on. | |
First-time purchase | The user is purchasing for the first time. | This is the first time I've bought a Wuling. |
Will repurchase | ||
Will not repurchase | ||
Usage scenario | Bought it for long-distance driving. | |
Will recommend | I recommend buying it. | |
Will not recommend | Not recommended. | |
Will post a follow-up review | I'll add a follow-up review later. | |
Usage status^Used | I've been driving it for 7 months. | |
Usage status^Not used | Haven't driven it yet. | |
Question about usage | Something the user has a question about. | I don't know the reasoning behind this design. |
Target audience | Extracts only the object entity. | An [experienced driver] might comment on the power, but for a [novice] like me, it's more than enough. |
Brand impression | This brand's cars are very bad. | |
Purchase channel | ||
User approval | The user's approval of the merchant. | |
Service promise - Not met | A promise made by the merchant was not fulfilled for the user. | They promised to write a greeting card, but they didn't. They promised a gift, but I didn't receive one. |
Fuel consumption | Refers to text that contains fuel consumption figures, such as 'fuel consumption is about 10' or '11.5 in the city'. | |
Novice | As a novice, I didn't notice. | |
Experienced driver | Even for an experienced driver like me, I have to be gentle on the pedals. |