Category prediction method, device, electronic device and storage medium
By extracting the semantic features and entities of the search terms, combining the knowledge marker and semantic features of the category knowledge base, the problem of low accuracy of category prediction in the existing technology is solved, more accurate category prediction is achieved, and search is improved The engine's user experience and recall accuracy.
Patent Information
- Application Number
- CN202010988807.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-18
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2040-09-18
AI Technical Summary
The category prediction method in the prior art has a Matthew effect, which leads to low accuracy of category prediction and failure to effectively consider text semantic correlation, resulting in cold start problems and limitations of statistical methods.
By obtaining the semantic features and entities of search terms entered by users, combining high-quality category knowledge bases, setting knowledge marker features and category semantic features, using pre-trained classifiers to determine the category to which the search terms belong, and improving the category Accuracy of prediction.
It improves the accuracy of category prediction, overcomes the Matthew effect and cold start problems, enhances the understanding of the semantics of search terms, and improves the user experience and recall accuracy of search engines.
Smart Images

Figure CN112182323B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a category prediction method, device, electronic device and storage medium. Background Art
[0002] In the Internet era, search engines are a basic and core function. Whether it is traditional Internet or mobile Internet, a good search engine can understand the user's search intent, so that users can find the information they want to search for in a timely manner. For search engines, the core of understanding user search intent is to understand the search terms entered by users. Generally speaking, the understanding of search term text includes category prediction to analyze which categories are more relevant to the search term intent.
[0003] In the related art, the category prediction method is usually: predict the category to which the search term belongs by counting the user behavior data of the recall results of the search term under each category. If the user has a lot of user behavior data of the recall results under a certain category, it is determined that the search term belongs to this category.
[0004] However, the category prediction method in the related art has a relatively obvious Matthew effect. Specifically, the statistical user behavior data will have an advantage for categories with more exposure, so that the predicted categories are more inclined to the categories with more exposure, resulting in lower accuracy of category prediction. Summary of the invention
[0005] In order to solve the technical problem of low accuracy of category prediction existing in the related art, the present application shows a category prediction method, device, electronic device and storage medium.
[0006] In a first aspect, an embodiment of the present application shows a category prediction method, the method comprising:
[0007] Get the target search term entered by the user;
[0008] Extracting semantic features of the target search term;
[0009] Extracting target entities included in the target search term;
[0010] Querying a predetermined category knowledge base for the category to which the target entity belongs;
[0011] Setting a knowledge flag feature for each category in the category knowledge base according to the category to which the target entity belongs;
[0012] Based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base, the target category to which the target search term belongs is determined.
[0013] Optionally, setting a knowledge flag feature for each category in the category knowledge base according to the category to which the target entity belongs includes:
[0014] Setting a first knowledge flag feature for the category to which the target entity belongs;
[0015] A second knowledge flag feature is set for other categories in the category knowledge base except the category to which the target entity belongs, and the second knowledge flag feature is different from the first knowledge flag feature.
[0016] Optionally, determining the target category to which the target search term belongs based on the semantic feature, the knowledge flag feature corresponding to each category in the category knowledge base, and the category semantic feature corresponding to each category in the category knowledge base includes:
[0017] Obtaining category semantic features corresponding to each category in the category knowledge base;
[0018] For any category in the category knowledge base, the semantic feature, the knowledge flag feature corresponding to the category, and the category semantic feature corresponding to the category are spliced to obtain a spliced feature;
[0019] Input the concatenated features corresponding to each category in the category knowledge base into a pre-trained classifier to obtain a probability value corresponding to each category;
[0020] The category with a probability value greater than a preset probability value is determined as the target category corresponding to the target search term.
[0021] Optionally, the acquiring the category semantic features corresponding to each category in the category knowledge base includes:
[0022] Acquire a first category semantic feature of a first dimension corresponding to each category in the category knowledge base;
[0023] Performing dimensionality reduction on the first category semantic features corresponding to each of the categories to obtain second category semantic features of a second dimension;
[0024] For each category in the category knowledge base, the second category semantic feature corresponding to the category is determined as the category semantic feature corresponding to the category.
[0025] Optionally, extracting the semantic features of the target search term includes:
[0026] The target search term is input into a pre-trained semantic feature extraction model to obtain the semantic feature of the target search term.
[0027] In a second aspect, an embodiment of the present application provides a category prediction device, the device comprising:
[0028] A search term acquisition module, used to acquire a target search term input by a user;
[0029] A semantic feature extraction module, used to extract the semantic features of the target search term;
[0030] An entity extraction module, used to extract target entities included in the target search term;
[0031] A category query module, used to query the category to which the target entity belongs in a predetermined category knowledge base;
[0032] A knowledge flag feature setting module, used to set knowledge flag features for each category in the category knowledge base according to the category to which the target entity belongs;
[0033] The category determination module is used to determine the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base.
[0034] Optionally, the knowledge flag feature setting module is specifically used to:
[0035] Setting a first knowledge flag feature for the category to which the target entity belongs;
[0036] A second knowledge flag feature is set for other categories in the category knowledge base except the category to which the target entity belongs, and the second knowledge flag feature is different from the first knowledge flag feature.
[0037] Optionally, the category determination module includes:
[0038] A category semantic feature acquisition unit, used to acquire the category semantic features corresponding to each category in the category knowledge base;
[0039] A feature concatenation unit is used to concatenate the semantic feature, the knowledge flag feature corresponding to the category, and the category semantic feature corresponding to the category for any category in the category knowledge base to obtain a concatenated feature;
[0040] A probability value calculation unit, used to input the concatenated features corresponding to each category in the category knowledge base into a pre-trained classifier to obtain a probability value corresponding to each category;
[0041] The category determination unit is used to determine a category whose probability value is greater than a preset probability value as a target category corresponding to the target search term.
[0042] Optionally, the category semantic feature acquisition unit is specifically used to:
[0043] Acquire a first category semantic feature of a first dimension corresponding to each category in the category knowledge base;
[0044] Performing dimensionality reduction on the first category semantic features corresponding to each of the categories to obtain second category semantic features of a second dimension;
[0045] For each category in the category knowledge base, the second category semantic feature corresponding to the category is determined as the category semantic feature corresponding to the category.
[0046] Optionally, the semantic feature extraction module is specifically used to:
[0047] The target search term is input into a pre-trained semantic feature extraction model to obtain the semantic feature of the target search term.
[0048] In a third aspect, an embodiment of the present application shows an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the category prediction method described in the first aspect are implemented.
[0049] In a fourth aspect, an embodiment of the present application illustrates a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the category prediction method described in the first aspect are implemented.
[0050] The technical solution provided in the embodiment of the present application obtains the target search term input by the user; extracts the semantic features of the target search term; extracts the target entity included in the target search term; queries the category to which the target entity belongs in a predetermined category knowledge base; sets knowledge flag features for each category in the category knowledge base according to the category to which the target entity belongs; and determines the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base. It can be seen that through the technical solution provided in the embodiment of the present application, when predicting the category, the entities included in the target search term are identified through the entity recognition task, and a high-quality category knowledge base is introduced. Finally, the target category to which the target search term belongs is determined through the semantic features of the target search term, the category knowledge flag features, and the category semantic features, thereby improving the accuracy of category prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 is a step flow chart of a category prediction method provided in an embodiment of the present application;
[0052] Figure 2 yes Figure 1 A flowchart of steps of an implementation method of S160;
[0053] Figure 3 It is a schematic diagram of category prediction combined with a specific example provided in an embodiment of the present application;
[0054] Figure 4 It is a structural block diagram of a category prediction device provided in an embodiment of the present application;
[0055] Figure 5 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0057] In the Internet era, search engines are a basic and core function. Whether it is traditional Internet or mobile Internet, a good search engine can understand the user's search needs and enable users to find the information they want to search for, such as news, videos, restaurants, hotels, and commodities in the first place. For search engines, the most core information to understand user search intent is to understand the user's search query, that is, the search term text entered by the user. Therefore, the degree to which the search engine understands the search term text directly determines the user experience of the search engine.
[0058] Generally speaking, the understanding of search term text includes keyword extraction, rule matching, rewriting, error correction, component identification, intent identification, semantic matching, feature extraction, and category prediction, etc. Among them, category prediction is to analyze which categories are more relevant to the search term intent.
[0059] After the search engine receives the search term and recalls the results, it generally uses category relevance as an important selection and sorting factor. In this way, on the one hand, the sorting efficiency is guaranteed, and on the other hand, the relevance of the category is guaranteed from the source to ensure user experience. At the same time, it can help optimize the recall results, improve the recall accuracy, and reduce the false recall rate. It can be seen that the improvement of category prediction accuracy helps to significantly improve the search accuracy and recall rate, and improve the user experience.
[0060] In the related art, the category prediction method is usually: predict the category to which the search term belongs by counting the user behavior data of the recall results of the search term under each category. If the user has a lot of user behavior data of the recall results under a certain category, it is determined that the search term belongs to this category.
[0061] However, the category prediction method in the related art has a more obvious Matthew effect. Specifically, first, the statistical user behavior data will have an advantage for categories with more exposure, so that the predicted categories are more inclined to categories with more exposure; secondly, there is a cold start problem, and if there are new categories, even if the user behavior data has increased in recent days, it is difficult to catch up with the existing categories in terms of statistical values; in addition, the method is completely based on statistics and does not consider the semantic relevance of the text. From the above description, it can be seen that the category prediction method in the related art has a technical problem of low category prediction accuracy.
[0062] To this end, embodiments of the present application provide a category prediction method, device, electronic device, and storage medium.
[0063] In the first aspect, a category prediction method provided in an embodiment of the present application is first described in detail.
[0064] It should be noted that the executor of a category prediction method provided in an embodiment of the present application may be a category prediction device, which may run in an electronic device, which may be a server. The embodiment of the present application does not specifically limit the electronic device.
[0065] Reference Figure 1 , shows a flowchart of a category prediction method of the present application, which may specifically include the following steps:
[0066] S110, obtaining a target search term input by a user.
[0067] The target search term may be any search term input by the user. For example, the target search term may be Haidilao, Haidilao base, self-service hot pot or hot pot, etc. The embodiment of the present application does not specifically limit the target search term.
[0068] S120, extracting semantic features of the target search term.
[0069] Specifically, after the target search term is acquired, a semantic feature of the target search term may be extracted. The semantic feature may be a feature vector for representing the semantics of the target search term.
[0070] In one implementation, extracting the semantic features of the target search term may include the following steps:
[0071] The target search term is input into a pre-trained semantic feature extraction model to obtain the semantic features of the target search term.
[0072] In this embodiment, the semantic feature extraction model is used to extract the deep semantic features of the target search term. Among them, the semantic feature extraction model can be a BERT model, or it can be a model that can extract semantic features, such as an ERNIE model, an XLNET model, a MASS model, etc. The embodiment of the present application does not specifically limit the semantic feature extraction model. Those skilled in the art should be able to understand the training process of the semantic feature extraction model, which will not be repeated here.
[0073] For example, when the target search term is "Chacha Walnut Flavored Melon Seeds", after inputting "Chacha Walnut Flavored Melon Seeds" into the semantic feature extraction model, a speech feature vector for characterizing the semantics of "Chacha Walnut Flavored Melon Seeds" can be obtained.
[0074] S130, extracting target entities included in the target search term.
[0075] Specifically, after obtaining the target search term, the target search term may be input into a pre-trained entity extraction model, such as the target search term may be input into a pre-trained NER model to obtain a target entity included in the target search term, and the target entity may be a merchant, a product, or a brand included in the target search term. For example, when the target search term is "walnut-flavored melon seeds", the target entity included in the target search term may be melon seeds.
[0076] The above is only an example of extracting the target entity included in the target search term by using the NER model. The embodiment of the present application does not specifically limit the method of extracting the target entity included in the target search term.
[0077] S140, querying a predetermined category knowledge base for the category to which the target entity belongs.
[0078] Specifically, search is one of the core entrances for Meituan and Dianping to carry user search requests. Compared with general search engines, user search requests in O2O (online to offline) search scenarios are relatively clear, mainly based on structured merchant POI and product SPU.
[0079] Taking Meituan search as an example, merchant search and product search account for a large part of the search traffic, and the semantic relevance between search terms and categories is one of the key factors affecting the user search experience. In the search business on both Meituan and Dianping, the relevance between search terms and categories is an important feature of the ranking model.
[0080] In O2O search scenarios, the text length of search terms is shorter, and there is less information to be mined than normal text, and it is more difficult to judge the relevance between search terms and categories. However, due to the business attributes of O2O, although the search term text length is shorter, the search term often contains more structured information such as POI / SPU / BRAND (merchants / products / brands). At the same time, when merchants or products go online, merchant operators will fill in the multi-level backend categories to which the merchants or products belong, and they will be reviewed and maintained by Meituan operators. The category knowledge base is a high-quality manually labeled knowledge base.
[0081] The storage structure of the category knowledge base can be shown in Table 1.
[0082] Table 1
[0083] POI / SPU First level category Secondary Category Third level category Fuji Apple (SPU) Fresh Fruits and Vegetables fruit apple Haidilao(POI) gourmet food hot pot Sichuan / Chongqing hotpot Haidilao soup base (POI) Grain and oil seasoning Seasoning Hotpot Base Self-service hot pot (SPU) Fast Food Delicatessen Hot pot
[0084] Therefore, after obtaining the target entity included in the target search term, the category to which the target entity belongs can be queried in a predetermined category knowledge base.
[0085] For example, when the target entity is Haidilao, the category to which the target entity belongs is the food category; when the target entity is Haidilao soup base, the category to which the target entity belongs is the grain, oil and seasoning category; when the target entity is self-service hot pot, the category to which the target entity belongs is the cooked food and fast food category; when the target entity is hot pot, the category to which the target entity belongs is the food category.
[0086] For another example, when the target entity is Fuji apple, the categories to which the target entity queried in the category knowledge base belongs are: the first-level category, second-level category and third-level category corresponding to Fuji apple, that is, the categories to which Fuji apple belongs are: fresh fruits and vegetables, fruits and apples.
[0087] S150, setting a knowledge flag feature for each category in the category knowledge base according to the category to which the target entity belongs.
[0088] Specifically, after the category to which the target entity belongs is queried in the category knowledge base, knowledge flag features can be set for each category in the category knowledge base according to the category to which the target entity belongs. It can be understood that the knowledge flag features set for the category to which the target entity belongs are different from the knowledge flag features set for other categories in the category knowledge base. For example, the knowledge flag features set for the category to which the target entity belongs can be 1, while the knowledge flag features set for other categories in the category knowledge base can be 0.
[0089] In one implementation, setting a knowledge flag feature for each category in a category knowledge base according to the category to which the target entity belongs may include the following steps:
[0090] Step a: setting a first knowledge flag feature for the category to which the target entity belongs.
[0091] Step b: setting a second knowledge flag feature for other categories in the category knowledge base except the category to which the target entity belongs, wherein the second knowledge flag feature is different from the first knowledge flag feature.
[0092] In this implementation, in order to accurately introduce a high-quality external category knowledge base, after querying the category to which the target entity belongs in the category knowledge base, different knowledge flag features can be set for the category to which the target entity belongs and other categories in the category knowledge base. Among them, the first knowledge flag feature can be 0, and the second knowledge flag feature can be 0.
[0093] S160, determining the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base.
[0094] Specifically, in order to accurately determine the target category to which the target entity belongs, the category semantic features corresponding to each category in the category knowledge base are also combined.
[0095] In one implementation, S160, based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base, determine the target category to which the target search term belongs, such as Figure 2 As shown, the following steps may be included:
[0096] S161, obtaining the category semantic features corresponding to each category in the category knowledge base.
[0097] Specifically, a multi-layer deep neural network DNN structure can be used to encode the semantic representation of each category in the category knowledge base. Of course, other encoding methods can also be used to encode the semantic features of each category in the category knowledge base, and this application does not make specific limitations on this.
[0098] In practical applications, if the dimension of the category semantic feature is too large, it may affect the efficiency of category prediction. Therefore, as an implementation method of the embodiment of the present application, S161, obtaining the category semantic features corresponding to each category in the category knowledge base, may include the following steps, namely, step b1 to step b3:
[0099] Step b1, obtaining the first category semantic features of the first dimension corresponding to each category in the category knowledge base.
[0100] Step b2: reducing the dimension of the first category semantic features corresponding to each category to obtain the second category semantic features of the second dimension.
[0101] Step b3: for each category in the category knowledge base, determine the second category semantic feature corresponding to the category as the category semantic feature corresponding to the category.
[0102] In this implementation, the dimension of the category semantic feature can be reduced from the first dimension to the second dimension, and for each category, the second category semantic feature of the second dimension after the dimension reduction can be determined as the category semantic feature of the category. In this way, the dimension of the acquired category semantic feature is low, which can reduce the amount of calculation for predicting the target category to which the target search term belongs, that is, improve the efficiency of presetting the target category.
[0103] S162, for any category in the category knowledge base, concatenate the semantic feature, the knowledge flag feature corresponding to the category, and the category semantic feature corresponding to the category to obtain a concatenated feature.
[0104] From the above description, it can be seen that for any category in the category knowledge base, the knowledge flag feature of the category and the category semantic feature corresponding to the category are determined. In order to accurately determine the target category to which the target search term belongs in the subsequent steps, for any category in the category knowledge base, the semantic feature of the target search term, the knowledge flag feature corresponding to the category, and the category semantic feature corresponding to the category can be spliced to obtain the spliced feature. In other words, the number of categories in the category knowledge base is the same as the number of spliced features.
[0105] S163, input the concatenated features corresponding to each category in the category knowledge base into a pre-trained classifier to obtain a probability value corresponding to each category.
[0106] Specifically, after obtaining the concatenated features corresponding to each category in the category knowledge base, the concatenated features corresponding to each category can be input into a pre-trained classifier, and then the probability value corresponding to each category can be obtained.
[0107] The probability value corresponding to each category is used to represent the probability that the target search term belongs to the category. If the probability value corresponding to a category is large, then the probability that the target search term belongs to the category is high; if the probability value corresponding to a category is small, then the probability that the target search term belongs to the category is low.
[0108] S164: Determine the category whose probability value is greater than the preset probability value as the target category corresponding to the target search term.
[0109] Specifically, in actual applications, the target search term may belong to only one category, or the target search term may also belong to multiple categories at the same time. Therefore, the category with a probability value greater than the preset probability value can be determined as the target category corresponding to the target search term. The size of the preset probability value can be determined according to actual conditions, and the embodiment of the present application does not specifically limit the size of the preset probability value.
[0110] The technical solution provided in the embodiment of the present application obtains the target search term input by the user; extracts the semantic features of the target search term; extracts the target entity included in the target search term; queries the category to which the target entity belongs in a predetermined category knowledge base; sets knowledge flag features for each category in the category knowledge base according to the category to which the target entity belongs; and determines the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base. It can be seen that through the technical solution provided in the embodiment of the present application, when predicting the category, the entities included in the target search term are identified through the entity recognition task, and a high-quality category knowledge base is introduced. Finally, the target category to which the target search term belongs is determined through the semantic features of the target search term, the category knowledge flag features, and the category semantic features, thereby improving the accuracy of category prediction.
[0111] In order to describe the solution clearly, the category prediction method will be explained in detail with reference to specific examples.
[0112] like Figure 3 As shown, it can be achieved by Figure 3 The model shown is used to achieve category prediction.
[0113] from Figure 3 It can be seen that the overall architecture of the model is mainly divided into four parts: ①) Query semantic representation part, ② entity-based knowledge integration part, ③ category semantic representation part, and ④ feature fusion classification part.
[0114] Among them, ① In the query semantic representation part, the pre-trained model BERT is used to learn the deep semantic features in the user query. Figure 3 In the example, the user's query is "Chachia walnut flavored melon seeds". Figure 3 The solution is explained using BERT as an example. In practical applications, the pre-trained model may also be other models such as ERNIE, XLNET, MASS, etc. This application does not make any specific limitations on this.
[0115] ② Entity-based knowledge integration. Input the target search term into the NER model, and the NER model identifies the entities included in the target search term, such as merchant POI, product SPU, and brand BRAND. Figure 3The entity identified in the NER is identified as melon seeds; and the category to which the entity belongs is queried in the category knowledge base (Knowledge Base) according to the entity identified by NER, and the corresponding knowledge flag feature is set according to the queried category. Specifically, the knowledge flag feature set for the queried category can be 1, and the knowledge flag feature set for other categories in the category knowledge base can be 0.
[0116] Among them, the category knowledge base (Knowledge Base) is a multi-level category system of merchants or products filled in by merchant operators when the merchants or products are launched, and reviewed and maintained by Meituan operators, which is a high-quality knowledge base. In addition, the storage structure of the category knowledge base (Knowledge Base) is shown in Table 1 of the above embodiment, and is not specifically limited here.
[0117] ③ Category semantic representation part. Specifically, a multi-layer DNN structure can be used to encode the semantic representation of the category. This part takes the DNN encoding method as an example, and other encoding methods can also be used. This embodiment of the application does not specifically limit this.
[0118] Each category corresponds to a category semantic feature vector. Figure 3 As shown, category C1, category C2, ... and category C N Each of them corresponds to a category semantic feature vector Category N, and each category Category N can be used to represent the semantics of the category. Since the dimension of Category N is usually high, Category N can be reduced in dimension, such as Figure 3 As shown, Category N can be first reduced to 768 dimensions and finally to 256 dimensions.
[0119] ④ Feature fusion classification part. Specifically, after the query semantic representation, knowledge flag feature, and category semantic feature are spliced, they are classified through the classifier to determine the probability that the user query belongs to each category. Figure 3 As shown in the figure, P(Q,C1) is used to represent the probability value that the user query belongs to category C1, P(Q,C2) is used to represent the probability value that the user query belongs to category C2, ..., P(Q,C n ) is used to indicate that the user Query belongs to category C n Finally, the category with a probability value greater than the preset probability value can be determined as the target category to which the user's query belongs.
[0120] It should be noted that training Figure 3 In the model shown, the training data can be a data pair consisting of user query, category and entity components, wherein the method of constructing the training data is as follows:
[0121] (1) Based on user behavior data: Based on the user query click order behavior data in the category over a period of time in history, combined with the online entity recognition results, construct data composed of (user query, category, entity component). When constructing training data, focus on medium and high frequency user queries. In this way, the training data can be guaranteed to be consistent with the online data and have a high degree of accuracy.
[0122] (2) Based on the category knowledge base: Based on the relationship between merchant POI and category, the relationship between product SPU and category, and the relationship between brand BRAND and category in the manually operated category knowledge base, we construct data (POI / SPU / BRAND, category, entity component). This makes the training set more evenly distributed in categories and more complete, which can help solve the long-tail problem.
[0123] Through the technical solution provided in the embodiments of the present application, when predicting categories, the entities included in the target search terms are identified through the entity recognition task, and a high-quality category knowledge base is introduced. Finally, the target category to which the target search term belongs is determined through the semantic features of the target search term, the category knowledge flag features and the category semantic features, thereby improving the accuracy of category prediction.
[0124] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.
[0125] In a second aspect, the present application embodiment provides a category prediction device, referring to Figure 4 , the device comprises:
[0126] The search term acquisition module 410 is used to acquire the target search term input by the user;
[0127] A semantic feature extraction module 420, used to extract the semantic features of the target search term;
[0128] An entity extraction module 430 is used to extract target entities included in the target search term;
[0129] A category query module 440 is used to query the category to which the target entity belongs in a predetermined category knowledge base;
[0130] A knowledge flag feature setting module 450 is used to set a knowledge flag feature for each category in the category knowledge base according to the category to which the target entity belongs;
[0131] The category determination module 460 is used to determine the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base.
[0132] The technical solution provided in the embodiment of the present application obtains the target search term input by the user; extracts the semantic features of the target search term; extracts the target entity included in the target search term; queries the category to which the target entity belongs in a predetermined category knowledge base; sets knowledge flag features for each category in the category knowledge base according to the category to which the target entity belongs; and determines the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base. It can be seen that through the technical solution provided in the embodiment of the present application, when predicting the category, the entities included in the target search term are identified through the entity recognition task, and a high-quality category knowledge base is introduced. Finally, the target category to which the target search term belongs is determined through the semantic features of the target search term, the category knowledge flag features, and the category semantic features, thereby improving the accuracy of category prediction.
[0133] Optionally, the knowledge flag feature setting module is specifically used to:
[0134] Setting a first knowledge flag feature for the category to which the target entity belongs;
[0135] A second knowledge flag feature is set for other categories in the category knowledge base except the category to which the target entity belongs, and the second knowledge flag feature is different from the first knowledge flag feature.
[0136] Optionally, the category determination module includes:
[0137] A category semantic feature acquisition unit, used to acquire the category semantic features corresponding to each category in the category knowledge base;
[0138] A feature concatenation unit is used to concatenate the semantic feature, the knowledge flag feature corresponding to the category, and the category semantic feature corresponding to the category for any category in the category knowledge base to obtain a concatenated feature;
[0139] A probability value calculation unit, used to input the concatenated features corresponding to each category in the category knowledge base into a pre-trained classifier to obtain a probability value corresponding to each category;
[0140] The category determination unit is used to determine a category whose probability value is greater than a preset probability value as a target category corresponding to the target search term.
[0141] Optionally, the category semantic feature acquisition unit is specifically used to:
[0142] Acquire a first category semantic feature of a first dimension corresponding to each category in the category knowledge base;
[0143] Performing dimensionality reduction on the first category semantic features corresponding to each of the categories to obtain second category semantic features of a second dimension;
[0144] For each category in the category knowledge base, the second category semantic feature corresponding to the category is determined as the category semantic feature corresponding to the category.
[0145] Optionally, the semantic feature extraction module is specifically used to:
[0146] The target search term is input into a pre-trained semantic feature extraction model to obtain the semantic feature of the target search term.
[0147] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0148] In a third aspect, an embodiment of the present application shows an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the category prediction method described in the first aspect are implemented.
[0149] The technical solution provided in the embodiment of the present application obtains the target search term input by the user; extracts the semantic features of the target search term; extracts the target entity included in the target search term; queries the category to which the target entity belongs in a predetermined category knowledge base; sets knowledge flag features for each category in the category knowledge base according to the category to which the target entity belongs; and determines the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base. It can be seen that through the technical solution provided in the embodiment of the present application, when predicting the category, the entities included in the target search term are identified through the entity recognition task, and a high-quality category knowledge base is introduced. Finally, the target category to which the target search term belongs is determined through the semantic features of the target search term, the category knowledge flag features, and the category semantic features, thereby improving the accuracy of category prediction.
[0150] In a fourth aspect, an embodiment of the present application illustrates a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the category prediction method described in the first aspect are implemented.
[0151] The technical solution provided in the embodiment of the present application obtains the target search term input by the user; extracts the semantic features of the target search term; extracts the target entity included in the target search term; queries the category to which the target entity belongs in a predetermined category knowledge base; sets knowledge flag features for each category in the category knowledge base according to the category to which the target entity belongs; and determines the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base. It can be seen that through the technical solution provided in the embodiment of the present application, when predicting the category, the entities included in the target search term are identified through the entity recognition task, and a high-quality category knowledge base is introduced. Finally, the target category to which the target search term belongs is determined through the semantic features of the target search term, the category knowledge flag features, and the category semantic features, thereby improving the accuracy of category prediction.
[0152] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0153] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0154] The present application is described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0155] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0156] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0157] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0158] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0159] The above is a detailed introduction to a category prediction method, device, electronic device and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A category prediction method, characterized in that: The method comprises: Get the target search term entered by the user; Extracting semantic features of the target search term; Extracting target entities included in the target search term; Querying a predetermined category knowledge base for the category to which the target entity belongs; Setting a knowledge flag feature for each category in the category knowledge base according to the category to which the target entity belongs; Determine the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base; The determining the target category to which the target search term belongs based on the semantic feature, the knowledge flag feature corresponding to each category in the category knowledge base, and the category semantic feature corresponding to each category in the category knowledge base includes: Obtaining category semantic features corresponding to each category in the category knowledge base; For any category in the category knowledge base, the semantic feature, the knowledge flag feature corresponding to the category, and the category semantic feature corresponding to the category are spliced to obtain a spliced feature; Input the concatenated features corresponding to each category in the category knowledge base into a pre-trained classifier to obtain a probability value corresponding to each category; The category with a probability value greater than a preset probability value is determined as the target category corresponding to the target search term.
2. The method according to claim 1, characterized in that: The step of setting a knowledge flag feature for each category in the category knowledge base according to the category to which the target entity belongs includes: Setting a first knowledge flag feature for the category to which the target entity belongs; A second knowledge flag feature is set for other categories in the category knowledge base except the category to which the target entity belongs, and the second knowledge flag feature is different from the first knowledge flag feature.
3. The method according to claim 1, characterized in that The acquiring of the category semantic features corresponding to each category in the category knowledge base includes: Acquire a first category semantic feature of a first dimension corresponding to each category in the category knowledge base; Performing dimensionality reduction on the first category semantic features corresponding to each of the categories to obtain second category semantic features of a second dimension; For each category in the category knowledge base, the second category semantic feature corresponding to the category is determined as the category semantic feature corresponding to the category.
4. The method according to any one of claims 1 to 3, characterized in that: The extracting the semantic features of the target search term includes: The target search term is input into a pre-trained semantic feature extraction model to obtain the semantic feature of the target search term.
5. A category prediction device, characterized in that: The device comprises: A search term acquisition module, used to acquire a target search term input by a user; A semantic feature extraction module, used to extract the semantic features of the target search term; An entity extraction module, used to extract target entities included in the target search term; A category query module, used to query the category to which the target entity belongs in a predetermined category knowledge base; A knowledge flag feature setting module, used to set knowledge flag features for each category in the category knowledge base according to the category to which the target entity belongs; A category determination module, configured to determine the target category to which the target search term belongs based on the semantic features, the knowledge flag features corresponding to each category in the category knowledge base, and the category semantic features corresponding to each category in the category knowledge base; The category determination module includes: A category semantic feature acquisition unit, used to acquire the category semantic features corresponding to each category in the category knowledge base; A feature concatenation unit is used to concatenate the semantic feature, the knowledge flag feature corresponding to the category, and the category semantic feature corresponding to the category for any category in the category knowledge base to obtain a concatenated feature; A probability value calculation unit, used to input the concatenated features corresponding to each category in the category knowledge base into a pre-trained classifier to obtain a probability value corresponding to each category; The category determination unit is used to determine a category whose probability value is greater than a preset probability value as a target category corresponding to the target search term.
6. The device according to claim 5, characterized in that The knowledge flag feature setting module is specifically used to: Setting a first knowledge flag feature for the category to which the target entity belongs; A second knowledge flag feature is set for other categories in the category knowledge base except the category to which the target entity belongs, and the second knowledge flag feature is different from the first knowledge flag feature.
7. The device according to claim 5, characterized in that The category semantic feature acquisition unit is specifically used to: Acquire a first category semantic feature of a first dimension corresponding to each category in the category knowledge base; Performing dimensionality reduction on the first category semantic features corresponding to each of the categories to obtain second category semantic features of a second dimension; For each category in the category knowledge base, the second category semantic feature corresponding to the category is determined as the category semantic feature corresponding to the category.
8. The device according to any one of claims 5 to 7, characterized in that The semantic feature extraction module is specifically used for: The target search term is input into a pre-trained semantic feature extraction model to obtain the semantic feature of the target search term.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the category prediction method according to any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the category prediction method according to any one of claims 1 to 4 are implemented.
