Data processing method and device, equipment, storage medium and program product

By automatically filtering query statements and matching the combined features of the category tree, the problem of time-consuming manual annotation of training data for category prediction models is solved, thus improving development efficiency.

CN115221197BActive Publication Date: 2026-05-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2022-07-22
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In existing technologies, the training data for category prediction models requires manual annotation by developers, which consumes a lot of time and affects development efficiency.

Method used

By obtaining the combination of query statements with various categories in the hierarchical category tree, feature extraction and semantic matching are performed to automatically filter out training data that meets the conditions for training the category prediction model.

Benefits of technology

It greatly saves data annotation time, improves the development efficiency of category prediction models, and reduces the need for manual annotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221197B_ABST
    Figure CN115221197B_ABST
Patent Text Reader

Abstract

This application relates to a data processing method, apparatus, device, storage medium, and program product, and pertains to the field of artificial intelligence technology. The method includes: obtaining a first query statement; combining the first query statement with each first category in a first-level category tree to obtain N query statement-category pairs; performing feature extraction on each of the N query statement-category pairs to obtain semantic feature information for each of the N query statement-category pairs; obtaining matching results for each of the N query statement-category pairs based on their semantic feature information; and, in response to a target query statement-category pair in the N query statement-category pairs satisfying a specified condition, acquiring the target query statement-category pair as training data for a category prediction model. This method significantly saves data annotation time and improves the development efficiency of the category prediction model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a data processing method, apparatus, device, storage medium, and program product. Background Technology

[0002] In scenarios such as querying or searching, it is usually necessary to match the corresponding category for the query statement entered by the user, and return the query / search result based on the matched category.

[0003] In related technologies, the process of matching a query statement with a corresponding category can be achieved using a machine learning model based on Artificial Intelligence (AI). For example, developers pre-label each query statement sample with corresponding category tags, and use the query statement samples and their corresponding category tags as training data to perform supervised machine learning training on a pre-built machine learning model to obtain a category prediction model. Subsequently, during the category matching process, the query statement to be matched is input into the category prediction model, and the category that matches the query statement is determined based on the output of the category prediction model.

[0004] However, in the aforementioned related technologies, the training data for the category prediction model requires developers to manually label the category tags of the query statement samples, which consumes a lot of manual labeling time and thus affects development efficiency. Summary of the Invention

[0005] This application provides a data processing method, apparatus, device, and storage medium that can automatically expand the training data of machine models used for category prediction, thereby improving development efficiency. The technical solution is as follows:

[0006] On the one hand, a data processing method is provided, the method comprising:

[0007] Retrieve the first query statement;

[0008] The first query statement is combined with each first category in the first-level category tree to obtain N query statement-category pairs; the first-level category tree contains N levels of categories, and the category of the leaf node in the N levels of categories is a subcategory of the category of the parent node of the leaf node; the first category is the last level of categories in the first-level category tree; N is greater than or equal to 3, and N is an integer.

[0009] Feature extraction is performed on each of the N query statement-category pairs to obtain the semantic feature information of each of the N query statement-category pairs;

[0010] Based on the semantic feature information of each of the N query statement-category pairs, obtain the matching results of each of the N query statement-category pairs; the matching results are used to indicate the degree of matching between the query statement and the category in the query statement-category pair.

[0011] In response to the matching results of the target query statement-category pair in N query statement-category pairs satisfying the specified conditions, the target query statement-category pair is obtained as training data for the category prediction model;

[0012] The category prediction model is used to predict the first category in the first-level category tree that corresponds to the second query statement input into the category prediction model.

[0013] On the other hand, a data processing method is provided, the method comprising:

[0014] Obtain query statement-category sample pairs; each query statement-category sample pair has a matching label; the matching label is used to indicate the degree of matching between the query statement and the category in the query statement-category sample pair.

[0015] The semantic feature information of the query statement-category sample pair is obtained by inputting the feature extraction part of the semantic relevance model into the query statement-category sample pair;

[0016] The semantic feature information of the query statement-category sample pair is input into the prediction part of the semantic relevance model to obtain the prediction matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model.

[0017] Based on the predicted matching results and the matching tags of the query statement-category sample pairs, the model parameters of the semantic relevance model are updated.

[0018] The semantic relevance model, after training, outputs matching results for each of the N query statement-category pairs. In response to a specified condition being met by the matching results of the target query statement-category pair among the N query statement-category pairs, the target query statement-category pair is used as training data for the category prediction model. The N query statement-category pairs are obtained by combining a first query statement with each first category in a first-level category tree. The first-level category tree contains N levels of categories, where the category of a leaf node in the N levels is a subcategory of the category of its parent node. The first category is the last level of categories in the first-level category tree. N is greater than or equal to 3 and is an integer. The matching results indicate the degree of matching between the query statement and the category in the query statement-category pair. The category prediction model predicts the first category in the first-level category tree corresponding to the second query statement input into the category prediction model.

[0019] On the other hand, a data processing apparatus is provided, the apparatus comprising:

[0020] The query statement retrieval module is used to retrieve the first query statement;

[0021] The combination module is used to combine the first query statement with each first category in the first-level category tree to obtain N query statement-category pairs; the first-level category tree contains N levels of categories, and the category of the leaf node in the N levels of categories is a subcategory of the category of the parent node of the leaf node; the first category is the last level of categories in the first-level category tree; N is greater than or equal to 3, and N is an integer;

[0022] The first extraction module is used to extract features from each of the N query statement-category pairs to obtain the semantic feature information of each of the N query statement-category pairs.

[0023] The first matching module is used to obtain matching results for each of the N query statement-category pairs based on their respective semantic feature information; the matching results are used to indicate the degree of matching between the query statement and the category in the query statement-category pair.

[0024] The training data acquisition module is used to acquire the target query statement-category pair as training data for the category prediction model in response to the matching results of the target query statement-category pair in the N query statement-category pairs meeting the specified conditions.

[0025] The category prediction model is used to predict the first category in the first-level category tree that corresponds to the second query statement input into the category prediction model.

[0026] In one possible implementation, the query statement retrieval module is used for,

[0027] Obtain the first query statement used for category querying in each second category of the second-level category tree;

[0028] Wherein, the second-level category tree is the first M-level category tree in the first-level category tree, and the second category is the last level category in the second-level category tree; 2≤M<N, and M is an integer.

[0029] In one possible implementation, the first extraction module is used to input the N query statement-category pairs into the feature extraction part of the semantic relevance model respectively, and obtain the semantic feature information of the N query statement-category pairs output by the feature extraction part of the semantic relevance model.

[0030] The first matching module is used to input the semantic feature information of each of the N query statements-category pairs into the prediction part of the semantic relevance model, and obtain the matching results of each of the N query statements-category pairs output by the prediction part of the semantic relevance model;

[0031] The semantic relevance model is a model trained on query statement-category sample pairs; the query statement-category sample pairs have matching labels; the matching labels are used to indicate the degree of matching between the query statement and the category in the query statement-category sample pairs.

[0032] In one possible implementation, the first extraction module is further configured to input the query statement-category sample pair into the feature extraction part of the semantic relevance model before the query statement acquisition module acquires the first query statement, so as to obtain the semantic feature information of the query statement-category sample pair output by the feature extraction part of the semantic relevance model;

[0033] The first matching module is further configured to input the semantic feature information of the query statement-category sample pair into the prediction part of the semantic relevance model, and obtain the prediction matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model.

[0034] Based on the predicted matching results and the matching tags of the query statement-category sample pairs, the model parameters of the semantic relevance model are updated.

[0035] In one possible implementation, the query statement acquisition module is further configured to acquire a third query statement for performing category queries in each third category of the third-level category tree; the third-level category tree contains N levels of categories, and the third-level category tree is different from the first-level category tree.

[0036] The combination module is further configured to combine the third query statement with a specified category in the third-level category tree to obtain the query statement-category sample pair; the specified category is any one of the last-level categories in the third-level category tree;

[0037] The device further includes: a tag setting module, used to set the matching tag for the query statement-category sample pair based on the relationship between the specified category and the target category in the third-level category tree;

[0038] The target category is the category in the last level of the third-level category tree corresponding to the third query statement.

[0039] In one possible implementation, the label setting module is used for,

[0040] In response to the fact that the specified category and the target category are the same category, a first matching tag is set for the query statement-category sample pair;

[0041] In response to the fact that the specified category and the target category are not the same category, obtain the lowest level of the grandparent node common to the specified category and the target category in the third-level category tree; set a second matching tag for the query statement-category sample pair based on the lowest level;

[0042] Wherein, the matching degree corresponding to the second matching tag is lower than the matching degree corresponding to the first matching tag; and the matching degree corresponding to the second matching tag is positively correlated with the lowest level.

[0043] In one possible implementation, the training data acquisition module is configured to acquire the target query statement-category pair as training data for the category prediction model in response to the matching result of the target query statement-category pair indicating that the degree of matching between the query statement and the category in the target query statement-category pair is the degree of matching corresponding to the first matching tag.

[0044] In one possible implementation, the apparatus further includes: a category prediction model training module, used for,

[0045] The first query statement is input into the first prediction model to obtain the first category prediction result output by the first prediction model; the first category prediction result is used to indicate the category in the first hierarchical category tree predicted by the first prediction model that corresponds to the first query statement.

[0046] Based on the first category prediction result and the categories in the target query statement-category pair, the parameters of the first prediction model are updated;

[0047] In response to the first prediction model satisfying the convergence condition, the first prediction model is obtained as the category prediction model.

[0048] In one possible implementation, the category prediction model training module is further used for:

[0049] The fourth query statement is input into the category prediction model to obtain the second category prediction result output by the category prediction model; the second category prediction result is used to indicate the category predicted by the category prediction model that the fourth query statement corresponds to the category in the first-level category tree; the fourth query statement has manually labeled categories;

[0050] Based on the second category prediction result and the manually labeled categories of the fourth query statement, the parameters of the category prediction model are updated.

[0051] In one possible implementation, the device further includes:

[0052] The category path acquisition module is used to acquire the category path of the second query statement; the category path of the second query statement includes the first category corresponding to the second query statement, and all categories in the first hierarchical category tree from the first category corresponding to the second query statement to the root node of the first hierarchical category tree.

[0053] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement the above-described data processing method.

[0054] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, the computer program being loaded and executed by a processor to implement the above-described data processing method.

[0055] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the data processing methods provided in the various optional implementations described above.

[0056] The technical solution provided in this application may include the following beneficial effects:

[0057] Before training the category prediction model to predict the last-level category of a certain category tree for the second query statement, query statement-category pairs are formed by combining the first query statement with each last-level category in the category tree. The semantic feature information of the query statement-category pairs is used to determine the matching degree between the query statement and the category in the query statement-category pair. Based on the matching degree, training data for training the category prediction model is selected. The above process automatically selects suitable training data through semantic matching, eliminating the need for manual annotation by developers. This greatly saves data annotation time and improves the development efficiency of the category prediction model. Attached Figure Description

[0058] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0059] Figure 1 This is a schematic diagram of the system used in the data processing method according to an exemplary embodiment of this application;

[0060] Figure 2 This is a flowchart illustrating a data processing method in an exemplary embodiment of this application;

[0061] Figure 3 This is a flowchart illustrating a data processing method in an exemplary embodiment of this application;

[0062] Figure 4 This is a schematic diagram illustrating a refined modification of the hierarchical category tree involved in this application;

[0063] Figure 5 This is a framework diagram illustrating a model training and application according to an exemplary embodiment of this application;

[0064] Figure 6 This is a flowchart illustrating a data processing method in an exemplary embodiment of this application;

[0065] Figure 7 yes Figure 6 The illustrated embodiment is a schematic diagram of a gear setting.

[0066] Figure 8 yes Figure 6 The illustrated embodiment is a schematic diagram of a gear setting.

[0067] Figure 9 yes Figure 6 The illustrated embodiment is a schematic diagram of a gear setting.

[0068] Figure 10 This is a model training and prediction framework diagram provided in an exemplary embodiment of this application;

[0069] Figure 11 A block diagram of a data processing apparatus illustrated in an exemplary embodiment of this application is shown;

[0070] Figure 12 A block diagram of a data processing apparatus illustrated in an exemplary embodiment of this application is shown;

[0071] Figure 13 A structural block diagram of a computer device illustrated in an exemplary embodiment of this application is shown. Detailed Implementation

[0072] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0073] It should be understood that "multiple" as used in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0074] This application provides a data processing method for predicting the category corresponding to a query statement. It can automatically generate training data for training a category prediction model, saving time spent manually labeling training data and improving development efficiency. For ease of understanding, the following explains several terms used in this application.

[0075] 1) Artificial Intelligence (AI)

[0076] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0077] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning. The display device with image acquisition components shown in this application mainly relates to computer vision, machine learning / deep learning, autonomous driving, and intelligent transportation.

[0078] 2) Machine Learning (ML)

[0079] Machine learning is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory, among others. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learn-by-doing.

[0080] 3) Categories

[0081] In the various embodiments of this application, "category" refers to the classification or category to which a product or object belongs. For example, the categories of goods can be divided into: men's clothing, women's clothing, shoes, skincare, electronics, etc., and the categories of documents can be divided into: literature, science and technology, nature, etc.

[0082] Categories are typically divided into primary categories, secondary categories, and more. For example, let's say clothing is a primary category, which can be further divided into secondary categories such as men's clothing, women's clothing, and children's clothing. Men's clothing can then be further divided into tertiary categories such as men's trousers and men's socks, and so on.

[0083] 4) Hierarchical category tree

[0084] In this embodiment of the application, a hierarchical category tree refers to a structure tree formed by connecting various categories in a category system according to their category hierarchy and the relationships between categories. That is, in a hierarchical category tree, the category of a leaf node is a subcategory of the category of its parent node.

[0085] For example, in a hierarchical category tree, clothing corresponds to a node in the hierarchical category tree, while the nodes corresponding to categories such as men's clothing, women's clothing, and children's clothing can be the next-level child nodes of the node corresponding to clothing.

[0086] Figure 1 A schematic diagram of a system used by a data processing method provided in an exemplary embodiment of this application is shown, such as... Figure 1 As shown, the system includes: server 110 and terminal 120.

[0087] Among them, the aforementioned server 110 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0088] The aforementioned terminal 120 can be a terminal device with network connectivity and data processing capabilities. Furthermore, the terminal can be a terminal with query capabilities. For example, terminal 120 can be a smartphone, tablet computer, e-book reader, smart glasses, smartwatch, smart TV, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, desktop computer, etc.

[0089] Optionally, the system described above includes one or more servers 110 and multiple terminals 120. This application embodiment does not limit the number of servers 110 and terminals 120.

[0090] The terminal and server are connected via a communication network. Optionally, the communication network can be a wired network or a wireless network.

[0091] Optionally, the aforementioned wireless or wired networks use standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to Local Area Networks (LANs), Metropolitan Area Networks (MANs), Wide Area Networks (WANs), mobile, wired or wireless networks, private networks, or any combination of virtual private networks. In some embodiments, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network. Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Networks (VPNs), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can be used to replace or supplement the aforementioned data communication technologies. This application does not impose any limitations.

[0092] Figure 2 A flowchart illustrating a data processing method according to an exemplary embodiment of this application is shown. This method is executed by a computer device, which can be implemented as a terminal or a server. Figure 1 The terminal or server shown, such as Figure 2 As shown, the data processing method includes the following steps:

[0093] Step 210: Obtain the first query statement.

[0094] In one possible implementation, the first query statement can be a query term entered by the user in the query system, or it can be a variant of the query term entered by the user in the query system, or it can be a query statement pre-set by the developer.

[0095] Step 220: Combine the first query statement with each first category in the first-level category tree to obtain N query statement-category pairs; the first-level category tree contains N levels of categories, and the category of the leaf node in the N levels of categories is a subcategory of the category of the parent node of the leaf node; the first category is the last level of categories in the first-level category tree; N is greater than or equal to 3, and N is an integer.

[0096] The query statement-category pair mentioned above refers to a pair consisting of a query statement and a category.

[0097] In this embodiment of the application, the first-level category tree contains at least three levels of categories, wherein the first-level category is the root category. Optionally, the root category may correspond to the highest-level classification, or it may not have any practical meaning. Each non-last-level category in the first-level category tree may be connected to one or more lower-level categories, each corresponding to one or more subcategories.

[0098] Step 230: Extract features from each of the N query statement-category pairs to obtain the semantic feature information of each of the N query statement-category pairs.

[0099] In this embodiment of the application, the computer device can extract features for each query statement-category pair separately.

[0100] For example, computer equipment can concatenate the query statement and category in a query statement-category pair and extract features as a whole to obtain the semantic feature information of the query statement-category pair.

[0101] Alternatively, computer devices can extract features from both the query statement and the category in a query statement-category pair to obtain the semantic feature information of that query statement-category pair.

[0102] In this embodiment, the computer device can convert query statement-category pairs into corresponding word vectors and extract semantic features based on the converted word vectors. For example, the computer device can convert the query statement and each word / character contained in the category in the query statement-category pair into corresponding word vectors / character vectors.

[0103] Step 240: Based on the semantic feature information of each of the N query statement-category pairs, obtain the matching results of each of the N query statement-category pairs; the matching results are used to indicate the degree of matching between the query statement and the category in the query statement-category pair.

[0104] In this embodiment of the application, a computer device can use a pre-trained machine learning model to map the semantic feature information of the query statement-category pair to the classification space to obtain the corresponding matching result.

[0105] Optionally, the matching degree between the query statement and the category in the query statement-category pair can correspond to multiple matching levels / grades, and different matching results correspond to different matching levels / grades.

[0106] Step 250: In response to the matching result of the target query statement-category pair in the N query statement-category pairs meeting the specified conditions, the target query statement-category pair is obtained as training data for the category prediction model; wherein, the category prediction model is used to predict the first category in the first-level category tree that corresponds to the second query statement input to the category prediction model.

[0107] In the embodiments of this application, the specified conditions may include: the matching degree indicated by the matching result of the target query statement-category pair reaches the specified matching degree; for example, when the matching degree indicated by the matching result of the target query statement-category pair is the highest matching level / grade, the target query statement-category pair is obtained as training data for the category prediction model.

[0108] When the target query statement-category pair is used as training data for the category prediction model, the first query statement in the target query statement-category pair can be used as input for training the category prediction model, and the category in the target query statement-category pair can be used as label for training the category prediction model, thereby enabling supervised training of the category prediction model.

[0109] After the above category prediction model is trained, it can process the input second query statement and predict the category that matches the second query statement in the last level of the first-level category tree. This allows subsequent business operations to be performed based on the predicted category, such as searching based on the predicted category and returning the search results to the device that sent the second query statement.

[0110] In summary, the solution presented in this application, before training a category prediction model to predict the last-level category of a second query statement in a certain hierarchical category tree, forms query statement-category pairs by combining the first query statement with each last-level category in the hierarchical category tree. The matching degree between the query statement and the category in the query statement-category pair is determined by the semantic feature information of the query statement-category pair, and training data for training the category prediction model is selected based on the matching degree. The above process automatically selects suitable training data through semantic matching, eliminating the need for manual annotation by developers, thereby greatly saving data annotation time and improving the development efficiency of the category prediction model.

[0111] The above Figure 2 In the illustrated embodiment, the process of semantic matching of the query statement and category in the query statement-category pair can be implemented using a machine learning model.

[0112] Figure 3A flowchart illustrating a data processing method according to an exemplary embodiment of this application is shown. This method is executed by a computer device, which can be implemented as a terminal or a server. Figure 1 The terminal or server shown, such as Figure 3 As shown, the data processing method includes the following steps:

[0113] Step 301: Obtain query statement-category sample pairs; query statement-category sample pairs have matching tags; matching tags are used to indicate the degree of matching between the query statement and the category in the query statement-category sample pair.

[0114] Step 302: Input the query statement-category sample pair into the feature extraction part of the semantic relevance model, and obtain the semantic feature information of the query statement-category sample pair output by the feature extraction part of the semantic relevance model.

[0115] Step 303: Input the semantic feature information of the query statement-category sample pair into the prediction part of the semantic relevance model to obtain the prediction matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model.

[0116] Step 304: Update the model parameters of the semantic relevance model based on the predicted matching results and the matching tags of the query statement-category sample pairs.

[0117] The trained semantic relevance model outputs matching results for each of the N query-category pairs. In response to a specified condition being met by the matching result of the target query-category pair among the N query-category pairs, the target query-category pair is used as training data for the category prediction model. The N query-category pairs are obtained by combining the first query statement with each first category in the first-level category tree. The first-level category tree contains N levels of categories, where the category of a leaf node is a subcategory of the category of its parent node. The first category is the last level of categories in the first-level category tree. N is greater than or equal to 3 and is an integer. The matching result indicates the degree of matching between the query statement and the category in the query-category pair. The category prediction model predicts the first category in the first-level category tree corresponding to the second query statement input into the category prediction model.

[0118] In summary, the solution presented in this application trains a semantic relevance model using query statement-category sample pairs labeled with matching tags. Subsequently, before training a category prediction model to predict the last-level category of a second query statement in a certain hierarchical category tree, query statement-category pairs are formed by combining the first query statement with each last-level category in that hierarchical category tree. The semantic relevance model then determines the degree of matching between the query statement and the category in each query statement-category pair. Based on this degree of matching, training data for the category prediction model is selected. This process automatically selects suitable training data through semantic matching, eliminating the need for manual labeling by developers, thus significantly saving data labeling time and improving the development efficiency of the category prediction model.

[0119] The application scenarios of the data processing method provided in this application embodiment include, but are not limited to, the following scenarios:

[0120] 1) Scenarios involving refined changes to existing hierarchical category trees;

[0121] In this application embodiment, the scenario of refining the hierarchical category tree refers to the need to assign more refined and deeper-level categories to short texts when the hierarchical category tree undergoes a refinement change. For example, please refer to... Figure 4 This illustration shows a schematic diagram of a refined modification of a hierarchical category tree involved in this application. For example... Figure 4 As shown, the Query = "Xinyang Maojian" already has the category "Food and Beverage_Tea_Green Tea" (level depth is 3). When the node "Food and Beverage_Tea_Green Tea" is further refined into "Longjing", "Maojian", "Matcha", "Anji White Tea", etc. (level depth is 4), the Query needs to be marked with a specific 4th level category.

[0122] When developers add one or more layers of categories to an existing hierarchical category tree, they need to retrain the corresponding category prediction model to accurately determine the category corresponding to the query statement from the newly added last layer of categories. However, as the hierarchy deepens, the distinguishability between categories decreases, and the number of effective samples within each category decreases. Therefore, there are problems such as difficulty in constructing training data, high cost of manual annotation, and low efficiency.

[0123] And through the above application Figure 2 or Figure 3The proposed solution can automatically generate training data for a category prediction model, thereby improving development efficiency. For example, given a hierarchical category tree with three levels of categories, developers can create a new hierarchical category tree with four levels by setting more refined subcategories for each level three category. The computer device (e.g., a server) can then combine the first query statement with each of the newly added level four categories. Using a semantic relevance model, the matching degree between the first query statement and each newly added level four category is predicted. The level four categories with the highest matching degree (e.g., the highest matching degree) are then used to form training data with the first query statement. By changing the first query statement, new training data can be automatically generated. Subsequently, the category prediction model is trained using this training data, allowing it to predict the level four category in the new hierarchical category tree corresponding to the second query statement input into the model.

[0124] 2) A scenario for constructing a completely new hierarchical category tree;

[0125] Once developers build a brand new hierarchical category tree with multiple levels of categories, they can train a category prediction model corresponding to that hierarchical category tree.

[0126] For example, if developers create a new hierarchical category tree with three levels of categories, a computer device (such as a server) can combine the first query statement with the newly added third-level categories. Then, it can use a semantic relevance model to predict the degree of matching between the first query statement and each newly added third-level category. The third-level categories with the highest matching degree are then used as training data along with the first query statement. By changing the first query statement, new training data can be automatically generated. Subsequently, the category prediction model can be trained using the above training data to predict the third-level category in the new hierarchical category tree corresponding to the second query statement input into the category prediction model.

[0127] The data processing method involved in this application can be implemented based on a semantic relevance model and a category prediction model. The scheme may include: a semantic relevance model training stage, a category prediction model training data generation stage, a category prediction model training stage, and a category prediction stage. Figure 5 This is a framework diagram illustrating model training and application as shown in an exemplary embodiment of this application, such as... Figure 5 As shown:

[0128] 1) During the semantic relevance model training phase, the model training device 510 inputs the query statement-category sample pairs with matching labels into the semantic relevance model, and trains the semantic relevance model based on the matching results output by the semantic relevance model and the aforementioned matching labels until the semantic relevance model converges.

[0129] 2) In the category prediction model training data generation stage, the model training device 510 combines the first query statement with each of the last-level categories in the first-level category tree to form query statement-category pairs. Each query statement-category pair is then input into the semantic relevance model to predict the degree of matching between the query statement and the category in each pair. Query statement-category pairs that meet the matching criteria are used as training data for the category prediction model. By replacing different first query statements, a large amount of training data can be quickly and automatically constructed.

[0130] 3) During the category prediction model training phase, the model training device 510 trains the category prediction model using the training data generated during the category prediction model training data generation phase. For example, the query statement in the query statement-category pair is used as the input to the category prediction model, and the category in the query statement-category pair is used as the label. The parameters of the category prediction model are updated by combining the output results of the category prediction model.

[0131] 4) In the category prediction stage, the prediction device 520 inputs the second query statement into the category prediction model and obtains the prediction result output by the category prediction model. The prediction result is used to indicate the category that matches the second query statement in each last-level category of the first-level category tree.

[0132] The aforementioned model training device 510 and prediction device 520 can be computer devices, such as fixed computer devices like personal computers and servers, or mobile computer devices like tablet computers and e-book readers.

[0133] Optionally, the model training device 510 and the prediction device 520 can be the same device, or they can be different devices. Furthermore, when the model training device 510 and the prediction device 520 are different devices, they can be of the same type, such as both being servers / server clusters; or they can be of different types, such as the model training device 510 being a personal computer or terminal, while the prediction device 520 can be a server, etc. This application embodiment does not limit the specific types of the model training device 510 and the prediction device 520.

[0134] Optionally, the model training device 510 can be a single device or a system of multiple devices. For example, the model training device 510 can consist of three sub-devices, which are respectively used to perform the steps corresponding to the semantic relevance model training stage, the category prediction model training data generation stage, and the category prediction model training stage.

[0135] Figure 6 This is a flowchart illustrating a data processing method provided in an exemplary embodiment of this application. The method can be executed by a single computer device, or by a computer system composed of multiple computer devices. For example, the computer device can be implemented as a terminal or a server. Figure 1 The terminal or server shown, such as Figure 6 As shown, the data processing method may include the following steps:

[0136] Step 601: Obtain the query statement-category sample pair; the query statement-category sample pair has matching tags.

[0137] The matching labels mentioned above are used to indicate the degree of matching between the query statement and the category in the query statement-category sample pair.

[0138] For example, in this embodiment of the application, the matching degree between the query statement and the category can be divided into four levels, namely level 3, level 2, level 1 and level 0; wherein the matching degree corresponding to level 3 to level 0 decreases step by step.

[0139] For example, level 3 indicates that the query statement has the same semantics as the category; level 2 indicates that the query statement has similar semantics to the category; level 1 indicates that the query statement has similar semantics to the category, but the demand has shifted; level 0 indicates that the query statement has no semantics related to the category.

[0140] In this embodiment of the application, the model training device can acquire several query statement-category sample pairs for training the semantic relevance model.

[0141] In one possible implementation, the above query statement-category sample pair can be sample data that is manually combined and labeled by developers.

[0142] In another possible implementation, the model training device can obtain query statements-category sample pairs and their matching tags in the following way:

[0143] Retrieve the third query statement used to perform category queries in each third category of the third-level category tree; the third-level category tree contains N levels of categories, and the third-level category tree is different from the first-level category tree;

[0144] Combine the third query statement with the specified category in the third-level category tree to obtain a query statement-category sample pair; the specified category is any one of the last-level categories in the third-level category tree;

[0145] Based on the relationship between the specified category and the target category in the third-level category tree, set matching tags for the query statement-category sample pair;

[0146] The target category is the category in the last level of the third-level category tree corresponding to the third query statement.

[0147] In this embodiment, the computer device can obtain a hierarchical category tree of the same level used by another search system outside the search system corresponding to the first-level category tree, namely the third-level category tree mentioned above. The query statement in the other search system is used as the third query statement and combined with any category in the last level category of the third-level category tree (i.e., the specified category mentioned above) to obtain a query statement-category sample pair. Then, the computer device determines the matching tag of the query statement-category sample pair according to the relationship between the specified category and the actual category in the last level category of the third-level category tree (i.e., the target category mentioned above) (e.g., whether they are the same, and, if they are not the same, the level of the deepest common parent node of the two). For example, the matching tag can be a matching level.

[0148] In one possible implementation, the process of setting matching tags for query-category sample pairs based on the relationship between the specified category and the target category in the third-level category tree can include:

[0149] In response to the fact that the specified category and the target category are the same category, set the first matching tag for the query statement-category sample pair;

[0150] In response to the fact that the specified category and the target category are not the same category, obtain the lowest level of the grandparent node that is common to the specified category and the target category in the third-level category tree; set the second matching tag based on the lowest level as the query statement-category sample pair;

[0151] Among them, the matching degree corresponding to the second matching tag is lower than that corresponding to the first matching tag; and the matching degree corresponding to the second matching tag is positively correlated with the lowest level.

[0152] In this embodiment of the application, when the specified category and the target category are the same category, the highest matching tag can be set for the query statement-category sample pair, such as setting the matching tag to the highest matching level.

[0153] When the specified category and the target category are not the same category, the matching tag can be set according to the level of the deepest common parent node of the two. The higher the level of the deepest common parent node of the two, the more similar their semantics are, and the higher the matching degree of the set matching tag.

[0154] In this embodiment, the number of levels in the hierarchical category tree increases progressively from the root node.

[0155] Typically, semantic relevance models are used to determine the degree of relevance between pairs of two queries. They are usually measured using four levels, and are essentially a four-level multi-class classification task.

[0156] The specific definitions are shown in Table 1. Gear 3 corresponds to the high gear, and gears 2, 1 and 0 correspond to the low gear.

[0157] Table 1

[0158]

[0159]

[0160] When the hierarchical category tree undergoes refinement changes (e.g., the level depth changes from 3 to 4 levels), it is necessary to determine the relevance between the query and the refined category pair (Query and category), which actually differs from the conventional semantic relevance task (Query and Query) (GAP). To better match the task involved in the embodiments of this application, external four-level category data can be used to construct the four-part data required for training the semantic relevance model.

[0161] For example, if the query is "1.5L rapeseed oil", and the external fourth-level category is "Food & Beverage_Grains & Oils & Seasonings_Edible Oils_Rapeseed Oil", then please refer to... Figure 7 This illustrates a gear setting diagram related to an embodiment of this application. Figure 7 As shown, the gear setting is as follows:

[0162] The pair consisting of the query and its most relevant category, "rapeseed oil," has a level of 3; the pair consisting of the query and "corn oil," a sibling node of "rapeseed oil," has a level of 2 ("rapeseed oil" and "corn oil" share the same parent node); the pair consisting of the query and "noodles" has a level of 1 ("rapeseed oil" and "noodles" share the same ancestor node); and the pair consisting of the query and "Maojian tea" has a level of 0 ("rapeseed oil" and "Maojian tea" share the same ancestor node). Following this pattern, a large amount of training data for semantic relevance models can be constructed, as shown in Table 2.

[0163] Table 2

[0164] Pair (Query, Category) gear (1.5L rapeseed oil) 3rd gear (1.5L rapeseed oil, corn oil) 2nd gear (1.5L rapeseed oil, dried noodles) 1st gear (1.5L rapeseed oil, Maojian brand) 0 gear …… ……

[0165] Step 602: Train a semantic relevance model based on the query statement-category sample pair and the matching tags of the query statement-category sample pair.

[0166] In one possible implementation, the training process for the semantic relevance model may include:

[0167] The semantic feature information of the query statement-category sample pair is obtained by inputting the feature extraction part of the semantic relevance model into the query statement-category sample pair;

[0168] Input the semantic feature information of the query statement-category sample pair into the prediction part of the semantic relevance model to obtain the predicted matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model.

[0169] The model parameters of the semantic relevance model are updated based on the predicted matching results and the matching tags of the query statement-category sample pairs.

[0170] In this embodiment, the computer device can input the query statement-category sample pair into the semantic relevance model, extract features through the feature extraction part of the input semantic relevance model, classify the extracted features through the prediction part of the feature extraction part, and obtain the predicted matching result of the query statement-category sample pair. That is, the semantic relevance model predicts the matching degree of the query statement-category sample pair. Then, the loss function value is calculated based on the difference between the predicted matching degree and the actual matching degree (represented by the matching label mentioned above), and the parameters of the semantic relevance model are updated based on the calculated loss function value. Multiple rounds of iterative updates are performed through multiple query statement-category sample pairs until the semantic relevance model meets the convergence condition.

[0171] The feature extraction part of the aforementioned semantic relevance model can be implemented using the BERT (Bidirectional Encoder Representations from Transformers) model. Alternatively, the feature extraction part of the aforementioned semantic relevance model can also be implemented using other models, such as the Bi-LSTM (Long Short-Term Memory) model, etc. This application does not limit the structure of the feature extraction part in the semantic relevance model.

[0172] Please refer to Figure 8 This diagram illustrates the structural design of the semantic relevance model involved in an embodiment of this application. Figure 8 As shown, the training process of this semantic relevance model can be as follows:

[0173] 1) In the input layer, input a short text and a category pair.

[0174] 2) In the encoding layer (i.e., the feature extraction part mentioned above), BERT is used to encode the short text. The specific process is as follows: For example, Query = "Jin Jun Mei buds", category = "Jin Jun Mei". First, each character in the Query is looked up in the thesaurus to obtain its corresponding ID, i.e., Q1, Q2, Q3, Q4, Q5, Q6. Then, each character in the category is looked up in the thesaurus to obtain its corresponding ID, i.e., C1, C2. Finally, the IDs corresponding to the [CLS] symbol, each character in the Query, the separator [SEP], each character in the category, and the padding [PAD] are concatenated and input into BERT, i.e., [CLS], Q1, Q2, Q3, Q4, Q5, Q6, [SEP], C1, C2, [SEP], [PAD], ..., [PAD]. After BERT encoding, the following vectors are obtained: E[CLS] vector, TQ1 to TQ6 vectors corresponding to each character in the Query, and TC1 to TC2 vectors corresponding to each character in the category. The E[CLS] vector is often used to represent the global semantics of the entire Query and category, and its dimension can be 768.

[0175] 3) In the classification layer (i.e., the prediction part mentioned above), the correlation level between the query and the category is calculated, that is, a single-label multi-classification model with four levels is constructed. The specific process is as follows: The input vector E[CLS] first passes through the first fully connected layer W1, then the activation layer tanh, then through the second fully connected layer W2, and finally the Logit is output.

[0176] Parameter update process: Calculate the cross-entropy loss between Logit and the true label, and then use the cross-entropy loss to update the model parameters of the encoding layer and the classification layer.

[0177] Step 603: Obtain the first query statement.

[0178] The first query statement can be a query statement pre-set by the developer.

[0179] In another possible implementation, the step of obtaining the first query statement may also include:

[0180] Obtain the first query statement used for category lookup in each second category of the second-level category tree; where the second-level category tree is the first M-level classification tree in the first-level category tree, and the second category is the last level category in the second-level category tree; 2≤M<N, and M is an integer.

[0181] In this embodiment of the application, when the first-level category tree is a hierarchy of categories obtained by refining and updating the second-level category tree, the computer device can obtain the query statement in the process of using the second-level category tree as the first query statement mentioned above.

[0182] Step 604: Combine the first query statement with each first category in the first-level category tree to obtain N query statement-category pairs.

[0183] The first-level category tree contains N levels of categories, and the category of the leaf node in the N levels of categories is a subcategory of the category of the parent node of the leaf node; the first category is the last level of categories in the first-level category tree; N is greater than or equal to 3, and N is an integer.

[0184] Step 605: Input the N query statements-category pairs into the feature extraction part of the semantic relevance model to obtain the semantic feature information of each of the N query statements-category pairs output by the feature extraction part of the semantic relevance model.

[0185] Step 606: Input the semantic feature information of each of the N query statements-category pairs into the prediction part of the semantic relevance model, and obtain the matching results of each of the N query statements-category pairs output by the prediction part of the semantic relevance model.

[0186] The matching results mentioned above are used to indicate the degree of matching between the query statement and the category in the query statement-category pair.

[0187] The process of obtaining the matching results of query statement-category pairs is similar to the training process of the semantic relevance model, and will not be described in detail here.

[0188] Step 607: In response to the matching result of the target query statement-category pair in the N query statement-category pairs meeting the specified conditions, the target query statement-category pair is obtained as training data for the category prediction model.

[0189] In one possible implementation, the process of obtaining the target query-category pair as training data for the category prediction model in response to the matching result of the target query-category pair among N query-category pairs satisfying a specified condition may include:

[0190] In response to the matching result of the target query statement-category pair indicating that the degree of matching between the query statement and the category in the target query statement-category pair is the degree of matching corresponding to the first matching label, the target query statement-category pair is obtained as training data for the category prediction model.

[0191] In this embodiment of the application, the computer device can use a semantic relevance model to predict the query statement-category pair with the highest matching degree among N query statement-category pairs and set it as the training data for the category prediction model.

[0192] Alternatively, the computer device can use a semantic relevance model to predict the matching degree of query-category pairs from N query-category pairs, and set these pairs as training data for the category prediction model. For example, the computer device can use a semantic relevance model to predict the query-category pairs with the highest and second-highest matching degree from N query-category pairs, and set these pairs as training data for the category prediction model.

[0193] In this embodiment, taking the category prediction model for predicting the hierarchical category of a product short text as an example, when the 3-level hierarchical category tree is refined into a 4-level hierarchical category tree, all fourth-level nodes under the existing third-level nodes of the short text can be traversed, and the high-level (3-level) pairs can be identified with the help of the semantic relevance model. Similarly, taking Query = "Xinyang Maojian" as an example, with the existing third-level category being "Food & Beverage_Tea_Green Tea", the process for obtaining the specific fourth-level category of this Query is as follows:

[0194] (Xinyang Maojian and Longjing tea) Lower-grade products should be discarded;

[0195] (Xinyang Maojian tea) High-end quality retained;

[0196] (Xinyang Maojian tea, matcha) Lower-end products should be discarded;

[0197] (Xinyang Maojian and Anji White Tea) Lower-end products should be discarded.

[0198] The final fourth-level category for Query = “Xinyang Maojian” is “Food and Beverages_Tea_Green Tea_Maojian”.

[0199] Optionally, the above methods can be used to construct large-scale pseudo-labeled data with four levels of categories, which can be used as pre-training data for product short text hierarchical category prediction.

[0200] Step 608: Based on the above training data, train the category prediction model.

[0201] In one possible implementation, the model training device can train the category prediction model in the following way:

[0202] The first query statement is input into the first prediction model to obtain the first category prediction result output by the first prediction model; the first category prediction result is used to indicate the category in the first-level category tree predicted by the first prediction model that corresponds to the first query statement.

[0203] Based on the prediction results of the first category and the categories in the target query statement-category pair, the parameters of the first prediction model are updated.

[0204] In response to the convergence condition of the first prediction model, the first prediction model is obtained as the category prediction model.

[0205] The first prediction model mentioned above can have a feature extraction part and a prediction part.

[0206] The feature extraction part of the first prediction model mentioned above can be implemented by the BERT model or by other models such as Bi-LSTM.

[0207] Unlike the semantic relevance model, in the first prediction model, the input to the feature extraction part is the query statement, rather than the query statement-category pair.

[0208] The structure of the prediction part in the first prediction model can be the same as or different from the structure of the prediction part in the semantic relevance model.

[0209] In this embodiment, when training the first prediction model, the computer device can use a first query statement as input to the first prediction model, predict the category of the first query statement, calculate the loss function value based on the difference between the predicted category and the category in the target query statement-category pair, and update the parameters of the first prediction model based on the calculated loss function value. Multiple iterations are performed using multiple target query statement-category pairs until the first prediction model converges.

[0210] The output of the first prediction model can include a probability distribution consisting of N probabilities. Each probability value corresponds to a last-level category in the first-level category tree, representing the probability that the input query corresponds to that last-level category. In other words, the first prediction model can be an N-classification model used to predict the probability that the input query corresponds to each last-level category in the first-level category tree.

[0211] In one possible implementation, the model training device can further fine-tune the category prediction model in the following ways:

[0212] Input the fourth query statement into the category prediction model to obtain the second category prediction result output by the category prediction model; the second category prediction result is used to indicate the category predicted by the category prediction model that the fourth query statement corresponds to in the first-level category tree; the fourth query statement has manually labeled categories;

[0213] Based on the prediction results of the second category and the manually labeled categories of the fourth query, the parameters of the category prediction model are updated.

[0214] In the embodiments of the present application, since the above-mentioned target query statement-category pairs are training data screened by a semantic relevance model, the query statements in the target query statement-category pairs may not necessarily match the categories exactly. Therefore, the accuracy of the category prediction model trained by the above-mentioned target query statement-category pairs may not necessarily meet the application conditions. In this regard, the solution shown in the embodiments of the present application can further use a small number of query statement-category pairs with artificial standards as accurate training data to fine-tune the parameters of the category prediction model and obtain an accurate category prediction model.

[0215] Please refer to Figure 9 , which shows the structural design diagram of the category prediction model designed in the embodiments of the present application. As Figure 9 shown, the training process of the category prediction model can be as follows:

[0216] 1) In the input layer, short texts are input.

[0217] 2) In the encoding layer (i.e., the above-mentioned feature extraction part), BERT is used to encode the short texts. The specific process is as follows: For example, Query = "Golden Monkey Eyebrow Buds Medium Buds", each word in Query is used to look up the corresponding ID in the vocabulary, namely Q1, Q2, Q3, Q4, Q5, Q6. The ID corresponding to the [CLS] symbol, the ID corresponding to each word in Query, the ID corresponding to the separator symbol [SEP], and the ID corresponding to the padding symbol [PAD] are concatenated in sequence and then input into BERT, that is, [CLS], Q1, Q2, Q3, Q4, Q5, Q6, [SEP], [PAD], …, [PAD]. After encoding by BERT, the E[CLS] vector, the TQ1 vector to TQ6 vectors corresponding to each word in Query are obtained. Among them, the E[CLS] vector is often used to represent the global semantics of the entire Query, and its dimension can be 768.

[0218] 3) In the classification layer (i.e., the above-mentioned prediction part), calculate which nodes in the commodity hierarchical category tree Query belongs to, that is, construct a multi-label classification model, and the number of classifiers is the sum of the number of nodes in each level of the hierarchical category tree. The specific process is as follows: Input the E[CLS] vector, first pass through the first fully connected layer W1, then the activation layer tanh, and then pass through the second fully connected layer W2, and finally output Logit.

[0219] When updating the parameters, calculate the binary cross-entropy loss between Logit and the true category, and then use the binary cross-entropy loss to update the model parameters of the encoding layer and the classification layer.

[0220] In addition to Figure 9In addition to the supervised training method shown, the category prediction model can also be trained in other ways, such as through contrastive learning. This application does not limit the training method of the category prediction model.

[0221] There are two main ways to train a category prediction model:

[0222] (1) The conventional training method is to use small-scale fine-calibrated data for fine-tuning training as version V1.

[0223] (2) The training method involved in the embodiments of this application is: first, pre-training is performed using large-scale data predicted by the semantic relevance model, and then fine-tuning training is performed using small-scale precision data as version V2.

[0224] The size of the training data can be shown in Table 3.

[0225] Table 3

[0226]

[0227] Comparison of prediction results:

[0228] For example, Query = "Xigui Pu'er Portable Pack" contains two real hierarchical categories ("Food and Beverage_Tea_Pu'er_Raw Pu'er Tea" and "Food and Beverage_Tea_Pu'er_Ripe Pu'er Tea"). V1's recognition result is None, while V2 can recognize all of them correctly, as shown in Table 4.

[0229] Table 4

[0230] Category V1 recognition results V2 recognition results Food and Beverages_Tea_Pu-erh_Raw Pu-erh Tea × √ Food and Beverages_Tea_Pu-erh_Ripe Pu-erh Tea × √

[0231] Step 609: Input the second query statement into the category prediction model to obtain the first category in the first-level category tree that corresponds to the second query statement.

[0232] Optionally, the computer device may also obtain the category path of the second query statement; the category path of the second query statement includes the first category corresponding to the second query statement, and the various categories in the first-level category tree from the first category corresponding to the second query statement to the root node of the first-level category tree.

[0233] In summary, the solution presented in this application, before training a category prediction model to predict the last-level category of a second query statement in a certain hierarchical category tree, forms query statement-category pairs by combining the first query statement with each last-level category in the hierarchical category tree. The matching degree between the query statement and the category in the query statement-category pair is determined by the semantic feature information of the query statement-category pair, and training data for training the category prediction model is selected based on the matching degree. The above process automatically selects suitable training data through semantic matching, eliminating the need for manual annotation by developers, thereby greatly saving data annotation time and improving the development efficiency of the category prediction model.

[0234] Please refer to Figure 10 This illustrates a model training and prediction framework diagram provided by an exemplary embodiment of this application. Figure 10 As shown, taking the refinement of an existing N-1 level hierarchical category tree into an N-level hierarchical category tree as an example, the training and prediction process of this model can be as follows:

[0235] Model training phase:

[0236] S1001, obtain the external N-level hierarchical category tree 1 (i.e. the aforementioned third-level category tree) from the external search system, and the query statement 1 (i.e. the aforementioned third query statement) from the external search system.

[0237] S1002, combine query statement 1 with the categories of the Nth level in the hierarchical category tree 1 to form query statement-category sample pairs, and set matching labels (e.g., gear 0-gear 3) for query statement-category sample pairs according to the relationship between the categories (the specified categories) in the query statement-category sample pairs and the actual categories (the target categories) of query statement 1 in the hierarchical category tree 1.

[0238] S1003 trains a semantic relevance model by querying query statements, category sample pairs, and their matching tags.

[0239] S1004, combine the query statement 2 of the self-owned search system (i.e. the first query statement mentioned above) and the hierarchical category tree 2 of the N-level used by the self-owned search system (i.e. the first hierarchical category tree mentioned above) to form query statement-category pairs respectively.

[0240] S1005, input the trained semantic relevance model into the query statement-category pair, and obtain the matching result of the query statement-category pair (e.g., gear 0-gear 3).

[0241] S1006, Based on the matching results of the query statement-category pair, obtain the target query statement-category pair of position 3 as training data.

[0242] S1007, Train the category prediction model using the above target query statement-category pair.

[0243] S1008, fine-tunes the category prediction model using manually annotated query statements and category pairs.

[0244] Prediction phase:

[0245] S1009, input query statement 3 (i.e. the second query statement mentioned above) into the fine-tuned category prediction model to obtain category 1 in the hierarchical category tree 2 corresponding to query statement 3.

[0246] S1010, based on the predicted category 1, obtain the category path of the above query statement 3 from the hierarchical category tree 2.

[0247] S1011, return the search results to the device that sent query statement 3 by using the category path of query statement 3.

[0248] Based on the scheme shown in the above embodiments of this application, taking "Food and Beverages_Tea" as an example, it includes 1 first-level category, 1 second-level category, 9 third-level categories, and 56 fourth-level categories. Experiments were conducted on "Food and Beverages_Tea," and the results are shown in Table 5.

[0249] Table 5

[0250]

[0251] Based on the solution shown in the embodiments of this application, the overall R&D efficiency can be improved by 10%.

[0252] Figure 11 A block diagram of a data processing apparatus illustrated in an exemplary embodiment of this application is shown. This apparatus can be used to perform, for example... Figure 2 or Figure 6 All or part of the steps in the method shown; such as Figure 11 As shown, the device may include:

[0253] The query statement acquisition module 1101 is used to acquire the first query statement;

[0254] The combination module 1102 is used to combine the first query statement with each first category in the first-level category tree to obtain N query statement-category pairs; the first-level category tree contains N levels of categories, and the category of the leaf node in the N levels of categories is a subcategory of the category of the parent node of the leaf node; the first category is the last level of categories in the first-level category tree; N is greater than or equal to 3, and N is an integer;

[0255] The first extraction module 1103 is used to extract features from each of the N query statement-category pairs to obtain the semantic feature information of each of the N query statement-category pairs.

[0256] The first matching module 1104 is used to obtain matching results for each of the N query statement-category pairs based on their respective semantic feature information; the matching results are used to indicate the degree of matching between the query statement and the category in the query statement-category pair.

[0257] The training data acquisition module 1105 is used to acquire the target query statement-category pair as training data for the category prediction model in response to the matching results of the target query statement-category pair in the N query statement-category pairs meeting the specified conditions.

[0258] The category prediction model is used to predict the first category in the first-level category tree that corresponds to the second query statement input into the category prediction model.

[0259] In one possible implementation, the query statement acquisition module 1101 is used to,

[0260] Obtain the first query statement used for category querying in each second category of the second-level category tree;

[0261] Wherein, the second-level category tree is the first M-level category tree in the first-level category tree, and the second category is the last level category in the second-level category tree; 2≤M<N, and M is an integer.

[0262] In one possible implementation, the first extraction module 1103 is used to input the N query statement-category pairs into the feature extraction part of the semantic relevance model respectively, and obtain the semantic feature information of the N query statement-category pairs output by the feature extraction part of the semantic relevance model.

[0263] The first matching module 1104 is used to input the semantic feature information of each of the N query statements-category pairs into the prediction part of the semantic relevance model, and obtain the matching results of each of the N query statements-category pairs output by the prediction part of the semantic relevance model.

[0264] The semantic relevance model is a model trained on query statement-category sample pairs; the query statement-category sample pairs have matching labels; the matching labels are used to indicate the degree of matching between the query statement and the category in the query statement-category sample pairs.

[0265] In one possible implementation, the first extraction module 1103 is further configured to input the query statement-category sample pair into the feature extraction part of the semantic relevance model before the query statement acquisition module 1101 acquires the first query statement, so as to obtain the semantic feature information of the query statement-category sample pair output by the feature extraction part of the semantic relevance model.

[0266] The first matching module 1104 is further configured to input the semantic feature information of the query statement-category sample pair into the prediction part of the semantic relevance model, and obtain the prediction matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model.

[0267] Based on the predicted matching results and the matching tags of the query statement-category sample pairs, the model parameters of the semantic relevance model are updated.

[0268] In one possible implementation, the query statement acquisition module 1101 is further configured to acquire a third query statement for performing category queries in each third category of the third-level category tree; the third-level category tree contains N levels of categories, and the third-level category tree is different from the first-level category tree.

[0269] The combination module 1102 is further configured to combine the third query statement with a specified category in the third-level category tree to obtain the query statement-category sample pair; the specified category is any one of the last-level categories in the third-level category tree;

[0270] The device further includes: a tag setting module, used to set the matching tag for the query statement-category sample pair based on the relationship between the specified category and the target category in the third-level category tree;

[0271] The target category is the category in the last level of the third-level category tree corresponding to the third query statement.

[0272] In one possible implementation, the label setting module is used for,

[0273] In response to the fact that the specified category and the target category are the same category, a first matching tag is set for the query statement-category sample pair;

[0274] In response to the fact that the specified category and the target category are not the same category, obtain the lowest level of the grandparent node common to the specified category and the target category in the third-level category tree; set a second matching tag for the query statement-category sample pair based on the lowest level;

[0275] Wherein, the matching degree corresponding to the second matching tag is lower than the matching degree corresponding to the first matching tag; and the matching degree corresponding to the second matching tag is positively correlated with the lowest level.

[0276] In one possible implementation, the training data acquisition module 1105 is configured to acquire the target query statement-category pair as training data for the category prediction model in response to the matching result of the target query statement-category pair indicating that the degree of matching between the query statement and the category in the target query statement-category pair is the degree of matching corresponding to the first matching tag.

[0277] In one possible implementation, the apparatus further includes: a category prediction model training module, used for,

[0278] The first query statement is input into the first prediction model to obtain the first category prediction result output by the first prediction model; the first category prediction result is used to indicate the category in the first hierarchical category tree predicted by the first prediction model that corresponds to the first query statement.

[0279] Based on the first category prediction result and the categories in the target query statement-category pair, the parameters of the first prediction model are updated;

[0280] In response to the first prediction model satisfying the convergence condition, the first prediction model is obtained as the category prediction model.

[0281] In one possible implementation, the category prediction model training module is further used for:

[0282] The fourth query statement is input into the category prediction model to obtain the second category prediction result output by the category prediction model; the second category prediction result is used to indicate the category predicted by the category prediction model that the fourth query statement corresponds to the category in the first-level category tree; the fourth query statement has manually labeled categories;

[0283] Based on the second category prediction result and the manually labeled categories of the fourth query statement, the parameters of the category prediction model are updated.

[0284] In one possible implementation, the device further includes:

[0285] The category path acquisition module is used to acquire the category path of the second query statement; the category path of the second query statement includes the first category corresponding to the second query statement, and all categories in the first hierarchical category tree from the first category corresponding to the second query statement to the root node of the first hierarchical category tree.

[0286] In summary, the solution presented in this application, before training a category prediction model to predict the last-level category of a second query statement in a certain hierarchical category tree, forms query statement-category pairs by combining the first query statement with each last-level category in the hierarchical category tree. The matching degree between the query statement and the category in the query statement-category pair is determined by the semantic feature information of the query statement-category pair, and training data for training the category prediction model is selected based on the matching degree. The above process automatically selects suitable training data through semantic matching, eliminating the need for manual annotation by developers, thereby greatly saving data annotation time and improving the development efficiency of the category prediction model.

[0287] Figure 12 A block diagram of a data processing apparatus illustrated in an exemplary embodiment of this application is shown. This apparatus can be used to perform, for example... Figure 3 or Figure 6 In the method shown, all or part of the steps related to the training part of the semantic relevance model; such as Figure 12 As shown, the device includes:

[0288] The acquisition module 1201 is used to acquire query statement-category sample pairs; the query statement-category sample pairs have matching tags; the matching tags are used to indicate the degree of matching between the query statement and the category in the query statement-category sample pairs.

[0289] The feature extraction module 1202 is used to input the query statement-category sample pair into the feature extraction part of the semantic relevance model, and obtain the semantic feature information of the query statement-category sample pair output by the feature extraction part of the semantic relevance model;

[0290] The prediction module 1203 inputs the semantic feature information of the query statement-category sample pair into the prediction part of the semantic relevance model to obtain the prediction matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model.

[0291] The update module 1204 is used to update the model parameters of the semantic relevance model based on the predicted matching results and the matching tags of the query statement-category sample pairs.

[0292] The semantic relevance model, after training, outputs matching results for each of the N query statement-category pairs. In response to a specified condition being met by the matching results of the target query statement-category pair among the N query statement-category pairs, the target query statement-category pair is used as training data for the category prediction model. The N query statement-category pairs are obtained by combining a first query statement with each first category in a first-level category tree. The first-level category tree contains N levels of categories, where the category of a leaf node in the N levels is a subcategory of the category of its parent node. The first category is the last level of categories in the first-level category tree. N is greater than or equal to 3 and is an integer. The matching results indicate the degree of matching between the query statement and the category in the query statement-category pair. The category prediction model predicts the first category in the first-level category tree corresponding to the second query statement input into the category prediction model.

[0293] In summary, the solution presented in this application trains a semantic relevance model using query statement-category sample pairs labeled with matching tags. Subsequently, before training a category prediction model to predict the last-level category of a second query statement in a certain hierarchical category tree, query statement-category pairs are formed by combining the first query statement with each last-level category in that hierarchical category tree. The semantic relevance model then determines the degree of matching between the query statement and the category in each query statement-category pair. Based on this degree of matching, training data for the category prediction model is selected. This process automatically selects suitable training data through semantic matching, eliminating the need for manual labeling by developers, thus significantly saving data labeling time and improving the development efficiency of the category prediction model.

[0294] Figure 13 A structural block diagram of a computer device 1300 illustrated in an exemplary embodiment of this application is shown. This computer device can be implemented as a server as described above in this application. The computer device 1300 includes a Central Processing Unit (CPU) 1301, a system memory 1304 including Random Access Memory (RAM) 1302 and Read-Only Memory (ROM) 1303, and a system bus 1305 connecting the system memory 1304 and the CPU 1301. The computer device 1300 also includes a mass storage device 1306 for storing an operating system 1309, application programs 1310, and other program modules 1311.

[0295] The mass storage device 1306 is connected to the central processing unit 1301 via a mass storage controller (not shown) connected to the system bus 1305. The mass storage device 1306 and its associated computer-readable media provide non-volatile storage for the computer device 1300. That is, the mass storage device 1306 may include computer-readable media (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0296] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage medium is not limited to the above-mentioned types. The system memory 1304 and mass storage device 1306 described above can be collectively referred to as memory.

[0297] According to various embodiments of this disclosure, the computer device 1300 can also be connected to a remote computer on a network, such as the Internet. That is, the computer device 1300 can be connected to a network 1308 via a network interface unit 1307 connected to the system bus 1305, or the network interface unit 1307 can be used to connect to other types of networks or remote computer systems (not shown).

[0298] The memory also includes at least one instruction stored in the memory, and the central processing unit 1301 executes the at least one instruction to implement all or part of the steps in the data processing methods shown in the above embodiments.

[0299] In one exemplary embodiment, a computer-readable storage medium is also provided for storing at least one instruction, which is loaded and executed by a processor to implement all or part of the steps in the data processing method described above. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, or optical data storage device, etc.

[0300] In one exemplary embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform all or part of the steps in the data processing method described above.

[0301] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0302] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.

Claims

1. A data processing method, characterized in that, The method includes: Retrieve the first query statement; The first query statement is combined with each first category in the first-level category tree to obtain N query statement-category pairs; the first-level category tree contains N levels of categories, and the category of the leaf node in the N levels of categories is a subcategory of the category of the parent node of the leaf node; the first category is the last level of categories in the first-level category tree; N is greater than or equal to 3, and N is an integer. Feature extraction is performed on each of the N query statement-category pairs to obtain the semantic feature information of each of the N query statement-category pairs; Based on the semantic feature information of each of the N query statement-category pairs, obtain the matching results of each of the N query statement-category pairs; the matching results are used to indicate the degree of matching between the query statement and the category in the query statement-category pair. In response to the matching results of the target query statement-category pair in N query statement-category pairs satisfying the specified conditions, the target query statement-category pair is obtained as training data for the category prediction model; The category prediction model is used to predict the first category in the first-level category tree that corresponds to the second query statement input into the category prediction model.

2. The method according to claim 1, characterized in that, The step of obtaining the first query statement includes: Obtain the first query statement used for category querying in each second category of the second-level category tree; Wherein, the second-level category tree is the first M-level category tree in the first-level category tree, and the second category is the last level category in the second-level category tree; 2≤M<N, and M is an integer.

3. The method according to claim 1 or 2, characterized in that, The step of extracting features from each of the N query statement-category pairs to obtain the semantic feature information of each of the N query statement-category pairs includes: Input the N query statements-category pairs into the feature extraction part of the semantic relevance model to obtain the semantic feature information of each of the N query statements-category pairs output by the feature extraction part of the semantic relevance model. The step of obtaining matching results for each of the N query statements-category pairs based on their respective semantic feature information includes: Input the semantic feature information of each of the N query statements-category pairs into the prediction part of the semantic relevance model to obtain the matching results of each of the N query statements-category pairs output by the prediction part of the semantic relevance model. The semantic relevance model is a model trained on query statement-category sample pairs; the query statement-category sample pairs have matching labels; the matching labels are used to indicate the degree of matching between the query statement and the category in the query statement-category sample pairs.

4. The method according to claim 3, characterized in that, Before obtaining the first query statement, the process also includes: The query statement-category sample pair is input into the feature extraction part of the semantic relevance model to obtain the semantic feature information of the query statement-category sample pair output by the feature extraction part of the semantic relevance model. The semantic feature information of the query statement-category sample pair is input into the prediction part of the semantic relevance model to obtain the prediction matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model. Based on the predicted matching results and the matching tags of the query statement-category sample pairs, the model parameters of the semantic relevance model are updated.

5. The method according to claim 3, characterized in that, The method further includes: Obtain a third query statement for performing category queries in each third category of the third-level category tree; the third-level category tree contains N levels of categories, and the third-level category tree is different from the first-level category tree; The third query statement is combined with a specified category in the third-level category tree to obtain the query statement-category sample pair; the specified category is any one of the last-level categories in the third-level category tree; Based on the relationship between the specified category and the target category in the third-level category tree, the matching tag is set for the query statement-category sample pair; The target category is the category in the last level of the third-level category tree corresponding to the third query statement.

6. The method according to claim 5, characterized in that, The step of setting the matching tags for the query statement-category sample pair based on the relationship between the specified category and the target category in the third-level category tree includes: In response to the fact that the specified category and the target category are the same category, a first matching tag is set for the query statement-category sample pair; In response to the fact that the specified category and the target category are not the same category, obtain the lowest level of the grandparent node common to the specified category and the target category in the third-level category tree; set a second matching tag for the query statement-category sample pair based on the lowest level; Wherein, the matching degree corresponding to the second matching tag is lower than the matching degree corresponding to the first matching tag; and the matching degree corresponding to the second matching tag is positively correlated with the lowest level.

7. The method according to claim 6, characterized in that, The step of responding to the matching results of the target query statement-category pair in the N query statement-category pairs satisfying a specified condition, and obtaining the target query statement-category pair as training data for the category prediction model, includes: In response to the matching result of the target query statement-category pair indicating that the degree of matching between the query statement and the category in the target query statement-category pair is the degree of matching corresponding to the first matching tag, the target query statement-category pair is obtained as training data for the category prediction model.

8. The method according to claim 1 or 2, characterized in that, The method further includes: The first query statement is input into the first prediction model to obtain the first category prediction result output by the first prediction model; the first category prediction result is used to indicate the category in the first hierarchical category tree predicted by the first prediction model that corresponds to the first query statement. Based on the first category prediction result and the categories in the target query statement-category pair, the parameters of the first prediction model are updated; In response to the first prediction model satisfying the convergence condition, the first prediction model is obtained as the category prediction model.

9. The method according to claim 8, characterized in that, The method further includes: The fourth query statement is input into the category prediction model to obtain the second category prediction result output by the category prediction model; the second category prediction result is used to indicate the category predicted by the category prediction model that the fourth query statement corresponds to the category in the first-level category tree; the fourth query statement has manually labeled categories; Based on the second category prediction result and the manually labeled categories of the fourth query statement, the parameters of the category prediction model are updated.

10. The method according to claim 1 or 2, characterized in that, The method further includes: Obtain the category path of the second query statement; the category path of the second query statement includes the first category corresponding to the second query statement, and all categories in the first hierarchical category tree from the first category corresponding to the second query statement to the root node of the first hierarchical category tree.

11. A data processing method, characterized in that, The method includes: Obtain query statement-category sample pairs; each query statement-category sample pair has a matching label; the matching label is used to indicate the degree of matching between the query statement and the category in the query statement-category sample pair. The semantic feature information of the query statement-category sample pair is obtained by inputting the feature extraction part of the semantic relevance model into the query statement-category sample pair; The semantic feature information of the query statement-category sample pair is input into the prediction part of the semantic relevance model to obtain the prediction matching result of the query statement-category sample pair output by the prediction part of the semantic relevance model. Based on the predicted matching results and the matching tags of the query statement-category sample pairs, the model parameters of the semantic relevance model are updated. The semantic relevance model, after training, outputs matching results for each of the N query statement-category pairs. In response to a specified condition being met by the matching results of the target query statement-category pair among the N query statement-category pairs, the target query statement-category pair is used as training data for the category prediction model. The N query statement-category pairs are obtained by combining a first query statement with each first category in a first-level category tree. The first-level category tree contains N levels of categories, where the category of a leaf node in the N levels is a subcategory of the category of its parent node. The first category is the last level of categories in the first-level category tree. N is greater than or equal to 3 and is an integer. The matching results indicate the degree of matching between the query statement and the category in the query statement-category pair. The category prediction model predicts the first category in the first-level category tree corresponding to the second query statement input into the category prediction model.

12. A data processing apparatus, characterized in that, The device includes: The query statement retrieval module is used to retrieve the first query statement; The combination module is used to combine the first query statement with each first category in the first-level category tree to obtain N query statement-category pairs; the first-level category tree contains N levels of categories, and the category of the leaf node in the N levels of categories is a subcategory of the category of the parent node of the leaf node; the first category is the last level of categories in the first-level category tree; N is greater than or equal to 3, and N is an integer; The first extraction module is used to extract features from each of the N query statement-category pairs to obtain the semantic feature information of each of the N query statement-category pairs. The first matching module is used to obtain matching results for each of the N query statement-category pairs based on their respective semantic feature information; the matching results are used to indicate the degree of matching between the query statement and the category in the query statement-category pair. The training data acquisition module is used to acquire the target query statement-category pair as training data for the category prediction model in response to the matching results of the target query statement-category pair in the N query statement-category pairs meeting the specified conditions. The category prediction model is used to predict the first category in the first-level category tree that corresponds to the second query statement input into the category prediction model.

13. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, which is loaded and executed by the processor to implement the data processing method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the data processing method as described in any one of claims 1 to 11.

15. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; the computer instructions are read and executed by a processor of a computer device to implement the data processing method as described in any one of claims 1 to 11.

Citation Information

Patent Citations

  • Data classification method, device and equipment based on multi-tree

    CN107330021A

  • Portable communication terminal for extracting subjects of interest to the user, and a method therefor

    WO2011096690A2