Best practices for mining VOC information and data analytics

Updated at:

This topic describes how to use Quanmiao - Enterprise VOC Mining and Xiyan GBI to mine Voice of the Customer (VOC) information and perform data analytics.

Goal

Tag large volumes of unstructured Voice of the Customer (VOC) data and organize it into structured data. You can then use ChatBI to perform real-time analysis of the tags. This process helps businesses gain comprehensive insights from VOC data.

image.png

Prerequisites


Install dependencies

  1. Obtain the latest version number of the Java software development kit (SDK) for Xiyan GBI and Quanmiao - Enterprise VOC Mining. For more information, see Java SDK.
  2. Open the pom.xml file of your Maven project.
  3. In the <dependencies> tag, add the following dependency information. Replace the version number in the <version></version> tag with the latest version.
  <dependency>
  <groupId>com.aliyun</groupId>
  <artifactId>alibabacloud-dataanalysisgbi20240823</artifactId>
  <version>1.0.0</version>
  </dependency>

  <groupId>com.aliyun</groupId>
  <artifactId>alibabacloud-aimiaobi20230801</artifactId>
  <version>Specify the latest version</version>
  </dependency>

  <dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <version>1.18.30</version>
  </dependency>

  <dependency>
  <groupId>com.alibaba.fastjson2</groupId>
  <artifactId>fastjson2</artifactId>
  <version>2.0.21</version>
  </dependency>

  <dependency>
  <groupId>org.junit.jupiter</groupId>
  <artifactId>junit-jupiter</artifactId>
  <version>5.8.1</version>
  </dependency>
  1. Save the pom.xml file.
  2. Update the project dependencies to add the SDK to your project.

Procedure

Step 1: Extract content tags using Quanmiao - Enterprise VOC Mining

Use an API of Quanmiao - Enterprise VOC Mining, such as the SubmitEnterpriseVocAnalysisTask API, to mine VOC data and extract tags from your existing ticket data. For more information, see Miaocai - Enterprise VOC Mining.

Replace accessKeyId, accessKeySecret, and workspaceId in the code sample with your actual values to ensure the code runs correctly and returns the expected results.

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
import com.aliyun.sdk.gateway.pop.Configuration;
import com.aliyun.sdk.gateway.pop.auth.SignatureVersion;
import com.aliyun.sdk.service.aimiaobi20230801.AsyncClient;
import com.aliyun.sdk.service.aimiaobi20230801.models.*;
import darabonba.core.client.ClientOverrideConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

/**
 * Enterprise VOC Mining API Example
 * Prerequisites
 * ```xml
 * <groupId>com.aliyun</groupId>
 * <artifactId>alibabacloud-aimiaobi20230801</artifactId>
 * <version>Specify the latest version</version>
 * </dependency>
 *
 * <dependency>
 * <groupId>org.projectlombok</groupId>
 * <artifactId>lombok</artifactId>
 * <version>1.18.30</version>
 * </dependency>
 *
 * <dependency>
 * <groupId>com.alibaba.fastjson2</groupId>
 * <artifactId>fastjson2</artifactId>
 * <version>2.0.21</version>
 * </dependency>
 *
 * <dependency>
 * <groupId>org.junit.jupiter</groupId>
 * <artifactId>junit-jupiter</artifactId>
 * <version>5.8.1</version>
 * </dependency>
 * <p>
 * ```
 */
@Slf4j
public class EnterpriseVocTest {

    /**
     * JSON parameter
     */
    private String jsonParam = "{\"MaterialType\":\"dialogue\",\"ModelId\":\"qwen-max\",\"TaskType\":\"lightAppSass\",\"ContentTags\":[{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Product Feedback-Product Name\",\"TagTaskType\":\"singleTagValue\",\"TagDefinePrompt\":\"The main name of the product mentioned in the customer feedback\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Product Feedback-Product Strengths\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"Mine the data to find points that users are satisfied with and approve of, which are the product's strengths according to users\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Product Feedback-Product Weaknesses\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"Mine the data to find points that users are dissatisfied with, which are the product's weaknesses according to users\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Product Feedback-User Expectations and Suggestions\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"Collect user expectations and suggestions for the product from the data. For example, users might want new features.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Product Feedback-Design and Appearance\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"User feedback on the product's appearance. Appearance includes but is not limited to design style, color, dimensions, and size.\"},{\"TagValueDefinePrompt\":\"Positive,Neutral,Negative\",\"TagName\":\"Product Feedback-User Sentiment\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"The user's overall sentiment towards the product. For example, if a user feels the product is bad and will not buy it again, the sentiment is negative.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Service Evaluation-Pre-sales Service\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"User satisfaction with pre-sales services such as consultations and introductions. For example, feedback on the professionalism and attitude of sales staff.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Service Evaluation-After-sales Service\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"User satisfaction with after-sales services such as repairs, returns, exchanges, and consultations.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Service Evaluation-Logistics and Delivery\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"User feedback on aspects like delivery speed and packaging integrity. For example, users might comment on delivery times or whether the packaging was secure.\"},{\"TagValueDefinePrompt\":\"Positive,Neutral,Negative\",\"TagName\":\"Service Evaluation-Sentiment\",\"TagTaskType\":\"singleTagValue\",\"TagDefinePrompt\":\"The user's attitude, opinion, and emotion towards the service experience. For example, a user might feel the service is very attentive, follows up on their feedback, and helps solve problems, showing approval of the service.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"User Needs and Pain Points-Usage Scenario\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"How the user uses the product and in what scenarios.\"},{\"TagValueDefinePrompt\":\"Yes,No\",\"TagName\":\"User Needs and Pain Points-Are There Unmet Needs\",\"TagTaskType\":\"singleTagValue\",\"TagDefinePrompt\":\"Whether the user expressed any unmet needs in the overall feedback.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"User Needs and Pain Points-Unmet Needs\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"Mine the user's currently unmet needs.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"User Needs and Pain Points-Pain Point Issues\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"Analyze and mine the problems and difficulties users encounter that require urgent solutions.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Competitor Comparison-Competitor Information\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"Information about competitors mentioned by the customer, including competitor names. This is usually for comparison with the current product.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Competitor Comparison-Evaluation of Competitors\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"Mine user evaluations of competitors, including their views on strengths and weaknesses.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Competitor Comparison-Reasons for Choosing Competitors\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"If the data shows the user is considering or has chosen a competitor, analyze the reasons for their choice.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Brand Image and Reputation-Brand Impression\",\"TagTaskType\":\"multiTagValues\",\"TagDefinePrompt\":\"The user's understanding and feelings about the brand's values and image positioning. For example, a user might associate a brand with high quality or innovation.\"},{\"TagValueDefinePrompt\":\"Yes,No\",\"TagName\":\"Brand Image and Reputation-Willingness to Recommend\",\"TagTaskType\":\"singleTagValue\",\"TagDefinePrompt\":\"Analyze the user's willingness to recommend the current product or brand to others.\"},{\"TagValueDefinePrompt\":\"\",\"TagName\":\"Brand Image and Reputation-Analysis of Recommendation Willingness\",\"TagTaskType\":\"summaryAndOverview\",\"TagDefinePrompt\":\"Summarize and analyze the reasons behind the user's willingness to recommend the current product or service to others.\"},{\"TagName\":\"Sentiment\",\"TagDefinePrompt\":\"The user's attitude, opinion, and emotion towards the service experience. For example, a user might feel the service is very attentive, follows up on their feedback, and helps solve problems, showing approval of the service.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"Positive,Neutral,Negative\"},{\"TagName\":\"User ID\",\"TagDefinePrompt\":\"The unique identifier ID for the current user\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"\"},{\"TagName\":\"Submission Time\",\"TagDefinePrompt\":\"The time the current ticket was created\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"\"},{\"TagName\":\"Problem Type Level 1 Tag\",\"TagDefinePrompt\":\"Analyze which level 1 category the current problem belongs to\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"Fault Feedback,Accessory Consultation\"},{\"TagName\":\"Problem Type Level 2 Tag\",\"TagDefinePrompt\":\"The sub-property of the current level 1 problem tag. 'Assembly Issues' and 'Missing/Wrong Parts' belong to 'Accessory Consultation'. 'Electrical Issues' also belong to 'Accessory Consultation'.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"Assembly Issues,Electrical Issues,Missing/Wrong Parts\"},{\"TagName\":\"Problem Type Level 3 Tag\",\"TagDefinePrompt\":\"The sub-property of the current level 2 problem tag. 'Assembly Issues' belong to 'Assembly Issues'. 'Electrical Component Quality' and 'Appearance Design' belong to 'Electrical Issues'. 'Wrong Part Shipped' and 'Missing Part' belong to 'Missing/Wrong Parts'.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"Wrong Part Shipped,Missing Part,Appearance Design,Electrical Component Quality,Assembly Issues\"},{\"TagName\":\"Problem Description\",\"TagDefinePrompt\":\"Summarize the problem described in the current user feedback ticket\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"\"},{\"TagName\":\"Faulty Part\",\"TagDefinePrompt\":\"If the problem reported by the user involves a faulty part, add the faulty accessory here. Otherwise, leave it empty\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"Brake,Seat\"},{\"TagName\":\"Service Dealer Name\",\"TagDefinePrompt\":\"The service dealer associated with the user's reported problem. Do not fill if no dealer is mentioned.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"\"},{\"TagName\":\"Service Station Province\",\"TagDefinePrompt\":\"The province where the ticket was submitted. Do not fill if not mentioned.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"\"},{\"TagName\":\"Service Station City\",\"TagDefinePrompt\":\"The city where the ticket was submitted. Do not fill if not mentioned.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"\"},{\"TagName\":\"Service Station District\",\"TagDefinePrompt\":\"The district where the ticket was submitted. Do not fill if not mentioned.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"\"},{\"TagName\":\"Ticket Source\",\"TagDefinePrompt\":\"The source of the current ticket. If not mentioned, the default is 'Phone'.\\n\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"WeChat Official Account,Phone,Outlet\"},{\"TagName\":\"Model\",\"TagDefinePrompt\":\"The product model involved in the current ticket. Leave empty if not mentioned.\",\"TagTaskType\":\"singleTagValue\",\"TagValueDefinePrompt\":\"Model 1,Model 2\"}],\"Contents\":[{\"Text\":\"Agent One 2025-01-05 09:36\\nHello, this is Agent One. How can I help you?\\nYoyo Qin 10:19 User ID:892-889-222\\nWhy is the battery life so poor now! It used to go 30 km on a full charge, but now it only goes 20 km!\\nYY Hotel 10:20\\nI'm very sorry about that. I will report this to our technical team. May I know your location and the model of your electric vehicle?\\nYoyo Qin 10:21\\nChangchun City, Jilin Province\\nYoyo Qin 10:21\\nModel 1\\nYY Hotel 10:24\\nI'm very sorry for the bad experience, Ms. Qin. Because your area is quite cold, it might cause higher power consumption. Next time you have a chance to visit an outlet, we can arrange a battery swap and check for you. Would that be okay?\\nYoyo Qin 10:35\\nAlright\\n\",\"ExtraInfo\":\"Ticket conversation between customer Yoyo Qin and Agent One after purchasing an electric vehicle\"}]}";

    /**
     * Workspace ID
     */
    private String workspaceId = "workspaceId";

    public static AsyncClient asyncClient() {
        // The AccessKey ID.
        String accessKeyId = "accessKeyId";

        // The AccessKey secret.
        String accessKeySecret = "accessKeySecret";

        // The domain name: aimiaobi.cn-hangzhou.aliyuncs.com
        String domain = "aimiaobi.cn-beijing.aliyuncs.com";

        return AsyncClient.builder().credentialsProvider(StaticCredentialProvider.create(Credential.builder()
                .accessKeyId(accessKeyId).accessKeySecret(accessKeySecret).build())).serviceConfiguration(Configuration.create()
                .setSignatureVersion(SignatureVersion.V3)).overrideConfiguration(ClientOverrideConfiguration.create().setProtocol("HTTPS")
                .setEndpointOverride(domain)).build();
    }

    @Test
    public void createEnterpriseVoc() throws ExecutionException, InterruptedException {
        AsyncClient asyncClient = asyncClient();
        // Submit the task.
        String taskId = doSubmitTask(asyncClient);

        // After the task is successfully polled, get the list of details.
        if (pollTask(asyncClient, taskId)) {

            CompletableFuture<ListAnalysisTagDetailByTaskIdResponse> responseFuture =
                    asyncClient.listAnalysisTagDetailByTaskId(ListAnalysisTagDetailByTaskIdRequest.builder().taskId(taskId).workspaceId(workspaceId).build());

            ListAnalysisTagDetailByTaskIdResponse response = responseFuture.get();

            StringBuilder detailInfo = new StringBuilder();

            for (ListAnalysisTagDetailByTaskIdResponseBody.Data datum : response.getBody().getData()) {
                detailInfo.append("VOC Content: ").append(datum.getContent().substring(0, Math.min(50, datum.getContent().length()))).append("\n");
                detailInfo.append("Mined Tag List:\n");
                for (ListAnalysisTagDetailByTaskIdResponseBody.ContentTags contentTag : datum.getContentTags()) {
                    detailInfo.append("\tTag Name: ").append(contentTag.getTagName()).append("\n");
                    if (contentTag.getTags() != null) {
                        detailInfo.append("\tTag Value: ").append(String.join(",", contentTag.getTags())).append("\n");
                    }
                    if (contentTag.getSummaryOverview() != null) {
                        detailInfo.append("\tSummary Overview: ").append(contentTag.getSummaryOverview()).append("\n");
                    }
                    detailInfo.append("\n");
                }
                detailInfo.append("\n");
            }

            System.out.println(detailInfo);
        }

    }

    private String doSubmitTask(AsyncClient asyncClient) throws ExecutionException, InterruptedException {
        JSONObject param = JSONObject.parseObject(jsonParam);

        String materialType = param.getString("MaterialType");

        String modelId = param.getString("ModelId");

        String fileKey = param.getString("FileKey");

        String PositiveSample = param.getString("PositiveSample");

        String PositiveSampleFileKey = param.getString("PositiveSampleFileKey");

        SubmitEnterpriseVocAnalysisTaskRequest.Builder builder = SubmitEnterpriseVocAnalysisTaskRequest.builder();

        builder.modelId(modelId).materialType(materialType).workspaceId(workspaceId);
        if (fileKey != null) {
            builder.fileKey(fileKey);
        }

        if (PositiveSample != null) {
            builder.positiveSample(PositiveSample);
        }

        if (PositiveSampleFileKey != null) {
            builder.positiveSampleFileKey(PositiveSampleFileKey);
        }

        JSONArray contents = param.getJSONArray("Contents");
        if (contents != null) {
            List<SubmitEnterpriseVocAnalysisTaskRequest.Contents> collect = contents.stream().map(x -> {
                return SubmitEnterpriseVocAnalysisTaskRequest.Contents.build((JSONObject) x, SubmitEnterpriseVocAnalysisTaskRequest.Contents.create());
            }).collect(Collectors.toList());
            builder.contents(collect);
        }
        JSONArray contentTags = param.getJSONArray("ContentTags");
        if (contentTags != null) {
            List<SubmitEnterpriseVocAnalysisTaskRequest.ContentTags> collect = contentTags.stream().map(x -> {
                return SubmitEnterpriseVocAnalysisTaskRequest.ContentTags.build((JSONObject) x, SubmitEnterpriseVocAnalysisTaskRequest.ContentTags.create());
            }).collect(Collectors.toList());
            builder.contentTags(collect);
        }

        JSONArray filterTags = param.getJSONArray("FilterTags");
        if (filterTags != null) {
            List<SubmitEnterpriseVocAnalysisTaskRequest.FilterTags> collect = filterTags.stream().map(x -> {
                return SubmitEnterpriseVocAnalysisTaskRequest.FilterTags.build((JSONObject) x, SubmitEnterpriseVocAnalysisTaskRequest.FilterTags.create());
            }).collect(Collectors.toList());
            builder.filterTags(collect);
        }

        SubmitEnterpriseVocAnalysisTaskRequest build = builder.build();

        CompletableFuture<SubmitEnterpriseVocAnalysisTaskResponse> enterpriseVocAnalysisTask = asyncClient.submitEnterpriseVocAnalysisTask(build);

        SubmitEnterpriseVocAnalysisTaskResponse response = enterpriseVocAnalysisTask.get();

        if (!response.getBody().getSuccess()) {
            log.error("Failed to submit the VOC task. Error code: {}, Error message: {}", response.getBody().getCode(), response.getBody().getMessage());
            return null;
        }

        return response.getBody().getData().getTaskId();
    }

    private boolean pollTask(AsyncClient asyncClient, String taskId) throws InterruptedException, ExecutionException {
        // Poll for the task result.
        while (true) {
            CompletableFuture<GetEnterpriseVocAnalysisTaskResponse> future = asyncClient.getEnterpriseVocAnalysisTask(GetEnterpriseVocAnalysisTaskRequest.builder().workspaceId(workspaceId).taskId(taskId).build());

            GetEnterpriseVocAnalysisTaskResponseBody body = future.get().getBody();
            if (!body.getSuccess()) {
                log.error("Failed to query the task. Error code: {}, Error message: {}", body.getCode(), body.getMessage());
                return false;
            }
            // Polling occurs only when the status is PENDING or RUNNING.
            GetEnterpriseVocAnalysisTaskResponseBody.Data data = body.getData();
            if (data.getStatus().equals("PENDING") || data.getStatus().equals("RUNNING")) {
                log.info("VOC analysis task is running. TaskId:{}, TaskStatus:{}", taskId, data.getStatus());
                Thread.sleep(4000);
                continue;
            }

            if (!data.getStatus().equals("SUCCESSED")) {
                log.error("VOC analysis task failed. Error code: {}, Error message: {}", body.getCode(), body.getMessage());
                return false;
            }

            GetEnterpriseVocAnalysisTaskResponseBody.Usage usage = data.getUsage();
            // Input tokens, output tokens
            Long inputToken = usage.getInputTokens();
            Long outputToken = usage.getOutputTokens();

            log.info("VOC analysis task completed successfully. TaskId:{}, TaskStatus:{}, Input Tokens:{}, Output Tokens:{}", taskId, data.getStatus(), inputToken, outputToken);

            GetEnterpriseVocAnalysisTaskResponseBody.StatisticsOverview statisticsOverview = data.getStatisticsOverview();
            log.info("Total data entries: {}", statisticsOverview.getCount());
            log.info("Filter tag statistics: {}", statisticsOverview.getFilterDimensionStatistics());
            log.info("Content tag statistics: {}", statisticsOverview.getTagDimensionStatistics());
            return true;
        }
    }

}

In the code sample above, the Enterprise VOC Mining API processes ticket data, as shown in the following figure:

image.png

It extracts various types of information and tags and returns them as structured data:

[
    {
        "tagName": "Product Feedback-User Sentiment",
        "tags": [
            "Negative"
        ]
    },
    {
        "tagName": "Product Feedback-Product Weaknesses",
        "tags": [
            "Poor battery life"
        ]
    },
    {
        "tagName": "Ticket Source",
        "tags": [
            "Phone"
        ]
    },
    {
        "tagName": "Sentiment",
        "tags": [
            "Negative"
        ]
    },
    {
        "tagName": "Submission Time",
        "tags": [
            "2025-01-05 09:36"
        ]
    },
    {
        "tagName": "Faulty Part",
        "tags": [
            "Battery"
        ]
    },
    {
        "tagName": "Service Station City",
        "tags": [
            "Changchun City"
        ]
    },
    {
        "tagName": "Service Station Province",
        "tags": [
            "Jilin Province"
        ]
    },
    {
        "tagName": "Service Evaluation-Sentiment",
        "tags": [
            "Neutral"
        ]
    },
    {
        "tagName": "Service Evaluation-After-sales Service",
        "tags": [
            "Battery swap and check service"
        ]
    },
    {
        "tagName": "Model",
        "tags": [
            "Model 1"
        ]
    },
    {
        "tagName": "User ID",
        "tags": [
            "892-889-222"
        ]
    },
    {
        "tagName": "User Needs and Pain Points-Pain Point Issues",
        "tags": [
            "Decreased battery life"
        ]
    },
    {
        "tagName": "User Needs and Pain Points-Unmet Needs",
        "tags": [
            "Longer battery range"
        ]
    },
    {
        "tagName": "User Needs and Pain Points-Are There Unmet Needs",
        "tags": [
            "Yes"
        ]
    },
    {
        "tagName": "Problem Description",
        "tags": [
            "The electric vehicle's battery range has decreased from 30 km to 20 km"
        ]
    },
    {
        "tagName": "Problem Type Level 1 Tag",
        "tags": [
            "Fault Feedback"
        ]
    },
    {
        "tagName": "Problem Type Level 3 Tag",
        "tags": [
            "Electrical Component Quality"
        ]
    },
    {
        "tagName": "Problem Type Level 2 Tag",
        "tags": [
            "Electrical Issues"
        ]
    }
]

Step 2: Transfer the structured data of content tags to a database

Use the tagName from the Enterprise VOC Mining results to create column names in your database. Then, generate a Data Definition Language (DDL) statement to create the database table. This example uses a MySQL database.

CREATE TABLE `analyze_table` (
  `Uid` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'The user ID',
  `Service_Station_Province` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The province where the ticket was submitted',
  `Service_Station_City` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The city where the ticket was submitted',
  `Service_Station_District` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The district where the ticket was submitted',
  `Service_Mileage` int DEFAULT NULL COMMENT 'The mileage of the electric vehicle',
  `Submission_Time` datetime DEFAULT NULL COMMENT 'The submission time of the ticket',
  `Submission_Source` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The source of the ticket submission',
  `Dealer_Name` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The name of the dealer',
  `Dealer_Code` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The unique code of the dealer',
  `Model` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The model of the electric vehicle',
  `Sentiment` varchar(20) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The sentiment of the ticket text',
  `Problem_Description` text COLLATE utf8mb4_unicode_520_ci COMMENT 'The original problem description from the ticket',
  `Faulty_Part` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The faulty part mentioned in the ticket',
  `Problem_Type_L1_Tag` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The level 1 tag for the ticket, representing a major problem category',
  `Problem_Type_L2_Tag` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The level 2 tag for the ticket, a sub-category of the level 1 tag',
  `Problem_Type_L3_Tag` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'The level 3 tag for the ticket, a sub-category of the level 2 tag',
  PRIMARY KEY (`Uid`),
  UNIQUE KEY `Dealer_Code` (`Dealer_Code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci COMMENT='Analysis table containing all ticket-related information';

Then, insert the content of the tags as column values into the database table.

INSERT INTO `chat_bi`.`analyze_table` (`Uid`, `Service_Station_Province`, `Service_Station_City`, `Service_Station_District`, `Service_Mileage`, `Submission_Time`, `Submission_Source`, `Dealer_Name`, `Dealer_Code`, `Model`, `Sentiment`, `Problem_Description`, `Faulty_Part`, `Problem_Type_L1_Tag`, `Problem_Type_L2_Tag`, `Problem_Type_L3_Tag`) VALUES ('001eeb2d-bd96-4bbe-a2f9-15b05d65ff7c', 'Liaoning Province', 'Dalian City', 'Zhongshan District', 774, '2025-01-02 20:07:00', 'Phone', 'Dealer C', 'ed1de1b2-3b5b-4564-b881-5fab9f29fbb1', 'Model 1', 'Negative', 'Described a fault issue with the vehicle frame.', 'Vehicle frame', 'Accessory Consultation', 'Part damaged upon unboxing (including after-sales derivatives)', 'Internal part damaged');

Step 3: Associate the database with Xiyan GBI and perform conversational analysis

  • In Xiyan GBI, associate the database that you configured.

    image.png
  • After the database is associated, you can ask questions about its content without performing any other configuration. You can obtain data results and related visual analytics.

    image.png image.png image.png

(Optional) Step 4: Integrate the Xiyan GBI conversational API into your business system

You can use the RunDataAnalysis - Chat API provided by the Xiyan GBI cloud service to implement ChatBI capabilities and integrate them into your business system.

For a code sample, see Procedure.