Search result display method, computer device and storage medium
By utilizing target knowledge graphs and entity association scores in search results display, the problem of inaccurate relevance measurement caused by complex product titles is solved, achieving accurate ranking and display of search results and improving user experience.
Patent Information
- Application Number
- CN202511045219.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-07-29
AI Technical Summary
In existing technologies, product titles are often set to be more complex in order to gain greater exposure. This makes it impossible to accurately measure the relevance between the product searched by the user and the search results through similarity calculation. As a result, the display order differs greatly from the actual relevance and cannot accurately display relevant products.
By acquiring and extracting search terms, the first entity is obtained. The third entity set is obtained by querying the target knowledge graph. The relevance between the search terms and the target product is determined based on the association score between the entities, and the results are displayed in order of relevance.
It enables precise ranking based on the actual relevance of search terms to products, improving the accuracy of search results and user experience.
Smart Images

Figure CN120541320B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method for displaying search results, a computer device, and a storage medium. Background Technology
[0002] Currently, there are a vast number of product categories and an unimaginable quantity of goods on various e-commerce platforms. Therefore, most e-commerce platforms have a search function, which allows users to find a list of products they want to buy.
[0003] In related technologies, users can enter the name of the product they want to order in a search box. A search algorithm then identifies products that meet the search criteria, resulting in a product list. Finally, the products in the list are displayed based on their similarity to the name of the product the user wants to order.
[0004] However, product titles are created by merchants to gain greater exposure, and therefore tend to be quite complex. Consequently, the similarity calculation method described above cannot accurately measure the relevance between the product a user searches for and the various products in the search results. This leads to a significant discrepancy between the displayed product order and the actual relevance, ultimately failing to accurately present relevant products to the user. Summary of the Invention
[0005] This application provides a method, apparatus, computer device, and storage medium for displaying search results, which can accurately calculate the relevance between search terms and search results, thereby enabling precise display of search results and improving user experience. The technical solution includes the following:
[0006] Firstly, a method for displaying search results is provided, the method comprising:
[0007] Obtain search terms and multiple target products obtained after a preliminary search for the search terms;
[0008] The search term is extracted to obtain a first entity associated with the search term. Information is extracted from the product title of any one of the multiple target products to obtain a second set of associated entities, which includes one or more entities.
[0009] Based on the relationships between each entity in the second entity set and the first entity, a third entity set is obtained by querying the target knowledge graph, and the third entity set includes one or more entities;
[0010] The relevance between the search term and the target product is determined based on the association score between each entity in the third entity set and each entity in the second entity set.
[0011] Based on the order of relevance between each of the multiple target products and the search term from high to low, the multiple target products are sorted so that the terminal device can respond to the search term and display the multiple target products from high to low relevance to the user.
[0012] In this application, after extracting the first and second entity sets, a third entity set is obtained based on the relationships between each entity in the second entity set and the query results of the first entity in the target knowledge graph. This allows for the retrieval of entities with the same specific entity relationships as the target product, ensuring that both the search term and the target product contain entities with the same entity relationships. This enables precise expansion of the entities corresponding to the search term, allowing for subsequent association scores between entities at the same entity relationship level. Furthermore, it accurately determines the association score between each entity in the third entity set and each entity in the second entity set, and then calculates the relevance between the search term and the target product. Compared to existing technologies that limit themselves to surface text matching between product titles and search terms, this approach expands the scope of semantically related entity matching to achieve entity relationship calculations at the same level, thus accurately determining the relevance between the search term and the target product. Finally, the multiple target products are sorted according to their relevance to the search term, from highest to lowest, ensuring that the multiple target products are ordered based on their degree of relevance to the search term. In this way, the target products displayed on the terminal can be shown according to their relevance. That is, the target products displayed earlier are more relevant to the search terms and are more likely to be the products the user expects. Thus, the entire process can achieve accurate display of search results on the user's terminal, which can improve the user experience.
[0013] In conjunction with the first aspect, in some implementations of the first aspect, the step of extracting the search term to obtain the first entity associated with the search term includes:
[0014] The search term is input into the first entity extraction model, and the first entity extraction model is used to extract the search term to obtain the first entity associated with the search term.
[0015] In conjunction with the first aspect and the above implementation methods, in some implementation methods of the first aspect, the first entity extraction model includes a character embedding layer, a word embedding layer, and a dictionary adapter. The step of inputting the search term into the first entity extraction model and extracting the search term through the first entity extraction model to obtain the first entity associated with the search term includes:
[0016] 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, wherein the target sequence includes a matching pair consisting of each character and its corresponding word;
[0017] For any matching pair in the target sequence, the characters in the matching pair are input into the character embedding layer to obtain the character vector of the character, and each word in the matching pair is input into the word embedding layer to obtain the word vector of each word;
[0018] 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 vectors of each word matched by the character are 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.
[0019] 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.
[0020] In the above implementation, by processing the character-word pair sequence through a character embedding layer, a word embedding layer, and a dictionary adapter, the word features in the dictionary and the model's character / word embedding representation can be fused together, further enhancing the model's ability to capture the semantics of words. Furthermore, by adding the character vector of the given character to the weighted word vector, the model can utilize both character-level and word-level information simultaneously, thereby enriching the model's feature representation and enabling more accurate entity recognition.
[0021] Combining the first aspect and the above implementation methods, in some implementation methods of the first aspect, the step of extracting information from the product title of any one of the plurality of target products to obtain an associated second entity set includes:
[0022] For any one of the multiple target products, the product title of the target product is input into the summary extraction model, and the summary extraction model extracts the summary of the product title of the target product and outputs the summary information of the product title of the target product.
[0023] The summary information is input into the second entity extraction model, and the second entity extraction model extracts entities from the summary information to output the second entity set.
[0024] In the above implementation, the product title of the target product is first extracted to extract key information and simplify the product title. Then, entity extraction is performed on the product title summary information. Compared with directly extracting entities from the product title, the above entity extraction process is based on the simplified key information, which can reduce the computational load of the model and allow the model to process directly based on the key information of the product title, thereby improving the accuracy of entity extraction and obtaining a more accurate second entity set.
[0025] In conjunction with the first aspect and the above implementation methods, in some implementation methods of the first aspect, the step of querying the target knowledge graph to obtain the third entity set based on the relationships between each entity in the second entity set and the first entity includes:
[0026] Based on the first entity, query the target knowledge graph for a first candidate entity;
[0027] The second candidate entity is obtained by querying the target knowledge graph for entities that have the relationship with the first candidate entity.
[0028] The first candidate entity and the second candidate entity are determined as entities in the third entity set.
[0029] In the above implementation, by locating the first entity in the target knowledge graph and then querying the entities that have a relationship with the entity at the located position in the second entity set, a third entity set is obtained. This makes it convenient to expand the first entity in a convenient way, thereby facilitating the querying of the third entity set in the target knowledge graph.
[0030] In conjunction with the first aspect and the above-described implementations, in some implementations of the first aspect, the method further includes:
[0031] Each entity in the second entity set is input into the relation extraction model, and the relation extraction model is used to extract relations for each entity to obtain the relationship between each entity in the second entity set. The relation extraction model is trained based on each entity in the target knowledge graph and the relationship between each entity.
[0032] In the above implementation, the relationship extraction model is trained by analyzing the entities and relationships within the target knowledge graph. This allows the model to learn the relationships between various entities, thus enabling it to identify these relationships. Furthermore, the target knowledge graph accurately describes the relationships between different entities. Training the relationship extraction model using the entities and their relationships within the target knowledge graph improves its ability to extract entity relationships. Consequently, the model can accurately identify the relationships between each entity in the second entity set.
[0033] In conjunction with the first aspect and the above-described implementations, in some implementations of the first aspect, the method further includes:
[0034] Based on the cross-attention mechanism, the association score between each entity in the third entity set and each entity in the second entity set is determined.
[0035] 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 by the cross-attention mechanism. This fully utilizes the characteristic that the cross-attention mechanism can capture the correlation between two input sequences to determine the association score, thereby achieving accurate determination of the association score, that is, accurately determining the correlation between each entity in the third entity set and each entity in the second entity set.
[0036] Combining the first aspect and the above implementation methods, in some implementation methods of the first aspect, determining 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 includes:
[0037] Determine the query vector for each entity in the third entity set, and determine the key vector and value vector for each entity in the second entity set;
[0038] For the i-th entity in the third entity set and the j-th entity in the second entity set, determine the similarity score between the query vector of the i-th entity and the key vector of the j-th entity;
[0039] The similarity score is normalized to obtain the second attention weight;
[0040] 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.
[0041] In the above implementation, similarity is calculated based on the query vector of the i-th entity and the key vector of the j-th entity in the third entity set. The query vector comes from entities in the third entity set, and the key vector comes from entities in the second entity set. This method allows for flexible interaction between two sequences. Furthermore, the association score between the i-th and j-th entities can be accurately calculated subsequently.
[0042] Combining the first aspect and the above implementation methods, in some implementation methods of the first aspect, determining 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 includes:
[0043] Based on the self-attention mechanism, determine the self-attention score between each entity in the second entity set and the other entities;
[0044] Based on the self-attention score, reference entities are filtered out from the second entity set to update the second entity set. The self-attention scores between the reference entities and the remaining entities in the second entity set meet preset conditions.
[0045] Based on the cross-attention mechanism, the association score between each entity in the third entity set and each entity in the updated second entity set is determined.
[0046] In the above implementation, by first determining the self-attention scores between different entities in the second entity set and then filtering out entities in the second entity set whose self-attention scores meet preset conditions, entities in the second entity set that might interfere with the calculation of the relevance between the search term and the target product can be filtered out. Then, based on the association scores between each entity in the third entity set and each entity in the updated second entity set, the relevance between the search term and the target product can be accurately calculated.
[0047] In conjunction with the first aspect and the above implementation methods, in some implementation methods 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:
[0048] Obtain the self-attention score between each entity in the second entity set and the other entities;
[0049] The step of 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 includes:
[0050] The relevance between the search term and the target product is determined based on the association score and the self-attention score.
[0051] In the above implementation, the association score can directly measure the explicit relevance between the search term and the target product, while the self-attention score can indicate the association between entities in the second entity set and assess 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 guides the process of determining the relevance, so that the association between entities in the second entity set can be fully considered in the process of determining the relevance based on the association score. The combination of the two can avoid the problem of "keyword stuffing matching", which helps to improve the depth of semantic understanding and thus can determine a more accurate relevance between the search term and the target product.
[0052] In conjunction with the first aspect and the above implementation methods, in some implementation methods 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:
[0053] 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.
[0054] In conjunction with the first aspect and the above implementation methods, in some implementation methods of the first aspect, determining the relevance between the search term and the target product by combining the self-attention score and the association score through the relevance calculation model includes:
[0055] The correlation calculation model performs a weighted summation of the correlation score and the self-attention score based on the first weight and the second weight, and normalizes the weighted summation result to obtain a reference score. The first weight and the second weight are the model weights learned by the correlation calculation model during the training process.
[0056] The relevance level between the search term and the target product is determined by the relevance calculation model based on the reference score.
[0057] The relevance calculation model determines the preset score corresponding to the relevance level as the relevance score between the search term and the target product. The multiple relevance levels correspond to multiple preset scores, and the multiple relevance levels and the multiple preset scores are in one-to-one correspondence. The relevance score is used to represent the relevance between the search term and the target product.
[0058] In the above implementation method, the relevance level between the search term and the target product is first determined by the self-attention score and the association score, and then the relevance score between the search term and the target product is determined based on the relevance level, so as to accurately determine the relevance between the search term and the target product.
[0059] In conjunction with the first aspect and the above-described implementations, in some implementations of the first aspect, the method further includes:
[0060] Obtain a target training set, which includes multiple training samples. These multiple training samples are obtained based on the user's historical behavior logs. The historical behavior logs consist of multiple sub-behavior logs, each of which includes the search terms, search results, and behavioral operation data generated by the user when using the search function.
[0061] The correlation calculation model is trained based on the target training set.
[0062] In the above implementation, the relevance calculation model is trained by combining the user's historical behavior logs. This is equivalent to integrating the user's preference data during the training process of the relevance calculation model, which can improve the calculation accuracy of the relevance calculation model. As a result, the relevance calculation model can intelligently calculate the relevance score between the target product and the search term. For example, the relevance score between the target product that matches the user's preferences and the search term is higher.
[0063] In combination with the first aspect and the above implementation methods, in some implementation methods of the first aspect, obtaining the target training set includes:
[0064] Obtain the historical behavior logs;
[0065] For any sub-behavior log in the historical behavior log, the search terms in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs;
[0066] Based on the behavioral operation data in the historical behavior log, the number of clicks on each of the multiple recommended products is counted;
[0067] 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 is determined;
[0068] 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 terms and recommended products in the multiple candidate sample pairs, multiple training samples in the target training set are determined.
[0069] Combining the first aspect and the above implementation methods, in some implementation methods of the first aspect, the plurality of training samples includes positive training samples and negative training samples. The step of determining the plurality of training samples in the target training set based on the 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 recommended products in the plurality of candidate sample pairs includes:
[0070] For any sub-behavior log in the historical behavior log, and any candidate sample pair among multiple candidate sample pairs corresponding to the sub-behavior log, the cross-attention score and self-attention score corresponding to the candidate sample pair are determined based on the search term and the product title of the recommended product in the candidate sample pair; and the cross-attention score, self-attention score, and the correlation between the search term and the recommended product in the candidate sample pair are determined as the training samples corresponding to the candidate sample pair.
[0071] If the number of clicks on the recommended product in the candidate sample pair is greater than or equal to a preset threshold, the training sample corresponding to the candidate sample pair is determined as a positive training sample.
[0072] If the number of clicks on the recommended product in the candidate sample pair is less than the preset threshold, the training sample corresponding to the candidate sample pair is determined to be a negative training sample.
[0073] Secondly, a search result display device is provided, the device comprising:
[0074] The first acquisition module is used to acquire search terms and multiple target products obtained after a preliminary search of the search terms;
[0075] The information processing module is used to extract and process the search terms to obtain a first entity associated with the search terms; it is also used to extract information from the product title of any one of the multiple target products to obtain a second set of associated entities, wherein the second set of entities includes one or more entities;
[0076] The query module is used 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;
[0077] The first determining module is used 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;
[0078] The sorting module is used to sort the multiple target products according to 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 in descending order of relevance to the user in response to the search term.
[0079] Thirdly, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the search result display method described above.
[0080] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described method for displaying search results.
[0081] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to perform the steps of the search result display method described above.
[0082] It is understood that the beneficial effects of the second, third, fourth, and fifth aspects mentioned above can be found in the relevant descriptions in the first aspect above, and will not be repeated here. Attached Figure Description
[0083] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0084] Figure 1 This is a schematic diagram illustrating a search result display method provided in an embodiment of this application;
[0085] Figure 2 This is a schematic diagram illustrating another method for displaying search results provided in this application embodiment;
[0086] Figure 3 This is a schematic diagram illustrating another method for displaying search results provided in an embodiment of this application;
[0087] Figure 4 This is a schematic diagram of the structure of a large language model provided in an embodiment of this application;
[0088] Figure 5 This is a flowchart illustrating a search result display method provided in an embodiment of this application;
[0089] Figure 6This is an overall framework diagram of a search result display method provided in an embodiment of this application;
[0090] Figure 7 This is a model structure diagram of a first entity extraction model provided in an embodiment of this application;
[0091] Figure 8 This is a schematic diagram of the structure of a target knowledge graph provided in an embodiment of this application;
[0092] Figure 9 This is a flowchart illustrating a cross-attention mechanism provided in an embodiment of this application;
[0093] Figure 10 This is a flowchart of the application architecture of a large language model provided in an embodiment of this application;
[0094] Figure 11 This is a schematic diagram of the structure of a search result display device provided in an embodiment of this application;
[0095] Figure 12 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0096] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0097] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.
[0098] The application scenarios of the embodiments of this application will be explained first.
[0099] To make it easier to understand, the following example will be taken as a scenario where a user searches for products using the first application installed on their phone (e.g., application A). Figure 1 This is a schematic diagram of a search result display method provided in an embodiment of this application. The following is in conjunction with... Figure 1 To elaborate further.
[0100] For example, Figure 1 Image (a) shows an interface 101 displayed on the mobile phone in unlocked mode. This interface 101 displays a weather clock component and multiple applications (Apps). These applications may include phone, messaging, settings, and app A, etc. It should be understood that this interface 101 may also include other applications, and this embodiment of the application does not limit this.
[0101] like Figure 1 As shown in (a), when a user clicks the icon of application A, the phone displays the following in response to the user's click: Figure 1 The main interface 102 of application A shown in (b) can also be referred to as the "homepage of application A". The main interface 102 of application A can display multiple category menus, operable controls or buttons, pictures and other interface content for users to meet their usage needs.
[0102] For example, such as Figure 1 As shown in Figure (b), the main interface 102 of application A displays the current delivery address (e.g., "XX District XX Street"), a first search box 10, and different category menus such as food delivery, supermarkets, fruits, flowers and gifts, desserts, hamburgers, lobsters, and barbecue, as well as a merchant list. This embodiment does not limit the displayed content or the size of the display area on the main interface 102 of application A. Currently, on the main interface 102 of application A, the merchant list can display one or more merchants for the user, who can view more merchant information by swiping up and down. Optionally, each merchant display area can display one or more of the merchant's user ratings, monthly sales volume, delivery time, delivery distance, minimum order price, delivery fee, promotional information, etc. For example, as shown... Figure 1 As shown in (b), the A Mala Tang display area shows promotional information such as user rating of 4.9 stars, monthly sales of 443, delivery time of 23 minutes, delivery distance from the current device of 1.2km, minimum order price of 20 yuan, delivery fee of 6 yuan, and 8 yuan no minimum order.
[0103] For example, a user can search for products through the first search box 10 on the main interface 102. First, the user can enter the corresponding search terms in the first search box 10. For example, if the user wants to search for red bean milk tea, they 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 as follows: Figure 1 The product display interface 103 shown in (c) is shown in the image.
[0104] The product display interface 103 is used to display the search results obtained after searching for the search term. The search results include multiple recommended products, that is, multiple products related to the search term. For example, such as... Figure 1 As shown in (c), the product display interface 103 displays multiple recommended products after searching for "red bean milk tea," including "Red Bean Milk Tea," "Brown Sugar Boba Milk Tea," and "Signature Red Bean Milk Tea." Users can swipe up and down to view more recommended products, and can also click on the display area of any recommended product to view its details.
[0105] like Figure 1 As shown in (c), the product display interface 103 first displays "Red Bean Milk Tea", then "Brown Sugar Boba Milk Tea", and then "Signature Red Bean Milk Tea". The search term is "Red Bean Milk Tea". "Brown Sugar Boba Milk Tea" is not very relevant to "Red Bean Milk Tea", but it is ranked before "Signature Red Bean Milk Tea". Therefore, the display order of the multiple recommended products in the product display interface 103 does not match the actual relevance order between the multiple recommended products and the search term. Consequently, the product display interface 103 cannot accurately display search results to the user.
[0106] When users browse multiple recommended products in the product display interface 103, visually, they will first see brown sugar boba milk tea, which is not very relevant to "red bean milk tea". This may make users feel that the search results do not meet their expectations, thus reducing the user's search experience.
[0107] Furthermore, e-commerce platforms offer a vast array of products, with an unimaginable number of items. To gain greater exposure, merchants often optimize their product titles, such as creating complex titles and adding as many tags as possible. For example, a product like "red roses" might be titled "Red Roses as a Valentine's Day / Birthday Gift for My Girlfriend," making it easier to find. However, with optimized product titles, complex relationships exist, making it difficult to accurately measure the relevance between search terms and the title. Consequently, search results may not meet user expectations, resulting in a poor user experience.
[0108] Therefore, to address the above-mentioned problems, this application provides a search result display method that can accurately calculate the relevance between search terms and products in the search results, thereby enabling users' terminal devices to accurately display search results and improve user experience.
[0109] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0110] It should be noted that, during the development of the target application, the technicians can configure this search result display method in the product search function of the target application, so that when the target application searches for search terms, the search results can be displayed based on the search result display method provided in the embodiments of this application.
[0111] In the first possible approach, the search result display method can be configured in the product search function on the main interface, so that when users use the product search function through the main interface, the search results can be displayed based on the search result display method provided in this application embodiment.
[0112] In the above method, users 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 results can be sorted using this search result display method so that the user's terminal device can display the sorted search results.
[0113] It should be noted that the process by which users utilize the product search function in the above manner is the same as described above. Figure 1 The user operation process described in the embodiments, that is, the user can... Figure 1 The operation process described in the embodiments is used to search for products. Then, the search results can be sorted based on the search result display method provided in the embodiments of this application, so that the user's terminal device can display the sorted search results.
[0114] In the second possible approach, the search result display method can be configured in the product search function of a merchant's store. This allows users to use the search result display method to sort the search results found in that merchant's store when they use the product search function through that merchant's store, so that the user's terminal device can display the sorted search results.
[0115] In the target application, not only can the product search function be used through the main interface, but a search box is also set up on the merchant's store page, so the merchant's store also has a product search function.
[0116] For example, Figure 2 This is a schematic diagram of another search result display method provided in the embodiments of this application.
[0117] like Figure 2As shown in (a), the main interface 102 of application A displays a list of merchants. This list can display one or more merchants for the user. The user can swipe up and down to view more merchant information, and can also enter the store of the selected merchant by clicking on its display area. For example, the user can click... Figure 2 As shown in (a) of the image, the "C Bakery" display area 20, in response to a user's click, the phone can then display as shown in the image. Figure 2 The merchant store interface 202 shown in (b) can display merchant information (such as ratings, sales volume, and promotional information) and a product list for users. The product list can display one or more products sold by the merchant.
[0118] For example, the merchant store interface 202 may also include a first search control 30, which provides a product search function within the store. When a user clicks the first search control 30, in response to the user's click, the mobile phone can display something like... Figure 2 The first product search interface 203 shown in (c) allows users to search for products.
[0119] For example, the first product search interface 203 may include a second search box 40, in which the user can enter search terms. After obtaining search results, the search results can be displayed using the search result display method provided in this application embodiment. Then, the products obtained from the search for the search terms can be displayed on a mobile phone, such as... Figure 2 The first search result display interface 204, shown in (d), displays products that match the search criteria entered by the user within the merchant's store. Additionally, the first product search interface 203 can also display search terms for frequently used search terms, allowing users to perform corresponding searches by clicking on any of these terms.
[0120] like Figure 2 As shown in (c), the user enters "cake" in the second search box 40. In response to the user's search term, the mobile phone can send the user's search term to the server. The server can then search for all items containing "cake" within the "C Bakery" store based on the user's search term. The server can then sort the searched items according to the search result display method provided in this embodiment and send the sorted results to the mobile phone. After receiving the sorted results, the mobile phone can display the results as shown in the image. Figure 2 The first search result display interface 204, shown in (d) in the figure, is as follows: Figure 2As shown in (d), the first search result display interface 204 displays all products related to "cake" in "C Bakery".
[0121] In the third possible approach, the search result display method can be configured in the product search function of each category menu, so that when a user uses the product search function through any category menu, the search result display method can be used to sort the search results, and the user's terminal device can display the sorted search results.
[0122] For example, Figure 3 This is a schematic diagram illustrating another method for displaying search results provided in this application embodiment.
[0123] like Figure 3 As shown in (a), the main interface 102 of application A displays the current delivery address, search box, and different category menus such as food delivery, supermarket, fruit, flowers and gifts, dessert, hamburger, lobster and barbecue. Users can enter the channel corresponding to the clicked category menu by clicking the corresponding category menu.
[0124] For example, when a user clicks the "Flowers & Gifts" category menu on the main interface 102, the phone can display the following in response to the user's click: Figure 3 The flower and gift interface 302 shown in (b) is as follows. This interface can display a third search box 50, a gift guide, and a list of vendors or products selling flowers and gifts. Furthermore, it can display different flower and gift categories such as "Holiday Bouquets," "Fruit Gift Boxes," "Snack Gift Boxes," and "Trendy Toys." Users can swipe up and down to view more vendor or product information.
[0125] The third search box 50 on the flower and gift interface 302 is used to provide users with a product search function within the flower and gift channel. For example, when a user clicks on the third search box 50, in response to the user's click, the mobile phone can display something like this: Figure 3 The second product search interface 303 is shown in (c). Users can search for the desired products in the flowers and gifts channel through the second product search interface 303.
[0126] For example, the second product search interface 303 may include a second search control 60, in which the user can enter search terms and click the search button. The search results can then be displayed using the search result display method provided in this application embodiment, and subsequently displayed on a mobile phone. Figure 3The second search results display interface 304, shown in (d), displays products that match the user's input search terms within the flowers and gifts channel. Additionally, the second product search interface 303 can also display historical search results and search findings. These historical search results and search findings can provide users with relevant search terms, which users can click on to perform a search.
[0127] like Figure 3 As shown in (c), the user can enter the search term "rose" in the second search control 60. After the user clicks the search button, in response to the user's operation, the mobile phone can send the user's entered search term to the server. The server can then perform a product search within the flowers and gifts channel based on the user's entered search term "rose" to obtain the search results. The server can then sort the search results based on the search result display method provided in this application embodiment and send the sorting results to the mobile phone. After receiving the sorting results, the mobile phone can display the results as shown in the image. Figure 3 The second search result display interface 304 is shown in (d) in the figure.
[0128] The above embodiments describe the user's operation process of using the product search function in a target application from the user interaction perspective. The following description, using the accompanying drawings provided in the embodiments of this application, illustrates the specific implementation of the search result display method.
[0129] Before introducing the method for displaying search results, the technical terms involved in the embodiments of this application will be explained.
[0130] 1. Knowledge Graph
[0131] Knowledge graphs are a structured form of knowledge representation. Essentially, they are graph-based data results composed of nodes (entities / concepts) and edges (relationships). They are typically used to store entities and the relationships between them, providing rich semantic information. Therefore, they are widely used in fields such as search engines, recommendation systems, and voice assistants to enhance the system's understanding and reasoning capabilities.
[0132] 2. Entity Relevance
[0133] Entity relevance refers to the degree of association or semantic connection between two or more entities. It is a core indicator for measuring whether there is a direct or indirect relationship between entities. Relevance between entities is typically calculated using graph-based methods, semantic similarity-based methods, machine learning-based methods, and knowledge reasoning-based methods.
[0134] 3. Entity Extraction
[0135] Entity extraction, also known as Named Entity Recognition (NER), aims to automatically identify and extract meaningful entities (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 (CRF), Recurrent Neural Networks (RNN), or Transformers, to label entity categories in text. This technology has wide applications in information extraction, question answering systems, and semantic analysis.
[0136] 4. Relation Extraction (RE)
[0137] Relation extraction (RE) is a task in natural language processing that aims to automatically identify relationships between entities in text. This includes identifying what the entities are, the type of relationship between them (e.g., working relationship, kinship relationship, location relationship, etc.), and the direction of the relationship. Relation extraction (RE) is one of the key technologies for building knowledge graphs. It enables computers to understand structured information in text, thereby enhancing the understanding and reasoning abilities of intelligent systems. Currently, traditional machine learning methods and deep learning methods are commonly used to achieve relation extraction.
[0138] 5. Abstract Extraction
[0139] Abstract extraction refers to the technique of extracting core content from text, documents, or other information carriers to form a concise and accurate summary of the main viewpoints, key data, and core conclusions of the original text. It is generally achieved through traditional natural language processing techniques or intelligent algorithms based on deep learning.
[0140] 6. Large Language Model (LLM)
[0141] Large language models are deep learning-based artificial intelligence systems that learn from massive amounts of text data to master the grammar, semantics, and contextual information of a language, performing various complex natural language processing tasks such as text generation, translation, question answering, and summarization. Large language models are typically built on transformer architectures, 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.
[0142] For example, Figure 4 This is a schematic diagram of the structure of a large language model provided in an embodiment of this application. For example... Figure 4 The model structure shown includes a word embedding layer, a Transformer block, a feature mapping layer, and a Softmax layer.
[0143] The word embedding layer maps discrete tokens (the smallest unit after splitting the input data) into continuous vectors of fixed dimensions, enabling the model to capture semantic relationships and similarities between tokens. After the word embedding layer outputs continuous vectors, positional encoding can be performed to supplement the token's positional information (since the Transformer itself has no order awareness, positional encoding is needed for the model to distinguish sequence order).
[0144] The Transformer block consists of a masked multi-head self-attention mechanism, residual connections, layer normalization, and a pointwise feedforward network. It captures local and global dependencies in a sequence by progressively encoding contextual information. In this embodiment, Transformer blocks can be stacked in multiple layers to form the model structure. Figure 4 The model structure shown can include multiple stacked Transformer blocks.
[0145] Among these features, the masked multi-head self-attention mechanism enables the model to perform parallel computations of multiple sets of self-attention to focus on the relationships between different dimensions and positions, thereby enhancing the model's expressive power. Residual connections: 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 residual connections (using methods such as mean or standard deviation division), making the model easier to compute. Pointwise feedforward network: used to perform non-linear transformations on the features of each token, further refining information and enhancing the model's fitting ability.
[0146] Feature mapping layer: Maps the feature vectors output by the Transformer block to the "vocabulary dimension" through the word embedding matrix.
[0147] The Softmax layer is used to transform 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, which is used to predict the probability of the expected output text.
[0148] Here's an example illustrating the overall process: The model receives input data (e.g., a piece of text). First, it segments the text into multiple discrete tokens. Then, these discrete tokens are input into a word embedding layer for word embedding, followed by positional encoding. The continuous vectors resulting from word embedding and positional encoding are then input into a multi-head self-attention (MSA) mechanism to capture the relationships between different dimensions and positions in the sequence. Next, the input and output of the MSA mechanism are summed through residual connections, and then normalized in the input layer normalization process. The features obtained from the normalized layer are input into a pointwise feedforward network for non-linear transformation to further refine the information. Then, the input and output of the pointwise feedforward network are summed through residual connections, and normalized again. Finally, the feature vector output from the last layer of the Transformer block (residual connection + normalized layer) is input into a feature mapping layer. The feature mapping layer maps the feature vectors to the vocabulary dimension. Finally, a Softmax layer transforms the vocabulary-dimensional features output from the feature mapping layer into the probability distribution of 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.
[0149] It should be noted that, in the embodiments of this application, different prediction tasks can be achieved through the Large Language Model (LLM), such as relation extraction and summary extraction. It should be understood that different prediction tasks are achieved using the same model structure, but the input and output data of the model differ for each task.
[0150] 7. Self-attention mechanism
[0151] Self-attention is a core component of 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 a 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.
[0152] 8. Cross-attention mechanism
[0153] Cross-attention is an extension of self-attention, used to handle two distinct sequences, such as source and target languages in machine translation. Cross-attention allows the model to focus on and utilize information from the source sequence while 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 also has wide applications in multimodal tasks (such as image caption generation) and dialogue systems.
[0154] The search result display method provided in the embodiments of this application will be explained in detail below.
[0155] Figure 5 This is a flowchart illustrating a search result display method provided in an embodiment of this application. The method can be applied to a computer device, which can be a server, either a single server or a server cluster comprising multiple servers.
[0156] It should be understood that this method of displaying search results is based on the aforementioned... Figures 1-3 The process described in the example, following the user's input of search terms, will not be repeated hereafter. See also Figure 5 The method includes the following steps.
[0157] Step 501: The server obtains the search term and multiple target products obtained after a preliminary search for the search term.
[0158] The search term can be the query that the user enters in the search box. For example, the search term can be what the user says in the search box. Figures 1-3 The query content entered in the search box as described in the embodiment.
[0159] After a user enters a search term in the search box, the terminal device can obtain the entered search term and send it to the server. After receiving the search term, the server can perform a product search based on the search term and obtain preliminary search results, which include multiple target products that are relevant to the search term.
[0160] After initially searching for the search term and obtaining multiple target products, these products need to be displayed on the terminal device so that users can browse them. Therefore, the display order of the multiple target products on the terminal device is very important. The following will combine... Figure 6 The implementation process of steps 502-506 is described in detail below.
[0161] Step 502: The server extracts the search term to obtain the first entity associated with the search term.
[0162] In the above operation, by extracting the search term, we can obtain the key information of the search term, that is, obtain the entity that best reflects the semantics of the search term.
[0163] For example, Figure 6 This is an overall framework diagram of a search result display method provided in an embodiment of this application. For example... Figure 6 As shown, after a user enters a search term, the server can perform entity extraction on the user's search term to extract the first entity associated with that search term.
[0164] The following describes a specific implementation method for extracting the search term to obtain the first entity associated with the search term.
[0165] One possible approach is for the server to input the search term into a first entity extraction model, which then extracts the search term to obtain the first entity associated with it.
[0166] The first entity extraction model is the model used for entity extraction. Optionally, the first entity extraction model can be a non-reactive entity extraction model (NER model), such as Lexicon Enhanced BERT (LEBERT). For example, inputting a piece of text into the first entity extraction model will allow it to output the entities within that text.
[0167] For example, after inputting the search term 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.
[0168] Figure 7 This is a model structure diagram of a first entity extraction model provided in an embodiment of this application. See also... Figure 7 , Figure 7 The model includes a character embedding layer 701, a word embedding layer 702, and a dictionary adapter 703. Furthermore, the first entity extraction model also includes multiple Transformer layers 704, where 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 can be preset, for example, L is 12), and the dictionary adapter 703 can be applied between the kth Transformer layer 704 and the (k+1)th Transformer layer 704 of the L Transformer layers 704.
[0169] The character embedding layer 701 is used to represent characters as character vectors, specifically by converting characters into multidimensional vector representations suitable for processing by the Transformer layer 704.
[0170] The word embedding layer 702 is used to transform discrete text into continuous dense vectors, thereby capturing semantic and syntactic information in the language.
[0171] The dictionary adapter 703 is used to fuse word features from the dictionary with the character / word embedding representation of the model. By combining prior knowledge from 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.
[0172] The Transformer layer 704 is used to extract features from the input vectors. The Transformer layer 704 includes an encoder unit composed of a multi-head attention mechanism and a feed-forward neural network. Through the multi-head attention mechanism, each character can pay attention to other characters during encoding, capture the semantic associations and syntactic structures between characters, and achieve the fusion of context information, so as to better capture the semantic relationships between characters in the search term, and then achieve more accurate feature extraction.
[0173] In this case, the server inputs the search term into the first entity extraction model, and the specific process of extracting the search term by the first entity extraction model to obtain the first entity associated with the search term may include the following steps (1)-(4).
[0174] (1) Represent the search term as a character sequence, and match each character in the character sequence with the corresponding word in the preset dictionary to obtain a target sequence. The target sequence includes matching pairs composed of each character and the corresponding word.
[0175] The preset dictionary can be set by technicians in advance. In the embodiments of the present application, the preset dictionary can be compiled through manual annotation or optimized and extended based on the existing word library. For example, the preset dictionary can be optimized and extended by technicians based on the existing general dictionary according to specific application requirements and newly emerging vocabulary.
[0176] For each character in the character sequence, the 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".
[0177] 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 is matched to include (ws1, ws2,..., ws n ), then multiple target sequences composed of matching pairs (c1, ws1), (c2, ws2),..., (c n , ws n ) can be obtained.
[0178] (2) For any matching pair in the target sequence, input the character in the matching pair into the character embedding layer 701 to obtain the character vector of the character, and input each word in the matching pair into the word embedding layer 702 to obtain the word vector of each word.
[0179] After the characters in the matching pair are input into the character embedding layer 701, the character embedding layer 701 can convert the input characters into character vectors suitable for processing by the Transformer layer 704. Similarly, inputting the word corresponding to the character into the word embedding layer 702 can also yield word vectors suitable for processing by the Transformer layer 704. For example... Figure 7 As shown, (c1, c2, ..., c n The characters are input into the character embedding layer 701 to obtain the character vector corresponding to each character. Then, the words matched by each character (ws1, ws2, ..., ws...) are... n The word vector is obtained by inputting it into the word embedding layer 702.
[0180] 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 be input into the Transformer layer 704 for processing. After the character vector has undergone feature extraction 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 on the character vector and word vector corresponding to each character.
[0181] (3) Input the character vector of the character and the word vector of each word 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. Based on the first attention weight, the word vectors of each word matched by the character are 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.
[0182] like Figure 7 As shown, the k-th Transformer layer 704 and the (k+1)-th Transformer layer 704 may include multiple dictionary adapters 703. Each dictionary adapter 703 corresponds one-to-one with a character in the character sequence. That is, for any character in the character sequence, the character vector corresponding to the character can be input into the corresponding dictionary adapter 703, and the word vector of the word matched by the character can be input into the corresponding dictionary adapter 703. The dictionary adapter 703 can then fuse the character features and dictionary features of the character to further improve the model's ability to capture the semantics of words, thereby enabling accurate entity recognition.
[0183] Bilinear attention mechanism uses a learnable weight matrix to capture the second-order correlation (i.e., the interaction between features) between two vectors, thereby enabling more refined calculation of attention weights.
[0184] In the above approach, the first attention weight between the character vector and the word vector of each word is calculated based on the bilinear attention mechanism. This allows different weights to be assigned to different words corresponding to each character to represent the importance of the word to the character. This enables the model to identify the most relevant word among all words that match a character, thereby helping the model focus on key word information, suppress irrelevant noise information, and thus capture semantic information more accurately.
[0185] Furthermore, by adding the character vector of the character to the weighted word vector, the model can utilize both character-level and word-level information simultaneously, thereby enriching the model's feature representation and enabling more accurate entity recognition.
[0186] It is worth noting that after inputting the word vectors into the dictionary adapter 703, the word vectors can be subjected to a nonlinear transformation first, and then the dictionary adapter 703 can calculate the first attention weight between the character vectors and the word vectors after the nonlinear transformation based on the bilinear attention mechanism.
[0187] Since the dimensions of character vectors and word vectors may be inconsistent, in order to ensure successful feature fusion, the word vectors can be subjected to a non-linear transformation to align their dimensions with those of character vectors.
[0188] (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.
[0189] The entity features corresponding to each character are 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+1)th Transformer layer 704. 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 output in the end.
[0190] The process of extracting the search term has been described above. The following describes a specific implementation method for extracting information from the title of any one of the multiple target products to obtain a related second entity set.
[0191] Step 503: The server extracts information from the product title of any one of the multiple target products to obtain a second set of associated entities, which includes one or more entities.
[0192] The product title is used to describe detailed information about the target product, such as the product name, category, and purpose. 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 after image content recognition of the product image of the target product.
[0193] In the embodiments of this application, the entities described (entities in the first entity and the second entity set) may include key information such as restaurant name and product name.
[0194] In the above operation, by extracting information from the title of any one of the multiple target products, key information related to the target product can be extracted. This essentially simplifies the target product title by obtaining its key information, facilitating subsequent relevance calculations.
[0195] For example, Figure 6 This is an overall framework diagram of a search result display method provided in an embodiment of this application.
[0196] like Figure 6 As shown, after a user enters a search term, the server can perform entity extraction on the user's search term to extract the first entity associated with that search term. Furthermore, for any target product, information extraction is also performed on the product title (e.g., Figure 6 The abstract extraction and entity extraction operations in the process yield the second entity set (Entity_1, Entity_2, ..., Entity_m).
[0197] One possible approach is to input the title of any one of the multiple target products into a summary extraction model, extract the summary of the product title using the summary extraction model, and output the summary information of the product title; then input the summary information into a second entity extraction model, extract entities from the summary information using the second entity extraction model, and output a second entity set.
[0198] This summary extraction model is used to extract summaries from product titles, that is, to extract key information from the product title while retaining the core content and semantics of the original text. In other words, after inputting the product title of a target product into this summary extraction model, the model can summarize the product title accordingly to simplify it and retain key information. In the embodiments of this 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 as described above. Figure 4 The model structure described in the embodiments will not be repeated here.
[0199] The second entity extraction model is used to extract entities from the extracted summary information. In this embodiment, similar to the first entity extraction model, the second entity extraction model can also be a NER model, such as a LEBERT model. The model structure of the second entity extraction model will not be elaborated here. The difference is that the summary information of a target product's title can be input into the second entity extraction model, enabling the model to identify entities within the summary information and output the entities contained in the summary information, i.e., outputting the second entity set.
[0200] In the above method, the product title of the target product is first extracted to extract the key information of the product title and simplify the product title. Then, entity extraction is performed on the product title summary information. Compared with directly extracting entities from the product title, the above entity extraction process is based on the simplified key information, which can reduce the computational load of the model and allow the model to process directly based on the key information of the product title, thereby improving the accuracy of entity extraction and obtaining a more accurate second entity set.
[0201] It should be noted that when extracting entities from the summary information corresponding to the product title of the target product, generally only the product type, category words, content words, product name, and other entities described in the product title are extracted, while other entities such as the product brand are not retained.
[0202] The above describes the specific process of extracting information from the product title of the target product to obtain the second entity set. In this embodiment, after obtaining the second entity set, the relationships between the entities in the second entity set can also be obtained.
[0203] In order to gain greater exposure, merchants often add many tags to their products, making the product titles complex. In this case, the different entities contained in the product title may have some kind of relationship. For example, for the entity "rose" and the entity "flower", "rose" belongs to "flower", so there is a hierarchical relationship between the two.
[0204] One possible approach is to input each entity in the second entity set into a relation extraction model, and then extract the relation between each entity using this model to obtain the relationship between each entity in the second entity set.
[0205] This relation extraction model is used to extract relationships between entities. That is, it receives multiple entities, identifies and outputs the relationships between them, thus obtaining the relationships between different entities. In this embodiment, the relation extraction model can be a Large Language Model (LLM). For example, the model structure of the relation extraction model can be as described above. Figure 4 The model structure described in the embodiments will not be repeated here.
[0206] It should be noted that although this relationship extraction model is similar to... Figure 4 The model structure described in the embodiments is the same, but the input data of this relation extraction model is multiple entities, and the output is the relationships between these entities. That is, this relation 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 multiple entities.
[0207] In this embodiment, the relationship extraction model can be trained based on the entities in the target knowledge graph and the relationships between them. Specifically, it can be trained based on the entities in the target knowledge graph and the relationships between them. Figure 4 The model constructed using the model structure described in the embodiment is trained to obtain the relationship extraction model.
[0208] The target knowledge graph includes a large number of entities and describes the relationships between different entities. These relationships can include hierarchical relationships, synonym (co-position) relationships, sibling relationships, entity-attribute relationships, and collateral relationships.
[0209] For example, Figure 8 This is a schematic diagram of the structure of a target knowledge graph provided in an embodiment of this application. For example... Figure 8 As shown, the target knowledge graph includes entities such as "catering," "supermarket," "staple food," "snacks," "noodles," and "fried noodles." Connections between two entities indicate a hierarchical relationship. For example, "catering" and "staple food" are hierarchical; the "catering" entity includes two parallel entities, "staple food" and "snacks," making them siblings. Similarly, the entity "daily necessities" has a connection with the entity "supermarket," meaning the "snacks" entity and the "daily necessities" entity are related.
[0210] The embodiments of this application are based on Figure 8 The above example illustrates the target knowledge graph. Figure 8 This does not constitute a limitation on the embodiments of this application.
[0211] In this scenario, the relationship extraction model is trained by analyzing the entities and relationships within the target knowledge graph. This allows the model to learn the relationships between various entities, thus enabling it to identify these relationships. Furthermore, the target knowledge graph accurately describes the relationships between different entities. Training the model using the entities and their relationships within the target knowledge graph improves its ability to extract entity relationships, allowing it to accurately identify the relationships between each entity in the second entity set.
[0212] Step 504: The server retrieves the third entity set from the target knowledge graph based on the relationships between each entity in the second entity set and the first entity.
[0213] The third entity set can be viewed as an extension of the first entity set. It should be understood that the third entity set may include one or more entities.
[0214] Because the target product side can extract relationships between different entities—meaning it can obtain multiple different entities with certain relationships—while the search term side extracts entities from search terms and does not contain entities with certain relationships, calculating the relevance between entities allows for a more accurate measure of relevance when both sides have entities with the same relationship.
[0215] In the above method, by querying the target knowledge graph to obtain the third entity set 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, the search term side can introduce indirectly related entities based on the relationship between entities on the target product side, thereby expanding the entities on the search term side. This allows subsequent relevance calculations to be performed from multiple levels, thus breaking the limitation of relying on literal matching.
[0216] For example, such as Figure 6 As shown, after extracting the first entity from the search terms and extracting the relationships between each entity in the second entity set, the first entity can be expanded by knowledge graph matching based on the relationships between each entity in the second entity set. That is, multiple entities are matched in the target knowledge graph based on the relationships between each entity in the second entity set to obtain the third entity set.
[0217] One possible approach is that step 504 can be performed as follows: 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 that is related to each entity in the second entity set; and determine the first candidate entity and the second candidate entity as entities in the third entity set.
[0218] The first candidate entity could be the first entity or an entity with the same semantics as the first entity. It should be understood that in the process of searching for the first candidate entity in the target knowledge graph, the first entity should be searched first. If the first entity is found, then 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, and that entity is the first candidate entity.
[0219] In the process of expanding the first entity, the location of the first entity is first determined in the target knowledge graph, and the entity at this location is designated as the first candidate entity. Then, entities in the target knowledge graph that have relationships with every entity in the second entity set that are related to the entity at this location are identified as second candidate entities. For example, if there are parent-child relationships and entity-attribute relationships among entities in the second entity set, then entities in the target knowledge graph with parent-child and entity-attribute relationships with the entity at this location can be identified as second candidate entities. Finally, the first and second candidate entities can constitute a third entity set.
[0220] In the above method, by locating the first entity in the target knowledge graph and then querying the entities that have relationships with the entities in the second entity set that are located at the location, a third entity set is obtained. This is a convenient way to expand the first entity, thereby facilitating the querying of the third entity set in the target knowledge graph.
[0221] The above content introduces the method for determining the entities corresponding to the search terms (the third entity set) and the entities corresponding to the target products (the second entity set). Through the above content, we can obtain the entities corresponding to the search terms (the third entity set) and the entities corresponding to the target products (the second entity set). Then, to calculate the relevance between the searched target products and the search terms, we can calculate the relevance between the corresponding entities.
[0222] In this embodiment of the application, the user's historical behavior logs can also be obtained, the contextual information of the historical behavior logs can be analyzed, and potential entity relationships can be mined. Based on the potential entity relationships, the target knowledge graph can be completed so that the third entity set can be queried in the completed target knowledge graph.
[0223] User history logs include data such as search terms and clicks generated when using the search function.
[0224] For example, if there are historical behavior logs of users searching for both brand A mobile phones and chargers, then after analyzing the historical behavior logs, entity relationships such as "brand A mobile phone - accessories - charger" can be discovered. Then, "brand A mobile phone - accessories - charger" can be added to the target knowledge graph.
[0225] In the above methods, by completing the target knowledge graph, the entities and relationships between them can be enriched, thereby improving the success rate of knowledge graph matching.
[0226] It is worth noting that after the potential entity relationship is discovered, it 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.
[0227] If the identified potential entity relationship already exists in the target knowledge graph, further completion of the target knowledge graph would be a waste of resources. However, if the potential entity relationship cannot be found in the target knowledge graph, then completion based on that potential entity relationship can avoid this waste of resources.
[0228] In this embodiment of the 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 can be determined based on the cross-attention mechanism.
[0229] 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.
[0230] Cross-attention mechanisms are used for information exchange between different input sequences, thereby better capturing the correlation between two input sequences.
[0231] 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 by the cross-attention mechanism. This fully utilizes the characteristic that the cross-attention mechanism can capture the correlation between two input sequences to determine the association score, thereby achieving accurate determination of the association score, that is, accurately determining the correlation between each entity in the third entity set and each entity in the second entity set.
[0232] One possible approach, based on a 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. This can be achieved by: determining the query vector for each entity in the third entity set and the key vector and 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, determining the similarity score between the query vector of the i-th entity and the key vector of the j-th entity; normalizing this similarity score to obtain a second attention weight; and weighted summing 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.
[0233] A query vector is a vector representing the content being followed. The key vector is used to represent the index or identification information of the followed content, while the value vector is used to represent the actual information carried by the followed content.
[0234] The second attention weight is used to represent the degree of attention that the i-th entity pays to the j-th entity.
[0235] For example, Figure 9 This is a flowchart of a cross-attention mechanism provided in an embodiment of this application.
[0236] like Figure 9 As shown, the cross-attention mechanism receives the i-th entity from the third entity set. The j-th entity in the second entity set Then determine the i-th entity. query vector Q i And determine the j-th entity The key vector K j Sum vector V j Then, based on the i-th entity... query vector Q i and the j-th entity The key vector K j The similarity score between the two entities is determined. Then, the similarity score is normalized using Softmax to obtain the second attention weight. Finally, the second attention weight is used to select the j-th entity. Value vector V j We perform a weighted summation to obtain the association score between the i-th entity and the j-th entity.
[0237] Among them, such as Figure 9 As shown, when receiving the i-th entity After that, you can Multiply by the query matrix W Q To obtain the i-th entity query vector Qi Similarly, upon receiving the j-th entity... After that, you can Multiply by the bond matrix W respectively K Sum matrix W V To obtain the j-th entity The key vector K j Sum vector V j .
[0238] Additionally, when calculating the similarity score, the query vector Q is used. i The key vector K after multiplication by the transpose j T Obtained.
[0239] In the above method, similarity is calculated based on the query vector of the i-th entity and the key vector of the j-th entity in the third entity set. The query vector comes from entities in the third entity set, and the key vector comes from entities in the second entity set. This method allows for flexible interaction between two sequences. Furthermore, the association score between the i-th and j-th entities can be accurately calculated subsequently.
[0240] In one possible implementation, the first entity set and the second entity set can be concatenated, and then, based on the cross-attention mechanism, the association score between each entity in the third entity set and each entity in the concatenated entity set can be calculated.
[0241] As described above, if the first entity is found in the target knowledge graph, the first candidate entity can be the first entity, and in this case, the third entity set includes the first entity. However, if the first entity is not found in the target knowledge graph, the first candidate entity is not the first entity, and in this case, the third entity set does not include the first entity. Nevertheless, the first entity is the entity that accurately represents the search term, therefore, the first entity is very important.
[0242] In the above method, by concatenating the first entity set with the second entity set, the association score between each entity in the third entity set, each entity in the second entity set, and the first entity can be calculated. This association score can more comprehensively and accurately represent the relevance between the search term and the entity corresponding to the target product. Therefore, based on this association score, a more accurate relevance between the search term and the target product can be determined.
[0243] Another 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. This can be done by: determining the self-attention score between each entity in the second entity set and the remaining entities based on the self-attention mechanism; filtering out reference entities from the second entity set based on the self-attention scores to update the second entity set; and determining the association score between each entity in the third entity set and each entity in the updated second entity set based on the cross-attention mechanism.
[0244] The self-attention score between an entity and the other entities in the second entity set is used to represent the degree of association between this entity and the other entities in the second entity set, so that the interrelationships between entities in the second entity set can be captured.
[0245] In this embodiment, the self-attention score between the reference entity and the remaining entities in the second entity set meets a preset condition. One possible implementation is that the preset condition can 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.
[0246] The preset score threshold can be set in advance, and the preset score threshold can be set to a small value, for example, the preset score threshold can be set to 0.1.
[0247] To increase brand exposure, merchants often include numerous tags in their product titles. Some of these tags may be relevant to the product, while others may be irrelevant. In such cases, certain entities within the target product category may have limited relevance. For example, a target product titled "Fresh Flowers, Red Roses, Milk Tea for Girlfriend / Best Friend" might include the entities "Fresh Flowers," "Rose," and "Milk Tea." Clearly, "Milk Tea" is not actually related to "Fresh Flowers" or "Rose," meaning their relevance is low.
[0248] If 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 indicates that the correlation between the reference entity and the remaining entities is not strong. In other words, the reference entity may not be very relevant to the remaining entities, which means that the title information corresponding to the reference entity is not very relevant to the title information corresponding to the remaining entities. Therefore, this is not helpful for the subsequent calculation of the relevance between the search term and the target product, and may even interfere with the accuracy of the calculation of the relevance between the search term and the target product. Therefore, the reference entity can be removed from the second entity set.
[0249] In the above method, by first determining the self-attention scores between different entities in the second entity set and then filtering out entities in the second entity set whose self-attention scores meet the preset conditions, entities in the second entity set that might interfere with the calculation of the relevance between the search term and the target product can be filtered out. Then, based on the association scores between each entity in the third entity set and each entity in the updated second entity set, the relevance between the search term and the target product can be accurately calculated.
[0250] The operation of determining the self-attention score between each entity in the second entity set and the other entities based on the self-attention mechanism can be as follows: determine 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, determine the similarity score between the query vector of the j-th entity and the key vector of each of the other entities; normalize the multiple similarity scores to obtain the self-attention score between the j-th entity and each of the other entities.
[0251] It should be understood that the difference between self-attention and cross-attention mechanisms lies in the fact that cross-attention calculates the correlation between different sequences. Therefore, in this embodiment, cross-attention calculates 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. Self-attention, on the other hand, calculates the correlation between different positions within the same sequence. Therefore, in this embodiment, self-attention calculates 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 for calculating the similarity score is the same and will not be elaborated upon here.
[0252] 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 relevance between the entity corresponding to the search term and the entity corresponding to the target product. This can be used to measure the relevance between the search term and the target product. Therefore, the relevance 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, we can continue to execute step 505 below.
[0253] 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.
[0254] In the above method, the entities in the third entity set represent key information on the search term side, and the entities in the second entity set represent key information on the target product side. In this embodiment, the relevance between the search term and the target product is determined by the relevance between the entities corresponding to the search term and the entities corresponding to the target product side. Compared to directly calculating the relevance between the search term and the product title of the target product, this is equivalent to directly determining the relevance between the search term and the target product based on the key information corresponding to the search term and the key information corresponding to the target product side. This improves the accuracy of the relevance calculation and reduces the computational load, saving computing resources.
[0255] 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, which is determined based on the aforementioned self-attention mechanism, can also be obtained.
[0256] In this case, step 505 can be performed as follows: The server determines the relevance between the search term and the target product based on the association score and the self-attention score between each entity in the second entity set and the remaining entities.
[0257] The association score directly measures the explicit relevance between the search term and the target product, while the self-attention score indicates the association between entities in the second entity set and can assess the internal consistency of product features. Therefore, in determining the relevance between the search term and the target product based on the association score, the self-attention score guides the process, ensuring that the association between entities in the second entity set is fully considered. Combining the two can avoid the problem of "keyword stuffing matching," contribute to the depth of semantic understanding, and thus determine a more accurate relevance between the search term and the target product.
[0258] One possible approach is for the server to determine the relevance between the search term and the target product based on the association score and the self-attention score between each entity in the second entity set and the remaining entities. This could involve the server inputting the self-attention score into a relevance calculation model, and inputting the association score into the same model. The relevance calculation model then combines the self-attention score and the association score to determine the relevance between the search term and the target product.
[0259] The relevance calculation model is used to calculate the relevance between the search term and the target product. In this embodiment, the relevance calculation model can be a linear regression model, a supervised neural network model, etc., and this embodiment does not limit it.
[0260] Specifically, the operation of determining the relevance between the search term and the target product by combining the self-attention score and the association score through the relevance calculation model can be as follows: the association score and the self-attention score are weighted and summed based on the first weight and the second weight, and the weighted sum is normalized to obtain a reference score; the relevance level between the search term and the target product is determined by the relevance calculation model based on the reference score; and the preset score corresponding to the relevance level is determined by the relevance calculation model as the relevance score between the search term and the target product.
[0261] The first weight can be the model weight corresponding to the association score, and the second weight can be the model weight corresponding to the self-attention score. In this embodiment, the first weight and the second weight can be the model weights learned by the correlation calculation model during training.
[0262] Relevance rating indicates the degree of relevance between a search term and a target product. A higher relevance rating means a stronger correlation between the search term and the target product. Conversely, a lower relevance rating indicates a weaker correlation. For example, relevance ratings can include strongly relevant, weakly relevant, and irrelevant, with the order from highest to lowest being: strongly relevant, weakly relevant, and irrelevant.
[0263] In this embodiment, multiple relevance levels correspond to multiple preset scores, and there is a one-to-one correspondence between the multiple relevance levels and the multiple preset scores. For example, the relevance levels of strong relevance, weak relevance, and no relevance can correspond to 3 points, 1 point, and 0 points, respectively. The preset score corresponding to a relevance level is used to represent the degree of relevance between the search term and the target product at that level.
[0264] The operation of determining the relevance level between the search term and the target product based on the reference score using the relevance calculation model may include: determining the probability corresponding to multiple relevance levels based on the reference score using the relevance calculation model; and determining the relevance level with the highest probability among the multiple relevance levels as the relevance level between the search term and the target product.
[0265] The probabilities corresponding to these multiple relevance levels refer to the probabilities that the relevance level between the search term and the target product belongs to each of these multiple relevance levels. For example, if the multiple relevance levels include strong relevance, weak relevance, and no relevance, then the probabilities corresponding to these multiple relevance levels include: the probability that the relevance level between the search term and the target product is strong, the probability that the relevance level between the search term and the target product is weak, and the probability that the relevance level between the search term and the target product is no.
[0266] The above method of determining the probability corresponding to multiple correlation levels based on the reference score can be achieved by processing the reference score using the Softmax function to predict the probability corresponding to multiple correlation levels.
[0267] For example, such as Figure 6 As shown, after calculating the association score between each entity corresponding to the search term and each entity corresponding to the target product through cross-attention, and calculating the self-attention score between entities corresponding to the target product, relevance is calculated based on the association score and self-attention score to determine the relevance between the search term and the target product. Specifically, as... Figure 6 As shown, the association score and self-attention score can be input into the relevance calculation model, and the relevance calculation model will output the relevance score (3 points, 1 point or 0 points) between the search term and the target product.
[0268] Steps 502-505 above describe the specific process of calculating the relevance between a target product and the search term among multiple target products. By performing steps 502-505 above, the relevance between each target product and the search term can be determined. Subsequently, the display order of multiple target products can be sorted based on the relevance between each target product and the search term.
[0269] Step 506: The server sorts the multiple target products according to the order of relevance between each target product and the search term from high to low, so that the terminal device can display multiple target products with high to low relevance to the user in response to the search term.
[0270] In the above method, multiple target products are sorted according to their relevance to the search term from high to low. This allows the terminal device to subsequently display multiple target products in the same order of relevance. Thus, the terminal device displays search results based on the relevance between the target products and the user's search keywords, prioritizing the display of products the user expects to find. This ensures that the search results meet the user's expectations and achieves accurate display of search results.
[0271] Furthermore, after the server sorts the multiple target products based on the order of relevance between each target product and the search term from high to low, it can send the product information of the multiple target products and the order in which the multiple target products are sorted to the terminal device.
[0272] After receiving product information and the order of multiple target products from the server, the terminal device can render the products according to the order to display them. This allows users to browse the multiple target products displayed in descending order of relevance.
[0273] It is worth noting that the embodiments of this application provide a novel method for calculating the relevance between search terms and target products. Throughout the process, various technical means are used, including entity extraction models, knowledge graph matching, cross-attention mechanisms, attention mechanisms, entity relationship extraction, and large language model LLM, to gradually improve the accuracy of the relevance calculation between queries and search results, enabling users to obtain the most relevant search results.
[0274] It should be noted that the entity extraction model (first entity extraction model and second entity extraction model), relation extraction model, summary extraction model and relevance calculation model introduced in the embodiments of this application can all be trained before the actual reasoning process to output output data that is more in line with expectations.
[0275] First, training the entity extraction model.
[0276] First, regarding the training of the first entity extraction model, it should be understood that the first entity extraction model adopts... Figure 7 The model structure is shown below. When training the first entity extraction model, a first training set can be obtained. The first training set can include multiple first training samples, each of which can include sample data and sample labels. The sample data can be a piece of text or a title text, and the sample labels can be entity sequences contained in the sample data obtained using Conditional Random Field (CRF) processing. Then, each first training sample is input as shown below. Figure 7In the neural network model shown, output data is obtained; a loss function is used to determine the loss value between the output data and the sample labels in the first training sample; the parameters in the neural network model are adjusted based on the loss value. After adjusting the parameters in the neural network model based on each of the multiple first training samples, the neural network model with adjusted parameters is the first entity extraction model.
[0277] It should be noted that during the training process, the negative log-likelihood loss function can be used to determine the loss value between the output data and the sample labels in the first training sample.
[0278] Secondly, the training of the second entity extraction model. The second entity extraction model also adopts... Figure 7 The model structure shown is similar to that of the first entity extraction model, and the training method for the second entity extraction model is similar to that described above, so it will not be repeated here. The difference is that the input data for the second entity extraction model is different from that for the first entity extraction model. The sample data for the second entity extraction model can be a summary text (obtained by extracting a summary from the title text).
[0279] Second, training of the summary extraction model and the relation extraction model.
[0280] In the embodiments of this application, both the summary extraction model and the relation extraction model adopt... Figure 4 The large language model structure shown primarily trains different models by using pre-trained data. Figure 4 The large language model shown is fine-tuned to train the various models.
[0281] Figure 10 This is a flowchart of the application architecture of a large language model provided in an embodiment of this application.
[0282] like Figure 10As shown, the foundation of the entire architecture is a general-purpose large language model (such as the LLM / GPT series), which possesses extensive general knowledge and language understanding and generation capabilities, but lacks in-depth industry-specific knowledge. Subsequently, based on this general foundation (large language model), industry-specific materials (including industry-specific material libraries, knowledge graphs, and image libraries) are integrated to inject industry-specific knowledge into the large language model, followed by CPT pre-training, allowing the model to initially learn industry-specific knowledge, terminology, and application logic. Then, 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.), allowing the model to adapt to the unique rules, processes, and requirements of different scenarios, achieving generation tasks in different scenarios. This step involves fine-tuning the pre-trained large language model using training data from different application scenarios to adapt the model to different application scenarios.
[0283] 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, so the model fine-tuned using the training data from the summary extraction scenario is the summary extraction model. Scenario 2 corresponds to the relation extraction task, so the model fine-tuned using the training data from the relation extraction scenario is the relation extraction model. Furthermore, Scenario 3 can correspond to the sample filtering task. The training process of the subsequent relevance calculation model involves filtering training samples. In this embodiment, a large language model can also be used to filter training samples.
[0284] For training the summary extraction model, a second training set can be obtained first. This second training set includes multiple second training samples, each containing sample data and sample labels. The sample data can be a title text, and the sample labels can be the summary information corresponding to that title text. Then, each second training sample is input into a pair of... Figure 4 The large language model, obtained by pre-training the neural network model shown, yields output data. A loss function is used to determine the loss value between this output data and the sample labels in the second training sample. The parameters of the large language model are then adjusted based on this loss value. After adjusting the parameters of the large language model based on each of the multiple second training samples, the parameter-adjusted large language model becomes the summary extraction model.
[0285] For training the relation extraction model, a third training set can be obtained first. This third training set includes multiple third training samples, each containing sample data and sample labels. The sample data can be knowledge graph samples, and the sample labels can be the relationships between entities within the knowledge graph samples. Then, each third training sample is input into a pair of... Figure 4In the large language model obtained by pre-training the neural network model shown, output data is obtained; the loss value between the output data and the sample labels in the third training sample is determined by the loss function; the parameters in the large language model are adjusted according to the loss value. After adjusting the parameters in the large language model based on each of the multiple third training samples, the large language model with adjusted parameters is the relation extraction model.
[0286] In application, the demand side outputs corresponding instructions and rules to instruct the trained large language model on what tasks to perform. When the large language model needs to perform a specific task, the demand side can output the corresponding task command, and then combine this with relevant information from the relevant scenario. This, along with the task context as input to the model, allows the large language model to clearly define which task to perform in which scenario. After pre-training and fine-tuning, the large language model integrates general capabilities, domain-specific knowledge, and scenario adaptation. Upon receiving instructions and contextual scenario information, it invokes domain-specific knowledge (knowledge graphs, material libraries, etc.) to process the corresponding task. The large language model can then output data that meets the scenario requirements.
[0287] Third, training the correlation calculation model.
[0288] The relevance calculation model is used to output the relevance score between the search term and the target product. In this embodiment, the relevance calculation model can actually be a classification model, used to classify and output data with scores of 3, 1 or 0.
[0289] One possible approach is to first obtain the target training set, and then train a correlation calculation model based on the target training set.
[0290] The target training set includes multiple training samples, which are obtained based on the user's historical behavior logs. The historical behavior logs may consist of multiple sub-behavior logs. In some embodiments, each sub-behavior log includes the search terms, search results, and behavioral data generated by the user when using the search function. The search results include multiple recommended products obtained from the search terms, and the behavioral data may include the number of clicks on the recommended products, the browsing time, etc.
[0291] In the above method, the relevance calculation model is trained by combining the user's historical behavior logs. This is equivalent to integrating the user's preference data during the training process of the relevance calculation model, which can improve the calculation accuracy of the relevance calculation model. As a result, the relevance calculation model can intelligently calculate the relevance score between the target product and the search term. For example, the relevance score between the target product and the search term is higher if the target product matches the user's preferences.
[0292] The operation of obtaining the target training set may include the following steps (a)-(e).
[0293] (a) Obtain historical behavior logs.
[0294] (b) For any sub-behavior log in the historical behavior log, the search terms in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs.
[0295] It should be understood that one sub-behavior log corresponds to one search operation. This means that the sub-behavior log includes the search term, the search result, and behavioral data related to the products in the search result, such as click data and browsing time for recommended products. Since one search term can correspond to one search result, the search terms in the sub-behavior log and the product titles of multiple recommended products in the search results can be used as multiple candidate sample pairs. In this case, multiple candidate sample pairs correspond one-to-one with multiple recommended products in the search results.
[0296] 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.
[0297] It is worth noting that, in this embodiment of the application, after generating multiple candidate sample pairs corresponding to each sub-behavior log, sample screening can 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.
[0298] Specifically, 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 multiple candidate sample pairs corresponding to each user behavior log, classifies high-quality sample pairs and low-quality sample pairs, and outputs high-quality sample pairs.
[0299] (c) Based on the behavioral operation data in the historical behavior log, count the number of clicks for each recommended product among multiple recommended products.
[0300] Since the behavioral data includes user click data on recommended products, the number of times a user clicked on each recommended product within a historical time period can be calculated based on the behavioral data in the historical behavior log. In other words, the number of times each recommended product was clicked is the total number of times it was clicked.
[0301] Furthermore, for a user, clicking on a product indicates that the user is interested in that product. Therefore, in this embodiment of the application, the higher the number of clicks on a recommended product, the more interested the user is in that recommended product. Thus, by counting the number of clicks on each of the multiple recommended products, it helps to improve the computational power of the relevance calculation model.
[0302] (d) Determine the correlation between search terms and recommended products in multiple candidate sample pairs based on the number of clicks on multiple recommended products.
[0303] 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 found in the search results. This indicates that the recommended product better meets the user's expectations, and therefore, the higher the relevance between the recommended product and the search term. In this case, the number of clicks on multiple recommended products can accurately measure the relevance between the search term and the recommended products.
[0304] 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. The relevance between the search term and the recommended product in this candidate sample pair can be determined based on the number of times the recommended product is clicked among the multiple recommended products.
[0305] One possible approach is to determine the relevance score between the search term and the recommended product as 0 points if the number of clicks on a recommended product is less than the first threshold; if the number of clicks on a recommended product is greater than the first threshold but less than the second threshold, the relevance score is determined as 1 point; and if the number of clicks on a recommended product is greater than the second threshold, the relevance score is determined as 3 points.
[0306] The threshold for the first count is less than the threshold for the second count. For example, the threshold for the first count can be 0, and the threshold for the second count can be 3.
[0307] (e) Based on the 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 recommended products in the multiple candidate sample pairs, determine multiple training samples in the target training set.
[0308] Multiple training samples can include positive training samples and negative training samples.
[0309] Specifically, for any sub-behavior log in the historical behavior log and any candidate sample pair among multiple candidate sample pairs corresponding to the sub-behavior log, the cross-attention score and self-attention score corresponding to the candidate sample pair are determined based on the search term and the product title of the recommended product in the candidate sample pair; and the cross-attention score, self-attention score, and correlation between the search term and the recommended product in the candidate sample pair are determined as a training sample; if the number of clicks on the recommended product in the candidate sample pair is greater than or equal to a preset threshold, the training sample is determined as a positive training sample; if the number of clicks on the recommended product in the candidate sample pair is less than the preset threshold, the training sample is determined as a negative training sample.
[0310] In the above method, the cross-attention score and self-attention score corresponding to the candidate sample can be determined through steps 502-504. Specifically, firstly, entity extraction is performed on the search terms in the candidate sample pair to obtain entities on the search term side; then, summary extraction and entity extraction are performed on the product titles of the recommended products to obtain entities on the recommended product side; and then, the entities on the search term side are expanded from the target knowledge graph. Next, the self-attention score between the entities on the recommended product side is calculated using a self-attention mechanism to obtain the self-attention score corresponding to the candidate sample pair. Finally, the cross-attention score between the expanded entities on the search term side and the entities on the recommended product side is determined using a cross-attention mechanism to obtain the cross-attention score corresponding to the candidate sample pair. Furthermore, 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 terms and recommended products in this candidate sample pair can be considered as the sample label of this training sample.
[0311] It is worth noting that for each sub-behavior log in the historical behavior log, multiple candidate sample pairs can be constructed based on the historical behavior log by repeatedly executing the above steps (c)-(e). These multiple training samples include multiple positive training samples and multiple negative training samples, which means that the target training set can be obtained.
[0312] Furthermore, after obtaining the target training set, the neural network model can be trained using multiple training samples in the training set to obtain the correlation calculation model.
[0313] This 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 the processed data; the multiple hidden layers are located between the input and output layers and are responsible for processing the data. These hidden layers are not visible to the outside world. For example, this neural network model can be a deep neural network, and it can be a convolutional neural network, etc., within deep neural networks.
[0314] When training a neural network model using multiple training samples, for each training sample, the input data from that training sample is fed into the neural network model to obtain output data. A loss function is used to determine the loss value between the output data and the sample labels in that training sample. The parameters in the neural network model are then adjusted based on this loss value. After adjusting the parameters of the neural network model based on each of the multiple training samples, the neural network model with adjusted parameters becomes the correlation calculation model.
[0315] The operation of adjusting the parameters in the neural network model based on the loss value can be referred to in relevant technologies, and will not be described in detail in the embodiments of this application.
[0316] For example, computer equipment can use formulas This allows for the adjustment of any parameter in the neural network model. These are the adjusted parameters. W These are the parameters before adjustment. It's the learning rate. It can be preset, such as It can be 0.001, 0.000001, etc., and the embodiments of this application do not limit it to this only. dw Is the loss function about W The derivative can be obtained from the loss value.
[0317] Another possible approach is to obtain a pre-defined knowledge graph, and based on the relationships between entities in the pre-defined knowledge graph, construct multiple training samples to obtain the target training set.
[0318] Preset knowledge graphs can be pre-configured, and can be knowledge graphs with special entity relationships added on top of general knowledge graphs.
[0319] It should be understood that the pre-defined knowledge graph includes multiple entities and the relationships between them. When constructing multiple training samples, training samples with labels of 0, 1, and 3 can be constructed based on the relationships between entities (correspondence, hierarchical relationships, subordinate relationships, collateral relationships, etc.). The sample data can be the cross-attention scores between multiple entity tuples constructed based on the pre-defined knowledge graph, and the self-attention scores between entities within each entity tuple. It should be understood that the self-attention scores and cross-attention scores between entity tuples can be determined through step 504 described above.
[0320] In the embodiments of this application, multiple training samples can be constructed using tree-based and graph-based methods.
[0321] In this embodiment, after extracting the first and second entity sets, the server retrieves the third entity set based on the relationships between each entity in the second entity set and the first entity's query in the target knowledge graph. This retrieves entities with the same specific entity relationships as the entity corresponding to the target product, ensuring that both the search term and the target product contain entities with the same entity relationships. This allows for precise expansion of the entities corresponding to the search term, enabling subsequent association scores between entities at the same entity relationship level. Furthermore, it accurately determines the association score between each entity in the third entity set and each entity in the second entity set, and then calculates the relevance between the search term and the target product. Compared to existing technologies that limit matching to surface text between product titles and search terms, this approach expands the scope of semantically related entity matching to calculate entity relationships at the same level, thus accurately determining the relevance between the search term and the target product. Finally, based on the order of relevance between each target product and the search term from high to low, 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 shown according to their relevance. That is, the target products displayed earlier are more relevant to the search terms and are more likely to be the products the user expects. Thus, the entire process can achieve accurate display of search results on the user's terminal, which can improve the user experience.
[0322] Figure 11 This is a schematic diagram of a search result display device provided in an embodiment of this 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. This computer device can be as described below. Figure 12 The computer equipment shown. See also 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.
[0323] The first acquisition module 1101 is used to acquire search terms and multiple target products obtained after a preliminary search of the search terms;
[0324] The information processing module 1102 is used to extract and process search terms to obtain the first entity associated with the search terms; it is also used to extract information from the product title of any one of the multiple target products to obtain the associated second entity set, which includes one or more entities.
[0325] The query module 1103 is used to query the target knowledge graph to obtain the third entity set based on the relationship between each entity in the second entity set and the first entity.
[0326] The first determining module 1104 is used 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;
[0327] The sorting module 1105 is used to sort 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 multiple target products with high to low relevance to the user in response to the search term.
[0328] In one possible implementation, the information processing module 1102 is specifically used for:
[0329] The search terms are input into the first entity extraction model, which then extracts the search terms to obtain the first entity associated with the search terms.
[0330] In one possible implementation, the first entity extraction model includes a character embedding layer, a word embedding layer, and a dictionary adapter. The information processing module 1102 is specifically used for:
[0331] The search term is represented as a character sequence, and the word corresponding to each character in the character sequence is matched in the preset dictionary to obtain the target sequence. The target sequence includes a matching pair consisting of each character and its corresponding word.
[0332] 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;
[0333] Input the character vector of the character and the word vector of each word 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 vectors of each word matched by the character are 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.
[0334] 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.
[0335] In one possible implementation, the information processing module 1102 is further specifically used for:
[0336] For any one of multiple target products, input the product title of the target product into the summary extraction model, extract the summary of the product title of the target product through the summary extraction model, and output the summary information of the product title of the target product.
[0337] The summary information is input into the second entity extraction model, which then extracts entities from the summary information and outputs the second entity set.
[0338] In one possible implementation, the query module 1103 is specifically used for:
[0339] Based on the first entity, query the first candidate entity in the target knowledge graph;
[0340] The second candidate entity is obtained by querying the target knowledge graph for entities that are related to the first candidate entity.
[0341] The first and second candidate entities are determined as entities in the third entity set.
[0342] In one possible implementation, the device further includes:
[0343] The relation extraction module is used to input each entity in the second entity set into the relation extraction model. The relation extraction model extracts relations for each entity to obtain the relationships between each entity in the second entity set. The relation extraction model is trained based on each entity in the target knowledge graph and the relationships between them.
[0344] In one possible implementation, the device further includes:
[0345] 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 the cross-attention mechanism.
[0346] In one possible implementation, the second determining module is specifically used for:
[0347] Determine the query vector for each entity in the third entity set, and determine the key vector and value vector for each entity in the second entity set;
[0348] For the i-th entity in the third entity set and the j-th entity in the second entity set, determine the similarity score between the query vector of the i-th entity and the key vector of the j-th entity;
[0349] The similarity scores are normalized to obtain the second attention weight;
[0350] 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.
[0351] In one possible implementation, the second determining module is specifically used for:
[0352] Based on the self-attention mechanism, determine the self-attention score between each entity in the second entity set and the other entities;
[0353] Based on the self-attention score, the reference entity is filtered out from the second entity set to update the second entity set. The self-attention scores between the reference entity and the remaining entities in the second entity set meet the preset conditions.
[0354] Based on the cross-attention mechanism, the association score between each entity in the third entity set and each entity in the updated second entity set is determined.
[0355] In one possible implementation, the device further includes:
[0356] The second acquisition module is used to acquire the self-attention score between each entity in the second entity set and the other entities;
[0357] In one possible implementation, the first determining module 1104 is specifically used for:
[0358] The relevance between search terms and target products is determined based on association score and self-attention score.
[0359] In one possible implementation, the first determining module 1104 is specifically used for:
[0360] The self-attention score and the association score are 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 in the relevance calculation model.
[0361] In one possible implementation, the first determining module 1104 is specifically used for:
[0362] The correlation calculation model performs a weighted summation of the correlation score and the self-attention score based on the first weight and the second weight, and then normalizes the weighted summation result to obtain the reference score. The first weight and the second weight are the model weights learned by the correlation calculation model during the training process.
[0363] The relevance level between the search term and the target product is determined by the reference score through a relevance calculation model.
[0364] The relevance calculation model determines the preset score corresponding to the relevance level as the relevance score between the search term and the target product. Multiple relevance levels correspond to multiple preset scores, and the relevance score is used to represent the relevance between the search term and the target product.
[0365] In one possible implementation, the device further includes:
[0366] The third acquisition module is used to acquire the target training set, which includes multiple training samples. These multiple training samples are obtained based on the user's historical behavior logs. The historical behavior logs consist of multiple sub-behavior logs. Each sub-behavior log includes the search terms, search results, and behavioral operation data generated by the user when using the search function.
[0367] The training module is used to train a correlation calculation model based on the target training set.
[0368] In one possible implementation, the third acquisition module is specifically used for:
[0369] Obtain historical behavior logs;
[0370] For any sub-behavior log in the historical behavior log, the search terms in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs.
[0371] Based on the behavioral data in the historical behavior log, count the number of clicks for each recommended product among multiple recommended products;
[0372] Based on the number of clicks on multiple recommended products, determine the relevance between search terms and recommended products in multiple candidate sample pairs;
[0373] 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 terms and recommended products in the multiple candidate sample pairs, multiple training samples are determined in the target training set.
[0374] In one possible implementation, the multiple training samples include positive training samples and negative training samples, and the third acquisition module is specifically used for:
[0375] For any sub-behavior log in the historical behavior log, and any candidate sample pair among 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, self-attention score, and the correlation between the search term and the recommended product in the candidate sample pair as the training samples corresponding to the candidate sample pair.
[0376] If the number of clicks on the recommended product in a candidate sample pair is greater than or equal to a preset threshold, the training sample corresponding to the candidate sample pair is determined as a positive training sample.
[0377] If the number of clicks on the recommended product in a candidate sample pair is less than a preset threshold, the training sample corresponding to the candidate sample pair is determined as a negative training sample.
[0378] In this embodiment, after extracting the first and second entity sets, a third entity set is obtained based on the relationships between each entity in the second entity set and the query results of the first entity in the target knowledge graph. This allows for the querying of entities with the same specific entity relationships 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 relationships, enabling precise expansion of the entities corresponding to the search term. Subsequently, this allows for the calculation of association scores between entities at the same entity relationship level, accurately determining the association score between each entity in the third entity set and each entity in the second entity set. Based on this, the relevance between the search term and the target product is then calculated. Compared to the existing technology that limits itself to surface text matching between product titles and search terms, this approach expands the scope of semantically related entity matching to achieve entity relationship calculation at the same level, thus accurately determining the relevance between the search term and the target product. Finally, the multiple target products are sorted according to their relevance to the search term, from highest to lowest. In this way, the target products displayed on the terminal can be shown according to their relevance. That is, the target products displayed earlier are more relevant to the search terms and are more likely to be the products the user expects. Thus, the entire process can achieve accurate display of search results on the user's terminal, which can improve the user experience.
[0379] It should be noted that the search result display device provided in the above embodiments is only illustrated by the division of the above functional modules when displaying search results. In actual applications, the above 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.
[0380] The functional units and modules in the above embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of the embodiments of this application.
[0381] The search result display device and the search result display method provided in the above embodiments belong to the same concept. The specific working process and technical effects of the units and modules in the above embodiments can be found in the method embodiments section, and will not be repeated here.
[0382] Figure 12 This is a schematic diagram of the structure of a computer device provided in an embodiment of this 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, it implements the steps in the search result display method in the above embodiments.
[0383] Computer device 1200 can be a general-purpose computer device or a special-purpose computer device. In a specific implementation, computer device 1200 can be a network server. Those skilled in the art will understand that... Figure 12 The computer device 1200 is merely an example and does not constitute a limitation on the computer device 1200. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0384] Processor 120 can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0385] In some embodiments, memory 121 may be an internal storage unit of computer device 1200, such as a hard disk or memory of computer device 1200. In other embodiments, memory 121 may be an external storage device of computer device 1200, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on computer device 1200. Furthermore, memory 121 may include both internal storage units and external storage devices of computer device 1200. Memory 121 is used to store operating systems, applications, boot loaders, data, and other programs. Memory 121 may also be used to temporarily store data that has been output or will be output.
[0386] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.
[0387] This application provides a computer program product that, when run on a computer, causes the computer to perform the steps described in the various method embodiments above.
[0388] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above method embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, 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 photographing device / terminal device, a recording medium, a 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 devices. The computer-readable storage medium mentioned in this application can be a non-volatile storage medium; in other words, it can be a non-transient storage medium.
[0389] It should be understood that all or part of the steps of the above embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-described computer-readable storage medium.
[0390] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0391] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art 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.
[0392] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0393] The units described as separate components may or may not be physically separate. The 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0394] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for displaying search results, characterized in that, The method includes: Obtain search terms and multiple target products obtained after a preliminary search for the search terms; The search term is extracted to obtain the first entity associated with the search term; Information is extracted from the title of any one of the multiple target products to obtain an associated second entity set, which includes one or more entities; Based on the relationships between each entity in the second entity set and the first entity, a third entity set is obtained by querying the target knowledge graph, and the third entity set includes one or more entities; Based on the cross-attention mechanism, the association score between each entity in the third entity set and each entity in the second entity set is determined; The relevance between the search term and the target product is determined based on the association score between each entity in the third entity set and each entity in the second entity set. Based on the order of relevance between each of the multiple target products and the search term from high to low, the multiple target products are sorted so that the terminal device can respond to the search term and display the multiple target products from high to low relevance to the user. The step of querying the target knowledge graph to obtain the third entity set based on the relationships between each entity in the second entity set and the first entity includes: Based on the first entity, a first candidate entity is queried in the target knowledge graph, wherein the first candidate entity is an entity with the same semantics as the first entity; The second candidate entity is obtained by querying the target knowledge graph for entities that have the relationship with the first candidate entity. The first candidate entity and the second candidate entity are determined as entities in the third entity set.
2. The method as described in claim 1, characterized in that, The step of extracting the search term to obtain the first entity associated with the search term includes: The search term is input into the first entity extraction model, and the first entity extraction model is used to extract the search term to obtain the first entity associated with the search term.
3. The method as described in claim 2, characterized in that, The first entity extraction model includes a character embedding layer, a word embedding layer, and a dictionary adapter. The step of inputting the search term into the first entity extraction model and extracting the search term through the first entity extraction model to obtain the first entity associated with the search term includes: 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, wherein the target sequence includes a matching pair consisting of each character and its corresponding word; For any matching pair in the target sequence, the characters in the matching pair are input into the character embedding layer to obtain the character vector of the character, and each word in the matching pair is input 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 vectors of each word matched by the character are 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.
4. The method as described in claim 1, characterized in that, The step of extracting information from the title of any one of the multiple target products to obtain an associated second entity set includes: For any one of the multiple target products, the product title of the target product is input into the summary extraction model, and the summary extraction model extracts the summary of the product title of the target product and outputs the summary information of the product title of the target product. The summary information is input into the second entity extraction model, and the second entity extraction model extracts entities from the summary information to output the second entity set.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: Each entity in the second entity set is input into the relation extraction model, and the relation extraction model is used to extract relations for each entity to obtain the relationship between each entity in the second entity set. The relation extraction model is trained based on each entity in the target knowledge graph and the relationship between each entity.
6. The method as described in claim 1, characterized in that, The method of determining 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 includes: Determine the query vector for each entity in the third entity set, and determine the key vector and 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 the similarity score between the query vector of the i-th entity and the key vector of the j-th entity; The similarity score is normalized 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.
7. The method as described in claim 1, characterized in that, The method of determining 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 includes: Based on the self-attention mechanism, determine the self-attention score between each entity in the second entity set and the other entities; Based on the self-attention score, reference entities are filtered out from the second entity set to update the second entity set. The self-attention scores between the reference entities and the remaining entities in the second entity set meet preset conditions. Based on the cross-attention mechanism, the association score between each entity in the third entity set and each entity in the updated second entity set is determined.
8. The method as described in claim 7, characterized in 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 method further includes: Obtain the self-attention score between each entity in the second entity set and the other entities; The step of 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 includes: The relevance between the search term and the target product is determined based on the association score and the self-attention score.
9. The method as described in claim 8, characterized in that, 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 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.
10. The method as described in claim 9, characterized in that, The step of determining the relevance between the search term and the target product by combining the self-attention score and the association score through the relevance calculation model includes: The correlation calculation model performs a weighted summation of the correlation score and the self-attention score based on the first weight and the second weight, and normalizes the weighted summation result to obtain a reference score. The first weight and the second weight are the model weights learned by the correlation calculation model during the training process. The relevance level between the search term and the target product is determined by the relevance calculation model based on the reference score. The relevance calculation model determines the preset score corresponding to the relevance level as the relevance score between the search term and the target product. The multiple relevance levels correspond to multiple preset scores, and the multiple relevance levels and the multiple preset scores are in one-to-one correspondence. The relevance score is used to represent the relevance between the search term and the target product.
11. The method as described in claim 9, characterized in that, The method further includes: Obtain a target training set, which includes multiple training samples. These multiple training samples are obtained based on the user's historical behavior logs. The historical behavior logs consist of multiple sub-behavior logs, each of which includes the search terms, search results, and behavioral operation data generated by the user when using the search function. The correlation calculation model is trained based on the target training set.
12. The method as described in claim 11, characterized in that, The acquisition of the target training set includes: Obtain the historical behavior logs; For any sub-behavior log in the historical behavior log, the search terms in the sub-behavior log and the product titles of multiple recommended products in the search results are used as multiple candidate sample pairs; Based on the behavioral operation data in the historical behavior log, the number of clicks on each of the multiple recommended products is counted; 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 is determined; 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 terms and recommended products in the multiple candidate sample pairs, multiple training samples in the target training set are determined.
13. The method as described in claim 12, characterized in that, The multiple training samples include positive training samples and negative training samples. The determination of 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, and the correlation between search terms and recommended products in the multiple candidate sample pairs includes: For any sub-behavior log in the historical behavior log, and any candidate sample pair among multiple candidate sample pairs corresponding to the sub-behavior log, the cross-attention score and self-attention score corresponding to the candidate sample pair are determined based on the search term and the product title of the recommended product in the candidate sample pair; and the cross-attention score, self-attention score, and the correlation between the search term and the recommended product in the candidate sample pair are determined as the training samples 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 threshold, the training sample corresponding to the candidate sample pair is determined as a positive training sample. If the number of clicks on the recommended product in the candidate sample pair is less than the preset threshold, the training sample corresponding to the candidate sample pair is determined to be a negative training sample.
14. 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, when executed by the processor, implements the method as claimed in any one of claims 1 to 13.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 13.
Citation Information
Patent Citations
Intelligent search method based on artificial intelligence recommendation
CN117786127A