Search result display method, computer equipment and storage medium
By querying and calculating entity correlation scores in the target knowledge graph, the problem of inaccurate correlation measurement caused by complex product titles is solved, and the accurate sorting and display of search results is achieved, improving user experience.
Patent Information
- Application Number
- CN202511045219.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-07-29
AI Technical Summary
In the prior art, product titles are set in complex to increase exposure, which makes it impossible to accurately measure the correlation between user search terms and products in the product list through similarity calculation, resulting in large differences in display order and actual correlation, and it is impossible to accurately display related products.
By obtaining the target product of the search terms and preliminary search results, the first entity associated with the search terms is extracted, the product title is extracted to obtain the second entity set, and the third entity set is queryed in the target knowledge graph, the entity correlation score is calculated using the cross attention and self-attention mechanism, the correlation between the search terms and the target product is determined, and the correlation between the search terms and the target product is then sorted and displayed.
It realizes sorting from high to low according to the correlation between search terms and products, accurately displays search results, improves user experience, avoids the problem of "keyword stacking and matching", and improves the depth and accuracy of semantic understanding.
Smart Images

Figure CN120541320A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a search result display method, a computer device, and a storage medium. Background Art
[0002] At present, there are many categories of goods on various commodity sales platforms, and the number of goods is unimaginable. Therefore, various commodity sales platforms generally have a search function, and users can use the search function to obtain a list of goods they want to buy.
[0003] In related technologies, users can enter the name of the product they want to order in a search box, and then a certain search algorithm can be used to determine the products that meet the conditions, thereby obtaining a product list. After that, each product in the product list can be displayed based on the similarity between each product and the name of the product the user wants to order.
[0004] However, product titles are often complex, often created by merchants to maximize exposure. Consequently, similarity calculations in the aforementioned approach cannot accurately measure the relevance between the product a user searches for and the individual products in the searched product list. This can lead to significant discrepancies between the order in which products are displayed and their actual relevance, hindering the accurate display of relevant products for users. Summary of the Invention
[0005] This application provides a search result display method, apparatus, computer device, and storage medium that can accurately calculate the correlation between search terms and search results, thereby accurately displaying search results and improving user experience. The technical solution includes the following content.
[0006] In a first aspect, a method for displaying search results is provided, the method comprising: Obtaining a search term and a plurality of target products obtained after a preliminary search for the search term; Extracting the search term to obtain a first entity associated with the search term, and extracting information from a product title of any one of the multiple target products to obtain an associated second entity set, where the second entity set includes one or more entities; According to the relationship between each entity in the second entity set and the first entity, query in the target knowledge graph to obtain a third entity set, wherein the third entity set includes one or more entities; determining, based on an association score between each entity in the third entity set and each entity in the second entity set, a correlation between the search term and the target product; The target products are sorted based on the order of the relevance between each target product and the search term from high to low, so that the terminal device can display the target products with the relevance from high to low to the user in response to the search term.
[0007] In this application, after extracting the first entity and the second entity set, a third entity set is obtained based on the relationship between each entity in the second entity set and the first entity in the target knowledge graph. This query obtains entities with the same entity relationship as the entity corresponding to the target product, so that both the search term and the target product contain entities with the same entity relationship. This allows for precise expansion of the entities corresponding to the search term, and subsequently allows for the association score between entities at the same entity relationship level to be accurately determined. This allows for the association score between each entity in the third entity set and each entity in the second entity set to be accurately determined, and the correlation between the search term and the target product to be subsequently calculated based on this. Compared to the prior art method of limiting the surface text matching between the product title and the search term, this method can expand the scope of entity matching for semantic associations to achieve entity relationship calculation at the same level, thereby accurately determining the correlation between the search term and the target product. Finally, based on the order of the correlation between each target product and the search term, the multiple target products are sorted from high to low, so that the multiple target products are sorted according to the degree of correlation with the search term. In this way, the target products displayed on the terminal can be displayed according to the size of the relevance. That is, the closer the target product is displayed, the higher the relevance between it and the search term, which means it is likely to be the user's expected product. Therefore, through the entire process, the user terminal can achieve accurate display of search results, which can improve the user experience.
[0008] In conjunction with the first aspect, in certain implementations of the first aspect, extracting the search term to obtain the first entity associated with the search term includes: The search term is input into a first entity extraction model, and the search term is extracted by the first entity extraction model to obtain a first entity associated with the search term.
[0009] In combination with the first aspect and the above implementations, in certain implementations of the first aspect, the first entity extraction model includes a character embedding layer, a word embedding layer, and a dictionary adapter, and inputting the search term into the first entity extraction model, extracting the search term using the first entity extraction model, and obtaining a first entity associated with the search term includes: Representing the search term as a character sequence, and matching the word corresponding to each character in the character sequence in a preset dictionary to obtain a target sequence, wherein the target sequence includes a matching pair consisting of each character and the corresponding word; For any matching pair in the target sequence, input the characters in the matching pair into the character embedding layer to obtain the character vector of the character, and input each word in the matching pair into the word embedding layer to obtain the word vector of each word; Inputting the character vector of the character and the word vector of each word into a dictionary adapter, calculating a first attention weight between the character vector and the word vector of each word through the dictionary adapter based on a bilinear attention mechanism, and performing a weighted summation on the word vectors of each word matched by the character based on the first attention weight to obtain a weighted word vector corresponding to the character; adding the character vector of the character to the weighted word vector to obtain an entity feature corresponding to the character; The entity features corresponding to each character in the character sequence of the search term are fused to obtain a first entity associated with the search term.
[0010] In this implementation, by processing the character-word pair sequence through the character embedding layer, the word embedding layer, and the dictionary adapter, the word features in the dictionary are integrated with the model's character / word embedding representations, further improving the model's ability to capture the semantic meaning of the vocabulary. Furthermore, by adding the character vector of the character to the weighted word vector, the model can simultaneously utilize character-level and word-level information, enriching the model's feature representation and enabling more accurate entity recognition.
[0011] In combination with the first aspect and the above implementations, in certain implementations of the first aspect, extracting information from the product title of any one of the multiple target products to obtain the associated second entity set includes: For any one of the plurality of target products, inputting the product title of the target product into a summary extraction model, extracting a summary of the product title of the target product by the summary extraction model, and outputting summary information of the product title of the target product; The summary information is input into a second entity extraction model, entities are extracted from the summary information using the second entity extraction model, and the second entity set is output.
[0012] In the above implementation method, the product title of the target product is first summarized to extract the key information of the product title and simplify the product title, and then entity extraction is performed on the summary information of the product title. Compared with directly extracting entities from the product title, the above entity extraction process is based on the key information obtained after simplification. This can reduce the computational complexity of the model and enable the model to process directly based on the key information of the product title, which can improve the accuracy of entity extraction and thus obtain a more accurate second entity set.
[0013] In combination with the first aspect and the above implementation, in some implementations of the first aspect, querying the target knowledge graph to obtain a third entity set based on the relationship between each entity in the second entity set and the first entity includes: Based on the first entity, querying the target knowledge graph for a first candidate entity; Querying the target knowledge graph for an entity having the relationship with the first candidate entity to obtain a second candidate entity; The first candidate entity and the second candidate entity are determined as entities in the third entity set.
[0014] In the above implementation, the third entity set is obtained by locating the first entity in the target knowledge graph and then querying the entities that have the relationship between the located entity and the entities in the second entity set, so that the first entity is expanded in a convenient way, thereby facilitating the query of the third entity set in the target knowledge graph.
[0015] In combination with the first aspect and the above implementations, in some implementations of the first aspect, the method further includes: Input each entity in the second entity set into the relationship extraction model, perform relationship extraction on each entity through the relationship extraction model, and obtain the relationship between each entity in the second entity set. The relationship extraction model is trained based on the entities in the target knowledge graph and the relationships between the entities.
[0016] In the above implementation, the relationship extraction model is obtained by training each entity in the target knowledge graph and the relationships between each entity, so that the relationship extraction model can learn the relationships between various entities, thereby enabling the relationship extraction model to identify the relationships between entities. In addition, if the target knowledge graph can accurately describe the relationships between different entities, then training the relationship extraction model with each entity in the target knowledge graph and the relationships between each entity can improve the model's ability to extract entity relationships, and thus the relationship extraction model can accurately identify the relationship between each entity in the second entity set.
[0017] In combination with the first aspect and the above implementations, in some implementations of the first aspect, the method further includes: Based on a cross-attention mechanism, a relevance score between each entity in the third entity set and each entity in the second entity set is determined.
[0018] In the above implementation, the association score between each entity in the third entity set and each entity in the second entity set is determined based on the cross-attention mechanism, so that the cross-attention mechanism can fully utilize the characteristic of capturing the correlation between two input sequences to determine the association score, thereby accurately determining the association score, that is, the correlation between each entity in the third entity set and each entity in the second entity set can be accurately determined.
[0019] In combination with the first aspect and the foregoing implementations, in certain implementations of the first aspect, determining, based on a cross-attention mechanism, a relevance score between each entity in the third entity set and each entity in the second entity set includes: Determining a query vector for each entity in the third entity set, and determining a key vector and a value vector for each entity in the second entity set; For an i-th entity in the third entity set and a j-th entity in the second entity set, determining a similarity score between a query vector of the i-th entity and a key vector of the j-th entity; Normalizing the similarity score to obtain a second attention weight; A weighted sum is performed on the value vector of the j-th entity based on the second attention weight to obtain a correlation score between the i-th entity and the j-th entity.
[0020] In the above implementation, similarity is calculated based on the query vector of the i-th entity in the third entity set and the key vector of the j-th entity, where the query vector comes from the entities in the third entity set and the key vector comes from the entities in the second entity set. This approach allows for flexible interaction between the two sequences. This allows for the subsequent accurate calculation of the association score between the i-th and j-th entities.
[0021] In combination with the first aspect and the foregoing implementations, in certain implementations of the first aspect, determining, based on a cross-attention mechanism, a relevance score between each entity in the third entity set and each entity in the second entity set includes: Determining, based on a self-attention mechanism, a self-attention score between each entity in the second entity set and the remaining entities; Based on the self-attention score, filter out a reference entity from the second entity set to update the second entity set, where the self-attention scores between the reference entity and the remaining entities in the second entity set meet a preset condition; Based on a cross-attention mechanism, a correlation score between each entity in the third entity set and each entity in the updated second entity set is determined.
[0022] In the above implementation, by first determining the self-attention scores between different entities in the second entity set, and screening out entities in the second entity set whose self-attention scores meet preset conditions, the entities in the second entity set that will interfere with the calculation of the correlation between the search term and the target product can be filtered out. Then, the correlation between the search term and the target product can be accurately calculated based on the association score between each entity in the third entity set and each entity in the updated second entity set.
[0023] In combination with the first aspect and the foregoing implementations, in certain implementations of the first aspect, before determining the relevance between the search term and the target product based on the association score between each entity in the third entity set and each entity in the second entity set, the method further includes: Obtaining a self-attention score between each entity and the remaining entities in the second entity set; Determining the relevance between the search term and the target product according to the association score between each entity in the third entity set and each entity in the second entity set includes: Determine the relevance between the search term and the target product based on the association score and the self-attention score.
[0024] In the above implementation, the association score can directly measure the explicit relevance between the search term and the target product, the self-attention score can indicate the association relationship between entities in the second entity set, and can evaluate the internal consistency of the product characteristics. Then, in the process of determining the correlation between the search term and the target product based on the association score, the self-attention score is used to guide the process of determining the correlation, so that in the process of determining the correlation based on the association score, the association relationship between entities in the second entity set can be fully considered. The combination of the two can avoid the problem of "keyword stacking matching", help the depth of semantic understanding, and thus determine a more accurate correlation between the search term and the target product.
[0025] In combination with the first aspect and the above implementations, in certain implementations of the first aspect, determining the relevance between the search term and the target product based on the association score and the self-attention score includes: The self-attention score is input into a correlation calculation model, and the association score is input into the correlation calculation model. The correlation calculation model combines the self-attention score and the association score to determine the correlation between the search term and the target product.
[0026] In combination with the first aspect and the above implementation, in certain implementations of the first aspect, determining the correlation between the search term and the target product by combining the self-attention score and the association score with the correlation calculation model includes: performing a weighted summation of the association score and the self-attention score based on a first weight and a second weight by the correlation calculation model, and normalizing the weighted summation result to obtain a reference score, where the first weight and the second weight are model weights learned by the correlation calculation model during training; Determining the relevance level between the search term and the target product according to the reference score using the relevance calculation model; The preset score corresponding to the correlation level is determined as the correlation score between the search term and the target product through the correlation calculation model. The multiple correlation levels correspond to multiple preset scores. The multiple correlation levels correspond one-to-one to the multiple preset scores. The correlation score is used to represent the correlation between the search term and the target product.
[0027] In the above implementation method, the correlation level between the search term and the target product is first determined based on the self-attention score and the association score, and then the correlation score between the search term and the target product is determined based on the correlation level, so that the correlation between the search term and the target product can be accurately determined.
[0028] In combination with the first aspect and the above implementations, in some implementations of the first aspect, the method further includes: Obtaining a target training set, the target training set including a plurality of training samples, the plurality of training samples being obtained based on a user's historical behavior log, the historical behavior log being composed of a plurality of sub-behavior logs, each of the plurality of sub-behavior logs including a search term, search result, and behavior operation data generated by the user when using a search function; The correlation calculation model is trained based on the target training set.
[0029] In the above implementation method, the correlation calculation model is trained by combining the user's historical behavior log, which is equivalent to integrating the user's preference data during the correlation calculation model training process, which can improve the calculation accuracy of the correlation calculation model. In the subsequent correlation calculation model, the correlation score between the target product and the search term can be intelligently calculated. For example, the correlation score between the target product that meets the user's preference and the search term is higher.
[0030] In combination with the first aspect and the above implementations, in some implementations of the first aspect, obtaining a target training set includes: Obtaining the historical behavior log; For any sub-behavior log in the historical behavior log, the search term in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs; Counting the number of clicks on each of the plurality of recommended products based on the behavioral operation data in the historical behavior log; Determining, based on the number of clicks on the multiple recommended products, the correlation between the search terms and the recommended products in the multiple candidate sample pairs; A plurality of training samples in the target training set are determined based on a plurality of candidate sample pairs corresponding to each sub-behavior log in the historical behavior log, the number of clicks, and the correlation between the search terms and the recommended products in the plurality of candidate sample pairs.
[0031] In combination with the first aspect and the above implementations, in certain implementations of the first aspect, the multiple training samples include positive training samples and negative training samples, and determining the multiple training samples in the target training set based on the multiple candidate sample pairs corresponding to each sub-behavior log in the historical behavior log, the number of clicks, and the correlation between the search term and the recommended product in the multiple candidate sample pairs includes: For any sub-behavior log in the historical behavior log, and any candidate sample pair among the multiple candidate sample pairs corresponding to the sub-behavior log, determine the cross-attention score and self-attention score corresponding to the candidate sample pair based on the search term and the product title of the recommended product in the candidate sample pair; and determine the cross-attention score and self-attention score corresponding to the candidate sample pair and the correlation between the search term and the recommended product in the candidate sample pair as the training sample corresponding to the candidate sample pair; If the number of clicks on the recommended product in the candidate sample pair is greater than or equal to a preset number threshold, determining the training sample corresponding to the candidate sample pair as a positive training sample; When the number of clicks on the recommended product in the candidate sample pair is less than the preset number threshold, the training sample corresponding to the candidate sample pair is determined to be a negative training sample.
[0032] In a second aspect, a search result display device is provided, the device comprising: A first acquisition module is used to acquire a search term and a plurality of target products obtained after a preliminary search of the search term; an information processing module, configured to extract the search term to obtain a first entity associated with the search term; and further configured to extract information from a product title of any one of the plurality of target products to obtain an associated second entity set, wherein the second entity set includes one or more entities; a query module, configured to query the target knowledge graph to obtain a third entity set based on the relationship between each entity in the second entity set and the first entity, wherein the third entity set includes one or more entities; a first determining module, configured to determine the relevance between the search term and the target product based on an association score between each entity in the third entity set and each entity in the second entity set; A sorting module is used to sort the multiple target products based on the order of relevance between each of the multiple target products and the search term from high to low, so that the terminal device can display the multiple target products with relevance from high to low to the user in response to the search term.
[0033] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the above-mentioned search result display method when executed by the processor.
[0034] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned search result display method is implemented.
[0035] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of the above-mentioned search result display method.
[0036] It can be understood that the beneficial effects of the second, third, fourth and fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0038] Figure 1 This is a scenario diagram of a search result display method provided in an embodiment of the present application; Figure 2 This is a schematic diagram of another search result display method provided in an embodiment of the present application; Figure 3 This is a scenario diagram of another search result display method provided in an embodiment of the present application; Figure 4 This is a schematic diagram of the structure of a large language model provided in an embodiment of the present application; Figure 5 This is a flowchart of a search result display method provided by an embodiment of the present application; Figure 6 This is an overall framework diagram of a search result display method provided in an embodiment of the present application; Figure 7 This is a model structure diagram of a first entity extraction model provided in an embodiment of the present application; Figure 8 This is a schematic diagram of the structure of a target knowledge graph provided in an embodiment of the present application; Figure 9 This is a flow chart of a cross-attention mechanism provided by an embodiment of the present application; Figure 10 This is a flow chart of the application architecture of a large language model provided by an embodiment of the present application; Figure 11 This is a structural diagram of a search result display device provided in an embodiment of the present application; Figure 12 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0040] It should be understood that the “multiple” mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, words such as “first” and “second” are used to distinguish between identical or similar items with basically the same functions and effects. Those skilled in the art can understand that words such as “first” and “second” do not limit the quantity and execution order, and words such as “first” and “second” do not necessarily limit them to be different.
[0041] The application scenarios of the embodiments of the present application are first described.
[0042] For ease of understanding, the following example uses a scenario where a user searches for a product through the first application (e.g., application A) installed on a mobile phone. Figure 1 This is a scene diagram of a search result display method provided by an embodiment of the present application. Figure 1 Give a detailed explanation.
[0043] For example, Figure 1 (a) in the figure shows interface 101 displayed on a mobile phone in unlocked mode. Interface 101 displays a weather clock component and multiple applications (apps). Applications may include phone, messages, settings, and application A. It should be understood that interface 101 may also include other applications, and this embodiment of the application is not limited to this.
[0044] like Figure 1 As shown in (a) in the figure, the user clicks the icon of application A. In response to the user's click operation, the mobile phone displays the following Figure 1 The main interface 102 of application A shown in (b) of FIG. 1 may also be referred to as the "homepage of application A." The main interface 102 of application A may display multiple category menus, operable controls or buttons, images, and other interface content to meet the user's usage needs.
[0045] For example, Figure 1As shown in Figure (b), the main interface 102 of the application A displays the current delivery address (for example, "XX District XX Street"), the first search box 10, and different classification menus such as food takeout, supermarkets, fruits, flower gifts, desserts, hamburgers, lobsters and barbecue, as well as a list of merchants. The embodiment of the present application does not limit the display content, the size of the display area, etc. on the main interface 102 of the application A. Currently, on the main interface 102 of the application A, one or more merchants can be displayed to the user in the merchant list, and the user can view more merchant information by sliding up and down. Optionally, each merchant display area can display one or more contents such as the merchant's user rating, monthly sales volume, delivery time, delivery distance, minimum delivery price, delivery fee, promotional information, etc. For example, as Figure 1 As shown in (b), the display area of Malatang A shows promotional information such as user rating 4.9 points, monthly sales of 443, delivery time 23 minutes, delivery distance from the current device 1.2km, minimum delivery price 20 yuan, delivery fee 6 yuan, and 8 yuan no threshold.
[0046] For example, the user can search for products through the first search box 10 on the main interface 102. First, the user can enter the corresponding search term in the first search box 10. For example, if the user wants to search for red bean milk tea, he can enter "red bean milk tea" in the first search box 10 and then click the search button. In response to the user's click, the mobile phone can display the following results: Figure 1 The product display interface 103 shown in (c) in FIG.
[0047] The product display interface 103 is used to display the search results obtained after searching the search term. The search results include multiple recommended products, that is, multiple products related to the search term. For example, Figure 1 As shown in (c) of FIG. 1 , product display interface 103 displays multiple recommended products after searching for "red bean milk tea," including "Xiangsi Red Bean Milk Tea," "Brown Sugar Boba Milk Tea," and "Signature Red Bean Milk Tea." Users can scroll up and down to view more recommended products and click on the display area of any recommended product to view its detailed information.
[0048] like Figure 1As shown in (c), the product display interface 103 first displays "Xiangsi Red Bean Milk Tea", then displays "Brown Sugar Boba Milk Tea", and finally displays "Signature Red Bean Milk Tea", while the search term is "Red Bean Milk Tea". Among them, "Brown Sugar Boba Milk Tea" has little relevance to "Red Bean Milk Tea", but it is ranked before "Signature Red Bean Milk Tea". Therefore, the display order of the multiple recommended products displayed in the product display interface 103 does not match the actual relevance order between the multiple recommended products and the search term, and thus the product display interface 103 cannot accurately display search results for users.
[0049] When a user browses through the multiple recommended products found in the product display interface 103, visually, the user will first browse the brown sugar boba milk tea which has little relevance to "red bean milk tea". For the user, this will make the user feel that the search results do not meet their expectations, thereby reducing the user's search experience.
[0050] Furthermore, on commodity sales platforms, there are numerous categories and an unimaginable number of products. To gain greater exposure, merchants often choose to optimize product titles, such as setting more complex product titles and adding as many tags as possible to the products. For example, for the product "red roses," a product title like "Red Roses for Girlfriend's Valentine's Day Birthday Gift" is often set to make the product "red roses" easier to search for. Therefore, when the product title is optimized, there will be multiple complex relationships in the product title, making it difficult to accurately measure the correlation between the search term and the product title. Consequently, the display of search results will not meet user expectations, thereby reducing the user experience.
[0051] Therefore, in response to the above problems, an embodiment of the present application provides a search result display method, which can accurately calculate the correlation between the search terms and the products in the search results, and thus can achieve accurate display of the search results on the user's terminal device, thereby improving the user experience.
[0052] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0053] It should be noted that, during the process of developing the target application, technical personnel can configure the search result display method in the product search function of the target application, so that when the target application searches for the search term, the search results can be displayed based on the search result display method provided in the embodiment of this application.
[0054] In the first possible way, the search result display method can be configured in the product search function on the main interface, so that when the user uses the product search function through the main interface, the search results can be displayed based on the search result display method provided in the embodiment of the present application.
[0055] In the above method, the user can trigger the product search function on the main interface of the target application. When the product search function is triggered and the search term is searched, the search result display method can be used to sort the search results so that the user's terminal device can display the sorted search results.
[0056] It should be noted that the process of users using the product search function in the above manner is also the above Figure 1 The user operation process described in the embodiment, that is, the user can Figure 1 The operation process described in the embodiment is used to search for products, and then the search results can be sorted based on the search result display method provided in the embodiment of the present application, so that the user's terminal device can display the sorted search results.
[0057] In the second possible way, the search result display method can be configured in the product search function of the merchant store, so that when the user uses the product search function through a merchant store, the search result display method can be used to sort the search results searched from this merchant store, so that the user's terminal device can display the sorted search results.
[0058] In the target application, the product search function can be used not only through the main interface, but a search box is also set up in the merchant's store page, so that the product search function also exists for the merchant's store.
[0059] For example, Figure 2 This is a scenario diagram of another search result display method provided in an embodiment of the present application.
[0060] like Figure 2 As shown in (a) in the figure, a merchant list can be displayed on the main interface 102 of application A. The merchant list can display one or more merchants for the user. The user can view more merchant information by sliding up and down. The user can also enter the merchant store of the clicked merchant by clicking on the display area of the merchant. For example, the user can click Figure 2 In the "C Bakery" display area 20 shown in (a), the mobile phone may display the following in response to the user's click: Figure 2 The merchant store interface 202 shown in (b) can display merchant information (such as ratings, sales volume, discount information, etc.) and a product list for users. The product list can display one or more products sold by the merchant.
[0061] Exemplarily, the merchant store interface 202 may further include a first search control 30, which is used to provide a product search function within the store. When the user clicks on the first search control 30, the mobile phone may display the following information in response to the user's click: Figure 2 In the first product search interface 203 shown in (c), the user can search for products in the first product search interface 203.
[0062] For example, the first product search interface 203 may include a second search box 40. The user may enter a search term in the second search box 40. After the search term is searched and the search results are obtained, the search results may be displayed based on the search result display method provided in the embodiment of the present application. Then, the mobile phone may display the products obtained by searching for the search term, such as Figure 2 In the first search result display interface 204 shown in (d), the product is a product that meets the search criteria and is found by searching the merchant's store for the search term entered by the user. In addition, the first product search interface 203 may also display some commonly searched search terms, and the user can click any of these commonly searched search terms to perform a corresponding search.
[0063] like Figure 2 As shown in (c) in the figure, the user enters "cake" in the second search box 40. Then, in response to the search term entered by the user, the mobile phone can send the search term entered by the user to the server. Then, the server can search for all products in "C Bakery" for the search term entered by the user, so as to search for all products with the "cake" as the product. Then, the server can sort the searched products based on the search result display method provided in the embodiment of the present application, and send the sorted results to the mobile phone. After receiving the sorted results, the mobile phone can display the results according to the sorted results. Figure 2 The first search result display interface 204 shown in (d) in FIG. Figure 2 As shown in (d) in FIG. 1 , the first search result display interface 204 displays all products related to “cake” in “C bakery”.
[0064] In a third possible method, the search result display method can be configured in the product search function of each category menu, so that when the user uses the product search function through any category menu, the search result display method can be used to sort the search results, so that the user's terminal device can display the sorted search results.
[0065] For example, Figure 3 This is a scenario diagram of another search result display method provided in an embodiment of the present application.
[0066] like Figure 3As shown in (a) in the figure, the main interface 102 of the application A displays the current delivery address, a search box, and different category menus such as food takeout, supermarket, fruit, flower gifts, dessert, hamburger, lobster and barbecue. The user can click on the corresponding category menu to enter the channel corresponding to the clicked category menu.
[0067] For example, when the user clicks on the "Flowers and Gifts" category menu on the main interface 102, the mobile phone may display the following information in response to the user's click: Figure 3 The flower gift interface 302 shown in (b) of FIG. Flower gift interface 302 may display a third search box 50, a gift guide, and a list of merchants or products selling flower gifts. Furthermore, it may display different flower gift categories, such as "holiday bouquets," "fruit gift boxes," "snack gift boxes," and "trendy toys." Users can scroll up and down to view more merchant or product information.
[0068] The third search box 50 on the flower gift interface 302 is used to provide the user with a product search function within the flower gift channel. For example, when the user clicks on the third search box 50, the mobile phone may display the following information in response to the user's click: Figure 3 The second product search interface 303 shown in (c) of FIG. The user can search for the desired product in the flower gift channel through the second product search interface 303.
[0069] For example, the second product search interface 303 may include a second search control 60. The user may enter a search term in the second search control 60 and click the search button. The search results may then be displayed based on the search result display method provided in the embodiment of the present application. The search results may then be displayed on the mobile phone, such as Figure 3 The second search results display interface 304 shown in (d) above displays matching products found within the flower and gift channel for the user's search term. Furthermore, the second product search interface 303 may also display historical search results and search findings. These historical search results and search findings may provide users with corresponding search terms, allowing them to click on any of these search terms to initiate a search.
[0070] like Figure 3As shown in (c) in the figure, the user can enter the search word "rose" in the second search control 60, and after the user clicks the search button, in response to the user's operation, the mobile phone can send the search word entered by the user to the server. The server can then search for products in the flower gift channel for the search word "rose" entered by the user and obtain search results. The server can then sort the search results based on the search result display method provided in the embodiment of the present application and send the sorted results to the mobile phone. After receiving the sorted results, the mobile phone can display the results according to the sorted results. Figure 3 The second search result display interface 304 shown in (d) in FIG.
[0071] The above embodiment introduces the operation process of a user using the product search function in a target application from the user interaction level. The following drawings provided in the embodiment of the present application are used to illustrate the specific implementation of the search result display method.
[0072] Before introducing the search result display method, the professional terms involved in the embodiments of the present application are first explained.
[0073] 1. Knowledge Graph A knowledge graph is a structured form of knowledge representation. It is essentially a graph-based data result consisting of nodes (entities / concepts) and edges (relationships). It is usually used to store entities and the relationships between them and can provide rich semantic information. Therefore, it is widely used in search engines, recommendation systems, voice assistants and other fields to enhance the system's understanding and reasoning capabilities.
[0074] 2. Entity Relevance Entity relevance refers to the degree of association or closeness of semantic connection between two or more entities. It is a core metric for measuring whether there is a direct or indirect relationship between entities. Entity relevance is typically calculated using methods based on graph structure, semantic similarity, machine learning, or knowledge reasoning.
[0075] 3. Entity Extraction Entity extraction, also known as named entity recognition (NER), aims to automatically identify and extract entities with specific meanings (such as dish names, brand names, personal names, and place names) from unstructured text and label their categories. NER typically uses machine learning models such as conditional random fields (CRFs), recurrent neural networks (RNNs), or transformers to label entity categories in text. This technology has been widely used in information extraction, question-answering systems, and semantic analysis.
[0076] 4. Relation Extraction (RE) Relation extraction (RE) is a task in natural language processing that aims to automatically identify relationships between entities in text. This involves identifying the entities, the types of relationships between them (such as work relationships, family relationships, and location relationships), and the direction of the relationships. Relation extraction (RE) is a key technology for building knowledge graphs. It enables computers to understand structured information in text, thereby enhancing the comprehension and reasoning capabilities of intelligent systems. Currently, traditional machine learning and deep learning methods are commonly used to implement relationship extraction.
[0077] 5. Abstract Extraction Summarization is the process of extracting the core content from text, documents, or other information carriers to create a concise and accurate summary of the original text's main points, key data, core conclusions, and other information. This is typically achieved through traditional natural language processing techniques or intelligent algorithms based on deep learning.
[0078] 6. Large Language Model (LLM) A large language model is an AI system based on deep learning. By learning from massive amounts of text data, it can grasp the grammar, semantics, and context of a language and perform various complex natural language processing tasks such as text generation, translation, question answering, and summarization. Large language models are typically based on a transformer architecture, such as the bidirectional pre-trained language model BERT and the generative pre-trained language model GPT. Their strength lies in their ability to handle long-range dependencies and understand complex contexts.
[0079] For example, Figure 4 This is a schematic diagram of the structure of a large language model provided in the embodiment of this application. Figure 4 The model structure shown includes a word embedding layer, a Transformer block, a feature map layer, and a Softmax layer.
[0080] The word embedding layer maps discrete tokens (the smallest unit after the input data is segmented) into continuous vectors of fixed dimension, allowing the model to capture the semantic relationships and similarities between tokens. After the word embedding layer outputs the continuous vector, positional encoding can be performed to supplement the positional information of the tokens (since the Transformer itself has no sense of order, positional encoding is required to enable the model to distinguish sequence order).
[0081] The Transformer block is composed of a masked multi-head self-attention mechanism, residual connections, layer normalization, and a point-by-point feedforward network. It captures local and global dependencies in the sequence by gradually encoding context information. In the embodiment of the present application, the Transformer block can be stacked in multiple layers to form a model structure, that is, Figure 4 The model structure shown can include multiple stacked Transformer blocks.
[0082] Among them, the masked multi-head self-attention mechanism enables the model to perform multiple sets of self-attention parallel calculations to focus on the correlation between different dimensions and different positions, thereby enhancing the expressiveness of the model. Residual connection: used to directly add the input and output of the previous layer to alleviate the gradient vanishing problem in deep networks, making the model easier to train. Layer normalization: normalizes the features after the residual connection (mean method, standard deviation method, etc.) to make the model easier to calculate. Point-by-point feedforward network: used to perform nonlinear transformations on the features of each token to further refine information and enhance model fitting capabilities.
[0083] Feature mapping layer: maps the feature vector output by the Transformer block to the "vocabulary dimension" through the word embedding matrix.
[0084] The Softmax layer is used to convert the "vocabulary dimension" features output by the feature mapping layer into the probability distribution of each token in the vocabulary. The essence of the Softmax layer is to implement the corresponding generation task and to predict the probability of the expected output text.
[0085] To illustrate the overall process, the model receives input data (e.g., a paragraph of text) and first segments the text into multiple discrete tokens. These discrete tokens are then fed into a word embedding layer for word embedding, followed by positional encoding. The resulting continuous vector, after word embedding and positional encoding, is then fed into a masked multi-head self-attention mechanism to capture correlations between different dimensions and positions in the sequence. The input and output of the masked multi-head self-attention mechanism are then summed via a residual connection and normalized via layer normalization. The resulting layer-normalized features are then fed into a point-by-point feedforward network for a nonlinear transformation to further extract information. The input and output of the point-by-point feedforward network are then summed via a residual connection and normalized. Finally, the feature vector from the last residual connection and layer normalization layer of the Transformer block is fed into a feature mapping layer, which maps the feature vector to the vocabulary dimension. Finally, a softmax layer transforms the vocabulary-dimensional features output by the feature mapping layer into a probability distribution for each token in the vocabulary. Finally, the model outputs the corresponding output data based on the probability distribution of each token in the vocabulary output by the Softmax layer.
[0086] It should be noted that in the embodiments of this application, the large language model (LLM) can be used to implement different prediction tasks, such as relation extraction tasks and summary extraction tasks. It should be understood that the same model structure is used to implement predictions for different prediction tasks, but the input and output data of the model are different for different prediction tasks.
[0087] 7. Self-Attention Mechanism The self-attention mechanism is a core component of the Transformer architecture, allowing the model to focus on different parts of the input sequence when processing sequential data. By calculating the correlation weights between elements within the sequence, self-attention enables the model to capture long-range dependencies and contextual information without relying on recurrent or convolutional structures. This mechanism improves the model's parallel processing capabilities and its ability to understand long sequences.
[0088] 8. Cross-Attention Mechanism The cross-attention mechanism is an extension of the self-attention mechanism for processing two different sequences, such as the source and target languages in machine translation. Cross-attention allows the model to focus on and leverage information from the source sequence when generating the target sequence. This enables the model to establish fine-grained correspondences between the two sequences, improving the efficiency and accuracy of cross-sequence information transfer. Cross-attention is also widely used in multimodal tasks (such as image description generation) and dialogue systems.
[0089] The search result display method provided in the embodiment of the present application is explained in detail below.
[0090] Figure 5 This is a flowchart of a search result display method provided by an embodiment of the present application. The method can be applied to a computer device, which can be a server, and the server can be a single server or a server cluster including multiple servers.
[0091] It should be understood that the search result display method is in the aforementioned Figure 1-Figure 3 The process performed after the user enters the search term introduced in the embodiment will not be described in detail later. Figure 5 , the method includes the following steps.
[0092] In step 501, the server obtains a search term and a plurality of target products obtained after a preliminary search for the search term.
[0093] The search term can be the query content entered by the user in the search box. Figure 1-Figure 3 The query content entered into the search box described in the embodiment.
[0094] After a user enters a search term in the search box, the terminal device can obtain the search term and send it to the server. After receiving the search term, the server can search for products using the search term and obtain preliminary search results, which include multiple target products that are relevant to the search term.
[0095] After the search term is searched for and multiple target products are obtained, the multiple target products must be displayed on the terminal device so that the user can browse the searched multiple target products. Therefore, the order in which the terminal device displays the multiple target products is very important. Figure 6 The implementation process of the following steps 502 to 506 is described in detail.
[0096] Step 502: The server extracts the search term to obtain a first entity associated with the search term.
[0097] In the above operation, by extracting the search term, key information of the search term can be obtained, that is, the entity that best reflects the semantics of the search term can be obtained.
[0098] For example, Figure 6 This is an overall framework diagram of a search result display method provided by an embodiment of the present application. Figure 6 As shown, after the user enters a search term, the server may perform entity extraction on the search term entered by the user to extract the first entity associated with the search term.
[0099] The following describes a specific implementation method for extracting the search term to obtain the first entity associated with the search term.
[0100] In one possible approach, the server inputs the search term into a first entity extraction model, extracts the search term through the first entity extraction model, and obtains a first entity associated with the search term.
[0101] The first entity extraction model is a model used for entity extraction. Optionally, the first entity extraction model can be an entity extraction model (NER model), such as Lexicon Enhanced BERT (LEBERT). For example, a text segment is input into the first entity extraction model, and the first entity extraction model can output entities within the segment.
[0102] Exemplarily, for the search term, after the search term is input into the first entity extraction model, the first entity extraction model can identify the dish name in the search term and output the identified dish name.
[0103] Figure 7This is a model structure diagram of a first entity extraction model provided in an embodiment of the present application, see Figure 7 , Figure 7 The first entity extraction model includes a character embedding layer 701, a word embedding layer 702, and a dictionary adapter 703. In addition, the first entity extraction model also includes multiple Transformer layers 704, wherein the dictionary adapter 703 is applied between the Transformer layers 704, such as Figure 7 As shown, the first entity extraction model may include L Transformer layers 704 (L may be preset, for example, L is 12), and the dictionary adapter 703 may be applied between the kth Transformer layer 704 and the (k+1)th Transformer layer 704 of the L Transformer layers 704 .
[0104] The character embedding layer 701 is used to represent characters as character vectors, specifically converting characters into multi-dimensional vector representations suitable for processing by the Transformer layer 704.
[0105] The word embedding layer 702 is used to convert discrete text into continuous dense vectors, thereby capturing the semantic and grammatical information in the language.
[0106] The dictionary adapter 703 is used to fuse the word features in the dictionary with the character / word embedding representation of the model. By combining the prior knowledge in the external dictionary with the contextual representation of the model, the model's ability to capture the semantics of specific entities or words can be improved.
[0107] The Transformer layer 704 is used to extract features from the input vector. It includes an encoder unit composed of a multi-head attention mechanism and a feedforward neural network. This multi-head attention mechanism allows each character to pay attention to other characters during encoding, capturing the semantic connections and grammatical structures between characters. This allows for the integration of contextual information, thereby better capturing the semantic relationships between characters in the search term and achieving more accurate feature extraction.
[0108] In this case, the server inputs the search term into the first entity extraction model, extracts the search term through the first entity extraction model, and obtains the first entity associated with the search term. The specific process may include the following steps (1) to (4).
[0109] (1) The search term is represented as a character sequence, and the word corresponding to each character in the character sequence is matched in a preset dictionary to obtain a target sequence, which includes a matching pair consisting of each character and the corresponding word.
[0110] The preset dictionary can be set in advance by technicians. In the embodiments of the present application, the preset dictionary can be compiled through manual annotation or optimized and extended based on existing word libraries. For example, the preset dictionary can be obtained by technicians optimizing and extending on the basis of existing general dictionaries according to specific application requirements and newly emerging words.
[0111] For each character in the character sequence, a corresponding word can be matched from the preset dictionary. For example, if the character sequence includes the character "milk", then the words corresponding to "milk" that can be matched from the preset dictionary include "milk" and "milk tea".
[0112] The target sequence is a character-word pair sequence. Exemplarily, as Figure 7 shown, the search term can be represented as a character sequence (c1, c2,..., c n ), and the corresponding word sequence includes (ws1, ws2,..., ws n ). Then, multiple target sequences composed of matching pairs (c1, ws1), (c2, ws2),..., (c n , ws n ) can be obtained.
[0113] (2) For any matching pair in the target sequence, the character in the matching pair is input into the character embedding layer 701 to obtain the character vector of the character, and each word in the matching pair is input into the word embedding layer 702 to obtain the word vector of each word.
[0114] After the character in the matching pair is input into the character embedding layer 701, the character embedding layer 701 can convert the input character into a character vector suitable for processing by the Transformer layer 704. And, when the word corresponding to the character is input into the word embedding layer 702, a word vector suitable for processing by the Transformer layer 704 can also be obtained. As Figure 7 shown, (c1, c2,..., c n ) are respectively input into the character embedding layer 701 to obtain the character vector corresponding to each character. And each word (ws1, ws2,..., ws n ) matched by each character is input into the word embedding layer 702 to obtain the word vector corresponding to each word.
[0115] It is worth noting that after obtaining the character vector and word vector corresponding to the characters in the matching pair, the character vector can also be input into the Transformer layer 704 for processing. After the character vector is feature extracted by k Transformer layers 704, the character vector obtained by feature extraction and the word vector output by the word embedding layer 702 can be input into the dictionary adapter 703 to perform feature fusion of the character vector and word vector corresponding to each character.
[0116] (3) The character vector of the character and the word vector of each word are input into the dictionary adapter 703. The dictionary adapter 703 calculates the first attention weight between the character vector and the word vector of each word based on the bilinear attention mechanism, and based on the first attention weight, performs weighted summation on the word vector of each word matching the character to obtain the weighted word vector corresponding to the character; the character vector of the character is added to the weighted word vector to obtain the entity feature corresponding to the character.
[0117] like Figure 7 As shown, a plurality of dictionary adapters 703 may be included between the kth Transformer layer 704 and the k+1th Transformer layer 704, wherein the plurality of dictionary adapters 703 correspond one-to-one to the characters in the character sequence, that is, for any character in the character sequence, the character vector corresponding to a character may be input into the corresponding dictionary adapter 703, and the word vector of the word matched by this character may be input into the corresponding dictionary adapter 703, so as to fuse the character features of this character with the dictionary features through the dictionary adapter 703, thereby further improving the model's ability to capture the semantics of vocabulary, and subsequently realizing accurate recognition of entities.
[0118] The bilinear attention mechanism captures the second-order correlation between two vectors (that is, the interaction between features) through a learnable weight matrix, thereby achieving more refined calculation of attention weights.
[0119] In the above method, by calculating the first attention weight between the character vector and the word vector of each word based on the bilinear attention mechanism, different weights can be assigned to different words corresponding to each character to represent the importance of the word to the character, so that the most relevant word among all the words matching a character can be known, which can help the model focus on key word information, suppress irrelevant noise information, and thus capture semantic information more accurately.
[0120] In addition, by adding the character vector of the character to the weighted word vector, the model can utilize both character-level and word-level information, thereby enriching the feature representation of the model and furthermore identifying entities more accurately.
[0121] It is worth noting that after the word vector is input into the dictionary adapter 703, the word vector can be first subjected to nonlinear transformation, and then the first attention weight between the character vector and the word vector after nonlinear transformation is calculated by the dictionary adapter 703 based on the bilinear attention mechanism.
[0122] Since the dimensions of character vectors and word vectors may be inconsistent, in order to ensure successful feature fusion, you can first perform a nonlinear transformation on the word vector to align the dimensions of the word vector and character vector.
[0123] (4) The entity features corresponding to each character in the character sequence of the search term are fused to obtain the first entity associated with the search term.
[0124] The entity feature corresponding to each character is also the output data of each dictionary adapter 703, such as Figure 7 As shown, after the dictionary adapter 703 outputs each entity feature, each entity feature can be input into the k+1th Transformer layer 704, and the entity features of each character are fused through Lk Transformer layers 704, so that the first entity corresponding to the search term can be finally output.
[0125] The above describes the process of extracting the search term. The following describes a specific implementation method for extracting information from the product title of any one of the multiple target products to obtain the associated second entity set.
[0126] Step 503: The server extracts information from the product title of any one of the multiple target products to obtain an associated second entity set, where the second entity set includes one or more entities.
[0127] The product title is used to describe the detailed information of the target product, such as the product name, category, purpose, etc. In some embodiments, the product title can be the product title of the target product. In other embodiments, the product title can also be text information obtained by performing image content recognition on the product image of the target product.
[0128] In the embodiment of the present application, the described entities (the first entity, the entities in the second entity set) may include key information such as restaurant name, product name, etc.
[0129] In the above operation, by extracting information from the product title of any one of the multiple target products, key information related to the target product can be extracted. This is equivalent to obtaining the key information of the target product title, which simplifies the target product title to facilitate subsequent relevance calculation operations.
[0130] For example, Figure 6 This is an overall framework diagram of a search result display method provided in an embodiment of the present application.
[0131] like Figure 6 As shown, after the user enters the search term, the server can perform entity extraction on the search term entered by the user to extract the first entity associated with the search term. In addition, for any target product, the product title of the target product is also refined (for example, Figure 6 ), and obtain the second entity set (Entity_1, Entity_2, …, Entity_m).
[0132] One possible approach is to input the product title of any one of multiple target products into a summary extraction model, perform summary extraction on the product title of the target product through the summary extraction model, and output summary information of the product title of the target product; input the summary information into a second entity extraction model, perform entity extraction on the summary information through the second entity extraction model, and output a second entity set.
[0133] The summary extraction model is used to extract the summary of the product title, that is, to extract the key information in the product title and retain the core content and semantics of the original text. That is to say, after the product title of a target product is input into the summary extraction model, the summary extraction model can summarize the product title accordingly to simplify the product title and retain the key information. In the embodiment of the present application, the summary extraction model can be a large language model LLM. In some embodiments, the model structure of the summary extraction model can be the aforementioned Figure 4 The model structure described in the embodiment will not be repeated here.
[0134] The second entity extraction model is used to extract entities from the extracted summary information. In the embodiment of the present application, similar to the first entity extraction model, the second entity extraction model can also be a NER model, such as a LEBERT model, and the model structure of the second entity extraction model is not repeated here. The difference is that the summary information of the product title of a target product can be input into the second entity extraction model, so that the second entity extraction model can identify the entities of the summary information and output the entities contained in the summary information, that is, output the second entity set.
[0135] In the above method, the product title of the target product is first summarized to extract the key information of the product title and simplify the product title, and then entity extraction is performed on the summary information of the product title. Compared with directly extracting entities from the product title, the above entity extraction process is based on the key information obtained after simplification. This can reduce the computational complexity of the model and enable the model to process directly based on the key information of the product title, which can improve the accuracy of entity extraction and thus obtain a more accurate second entity set.
[0136] It should be noted that when extracting entities from the summary information corresponding to the product title of the target product, entities such as product type, category words, content words, product name, etc. described in the product title are generally extracted, and other entities such as product brand are not retained.
[0137] The above describes the specific process of extracting information from the product title of the target product to obtain the second entity set. In the embodiment of the present application, after obtaining the second entity set, the relationship between the entities in the second entity set can also be obtained.
[0138] In order to gain greater exposure, merchants often add more labels to their products, making the product titles complex. In this case, the different entities contained in the product title may have some relationship. For example, for the entity "rose" and the entity "flower", "rose" belongs to "flower", so there is a hierarchical relationship between the two.
[0139] One possible approach is to input each entity in the second entity set into a relationship extraction model, perform relationship extraction on each entity through the relationship extraction model, and obtain the relationship between each entity in the second entity set.
[0140] The relationship extraction model is used to extract the relationship between entities, that is, the relationship extraction model receives multiple entities, can identify the relationship between multiple entities and output, so as to obtain the relationship between different entities. In the embodiment of the present application, the relationship extraction model can be a large language model LLM. For example, the model structure of the relationship extraction model can be the aforementioned Figure 4 The model structure described in the embodiment will not be repeated here.
[0141] It should be noted that although the relationship extraction model is Figure 4 The model structure described in the embodiment is the same, but the input data of the relationship extraction model is multiple entities, and the output is the relationship between multiple entities. That is, the relationship extraction model receives multiple entities as input data, and then Figure 4 The model structure described in the embodiment extracts the relationships between multiple entities and outputs the relationships between the multiple entities.
[0142] In the embodiment of the present application, the relationship extraction model can be trained based on the entities in the target knowledge graph and the relationships between the entities. Figure 4 The model composed of the model structure described in the embodiment is trained to obtain the relationship extraction model.
[0143] The target knowledge graph includes a large number of entities and describes the relationships between different entities. The relationships between different entities can include hyponymy, synonymy (apposition), sibling relationships, entity-attribute relationships, and collateral relationships.
[0144] For example, Figure 8 This is a schematic diagram of the structure of a target knowledge graph provided in the embodiment of this application. Figure 8 As shown, the target knowledge graph includes entities such as "catering," "supermarket," "staple food," "snacks," "noodles," and "fried noodles." A line connecting two entities indicates a hierarchical relationship. For example, "catering" and "staple food" are hierarchical. Under the entity "catering" are two parallel entities, "staple food" and "snacks." Therefore, "staple food" and "snacks" are siblings. The entity "daily necessities" has a connected relationship with the entity "supermarket," so the "snacks" and "daily necessities" entities are collaterally related.
[0145] The embodiment of this application is based on Figure 8 Take the target knowledge graph as an example to illustrate the above Figure 8 It does not limit the embodiments of the present application.
[0146] In this case, the relationship extraction model is trained on the entities and relationships between them in the target knowledge graph, allowing it to learn the relationships between various entities and thus gain the ability to identify relationships between entities. Furthermore, if the target knowledge graph accurately describes the relationships between different entities, then training the relationship extraction model on the entities and relationships between them in the target knowledge graph can improve the model's ability to extract entity relationships, allowing it to accurately identify the relationships between each entity in the second entity set.
[0147] In step 504, the server searches the target knowledge graph to obtain a third entity set based on the relationship between each entity in the second entity set and the first entity.
[0148] The third entity set may be viewed as an entity set obtained by expanding the first entity. It should be understood that the third entity set may include one or more entities.
[0149] Since the target product side can extract the relationships between different entities, that is, the target product side can obtain multiple different entities with certain relationships, while the search term side only extracts entities from the search term and does not contain entities with certain relationships. When calculating the correlation between entities, if entities with the same relationship exist on both sides, the correlation between the entities can be measured more accurately.
[0150] In the above method, the third entity set is obtained by querying in the target knowledge graph based on the relationship between each entity in the second entity set on the target product side and the first entity on the search term side, so that the search term side can introduce indirect related entities based on the relationship between the entities on the target product side, thereby realizing the expansion of the entities on the search term side, so that subsequent correlation calculations can be performed from multiple levels, thereby breaking the limitation of relying on literal matching.
[0151] For example, Figure 6 As shown, after performing entity extraction on the search term to obtain the first entity, and performing relationship extraction on the relationship between each entity in the second entity set, the first entity can be expanded through knowledge graph matching based on the relationship between each entity in the second entity set, that is, multiple entities are matched in the target knowledge graph based on the relationship between each entity in the second entity set to obtain a third entity set.
[0152] In one possible manner, the operation of step 504 may be: based on the first entity, querying the target knowledge graph for a first candidate entity; querying the target knowledge graph for entities that have a relationship with the first candidate entity that has a relationship with each entity in the second entity set; and determining the first candidate entity and the second candidate entity as entities in the third entity set.
[0153] The first candidate entity may be the first entity or an entity with the same semantics as the first entity. It should be understood that when searching for the first candidate entity in the target knowledge graph, the first entity should be searched first. If the first entity is found, the first candidate entity is the first entity. If the first entity cannot be found in the target knowledge graph, then an entity with the same semantics as the first entity is searched. In this case, the entity with the same semantics as the first entity is the first candidate entity.
[0154] During the expansion of the first entity, the first entity's location is first located in the target knowledge graph, and the entity at this location is used as the first candidate entity. Entities that have relationships with each entity in the second entity set are then identified from the target knowledge graph. For example, if there are parent-child and entity-attribute relationships between entities in the second entity set, entities that have parent-child and entity-attribute relationships with the entity at this location are identified from the target knowledge graph as second candidate entities. The first and second candidate entities can then form the third entity set.
[0155] In the above method, the third entity set is obtained by locating the first entity in the target knowledge graph and then querying the entities that have the relationship between the located entity and the entities in the second entity set, so that the first entity is expanded in a convenient way, thereby facilitating the query of the third entity set in the target knowledge graph.
[0156] The above content introduces the method for determining the entities corresponding to the search term side (the third entity set) and the entities corresponding to the target product side (the second entity set). Through the above content, the entities corresponding to the search term side (the third entity set) and the entities corresponding to the target product side (the second entity set) can be obtained. Then, if you want to subsequently calculate the correlation between the searched target product and the search term, you can achieve this by calculating the correlation between the entities corresponding to the two.
[0157] In an embodiment of the present application, it is also possible to obtain the user's historical behavior log, analyze the contextual information of the historical behavior log, and mine potential entity relationships; based on the potential entity relationships, the target knowledge graph is completed so that a third entity set can be queried in the completed target knowledge graph later.
[0158] The user's historical behavior log includes data such as search terms, click behaviors, etc. generated when the user uses the search function.
[0159] For example, if there is a historical behavior log in which a user searches for Brand A mobile phone and charger at the same time, after analyzing the historical behavior log, an entity relationship such as "Brand A mobile phone-accessory-charger" can be mined, and then "Brand A mobile phone-accessory-charger" can be added to the target knowledge graph.
[0160] In the above method, by completing the target knowledge graph, the relationships between entities in the target knowledge graph can be enriched, thereby improving the success rate of knowledge graph matching when performing knowledge graph matching.
[0161] It is worth noting that after the potential entity relationship is mined, the potential entity relationship can be queried in the target knowledge graph first; if the potential entity relationship cannot be found in the target knowledge graph, the target knowledge graph can be completed based on the potential entity relationship.
[0162] If the target knowledge graph already contains the mined potential entity relationship, then completing the target knowledge graph again will result in a waste of resources. However, if the target knowledge graph cannot find the potential entity relationship, completing the target knowledge graph based on the potential entity relationship can avoid wasting resources.
[0163] In an embodiment of the present application, after determining the second entity set and the third entity set, the association score between each entity in the third entity set and each entity in the second entity set may be determined based on a cross-attention mechanism.
[0164] The association score is used to represent the entity relevance between each entity in the third entity set and each entity in the second entity set, that is, the degree of relevance between each entity in the third entity set and each entity in the second entity set.
[0165] The cross-attention mechanism is used to interact information between different input sequences, so as to better capture the correlation between two input sequences.
[0166] In the above method, the association score between each entity in the third entity set and each entity in the second entity set is determined based on the cross-attention mechanism, so that the cross-attention mechanism can fully utilize the characteristic of capturing the correlation between two input sequences to determine the association score, thereby achieving accurate determination of the association score, that is, the correlation between each entity in the third entity set and each entity in the second entity set can be accurately determined.
[0167] One possible approach, based on the cross-attention mechanism, is to determine the association score between each entity in the third entity set and each entity in the second entity set by: determining the query vector of each entity in the third entity set, and determining the key vector and value vector of each entity in the second entity set; for the i-th entity in the third entity set and the j-th entity in the second entity set, determining the similarity score between the query vector of the i-th entity and the key vector of the j-th entity; normalizing the similarity score to obtain a second attention weight; and performing weighted summation on the value vector of the j-th entity based on the second attention weight to obtain the association score between the i-th entity and the j-th entity.
[0168] The query vector is a vector representing the content of interest, the key vector is used to represent the index or identification information of the party being followed, and the value vector is used to represent the information actually carried by the party being followed.
[0169] The second attention weight is used to indicate the degree of attention that the i-th entity pays to the j-th entity.
[0170] For example, Figure 9 This is a flowchart of a cross-attention mechanism provided in an embodiment of the present application.
[0171] like Figure 9 As shown, the cross attention mechanism receives the i-th entity in the third entity set and the jth entity in the second entity set . Then determine the i-th entity The query vector Q i , and determine the jth entity The key vector K j Sum value vector V j . Then according to the i-th entity The query vector Q i and the jth entity The key vector K j To determine the similarity score between the two. Then normalize the similarity score through Softmax to get the second attention weight. Finally, based on the second attention weight, the jth entity The value vector V j Perform weighted summation to obtain the association score between the i-th entity and the j-th entity.
[0172] Among them, Figure 9 As shown, when receiving the i-th entity Afterwards, you can Multiply by the query matrix W Q , to get the i-th entity The query vector Q i Similarly, after receiving the jth entity Afterwards, you can Multiply by the bond matrix W K Sum matrix W V , to get the j-th entity The key vector K j Sum value vector V j .
[0173] In addition, when calculating the similarity score, the query vector Q i Multiply by the transposed key vector K j T Got it.
[0174] In this approach, similarity is calculated based on the query vector of the i-th entity in the third entity set and the key vector of the j-th entity, where the query vector comes from the entities in the third entity set and the key vector comes from the entities in the second entity set. This approach allows for flexible interaction between the two sequences. This allows for the subsequent accurate calculation of the association score between the i-th and j-th entities.
[0175] In a possible implementation, the first entity and the second entity set may be concatenated, and then, based on a cross-attention mechanism, a correlation score between each entity in the third entity set and each entity in the concatenated entity set may be calculated.
[0176] As described above, if the first entity is found in the target knowledge graph, the first candidate entity can be the first entity. In this case, the first entity is included in the third entity set. However, if the first entity is not found in the target knowledge graph, the first candidate entity is not the first entity. In this case, the first entity is not included in the third entity set. However, the first entity is an entity that can accurately represent the search term, so the first entity is very important.
[0177] In the above method, by concatenating the first entity and the second entity set, the correlation score between each entity in the third entity set, each entity in the second entity set and the first entity can be calculated subsequently. The correlation score can more comprehensively and accurately represent the correlation between the search term and the entity corresponding to the target product, so that a more accurate correlation between the search term and the target product can be determined based on the correlation score.
[0178] Another possible approach is to determine the association score between each entity in the third entity set and each entity in the second entity set based on the cross-attention mechanism. The operation may be as follows: based on the self-attention mechanism, determining the self-attention score between each entity in the second entity set and the remaining entities; based on the self-attention score, filtering out the reference entity from the second entity set to update the second entity set; based on the cross-attention mechanism, determining the association score between each entity in the third entity set and each entity in the updated second entity set.
[0179] The self-attention score between an entity and the rest of the entities in the second entity set is used to represent the degree of association of the entity with the rest of the entities in the second entity set, so that the mutual association relationship between the entities in the second entity set can be captured.
[0180] In this embodiment of the present application, the self-attention score between the reference entity and the remaining entities in the second entity set satisfies a preset condition. In one possible implementation, the preset condition may be that the self-attention score is less than a preset score threshold, that is, the self-attention score between the reference entity and the remaining entities in the second entity set is less than the preset score threshold.
[0181] The preset score threshold may be set in advance, and the preset score threshold may be set to be relatively small, for example, the preset score threshold may be set to 0.1.
[0182] To increase exposure, merchants often include numerous tags in product titles. While some tags may be relevant to the product, others may not. This can lead to weak correlation between entities within the target product. For example, if the title of a target product is "Flowers, Red Roses, Milk Tea for Girlfriends," and the corresponding entities include "Flowers, Roses, Milk Tea," it's clear that "Milk Tea" has no real connection with "Flowers" or "Roses," meaning they have little correlation.
[0183] When the self-attention score between the reference entity and the remaining entities in the second entity set is less than the preset score threshold, it means that the correlation between the reference entity and the remaining entities is not strong, that is, the reference entity may not be highly correlated with the remaining entities, which also means that the title information corresponding to the reference entity is not highly correlated with the title information corresponding to the remaining entities. This is of little help in the subsequent calculation of the correlation between the search term and the target product, and may even interfere with the accuracy of the calculation of the correlation between the search term and the target product. Therefore, the reference entity can be screened out from the second entity set.
[0184] In the above method, by first determining the self-attention scores between different entities in the second entity set, and screening out the entities in the second entity set whose self-attention scores meet the preset conditions, the entities in the second entity set that will interfere with the calculation of the correlation between the search term and the target product can be filtered out. Then, the correlation between the search term and the target product can be accurately calculated based on the association score between each entity in the third entity set and each entity in the updated second entity set.
[0185] Among them, based on the self-attention mechanism, the operation of determining the self-attention score between each entity in the second entity set and the remaining entities can be: determining the query vector, key vector and value vector of each entity in the second entity set; for the j-th entity in the second entity set, determining the similarity score between the query vector of the j-th entity and the key vector of each remaining entity; normalizing multiple similarity scores to obtain the self-attention score between the j-th entity and each remaining entity.
[0186] It should be understood that the difference between the self-attention mechanism and the cross-attention mechanism is that the cross-attention mechanism calculates the degree of correlation between different sequences. Thus, in the embodiment of the present application, the cross-attention mechanism is the similarity score between the query vector of the i-th entity in the third entity set and the key vector of the j-th entity in the second entity set, while the self-attention mechanism calculates the degree of correlation between different positions in the same sequence. Thus, in the embodiment of the present application, the self-attention mechanism is the similarity score between the query vector of the j-th entity in the same entity set and the key vector of each of the remaining entities. The specific method of calculating the similarity score is the same, and will not be repeated here.
[0187] It is worth noting that after calculating the association score between each entity in the third entity set and each entity in the second entity set, it is equivalent to calculating the correlation between the entity corresponding to the search term side and the entity corresponding to the target product side, which can be used to measure the correlation between the search term and the target product. Therefore, the correlation between the search term and the target product can be determined based on the association score between each entity in the third entity set and each entity in the second entity set, that is, continue to execute the following step 505.
[0188] Step 505 : The server determines the relevance between the search term and the target product based on the association score between each entity in the third entity set and each entity in the second entity set.
[0189] In the above method, the entities in the third entity set represent the key information on the search term side, and the entities in the second entity set represent the key information on the target product side. In an embodiment of the present application, the correlation between the search term and the target product is determined by the correlation between the entity corresponding to the search term side and the entity corresponding to the target product side. Compared with directly calculating the correlation between the search term and the product title of the target product, this is equivalent to directly determining the correlation between the search term and the target product based on the key information corresponding to the search term side and the key information corresponding to the target product side. On the one hand, it can improve the accuracy of the correlation calculation between the search term and the target product, and on the other hand, it can reduce the amount of correlation calculation and save computing resources.
[0190] It is worth noting that before determining the relevance between the search term and the target product based on the association score between each entity in the third entity set and each entity in the second entity set, the self-attention score between each entity in the second entity set and the remaining entities determined based on the aforementioned self-attention mechanism can also be obtained.
[0191] In this case, the operation of step 505 may be: the server determines the relevance between the search term and the target product according to the association score and the self-attention score between each entity in the second entity set and the remaining entities.
[0192] The association score can directly measure the explicit relevance between the search term and the target product, the self-attention score can indicate the association relationship between entities in the second entity set, and can evaluate the internal consistency of product features. Therefore, in the process of determining the relevance between the search term and the target product based on the association score, the self-attention score is used to guide the process of determining the relevance, so that in the process of determining the relevance based on the association score, the association relationship between entities in the second entity set can be fully considered. The combination of the two can avoid the problem of "keyword stacking matching", help the depth of semantic understanding, and thus determine a more accurate relevance between the search term and the target product.
[0193] One possible way is that the server determines the correlation between the search term and the target product based on the correlation score and the self-attention score between each entity in the second entity set and the remaining entities. The operation can be: the server inputs the self-attention score into the correlation calculation model, and inputs the correlation score into the correlation calculation model, and determines the correlation between the search term and the target product through the correlation calculation model in combination with the self-attention score and the correlation score.
[0194] The correlation calculation model is used to calculate the correlation between the search term and the target product. In the embodiment of the present application, the correlation calculation model can be a linear regression model, a supervised neural network model, etc., which is not limited in the embodiment of the present application.
[0195] Specifically, the operation of determining the correlation between the search term and the target product through the correlation calculation model in combination with the self-attention score and the association score can be: performing weighted summation of the association score and the self-attention score based on the first weight and the second weight through the correlation calculation model, and normalizing the weighted summation result to obtain a reference score; determining the correlation level between the search term and the target product based on the reference score through the correlation calculation model; and determining the preset score corresponding to the correlation level through the correlation calculation model as the correlation score between the search term and the target product.
[0196] The first weight may be the model weight corresponding to the association score, and the second weight may be the model weight corresponding to the self-attention score. In an embodiment of the present application, the first weight and the second weight may be the model weights learned by the correlation calculation model during training.
[0197] The relevance level indicates the degree of correlation between the search term and the target product. A higher relevance level indicates a higher degree of correlation between the search term and the target product, meaning that the search term and the target product are more relevant. Conversely, a lower relevance level indicates a lower degree of correlation between the search term and the target product. For example, the relevance level can include strong correlation, weak correlation, and no correlation, where the order of relevance levels from high to low is strong correlation, weak correlation, and no correlation.
[0198] In the embodiment of the present application, multiple relevance levels correspond to multiple preset scores, and the multiple relevance levels correspond one-to-one with the multiple preset scores. For example, the relevance levels of strong relevance, weak relevance, and no relevance may correspond to 3 points, 1 point, and 0 points, respectively. The preset score corresponding to a relevance level is used to indicate the degree of relevance between the search term and the target product at that level.
[0199] Among them, the operation of determining the correlation level between the search term and the target product based on the reference score through the correlation calculation model may include: determining the probabilities corresponding to multiple correlation levels based on the reference score through the correlation calculation model; and determining the correlation level with the highest probability among the multiple correlation levels as the correlation level between the search term and the target product.
[0200] The probabilities corresponding to the multiple correlation levels refer to the probabilities that the correlation levels between the search term and the target product belong to the multiple correlation levels respectively. For example, the multiple correlation levels include strong correlation, weak correlation and irrelevant. Then the probabilities corresponding to the multiple correlation levels include: the probability that the correlation level between the search term and the target product is strongly correlated, the probability that the correlation level between the search term and the target product is weakly correlated, and the probability that the correlation level between the search term and the target product is irrelevant.
[0201] The above method of determining the probabilities corresponding to the multiple correlation levels based on the reference score may be to process the reference score through a Softmax function to predict the probabilities corresponding to the multiple correlation levels.
[0202] For example, Figure 6 As shown in FIG, after calculating the association score between each entity corresponding to the search term side and each entity corresponding to the target product side through cross attention, and calculating the self-attention score between the entities corresponding to the target product side, the correlation calculation is performed based on the association score and the self-attention score to calculate the correlation between the search term and the target product. Specifically, as Figure 6 As shown, the association score and the self-attention score can be input into the relevance calculation model, and the relevance score (3 points, 1 point or 0 points) between the search term and the target product can be output through the relevance calculation model.
[0203] The above steps 502-505 introduce the specific process of calculating the correlation between a target product among multiple target products and the search term. Then, for each target product among the multiple target products, the correlation between each target product and the search term can be determined by executing the above steps 502-505, and then the display order of the multiple target products can be sorted according to the correlation between each target product and the search term.
[0204] In step 506, the server sorts the target products based on the order of relevance between each target product and the search term, so that the terminal device can display the target products with the highest to lowest relevance to the user in response to the search term.
[0205] In the above method, multiple target products are sorted in order from high to low based on the correlation between each target product in the multiple target products and the search term, so that the terminal device can subsequently display multiple target products in order from high to low correlation, so that the terminal device displays the search results according to the degree of correlation between the target product and the keyword searched by the user, and then the terminal device gives priority to displaying the products that the user expects to search for, so that the search results can meet the user's expectations, and the terminal device can realize accurate display of the search results.
[0206] Furthermore, after the server sorts the target products based on the correlation between each target product and the search term from high to low, the product information of the target products and the sorting order of the target products can be sent to the terminal device.
[0207] After the terminal device receives the product information of multiple target products and the arrangement order of the multiple target products sent by the server, the terminal device can render according to the arrangement order to display the multiple target products, so that the user can browse the multiple target products displayed in order of relevance from high to low from the terminal device.
[0208] It is worth noting that the embodiment of the present application provides a new method for calculating the correlation between search terms and target products. During the entire process, various technical means are used, including entity extraction models, knowledge graph matching, cross-attention mechanisms, attention mechanisms, entity relationship extraction, large language models (LLM), etc. to gradually improve the accuracy of the correlation calculation between queries and search results, so that users can obtain the most relevant search results.
[0209] It should be noted here that the entity extraction model (first entity extraction model and second entity extraction model), relationship extraction model, summary extraction model and relevance calculation model introduced in the embodiments of the present application can all be trained before the actual reasoning process to output output data that is more in line with expectations.
[0210] First, training of entity extraction model First, for the training of the first entity extraction model, it should be understood that the first entity extraction model takes Figure 7 The model structure shown. When training the first entity extraction model, a first training set can be obtained. The first training set can include multiple first training samples, and each first training sample can include sample data and sample tags. The sample data can be a text or a title text, and the sample tag can be an entity sequence contained in the sample data obtained by processing the conditional random field CRF. Then, each first training sample is input as follows Figure 7 In the neural network model constructed by the model shown, output data is obtained; a loss value between the output data and the sample label in the first training sample is determined using a loss function; and parameters in the neural network model are adjusted based on the loss value. After the parameters in the neural network model are adjusted based on each first training sample in the plurality of first training samples, the neural network model with the adjusted parameters becomes the first entity extraction model.
[0211] It should be noted that during the training process, a negative log-likelihood loss function may be used to determine the loss value between the output data and the sample labels in the first training sample.
[0212] Secondly, for the training of the second entity extraction model. The second entity extraction model also adopts Figure 7 The model structure shown in FIG2 is shown in FIG3 . The training method for the second entity extraction model is similar to the training method for the first entity extraction model described above and will not be repeated here. The difference is that the input data of the second entity extraction model is different from the input data of the first entity extraction model. The sample data of the second entity extraction model can be a summary text (obtained by extracting the summary of the title text).
[0213] Second, for the training of summary extraction model and relationship extraction model In the embodiment of the present application, both the abstract extraction model and the relationship extraction model adopt Figure 4 The large language model structure shown in the figure is mainly obtained by pre-training for the training of different models. Figure 4 The large language model shown is fine-tuned to train the individual models.
[0214] Figure 10This is a flow chart of the application architecture of a large language model provided in an embodiment of the present application.
[0215] like Figure 10 As shown, the foundation of the entire architecture is a general large language model (such as the LLM / GPT series), which has a wide range of general knowledge and language understanding generation capabilities, but lacks in-depth knowledge of the vertical domain of the industry. Subsequently, based on this general base (large language model), the materials within the vertical domain of the industry (including the vertical domain material library, the vertical domain knowledge graph, and the vertical domain image library, etc.) are integrated to inject vertical domain knowledge into the large language model, and CPT pre-training is performed to allow the model to initially learn industry-specific knowledge, terminology, and application logic. After that, based on the pre-trained model, the model parameters are further customized and fine-tuned for specific application scenarios (such as Scenario 1, Scenario 2, Scenario 3, etc.) to adapt the model to the unique rules, processes, and requirements of different scenarios and realize generation tasks in different scenarios. This step is to fine-tune the pre-trained large language model based on the training data in different application scenarios to adapt the model to different application scenarios.
[0216] It should be noted that Scenario 1 and Scenario 2 correspond to the different generation tasks mentioned above. For example, Scenario 1 corresponds to the summary extraction task. In this case, the model obtained by fine-tuning the training data in the summary extraction scenario is the summary extraction model. Scenario 2 corresponds to the relationship extraction task. In this case, the model obtained by fine-tuning the training data in the relationship extraction scenario is the relationship extraction model. In addition, Scenario 3 can correspond to the task of filtering samples. The subsequent training process of the correlation calculation model involves filtering the training samples. In the embodiment of the present application, a large language model can also be used to filter the training samples.
[0217] For training the summary extraction model, a second training set can be obtained first. The second training set includes multiple second training samples. Any second training set in the multiple second training samples includes sample data and sample tags. The sample data can be a section of title text, and the sample tag can be the summary information corresponding to the section of title text. Then, each second training sample is input into the Figure 4 Output data is obtained from a large language model obtained by pre-training a neural network model composed of the model shown; a loss value between the output data and the sample labels in the second training sample is determined using a loss function; and parameters in the large language model are adjusted based on the loss value. After the parameters in the large language model are adjusted based on each of the multiple second training samples, the large language model with adjusted parameters becomes the summary extraction model.
[0218] For training the relationship extraction model, a third training set can be obtained first. The third training set includes multiple third training samples. Any third training set in the multiple third training samples includes sample data and sample labels. The sample data can be a knowledge graph sample, and the sample label can be the relationship between entities in the knowledge graph sample. Then, each third training sample is input into the Figure 4 Output data is obtained from a large language model obtained by pre-training a neural network model composed of the model shown; a loss value between the output data and the sample labels in the third training sample is determined using a loss function; and parameters in the large language model are adjusted based on the loss value. After the parameters in the large language model are adjusted based on each of the multiple third training samples, the large language model with adjusted parameters becomes a relationship extraction model.
[0219] During application, the demand side will output corresponding instructions, rules, etc. to instruct the trained large language model on what tasks to perform. When the large language model is required to perform a corresponding task, the demand side can output the corresponding task command, and then combine it with the relevant information of the corresponding scenario. The two are combined as the task context of the model input, allowing the large language model to clearly understand what tasks to perform in what scenarios. The pre-trained and fine-tuned large language model integrates general capabilities, vertical domain knowledge, and scenario adaptation. After receiving instructions and contextual scenario information, it calls on vertical domain knowledge (knowledge graph, material library, etc.) to process the corresponding tasks. The large language model can then output output data that meets the scenario requirements.
[0220] Third, training of correlation calculation model The correlation calculation model is used to output the correlation score between the search term and the target product. In the embodiment of the present application, the correlation calculation model can actually be a classification model, which is used to classify and output output data of 3 points, 1 point or 0 points.
[0221] One possible approach is to first obtain a target training set, and then train a correlation calculation model based on the target training set.
[0222] The target training set includes multiple training samples, which are obtained based on the user's historical behavior log. The historical behavior log can be composed of multiple sub-behavior logs. In some embodiments, each of the multiple sub-behavior logs includes the search term, search results, and behavioral operation data generated by the user when using the search function. The search results include multiple recommended products obtained by searching for the search term. The behavioral operation data may include the number of clicks on the recommended products, the browsing time, etc.
[0223] In the above method, the correlation calculation model is trained by combining the user's historical behavior log, which is equivalent to integrating the user's preference data during the correlation calculation model training process, which can improve the calculation accuracy of the correlation calculation model. In the subsequent correlation calculation model, the correlation score between the target product and the search term can be intelligently calculated. For example, the correlation score between the target product that meets the user's preference and the search term is higher.
[0224] The operation of obtaining the target training set may include the following steps (a) to (e).
[0225] (a) Obtain historical behavior logs.
[0226] (b) For any sub-behavior log in the historical behavior log, the search term in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs.
[0227] It should be understood that a sub-behavior log corresponds to a single search operation. This means that the sub-behavior log includes the search term, search results, and behavioral data for the products in the search results, such as click data and browsing time for recommended products. Since a single search term can correspond to a single search result, the search term in the sub-behavior log and the titles of multiple recommended products in the search results can be used as multiple candidate sample pairs. In this case, the multiple candidate sample pairs correspond one-to-one to the multiple recommended products in the search results.
[0228] By performing the above step (b) on each sub-behavior log in the historical behavior log, multiple candidate sample pairs corresponding to each sub-behavior log can be obtained.
[0229] It is worth noting that in an embodiment of the present application, after generating multiple candidate sample pairs corresponding to each sub-behavior log, sample screening can also be performed on multiple candidate sample pairs corresponding to multiple sub-behavior logs of the historical behavior log to screen out candidate sample pairs that are helpful for model training. Subsequently, training samples can be determined based on the candidate sample pairs after sample screening.
[0230] Specifically, the multiple candidate sample pairs corresponding to each sub-behavior log in the historical behavior log are input into the sample screening model. The sample screening model evaluates the sample quality of the multiple candidate sample pairs corresponding to each user behavior log, classifies them into high-quality sample pairs and low-quality sample pairs, and outputs high-quality sample pairs.
[0231] (c) Counting the number of clicks on each of the multiple recommended products based on the behavioral operation data in the historical behavior log.
[0232] Since the behavioral operation data includes the user's click data on the recommended products, the number of clicks on each recommended product by the user in the historical time period can be counted based on the behavioral operation data in the historical behavior log, that is, the number of clicks on each recommended product.
[0233] In addition, for a user, clicking on a product indicates that the user is interested in the product. In the embodiment of the present application, the higher the number of clicks on a recommended product, the more interested the user is in the recommended product. Therefore, by counting the number of clicks on each of multiple recommended products, it helps to improve the computing power of the correlation calculation model.
[0234] (d) Determine the correlation between the search term and the recommended products in multiple candidate sample pairs based on the number of clicks on the multiple recommended products.
[0235] It should be understood that the more times a user clicks on a recommended product, the more interested the user is in the recommended product, which in turn indicates that the recommended product more closely meets the user's expectations, and the higher the correlation between the recommended product and the search term. In this case, the number of clicks on multiple recommended products can accurately measure the correlation between the search term and the recommended product.
[0236] In the above method, for any one of the multiple candidate sample pairs, this candidate sample pair includes a search term and a recommended product. Then, the correlation between the search term and the recommended product in this candidate sample pair can be determined based on the number of clicks on this recommended product among the multiple recommended products.
[0237] In one possible approach, if the number of clicks on a recommended product is less than a first threshold, the relevance score between the search term and the recommended product is determined to be 0. If the number of clicks on a recommended product is greater than the first threshold but less than a second threshold, the relevance score between the search term and the recommended product is determined to be 1. If the number of clicks on a recommended product is greater than the second threshold, the relevance score between the search term and the recommended product is determined to be 3.
[0238] The first number threshold is smaller than the second number threshold. For example, the first number threshold may be 0, and the second number threshold may be 3.
[0239] (e) Determine multiple training samples in the target training set based on multiple candidate sample pairs corresponding to each sub-behavior log in the historical behavior log, the number of clicks on the recommended products in each sub-behavior log, and the correlation between the search terms and the recommended products in the multiple candidate sample pairs.
[0240] The multiple training samples may include positive training samples and negative training samples.
[0241] Specifically, for any sub-behavior log in the historical behavior log and any candidate sample pair among the multiple candidate sample pairs corresponding to the sub-behavior log, the cross-attention score and self-attention score corresponding to this candidate sample pair are determined based on the search term and the product title of the recommended product in this candidate sample pair; and the cross-attention score, self-attention score corresponding to this candidate sample pair and the correlation between the search term and the recommended product in this candidate sample pair are determined as a training sample; when the number of clicks on the recommended product in this candidate sample pair is greater than or equal to a preset number threshold, this training sample is determined to be a positive training sample; when the number of clicks on the recommended product in this candidate sample pair is less than the preset number threshold, this training sample is determined to be a negative training sample.
[0242] In the above method, the cross-attention score and self-attention score corresponding to this candidate sample can be determined through the aforementioned steps 502-504. Specifically, the search term in this candidate sample pair is first subjected to entity extraction to obtain the entity on the search term side, and then the product title of the recommended product is subjected to summary extraction and entity extraction to obtain the entity on the recommended product side, and then the entity on the search term side is expanded from the target knowledge graph. Afterwards, the self-attention score between the entities on the recommended product side is calculated through the self-attention mechanism to obtain the self-attention score corresponding to this candidate sample pair. The cross-attention score between the entity on the search term side and the entity on the recommended product side after expansion is then determined through the cross-attention mechanism to obtain the cross-attention score corresponding to this candidate sample pair. In addition, the cross-attention score and self-attention score corresponding to this candidate sample pair can be considered as sample data of a training sample, and the correlation between the search term and the recommended product in this candidate sample pair can be considered as the sample label of this training sample.
[0243] It is worth noting that for the multiple candidate sample pairs corresponding to each sub-behavior log in the historical behavior log, by repeatedly executing steps (c) to (e) above, multiple training samples can be constructed based on the historical behavior log, where the multiple training samples also include multiple positive training samples and multiple negative training samples, that is, the target training set can be obtained.
[0244] Furthermore, after obtaining the target training set, the neural network model can be trained using multiple training samples in the training set to obtain a correlation calculation model.
[0245] The neural network model can include multiple network layers, including an input layer, multiple hidden layers, and an output layer. The input layer is responsible for receiving input data; the output layer is responsible for outputting processed data; multiple hidden layers are located between the input and output layers and are responsible for processing data. The multiple hidden layers are invisible to the outside world. For example, the neural network model can be a deep neural network, and can be a convolutional neural network within a deep neural network.
[0246] When training a neural network model using multiple training samples, for each of the multiple training samples, the input data in the training sample can be input into the neural network model to obtain output data; a loss value between the output data and the sample label in the training sample can be determined using a loss function; and parameters in the neural network model can be adjusted based on the loss value. After the parameters in the neural network model are adjusted based on each of the multiple training samples, the neural network model with the adjusted parameters is the correlation calculation model.
[0247] Among them, the operation of adjusting the parameters in the neural network model according to the loss value can refer to the relevant technology, and the embodiments of the present application will not elaborate on this in detail.
[0248] For example, a computer device can be To adjust any parameter in the neural network model. is the adjusted parameter. W is the parameter before adjustment. is the learning rate, Can be pre-set, such as It can be 0.001, 0.000001, etc., and this embodiment of the present application does not make a sole limitation to this. dw The loss function is about W The derivative of can be obtained based on the loss value.
[0249] Another possible approach is to obtain a preset knowledge graph, construct multiple training samples based on the relationships between entities in the preset knowledge graph, and obtain a target training set.
[0250] The preset knowledge graph may be pre-set, and the preset knowledge graph may be a knowledge graph that adds special entity relationships on the basis of a general knowledge graph.
[0251] It should be understood that the preset knowledge graph includes multiple entities and the relationships between entities. When constructing multiple training samples, training samples with sample labels of 0, 1, and 3 can be constructed based on the relationships between entities (co-ordinate relationships, hierarchical relationships, subordinate relationships, collateral relationships, etc.), where the sample data can be the cross-attention scores between multiple entity tuples constructed based on the preset knowledge graph and the self-attention scores between entities in each entity tuple. It should be understood that the method of determining the self-attention scores and cross-attention scores between entity tuples can be implemented through the above-mentioned step 504.
[0252] In the embodiment of the present application, multiple training samples can be constructed in a tree-structure based and graph-structure based manner.
[0253] In an embodiment of the present application, after extracting the first entity and the second entity set, the server obtains a third entity set based on the relationship between each entity in the second entity set and the first entity in the target knowledge graph, in order to obtain entities with the same entity relationship as the entity corresponding to the target product. This ensures that both the search term and the target product contain entities with the same entity relationship. This allows for precise expansion of the entities corresponding to the search term, and subsequently allows for accurate correlation scores between entities at the same entity relationship level. This allows for accurate determination of the correlation score between each entity in the third entity set and each entity in the second entity set, and subsequently calculates the correlation between the search term and the target product. Compared to the prior art method of limiting the surface text matching between the product title and the search term, this method expands the scope of semantically related entity matching to achieve entity relationship calculation at the same level, thereby accurately determining the correlation between the search term and the target product. Finally, based on the correlation between each target product and the search term, the multiple target products are sorted from high to low, so that the multiple target products are sorted according to their degree of relevance to the search term. In this way, the target products displayed on the terminal can be displayed according to the size of the relevance. That is, the closer the target product is displayed, the higher the relevance between it and the search term, which means it is likely to be the user's expected product. Therefore, through the entire process, the user terminal can achieve accurate display of search results, which can improve the user experience.
[0254] Figure 11 This is a schematic diagram of the structure of a search result display device provided by an embodiment of the present application. The search result display device can be implemented as part or all of a computer device by software, hardware, or a combination of both. The computer device can be the following Figure 12 Computer equipment shown. Figure 11The device includes: a first acquisition module 1101, an information processing module 1102, a query module 1103, a first determination module 1104 and a sorting module 1105.
[0255] The first acquisition module 1101 is used to acquire a search term and multiple target products obtained after a preliminary search of the search term; Information processing module 1102 is used to extract the search term to obtain a first entity associated with the search term; and further used to extract information from the product title of any target product among the multiple target products to obtain a second entity set associated with the product, wherein the second entity set includes one or more entities; A query module 1103 is configured to query the target knowledge graph to obtain a third entity set based on the relationship between each entity in the second entity set and the first entity; A first determining module 1104 is configured to determine the relevance between the search term and the target product based on the association score between each entity in the third entity set and each entity in the second entity set; The sorting module 1105 is used to sort the multiple target products based on the order of relevance between each target product and the search term from high to low, so that the terminal device can display the multiple target products with high to low relevance to the user in response to the search term.
[0256] In one possible implementation, the information processing module 1102 is specifically configured to: The search term is input into the first entity extraction model, and the search term is extracted by the first entity extraction model to obtain the first entity associated with the search term.
[0257] In one possible implementation, the first entity extraction model includes a character embedding layer, a word embedding layer, and a dictionary adapter, and the information processing module 1102 is specifically configured to: Represent the search term as a character sequence, and match the word corresponding to each character in the character sequence in a preset dictionary to obtain a target sequence, which includes matching pairs consisting of each character and the corresponding word; For any matching pair in the target sequence, input the characters in the matching pair into the character embedding layer to obtain the character vector of the character, and input each word in the matching pair into the word embedding layer to obtain the word vector of each word; The character vector of the character and the word vector of each word are input into the dictionary adapter. The dictionary adapter calculates the first attention weight between the character vector and the word vector of each word based on the bilinear attention mechanism. Based on the first attention weight, the word vector of each word matching the character is weighted and summed to obtain the weighted word vector corresponding to the character. The character vector of the character is added to the weighted word vector to obtain the entity feature corresponding to the character. The entity features corresponding to each character in the character sequence of the search term are fused to obtain the first entity associated with the search term.
[0258] In one possible implementation, the information processing module 1102 is further specifically configured to: For any one of the multiple target products, the product title of the target product is input into the summary extraction model, the product title of the target product is abstracted by the summary extraction model, and summary information of the product title of the target product is output; The summary information is input into the second entity extraction model, entities are extracted from the summary information by the second entity extraction model, and a second entity set is output.
[0259] In one possible implementation, the query module 1103 is specifically configured to: Based on the first entity, query the target knowledge graph for the first candidate entity; Query the target knowledge graph for entities that have a relationship with the first candidate entity to obtain the second candidate entity; The first candidate entity and the second candidate entity are determined as entities in a third entity set.
[0260] In one possible implementation, the device further includes: The relationship extraction module is used to input each entity in the second entity set into the relationship extraction model, extract the relationship of each entity through the relationship extraction model, and obtain the relationship between each entity in the second entity set. The relationship extraction model is trained based on the entities in the target knowledge graph and the relationships between the entities.
[0261] In one possible implementation, the device further includes: The second determination module is used to determine the association score between each entity in the third entity set and each entity in the second entity set based on a cross-attention mechanism.
[0262] In one possible implementation, the second determining module is specifically configured to: Determining a query vector for each entity in the third entity set, and determining a key vector and a value vector for each entity in the second entity set; For the i-th entity in the third entity set and the j-th entity in the second entity set, determine a similarity score between the query vector of the i-th entity and the key vector of the j-th entity; Normalize the similarity score to obtain the second attention weight; The value vector of the j-th entity is weighted and summed based on the second attention weight to obtain the association score between the i-th entity and the j-th entity.
[0263] In one possible implementation, the second determining module is specifically configured to: Based on the self-attention mechanism, determine the self-attention score between each entity in the second entity set and the remaining entities; Based on the self-attention score, the reference entity is filtered out from the second entity set to update the second entity set, and the self-attention scores between the reference entity and the remaining entities in the second entity set meet a preset condition; Based on the cross-attention mechanism, a correlation score between each entity in the third entity set and each entity in the updated second entity set is determined.
[0264] In one possible implementation, the device further includes: A second acquisition module is used to obtain the self-attention score between each entity and the remaining entities in the second entity set; In one possible implementation, the first determining module 1104 is specifically configured to: Determine the relevance between the search term and the target product based on the association score and self-attention score.
[0265] In one possible implementation, the first determining module 1104 is specifically configured to: The self-attention score is input into the relevance calculation model, and the association score is input into the relevance calculation model. The relevance between the search term and the target product is determined by combining the self-attention score and the association score through the relevance calculation model.
[0266] In one possible implementation, the first determining module 1104 is specifically configured to: Performing a weighted summation of the association score and the self-attention score based on a first weight and a second weight through a correlation calculation model, and normalizing the weighted summation result to obtain a reference score, where the first weight and the second weight are model weights learned by the correlation calculation model during training; Determine the relevance level between the search term and the target product based on the reference score through the relevance calculation model; The preset score corresponding to the correlation level is determined as the correlation score between the search term and the target product through the correlation calculation model. Multiple correlation levels correspond to multiple preset scores, and multiple correlation levels correspond one-to-one to multiple preset scores. The correlation score is used to represent the correlation between the search term and the target product.
[0267] In one possible implementation, the device further includes: A third acquisition module is used to obtain a target training set, which includes multiple training samples. The multiple training samples are obtained based on the user's historical behavior log. The historical behavior log is composed of multiple sub-behavior logs. Each of the multiple sub-behavior logs includes the search terms, search results, and behavioral operation data generated by the user when using the search function; The training module is used to train a correlation calculation model based on a target training set.
[0268] In one possible implementation, the third acquisition module is specifically configured to: Get historical behavior logs; For any sub-behavior log in the historical behavior log, the search term in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs; Count the number of clicks on each of the multiple recommended products based on the behavioral operation data in the historical behavior log; Determine the correlation between the search terms and the recommended products in the plurality of candidate sample pairs based on the number of clicks on the plurality of recommended products; Based on multiple candidate sample pairs corresponding to each sub-behavior log in the historical behavior log, the number of clicks, and the correlation between the search terms and recommended products in the multiple candidate sample pairs, multiple training samples in the target training set are determined.
[0269] In a possible implementation, the multiple training samples include positive training samples and negative training samples, and the third acquisition module is specifically configured to: For any sub-behavior log in the historical behavior log, and any candidate sample pair among the multiple candidate sample pairs corresponding to the sub-behavior log, determine the cross-attention score and self-attention score corresponding to the candidate sample pair based on the search term and the product title of the recommended product in the candidate sample pair; and determine the cross-attention score and self-attention score corresponding to the candidate sample pair and the correlation between the search term and the recommended product in the candidate sample pair as the training sample corresponding to the candidate sample pair; If the number of clicks on the recommended product in the candidate sample pair is greater than or equal to a preset number threshold, the training sample corresponding to the candidate sample pair is determined to be a positive training sample; When the number of clicks on the recommended product in the candidate sample pair is less than a preset threshold, the training sample corresponding to the candidate sample pair is determined to be a negative training sample.
[0270] In an embodiment of the present application, after extracting the first entity and the second entity set, a third entity set is obtained based on the relationship between each entity in the second entity set and the first entity in the target knowledge graph to query for entities with the same entity relationship as the entity corresponding to the target product, so that both the search term and the target product contain entities with the same entity relationship. This can achieve accurate expansion of the entities corresponding to the search term, and subsequently achieve the association score between entities at the same entity relationship level. In turn, the association score between each entity in the third entity set and each entity in the second entity set can be accurately determined, and the correlation between the search term and the target product can be calculated based on this. Compared with the existing method that is limited to surface text matching between product titles and search terms, the scope of entity matching for semantic associations can be expanded to achieve entity relationship calculation at the same level, thereby accurately determining the correlation between the search term and the target product. Finally, based on the correlation between each target product and the search term in the multiple target products, the multiple target products are sorted from high to low, so that the multiple target products are sorted according to the degree of correlation with the search term. In this way, the target products displayed on the terminal can be displayed according to the size of the relevance. That is, the closer the target product is displayed, the higher the relevance between it and the search term, which means it is likely to be the user's expected product. Therefore, through the entire process, the user terminal can achieve accurate display of search results, which can improve the user experience.
[0271] It should be noted that: when the search result display device provided in the above embodiment displays the search results, it only uses the division of the above-mentioned functional modules as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0272] The functional units and modules in the above embodiments may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The above integrated units may be implemented in the form of hardware or software functional units. In addition, the specific names of the functional units and modules are only for the purpose of distinguishing them from each other and are not intended to limit the scope of protection of the embodiments of this application.
[0273] The search result display device and the search result display method provided in the above embodiment belong to the same concept. The specific working process and technical effects brought about by the units and modules in the above embodiment can be found in the method embodiment part and will not be repeated here.
[0274] Figure 12 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 12 As shown, the computer device 1200 includes: a processor 120, a memory 121, and a computer program 122 stored in the memory 121 and executable on the processor 120. When the processor 120 executes the computer program 122, the steps of the search result display method in the above embodiment are implemented.
[0275] The computer device 1200 may be a general-purpose computer device or a dedicated computer device. In a specific implementation, the computer device 1200 may be a network server. Those skilled in the art will appreciate that Figure 12 This is merely an example of the computer device 1200 and does not constitute a limitation on the computer device 1200 . The computer device 1200 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device 1200 may also include input and output devices, network access devices, etc.
[0276] The processor 120 may be a central processing unit (CPU). The processor 120 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0277] In some embodiments, the memory 121 may be an internal storage unit of the computer device 1200, such as the hard disk or memory of the computer device 1200. In other embodiments, the memory 121 may also be an external storage device of the computer device 1200, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on the computer device 1200. Furthermore, the memory 121 may include both the internal storage unit of the computer device 1200 and an external storage device. The memory 121 is used to store the operating system, application programs, boot loader, data, and other programs. The memory 121 may also be used to temporarily store data that has been output or is about to be output.
[0278] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0279] An embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the steps in the above-mentioned various method embodiments.
[0280] If the integrated unit is implemented as a software functional unit and sold or used as a standalone product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application can implement all or part of the processes in the above-mentioned method embodiments by using a computer program to instruct the relevant hardware. The computer program can be stored in a computer-readable storage medium. When executed by a processor, the computer program can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, an executable file, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a camera / terminal device, a recording medium, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, a non-transitory storage medium.
[0281] It should be understood that all or part of the steps for implementing the above embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the steps may be implemented in the form of a computer program product. The computer program product may include one or more computer instructions. The computer instructions may be stored in the above-mentioned computer-readable storage medium.
[0282] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0283] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0284] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer equipment and methods can be implemented in other ways. For example, the apparatus / computer equipment embodiments described above are merely schematic. For example, the division of modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of the apparatus or unit, which can be electrical, mechanical or other forms.
[0285] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0286] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A search result display method, characterized in that: The method comprises: Obtaining a search term and a plurality of target products obtained after a preliminary search for the search term; Extracting the search term to obtain a first entity associated with the search term; Extracting information from a product title of any one of the multiple target products to obtain a related second entity set, where the second entity set includes one or more entities; According to the relationship between each entity in the second entity set and the first entity, query in the target knowledge graph to obtain a third entity set, wherein the third entity set includes one or more entities; determining, based on an association score between each entity in the third entity set and each entity in the second entity set, a correlation between the search term and the target product; The target products are sorted based on the order of the relevance between each target product and the search term from high to low, so that the terminal device can display the target products with the relevance from high to low to the user in response to the search term.
2. The method according to claim 1, wherein The extracting the search term to obtain a first entity associated with the search term includes: The search term is input into a first entity extraction model, and the search term is extracted by the first entity extraction model to obtain a first entity associated with the search term.
3. The method according to claim 2, wherein The first entity extraction model includes a character embedding layer, a word embedding layer, and a dictionary adapter. Inputting the search term into the first entity extraction model, extracting the search term through the first entity extraction model to obtain a first entity associated with the search term includes: Representing the search term as a character sequence, and matching the word corresponding to each character in the character sequence in a preset dictionary to obtain a target sequence, wherein the target sequence includes a matching pair consisting of each character and the corresponding word; For any matching pair in the target sequence, input the characters in the matching pair into the character embedding layer to obtain the character vector of the character, and input each word in the matching pair into the word embedding layer to obtain the word vector of each word; Inputting the character vector of the character and the word vector of each word into a dictionary adapter, calculating a first attention weight between the character vector and the word vector of each word through the dictionary adapter based on a bilinear attention mechanism, and performing a weighted summation on the word vectors of each word matched by the character based on the first attention weight to obtain a weighted word vector corresponding to the character; adding the character vector of the character to the weighted word vector to obtain an entity feature corresponding to the character; The entity features corresponding to each character in the character sequence of the search term are fused to obtain a first entity associated with the search term.
4. The method according to claim 1, wherein The extracting information from the product title of any one of the multiple target products to obtain a related second entity set includes: For any one of the plurality of target products, inputting the product title of the target product into a summary extraction model, extracting a summary of the product title of the target product by the summary extraction model, and outputting summary information of the product title of the target product; The summary information is input into a second entity extraction model, entities are extracted from the summary information using the second entity extraction model, and the second entity set is output.
5. The method according to claim 1, wherein The querying in the target knowledge graph to obtain a third entity set based on the relationship between each entity in the second entity set and the first entity includes: Based on the first entity, querying the target knowledge graph for a first candidate entity; Querying the target knowledge graph for an entity having the relationship with the first candidate entity to obtain a second candidate entity; The first candidate entity and the second candidate entity are determined as entities in the third entity set.
6. The method according to any one of claims 1 to 5, wherein: The method further comprises: Input each entity in the second entity set into the relationship extraction model, perform relationship extraction on each entity through the relationship extraction model, and obtain the relationship between each entity in the second entity set. The relationship extraction model is trained based on the entities in the target knowledge graph and the relationships between the entities.
7. The method according to any one of claims 1 to 5, wherein: The method further comprises: Based on a cross-attention mechanism, a relevance score between each entity in the third entity set and each entity in the second entity set is determined.
8. The method according to claim 7, wherein The determining, based on the cross-attention mechanism, a relevance score between each entity in the third entity set and each entity in the second entity set includes: Determining a query vector for each entity in the third entity set, and determining a key vector and a value vector for each entity in the second entity set; For an i-th entity in the third entity set and a j-th entity in the second entity set, determining a similarity score between a query vector of the i-th entity and a key vector of the j-th entity; Normalizing the similarity score to obtain a second attention weight; A weighted sum is performed on the value vector of the j-th entity based on the second attention weight to obtain a correlation score between the i-th entity and the j-th entity.
9. The method according to claim 7, wherein The determining, based on the cross-attention mechanism, a relevance score between each entity in the third entity set and each entity in the second entity set includes: Determining, based on a self-attention mechanism, a self-attention score between each entity in the second entity set and the remaining entities; Based on the self-attention score, filter out a reference entity from the second entity set to update the second entity set, where the self-attention scores between the reference entity and the remaining entities in the second entity set meet a preset condition; Based on a cross-attention mechanism, a correlation score between each entity in the third entity set and each entity in the updated second entity set is determined.
10. The method according to claim 9, wherein Before determining the relevance between the search term and the target product based on the association score between each entity in the third entity set and each entity in the second entity set, the method further includes: Obtaining a self-attention score between each entity and the remaining entities in the second entity set; Determining the relevance between the search term and the target product according to the association score between each entity in the third entity set and each entity in the second entity set includes: Determine the relevance between the search term and the target product based on the association score and the self-attention score.
11. The method according to claim 10, wherein The determining, based on the association score and the self-attention score, the relevance between the search term and the target product includes: The self-attention score is input into a correlation calculation model, and the association score is input into the correlation calculation model. The correlation calculation model combines the self-attention score and the association score to determine the correlation between the search term and the target product.
12. The method according to claim 11, wherein Determining the correlation between the search term and the target product by combining the self-attention score and the association score with the correlation calculation model includes: performing a weighted summation of the association score and the self-attention score based on a first weight and a second weight by the correlation calculation model, and normalizing the weighted summation result to obtain a reference score, where the first weight and the second weight are model weights learned by the correlation calculation model during training; Determining the relevance level between the search term and the target product according to the reference score using the relevance calculation model; The preset score corresponding to the correlation level is determined as the correlation score between the search term and the target product through the correlation calculation model. The multiple correlation levels correspond to multiple preset scores. The multiple correlation levels correspond one-to-one to the multiple preset scores. The correlation score is used to represent the correlation between the search term and the target product.
13. The method according to claim 11, wherein The method further comprises: Obtaining a target training set, the target training set including a plurality of training samples, the plurality of training samples being obtained based on a user's historical behavior log, the historical behavior log being composed of a plurality of sub-behavior logs, each of the plurality of sub-behavior logs including a search term, search result, and behavior operation data generated by the user when using a search function; The correlation calculation model is trained based on the target training set.
14. The method according to claim 13, wherein The obtaining of the target training set includes: Obtaining the historical behavior log; For any sub-behavior log in the historical behavior log, the search term in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs; Counting the number of clicks on each of the plurality of recommended products based on the behavioral operation data in the historical behavior log; Determining, based on the number of clicks on the multiple recommended products, the correlation between the search terms and the recommended products in the multiple candidate sample pairs; Multiple training samples in the target training set are determined based on multiple candidate sample pairs corresponding to each sub-behavior log in the historical behavior log, the number of clicks, and the correlation between the search terms and the recommended products in the multiple candidate sample pairs.
15. The method according to claim 14, wherein The multiple training samples include positive training samples and negative training samples. The determining of the multiple training samples in the target training set based on the multiple candidate sample pairs corresponding to each sub-behavior log in the historical behavior log, the number of clicks, and the correlation between the search term and the recommended product in the multiple candidate sample pairs includes: For any sub-behavior log in the historical behavior log, and any candidate sample pair among the multiple candidate sample pairs corresponding to the sub-behavior log, determine the cross-attention score and self-attention score corresponding to the candidate sample pair based on the search term and the product title of the recommended product in the candidate sample pair; and determine the cross-attention score and self-attention score corresponding to the candidate sample pair and the correlation between the search term and the recommended product in the candidate sample pair as the training sample corresponding to the candidate sample pair; If the number of clicks on the recommended product in the candidate sample pair is greater than or equal to a preset number threshold, determining the training sample corresponding to the candidate sample pair as a positive training sample; When the number of clicks on the recommended product in the candidate sample pair is less than the preset number threshold, the training sample corresponding to the candidate sample pair is determined to be a negative training sample.
16. A computer device, characterized in that: The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 15 when executed by the processor.
17. 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 method according to any one of claims 1 to 15 is implemented.
Citation Information
Patent Citations
Determination method and device for recommended search keyword
CN107169010A
Method and a terminal for acquiring associated information
CN109739992A
Entity retrieval method and device based on knowledge graph, equipment and storage medium
CN113704494A
Video searching method and device
CN116955703A
Intelligent search method based on artificial intelligence recommendation
CN117786127A
Cited By
Information search method and device, storage medium and computer equipment
CN120763380A