Methods, apparatus, computer equipment, and storage media for generating search suggestions

By using a word vector pre-trained model and attention mechanism in the financial asset management field to generate search suggestions, the problems of insufficient data extraction and poor matching accuracy in multi-attribute queries are solved, and more efficient query results are output.

CN116010559BActive Publication Date: 2026-04-17CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2023-01-30
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing multi-attribute query methods suffer from insufficient data extraction and poor matching accuracy in the financial asset management field. In particular, when querying securities information, users need to manually select the required attributes from hundreds of attributes, which is time-consuming, inefficient, and makes it difficult to determine the accurate names.

Method used

By employing a word vector pre-training model and an attention mechanism, the system obtains user query text vectors, extracts first-order and second-order attribute path vectors from the knowledge graph, and uses an encoding model for weighted and similarity matching to generate search suggestions.

Benefits of technology

It improves the matching accuracy between query text and path vectors, ensures the accuracy and efficiency of search suggestions, fully extracts data, and provides more accurate query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116010559B_ABST
    Figure CN116010559B_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, computer device, storage medium, and computer program product for generating search suggestions, belonging to the field of information retrieval technology. The method includes: acquiring a user's query text; obtaining a query text vector based on a word vector pre-trained model; weighting the query text vector using an attention mechanism to obtain a query vector; extracting first-order attribute paths and second-order attribute paths related to the query text from data text in a pre-constructed knowledge graph, obtaining first-order attribute path vectors and second-order attribute path vectors respectively; performing similarity matching between the query vector and the first-order attribute path vectors and second-order attribute path vectors respectively, and outputting the path corresponding to the larger similarity value between the first-order and second-order attribute path vectors as the search suggestion for the query text. This method improves the matching accuracy by using an attention mechanism to weight the query text vector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information retrieval technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for generating search suggestions. Background Technology

[0002] In the financial asset management field, multi-attribute queries mainly rely on manual selection of the required attributes. For example, a security may have hundreds of attributes, and it is undoubtedly time-consuming and inefficient for users to filter out the attributes they need from among many. Moreover, sometimes users are not even sure of the exact name of the attribute they want.

[0003] Therefore, existing multi-attribute query methods suffer from insufficient data extraction and poor matching accuracy. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for generating search suggestions that can improve matching results, in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a method for generating search suggestions, the method comprising:

[0006] Get the user's query text;

[0007] Based on the word vector pre-training model, the query text vector of the query text is obtained;

[0008] The query text vector is weighted using an attention mechanism to obtain the query vector;

[0009] Extract first-order attribute paths and second-order attribute paths related to the query text from the data text in the pre-built knowledge graph, and obtain first-order attribute path vectors and second-order attribute path vectors respectively through a pre-trained encoding model;

[0010] The query text vector is weighted based on the attention mechanism of the encoding model to obtain the query vector;

[0011] The query vector is matched with the first-order attribute path vector and the second-order attribute path vector for similarity, and the path with the larger similarity value between the first-order attribute path vector and the second-order attribute path vector is output as the search suggestion for the query text.

[0012] In one embodiment, the attention mechanism based on the encoding model weights the query text vector to obtain a query vector, including:

[0013] The path attention vector is obtained through the path attention mechanism of the encoding model.

[0014] The query vector is obtained by weighting the query text vector based on the attention vector of the path.

[0015] In one embodiment, obtaining the attention vector of the path through the path attention mechanism of the encoding model includes:

[0016] The path attention mechanism of the encoding model is used to obtain the intermediate vectors of the first-order attribute path and the intermediate vectors of the second-order attribute path.

[0017] The attention vector of the path is obtained based on the preset attention weight, the preset attention offset, the intermediate vector of the first-order attribute path, and the intermediate vector of the second-order attribute path.

[0018] In one embodiment, the method for constructing a knowledge graph includes:

[0019] Data is retrieved from the asset management database of the target business area, and multiple attributes and corresponding data text are constructed.

[0020] Based on the data text corresponding to the attribute, extract the attribute, the first-order attribute path of the attribute, and the second-order attribute path of the attribute;

[0021] The extracted attributes, the first-order attribute paths of the attributes, and the second-order attribute paths of the attributes are preprocessed to obtain the first-order attribute path vectors corresponding to the first-order attribute paths and the second-order attribute path vectors corresponding to the second-order attribute paths.

[0022] A knowledge graph of the target business domain is constructed based on the first-order attribute path vector and the second-order attribute path vector of each attribute.

[0023] In one embodiment, the preprocessing of the extracted attributes, their first-order attribute paths, and their second-order attribute paths to obtain the first-order attribute path vectors corresponding to the first-order attribute paths and the second-order attribute path vectors corresponding to the second-order attribute paths includes:

[0024] Keyword extraction is performed based on the first-order attribute paths and second-order attribute paths of the extracted attributes.

[0025] The first-order target text is obtained based on the keywords of the first-order attribute path of the attribute;

[0026] The second-order target text is obtained based on the keywords of the second-order attribute path of the attribute;

[0027] Based on the word vector pre-training model, the first-order text vector of the first-order target text and the second-order text vector of the second-order target text are obtained.

[0028] The first-order text vector and the second-order text vector are encoded to obtain the first-order attribute path vector of the first-order text vector and the second-order attribute path vector of the second-order text vector.

[0029] In one embodiment, the data text contains target attributes, and the step of extracting first-order attribute paths and second-order attribute paths related to the query text from the data text in a pre-constructed knowledge graph includes:

[0030] Starting from the target attribute in the knowledge graph, the first-order path of the query text is extracted to obtain the first-order attribute path related to the target attribute.

[0031] Starting from the target attribute in the knowledge graph, the second-order path of the query text is extracted to obtain the second-order attribute path related to the target attribute.

[0032] Secondly, this application provides a search suggestion generation apparatus, the apparatus comprising:

[0033] The retrieval module is used to retrieve the user's query text;

[0034] The word vector module is used to obtain the query text vector of the query text based on the word vector pre-trained model;

[0035] The query encoding module is used to extract first-order attribute paths and second-order attribute paths related to the query text from the data text in the pre-built knowledge graph, and obtain the first-order attribute path vector and the second-order attribute path vector respectively through the pre-trained encoding model.

[0036] The processing module is used to weight the query text vector based on the attention mechanism of the encoding model to obtain the query vector;

[0037] The calculation module is used to perform similarity matching between the query vector and the first-order attribute path vector and the second-order attribute path vector, respectively, and output the path corresponding to the larger similarity value between the first-order attribute path vector and the second-order attribute path vector as the search suggestion for the query text.

[0038] In one embodiment, the query encoding module is further configured to obtain the attention vector of the path through the path attention mechanism of the encoding model; and to weight the query text vector according to the attention vector of the path to obtain the query vector.

[0039] In one embodiment, the query encoding module is further configured to obtain the intermediate vector of the first-order attribute path and the intermediate vector of the second-order attribute path through the path attention mechanism of the encoding model; and to obtain the attention vector of the path according to the preset attention weight, the preset attention offset, the intermediate vector of the first-order attribute path and the intermediate vector of the second-order attribute path.

[0040] In one embodiment, the apparatus further includes: a construction module, configured to acquire data from an asset management database of a target business domain, construct multiple attributes and corresponding data texts; extract attributes, first-order attribute paths, and second-order attribute paths based on the corresponding data texts; preprocess the extracted attributes, first-order attribute paths, and second-order attribute paths to obtain first-order attribute path vectors corresponding to the first-order attribute paths and second-order attribute path vectors corresponding to the second-order attribute paths; and construct a knowledge graph of the target business domain based on the first-order attribute path vectors and second-order attribute path vectors of each attribute.

[0041] In one embodiment, the construction module is further configured to extract keywords based on the extracted first-order attribute paths and second-order attribute paths of the attributes; obtain first-order target text based on the keywords of the first-order attribute paths of the attributes; obtain second-order target text based on the keywords of the second-order attribute paths of the attributes; obtain first-order text vectors of the first-order target text and second-order text vectors of the second-order target text based on the word vector pre-training model; and encode the first-order text vectors and the second-order text vectors to obtain first-order attribute path vectors of the first-order text vectors and second-order attribute path vectors of the second-order text vectors.

[0042] In one embodiment, the data text contains a target attribute, and the processing module is further configured to extract the first-order path of the query text from the knowledge graph, starting from the target attribute, to obtain the first-order attribute path related to the target attribute; and to extract the second-order path of the query text from the knowledge graph, starting from the target attribute, to obtain the second-order attribute path related to the target attribute.

[0043] Thirdly, this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the following method:

[0044] Get the user's query text;

[0045] Based on the word vector pre-training model, the query text vector of the query text is obtained;

[0046] Extract first-order attribute paths and second-order attribute paths related to the query text from the data text in the pre-built knowledge graph, and obtain first-order attribute path vectors and second-order attribute path vectors respectively through a pre-trained encoding model;

[0047] The query text vector is weighted based on the attention mechanism of the encoding model to obtain the query vector;

[0048] The query vector is matched with the first-order attribute path vector and the second-order attribute path vector for similarity, and the path with the larger similarity value between the first-order attribute path vector and the second-order attribute path vector is output as the search suggestion for the query text.

[0049] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the following method:

[0050] Get the user's query text;

[0051] Based on the word vector pre-training model, the query text vector of the query text is obtained;

[0052] Extract first-order attribute paths and second-order attribute paths related to the query text from the data text in the pre-built knowledge graph, and obtain first-order attribute path vectors and second-order attribute path vectors respectively through a pre-trained encoding model;

[0053] The query text vector is weighted based on the attention mechanism of the encoding model to obtain the query vector;

[0054] The query vector is matched with the first-order attribute path vector and the second-order attribute path vector for similarity, and the path with the larger similarity value between the first-order attribute path vector and the second-order attribute path vector is output as the search suggestion for the query text.

[0055] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the following method:

[0056] Get the user's query text;

[0057] Based on the word vector pre-training model, the query text vector of the query text is obtained;

[0058] Extract first-order attribute paths and second-order attribute paths related to the query text from the data text in the pre-built knowledge graph, and obtain first-order attribute path vectors and second-order attribute path vectors respectively through a pre-trained encoding model;

[0059] The query text vector is weighted based on the attention mechanism of the encoding model to obtain the query vector;

[0060] The query vector is matched with the first-order attribute path vector and the second-order attribute path vector for similarity, and the path with the larger similarity value between the first-order attribute path vector and the second-order attribute path vector is output as the search suggestion for the query text.

[0061] The aforementioned search suggestion generation method, apparatus, computer device, storage medium, and computer program product acquire the user's query text, obtain query text vectors based on a word vector pre-training model, vectorize the user's query text to facilitate matching with path vectors and calculating the degree of relevance, and use an attention mechanism to weight the query text vectors to obtain query result vectors. Using the attention mechanism to weight the query text vectors improves the matching accuracy between the query text and path vectors. First-order and second-order attribute paths related to the query text are extracted from the data text in a pre-constructed knowledge graph. The query vector is then matched with the first-order and second-order attribute path vectors for similarity, and the path with the higher similarity value between the first-order and second-order attribute path vectors is output as the search suggestion for the query text. This method, on the one hand, fully extracts data by extracting first-order and second-order paths from the knowledge graph and matching them with the query text; on the other hand, by using an attention mechanism to weight the query text vectors, it considers the relevance between the query text and attribute paths, thus obtaining accurate search suggestions and improving matching accuracy. Attached Figure Description

[0062] Figure 1 This is an application environment diagram of a search suggestion generation method in one embodiment;

[0063] Figure 2 This is a flowchart illustrating a method for generating search suggestions in one embodiment;

[0064] Figure 3 This is a flowchart illustrating a method for constructing a knowledge graph in one embodiment;

[0065] Figure 4 This is a flowchart illustrating a method for generating attribute path vectors in one embodiment.

[0066] Figure 5 This is a flowchart illustrating a search suggestion method based on attribute-based multi-section path matching in one embodiment;

[0067] Figure 6 This is a schematic diagram of query text and search suggestions in one embodiment;

[0068] Figure 7This is a structural block diagram of a search suggestion generation device in one embodiment;

[0069] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0070] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0071] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0072] In the financial asset management field, multi-attribute queries mainly rely on manual selection of the required attributes. For example, a security may have hundreds of attributes, and it is undoubtedly time-consuming and inefficient for users to filter out the attributes they need from among many. Moreover, sometimes users are not even sure of the exact name of the attribute they want.

[0073] This led to the development of methods that recommend content based on the user's input query text and return query suggestions (search tips).

[0074] Search suggestions are a technology that reads a user's query keywords, generates a series of suggested statements, and ultimately returns search suggestions to the user. It can be divided into two categories: open-domain search suggestions, such as those from search engines like Baidu, where inputting a question may directly return the answer; and domain-specific or object-specific search suggestions, where inputting a question typically returns certain attributes of an object. For the first type of search suggestion generation, search engines generally use string search matching, matching suggestion text containing the user's query keywords from a database. For the second type of search suggestion generation, which limits the scope to attribute matching, keyword text matching can be used, but semantic encoding matching is now more commonly employed.

[0075] In the financial asset management field, three methods are generally used to process the query text input by the user and match search suggestions. (1) Based on data mining and keyword matching, data mining is carried out in the financial asset management field to obtain a structured data table containing relational data in the financial field. Then, the query text input by the user is matched with the structured data table containing relational data to obtain search suggestions for the query text. (2) Based on deep learning, data mining is carried out based on past query history to establish a query recommendation model. This method cannot judge the text that has not been queried, and has a large limitation. (3) Matching by extracting the features of the actual query and attributes. The key lies in the feature extraction and matching method. The Bilstm+CRT network is used, which may have problems such as insufficient data extraction and poor matching accuracy.

[0076] In view of this, the search suggestion generation method provided in the embodiments of this application can be applied to, for example, Figure 1 The application environment shown is illustrated. Terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on another network server.

[0077] Server 104 obtains the user's query text from terminal 102; server 104 obtains the query text vector based on a word vector pre-trained model; server 104 extracts the first-order attribute path and second-order attribute path related to the query text from the data text in the pre-constructed knowledge graph, and obtains the first-order attribute path vector and second-order attribute path vector respectively through a pre-trained encoding model; server 104 weights the query text vector based on the attention mechanism of the encoding model to obtain the query vector; server 104 performs similarity matching between the query vector and the first-order attribute path vector and the second-order attribute path vector respectively, and outputs the path corresponding to the larger similarity value between the first-order attribute path vector and the second-order attribute path vector as the search suggestion for the query text to terminal 102.

[0078] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0079] In one embodiment, such as Figure 2 As shown, a method for generating search suggestions is provided, which can be applied to... Figure 1 Taking the server in the example, the following steps are included:

[0080] S202, Obtain the user's query text.

[0081] Among them, query text is the user's expression of the meaning of the query or retrieval. For example, when a user searches for professional terms in certain specific fields, the query words and query statements they enter belong to query text.

[0082] Specifically, taking financial securities as an example, the query text can include category, location, issuer, etc. Among them, category can refer to the category of special terms in the security code, location can be the company's place of registration or the location of the security issuer, and issuer can be the issuer of the security, etc.

[0083] S204. Based on the word vector pre-training model, obtain the query text vector of the query text.

[0084] Among them, word vector pre-training models refer to models trained on a large amount of domain-specific corpus, which may include fields such as finance and securities, healthcare, and environmental protection. Taking finance and securities as an example, a word vector pre-training model can be trained on data from financial asset management databases and securities management databases.

[0085] Among them, the pre-trained model can be a word vector pre-trained model. The word vector training model obtains the query text, vectorizes the query text, and obtains the query text vector of the query text.

[0086] Specifically, the word vector training model can be a pre-trained FinBERT model. The query text q is input into the FinBERT model, and the model's expression can be:

[0087] V q =FinBert(q)

[0088] Among them, V q Let q be the query text vector.

[0089] S206. Extract the first-order attribute path and second-order attribute path related to the query text from the data text in the pre-constructed knowledge graph, and obtain the first-order attribute path vector and second-order attribute path vector respectively through the pre-trained encoding model.

[0090] Among them, a knowledge graph can represent the correlation between multiple attributes. Specifically, the process of constructing a knowledge graph includes: constructing a visual description of knowledge content and the carrier of knowledge content; constructing and displaying the interrelationship between knowledge content and the carrier of knowledge content; and completing the construction of the knowledge graph based on multiple knowledge contents and carriers and the correlation between knowledge contents.

[0091] It should be noted that common knowledge graphs are represented by lines between nodes. Nodes represent entities (knowledge content), and lines between nodes represent relationships between entities (interrelationships).

[0092] Knowledge graphs are typically described using triples to represent the relationships between entities, or entities, attributes, and attribute values. For example, location-issuer-registered location, or issuer-registered location-Shanghai.

[0093] The first-order attribute path includes first-order attributes, the second-order attribute path can contain second-order attributes, and there are also third-order attribute paths or more. It should be noted that for the search suggestion problem, the extraction of second-order attribute paths can basically cover all possible paths. In order to reduce the amount of computation and speed up the system response, it is not necessary to continue to extract third-order attribute paths.

[0094] Specifically, a first-order attribute is attribute p1 on a one-hop path o1-p1-o2 in the knowledge graph, and a second-order attribute is attributes p1 and p2 on a two-hop path o1-p1-o2-p2-o3 in the knowledge graph. Taking the second-order attribute o1 as the location, attribute p1 could be the issuer's location, and attribute p2 could be the province where the issuer's location is located. Understandably, second-order attribute paths are more complex and contain more information than first-order attribute paths.

[0095] Specifically, the first-order and second-order attribute paths related to the query text can be found by judging the degree of relevance between the attribute names (o1, o2, and o3) of the first-order and second-order attribute paths and the query text q.

[0096] Specifically, after obtaining the first-order attribute path and second-order attribute path related to the query text, the first-order attribute path vector of the first-order attribute path and the second-order attribute path vector of the second-order attribute path are extracted from the data text corresponding to the attribute path in the knowledge graph.

[0097] S208, the query text vector is weighted based on the attention mechanism of the encoding model to obtain the query vector.

[0098] The attention mechanism, originating from research on human vision, is based on the information processing bottleneck. Humans selectively focus on a portion of all information while ignoring other visible information. This mechanism is commonly referred to as the attention mechanism.

[0099] Specifically, an attention mechanism model can be used to obtain the attention weights and attention offset vectors related to the query text vector. The attention weights and attention offset vectors are related to the initial settings of the attention mechanism model and the number of iterations of the model.

[0100] For a trained attention mechanism model, the weights of the query text vector can be calculated based on the attention weights and attention offset vectors. Then, the query vector R can be calculated based on the weights and the query text vector. q Therefore, a vector representation of the query text entered by the user can be obtained, based on the query vector R. q It can determine the spatial position and orientation of the query text within the vector space of a specific domain corpus, which facilitates the subsequent matching process with other matching words in the vector space of the specific domain corpus, so as to obtain the matching word with the highest degree of matching with the query text.

[0101] It should be noted that the matching words can be a single word or multiple words, and can include multiple words as well as the relationships between multiple words.

[0102] S210, perform similarity matching between the query vector and the first-order attribute path vector and the second-order attribute path vector respectively, and output the path corresponding to the larger similarity value between the first-order attribute path vector and the second-order attribute path vector as the search suggestion of the query text.

[0103] Among them, the query vector R q With the first-order attribute path vector R pi Second-order attribute path vector R′ pi Perform similarity matching to obtain the degree of similarity matching.

[0104] Specifically, the similarity matching method can be cosine similarity matching, for the query vector R. q With the first-order attribute path vector R pi The calculation formula is:

[0105]

[0106] Among them, match i Represents the query vector R q With the first-order attribute path vector R pi The calculated similarity.

[0107] For query vector R q With the second-order attribute path vector R′ pi The calculation formula is:

[0108]

[0109] Among them, match i Represents the query vector R q With the second-order attribute path vector R′ pi The calculated similarity.

[0110] The paths with higher similarity values ​​in the first-order and second-order attribute path vectors are used as search suggestions for the query text.

[0111] Among them, for the query vector R during model training q With the second-order attribute path vector R′ pi The target function for matching is as follows:

[0112] max(0, γ-Match(R) q ,R′ pi )+Match(R q ,R′ pi- ))

[0113] Among them, R′ pi- This is a second-order result vector generated from attribute paths (negative example paths) unrelated to the query. γ is a boundary adjustment parameter. This objective function focuses on data pairs where the difference between the scores of negative and positive examples is less than the boundary γ, aiming to maximize the difference in matching degree between positive and negative examples. Query vector R q With the second-order attribute path vector R′ pi The formula and principle of the matching objective function are similar to those of the second-order attribute path vector, and will not be elaborated here.

[0114] In the aforementioned method for generating search suggestions, the user's query text is obtained. A query text vector is generated based on a word vector pre-trained model. Vectorizing the user's query text facilitates matching with path vectors and calculating the degree of relevance. An attention mechanism is used to weight the query text vector, resulting in a query result vector. Using the attention mechanism to weight the query text vector improves the matching accuracy between the query text and path vectors. First-order and second-order attribute paths related to the query text are extracted from the pre-constructed knowledge graph. The query vector is then matched with both the first-order and second-order attribute path vectors for similarity. The path with the higher similarity value between the first-order and second-order attribute path vectors is output as the search suggestion for the query text. This method, on the one hand, fully extracts data by extracting first-order and second-order paths from the knowledge graph and matching them with the query text; on the other hand, by using an attention mechanism to weight the query text vector, it considers the relevance between the query text and attribute paths, thus obtaining accurate search suggestions and improving matching accuracy.

[0115] In one embodiment, the query text vector is weighted based on the attention mechanism of the encoding model to obtain the query vector, including: obtaining the path attention vector through the path attention mechanism of the encoding model; and weighting the query text vector according to the path attention vector to obtain the query vector.

[0116] In the process of encoding the query text and constructing the knowledge graph, it is necessary to extract the first-order and second-order attribute paths related to the query text. During the extraction of the first-order and second-order attribute paths, an attention mechanism is introduced to obtain the attention vector of the path related to the query text vector.

[0117] Specifically, it can be based on the attention weight W in the attention mechanism. a and attention offset vector b a The weighting coefficient 'a' of the query text vector is calculated. ij Then, based on the weighting coefficient a ij For the query text vector V q We perform weighting to obtain the query vector R. q .

[0118] Obtain the query text vector V q The weighting coefficient a ij Then, attention vectors of the path can be used. For the query text vector V q We perform weighting to obtain the query vector R. q The calculation formula is as follows:

[0119]

[0120] In this embodiment, by employing an attention mechanism to weight the query text vector, the relevance between the query text and the attribute path is considered, thereby obtaining accurate search suggestions and improving the accuracy of matching.

[0121] In one embodiment, obtaining the attention vector of a path through the path attention mechanism of the encoding model includes: obtaining the intermediate vector of the first-order attribute path and the intermediate vector of the second-order attribute path through the path attention mechanism of the encoding model; and obtaining the attention vector of the path based on the preset attention weight, the preset attention offset, the intermediate vector of the first-order attribute path, and the intermediate vector of the second-order attribute path.

[0122] The encoding model can be a shared-weight neural network model, which consists of two BiLSTM networks (i.e., a Siamese network model). A BiLSTM is composed of two LSTMs: one processes the input sequence forward, and the other processes it backward. The outputs of the two LSTMs are then concatenated. The final BiLSTM output is obtained only after all time steps have been computed. The forward LSTM produces a result vector after a predetermined number of time steps; the backward LSTM also produces another result vector after a predetermined number of time steps. These two result vectors are then concatenated to obtain the final BiLSTM output.

[0123] Specifically, during the encoding process of first-order and second-order text vectors using the attention mechanism of the encoding model, the intermediate vector of the first-order attribute path is obtained. Intermediate vector of second-order attribute path

[0124] The weighting coefficients are obtained based on the preset attention weights, preset attention offsets, the intermediate vectors of the first-order attribute path, and the intermediate vectors of the second-order attribute path.

[0125] Wherein, the weighting coefficient a ij The calculation formula is as follows:

[0126]

[0127]

[0128] in, For attention weights, Let tanh() be the attention offset vector, and exp(w) be the hyperbolic tangent function. ij Let w be an exponential function with base e. ij As the intermediate vector, Let represent the path attention vector, the first-order path attention vector, and the second-order path attention vector, respectively. h is the hidden layer dimension parameter of BiLSTM, l q The length of the query vector is set based on experience.

[0129] It should be noted that the intermediate vector of the first-order attribute path can also be used. Intermediate vector of second-order attribute path Fully connected parameter vector W p and offset vector b p The first-order attribute path vector R can be obtained by computing in the fully connected layer of the network. pi and the second-order attribute path vector R′ pi .

[0130] Specifically, the first-order attribute path vector R pi The calculation formula is as follows:

[0131]

[0132] Second-order attribute path vector R′ pi The calculation formula is as follows:

[0133]

[0134] in, It is a stretching operation on a vector. It is a fully connected parameter vector. This is the offset vector, and c is a hyperparameter, typically set to 200. h is the hidden layer dimension parameter of BiLSTM, l p Let l be the length of the attribute path vector, and l p =l q .

[0135] In this embodiment, the first-order and second-order text vectors are encoded using a neural network model based on shared weights to obtain weighting coefficients. By employing an attention mechanism to weight the query text vector, the relevance between the query text and the attribute path is considered, thereby obtaining accurate search suggestions and improving the matching accuracy.

[0136] In one embodiment, such as Figure 3 As shown, a method for constructing a knowledge graph is provided, including:

[0137] S302, retrieve data from the asset management database of the target business area, and construct multiple attributes and corresponding data text.

[0138] The target business area can be finance and securities, healthcare, environmental protection, etc. Taking finance and securities as an example, we will explain the situation.

[0139] Specifically, data is obtained from asset management databases or query interfaces in the financial securities field, the data is cleaned, and steps such as entity recognition and entity connection are used to construct multiple attributes and corresponding data text.

[0140] The data text corresponding to the attribute can be obtained by querying a relational database to retrieve all text data in that column of the attribute. The data text can be a structured data type or a semi-structured data type.

[0141] S304, extract the attribute, the first-order attribute path of the attribute, and the second-order attribute path of the attribute based on the data text corresponding to the attribute.

[0142] In this process, based on the existing architecture of the knowledge graph, a certain attribute can be used as the target attribute. Based on the data text corresponding to the target attribute, the target attribute, the first-order attribute path of the target attribute, and the second-order attribute path of the target attribute can be extracted to obtain the first-order attribute path of the target attribute starting from the target attribute and the second-order attribute path of the target attribute.

[0143] S306. The extracted attributes, first-order attribute paths, and second-order attribute paths are preprocessed to obtain the first-order attribute path vectors corresponding to the first-order attribute paths and the second-order attribute path vectors corresponding to the second-order attribute paths.

[0144] The methods for preprocessing the extracted attributes, first-order attribute paths, and second-order attribute paths include: extracting keywords from the first-order and second-order attribute paths, and encoding the extracted text.

[0145] Specifically, the unsupervised learning algorithm TextRank can be used to extract keywords from the first-order path and second-order path of an attribute. The extracted keywords can be arranged in order to obtain the keyword-extracted text. The text can be encoded to obtain the first-order attribute path vector and the second-order attribute path vector. This allows us to obtain the spatial position and direction of the first-order path and the second-order path of the attribute within the vector space of the domain-specific corpus. This facilitates the subsequent matching process with other matching words in the domain-specific corpus vector space, so as to obtain the matching word with the highest degree of matching with the query text.

[0146] S308. Construct a knowledge graph of the target business domain based on the first-order attribute path vector and the second-order attribute path vector of each attribute.

[0147] In this way, a knowledge graph of the target business domain can be constructed by using attributes as nodes and first-order attribute paths and second-order attribute paths as connections between nodes.

[0148] In this embodiment, by extracting the first-order and second-order paths of the target business domain attributes, the first-order attribute path vector and the second-order attribute path vector of the attribute can be obtained. This allows us to obtain the spatial position and direction of the first-order path and the second-order path of the attribute within the specific domain corpus vector space. This facilitates the subsequent matching process with other matching words in the specific domain corpus vector space, so as to obtain the matching word with the highest degree of matching with the query text.

[0149] In one embodiment, such as Figure 4 The method for generating attribute path vectors, as shown, preprocesses the extracted attributes, their first-order attribute paths, and their second-order attribute paths to obtain first-order attribute path vectors corresponding to the first-order attribute paths and second-order attribute path vectors corresponding to the second-order attribute paths, including:

[0150] S402, Keyword extraction is performed based on the first-order attribute path and the second-order attribute path of the extracted attributes.

[0151] Among these steps, the data text corresponding to the attributes is extracted. Generally speaking, the complete text data for certain attributes is long text. For example, the attribute "special clauses" in the financial securities field is usually long text, and keywords need to be extracted from the long text.

[0152] Specifically, for the first-order attribute path p′ of the attribute i The second-order attribute path p″ of the attribute i Keyword extraction was performed to obtain the keywords key1 to key2 of the first-order path. n and the keywords key1~key of the second-order path n Understandably, for a target attribute, there can be multiple first-order and second-order paths for that target attribute, and for a single path of the target attribute, there can also be multiple keywords extracted.

[0153] Among them, keyword extraction algorithms can be used in various ways, such as TF-IDF, TextRank, LDA topic model, etc.

[0154] S404: Obtain the first-order target text based on the keywords of the first-order attribute path of the attribute.

[0155] Among them, the keywords key1 to key in the first-order attribute path of the attribute. n They can be concatenated to obtain the first-order target text, p′ target_i =p′ i ;key1;key2...;key n , p′ target_i p′ represents the first-order target text. i This represents a first-order attribute path.

[0156] S406, based on the keywords of the second-order attribute path of the attribute, obtain the second-order target text.

[0157] Among them, the keywords key1 to key are based on the second-order attribute path of the attribute. n They can be concatenated to obtain the second-order target text, p″ target_i =p″ i ;key1;key2...;key n , p″ target_i p″ represents the second-order target text. i This represents a second-order attribute path.

[0158] S408, based on a word vector pre-training model, obtains the first-order text vector of the first-order target text and the second-order text vector of the second-order target text.

[0159] The word vector training model can be a pre-trained FinBERT model, which takes the first-order target text p′ as an example. target_i The input is fed into the FinBERT model to obtain a first-order text vector V. pi First-order text vector V pi The expression can be:

[0160] Vpi =FinBert(p′) target_i )

[0161] Similarly, the second-order target text p″ can be... target_i The input is fed into the FinBERT model to obtain a second-order text vector V. pi ′, second-order text vector V pi The expression can be:

[0162] V′ pi =FinBert(p″) target_i )

[0163] S410, encode the first-order text vector and the second-order text vector to obtain the first-order attribute path vector of the first-order text vector and the second-order attribute path vector of the second-order text vector.

[0164] Among them, the first-order text vector V pi Encoding yields the first-order attribute path vector R. pi .

[0165] Wherein, the second-order text vector V pi Encoding yields the second-order attribute path vector R′. pi .

[0166] In this embodiment, the extracted attributes, first-order attribute paths, and second-order attribute paths are preprocessed to obtain first-order attribute path vectors corresponding to the first-order attribute paths and second-order attribute path vectors corresponding to the second-order attribute paths. Keyword extraction is performed on the first-order attribute paths and second-order attribute paths of the attributes to fully extract data and provide a basis for subsequent matching steps.

[0167] In one embodiment, the data text contains a target attribute. Extracting first-order attribute paths and second-order attribute paths related to the query text from the data text in a pre-built knowledge graph includes: extracting first-order paths of the query text from the knowledge graph, starting with the target attribute, to obtain first-order attribute paths related to the target attribute; and extracting second-order paths of the query text from the knowledge graph, starting with the target attribute, to obtain second-order attribute paths related to the target attribute.

[0168] The target attribute can be an attribute matched by the query text after certain processing. It can be understood that the query text may match multiple attributes. The attributes with higher relevance are selected as the target attributes based on the relevance of the query text.

[0169] Starting with the target attribute, we can extract the first-order attribute path and the second-order attribute path of the target attribute based on the original architecture of the knowledge graph.

[0170] It should be noted that there can be multiple first-order attribute paths for extracting target attributes, and there can also be multiple second-order attribute paths for extracting target attributes. The semantic depth of second-order attribute paths is greater than that of first-order attribute paths, that is, they contain more information.

[0171] In this embodiment, by extracting first-order and second-order attribute paths starting from the target attribute, the first-order and second-order attribute paths related to the query text can be quickly extracted, providing a basis for subsequent matching steps.

[0172] In one embodiment, such as Figure 5 As shown, a search suggestion method based on attribute multi-section path matching is provided, including:

[0173] The first part involves constructing a knowledge graph, including:

[0174] S502: Obtain data from the asset management database of the target business area and construct multiple attributes and corresponding data text.

[0175] S504, extract the attribute, the first-order attribute path of the attribute, and the second-order attribute path of the attribute based on the data text corresponding to the attribute.

[0176] S506, Keyword extraction is performed based on the first-order attribute path and the second-order attribute path of the extracted attributes.

[0177] S508: Obtain the first-order target text based on the keywords of the first-order attribute path of the attribute.

[0178] S510: Obtain the second-order target text based on the keywords of the second-order attribute path of the attribute.

[0179] S512, based on a word vector pre-training model, obtains the first-order text vector of the first-order target text and the second-order text vector of the second-order target text.

[0180] S514, encode the first-order text vector and the second-order text vector to obtain the first-order attribute path vector of the first-order text vector and the second-order attribute path vector of the second-order text vector.

[0181] S516. Construct a knowledge graph of the target business domain based on the first-order attribute path vector and the second-order attribute path vector of each attribute.

[0182] The second part involves attribute-based multi-level path matching search suggestions based on the constructed knowledge graph, including:

[0183] It should be noted that multi-level paths can be first-level attribute paths, second-level attribute paths, or more-level attribute paths. For attribute paths of more than two levels, such as third-level attribute paths, for search suggestion questions, extracting second-level attribute paths can basically cover all possible paths. In order to reduce the amount of computation and speed up the system response, it is not necessary to continue to extract third-level attribute paths.

[0184] Therefore, we will use first-order and second-order attribute paths as examples for explanation.

[0185] S518, retrieve the user's query text.

[0186] S520: Based on the word vector pre-training model, obtain the query text vector of the query text.

[0187] S522: Extract first-order attribute paths and second-order attribute paths related to the query text from the data text in the pre-built knowledge graph, and obtain first-order attribute path vectors and second-order attribute path vectors respectively through a pre-trained encoding model.

[0188] Specifically, starting from the target attribute in the knowledge graph, the first-order path of the query text is extracted to obtain the first-order attribute path related to the target attribute; starting from the target attribute in the knowledge graph, the second-order path of the query text is extracted to obtain the second-order attribute path related to the target attribute.

[0189] S524 obtains the intermediate vectors of the first-order attribute path and the intermediate vectors of the second-order attribute path through the path attention mechanism of the encoding model.

[0190] S526. Obtain the attention vector of the path based on the preset attention weight, preset attention offset, intermediate vector of the first-order attribute path, and intermediate vector of the second-order attribute path.

[0191] S529, the query text vector is weighted according to the attention vector of the path to obtain the query vector.

[0192] S530, perform similarity matching between the query vector and the first-order attribute path vector and the second-order attribute path vector respectively, and output the path corresponding to the larger similarity value between the first-order attribute path vector and the second-order attribute path vector as the search suggestion of the query text.

[0193] Among them, such as Figure 6 The illustration shown includes the query text and search suggestions:

[0194] When a user enters the search text "category" in the search box, a search suggestion will automatically pop up: "Do you want to search for: 1. Special terms (keyword: variety); 2. Issuer; etc.?" The first-order attribute path of variety-special terms will be pushed to the user as a search suggestion.

[0195] Specifically, the first-order property path is as follows:

[0196] Table 1. Variety-Specific Clause Interpretation

[0197]

[0198] When a user enters the search text "location" in the search box, a search suggestion will automatically pop up: "Do you want to search for: 1. Issuer (path: issuer-province); 2. Special terms; etc.?" The second-order attribute path of location-issuer-province will be pushed to the user as a search suggestion.

[0199] Specifically, the second-order property path is as follows:

[0200] Table 2. Location-Issuer-Province Diagram

[0201] Issuer Date of Establishment province A real estate company in Suzhou 2002 Jiangsu A certain group company in Shaanxi 2003 Shaanxi

[0202] In this embodiment, the user's query text is acquired, and a query text vector is obtained based on a word vector pre-training model. Vectorizing the user's query text facilitates matching with path vectors and calculating the degree of association. An attention mechanism is used to weight the query text vector to obtain a query result vector. Using the attention mechanism to weight the query text vector improves the matching accuracy between the query text and path vectors. First-order and second-order attribute paths related to the query text are extracted from the data text in a pre-constructed knowledge graph. The query vector is then matched with the first-order and second-order attribute path vectors for similarity. The path with the higher similarity value between the first-order and second-order attribute path vectors is output as a search suggestion for the query text. This method, on the one hand, fully extracts data by extracting first-order and second-order paths from the knowledge graph and matching them with the query text; on the other hand, by using an attention mechanism to weight the query text vector, it considers the relevance between the query text and attribute paths, thus obtaining accurate search suggestions and improving matching accuracy.

[0203] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0204] Based on the same inventive concept, this application also provides a search suggestion generation apparatus for implementing the search suggestion generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more search suggestion generation apparatus embodiments provided below can be found in the limitations of the search suggestion generation method described above, and will not be repeated here.

[0205] In one embodiment, such as Figure 7 As shown, a search suggestion generation device is provided, including: an acquisition module 702, a word vector module 704, a query encoding module 706, a processing module 708, and a calculation module 710, wherein:

[0206] Module 702 is used to obtain the user's query text;

[0207] The word vector module 704 is used to obtain the query text vector of the query text based on the word vector pre-trained model;

[0208] The query encoding module 706 is used to extract the first-order attribute path and the second-order attribute path related to the query text from the data text in the pre-built knowledge graph, and obtain the first-order attribute path vector and the second-order attribute path vector respectively through the pre-trained encoding model.

[0209] Processing module 708 is used to weight the query text vector based on the attention mechanism of the encoding model to obtain the query vector;

[0210] The calculation module 710 is used to perform similarity matching between the query vector and the first-order attribute path vector and the second-order attribute path vector, respectively, and output the path corresponding to the larger similarity value between the first-order attribute path vector and the second-order attribute path vector as the search suggestion of the query text.

[0211] In one embodiment, the query encoding module 706 is further configured to obtain the path attention vector through the path attention mechanism of the encoding model; and to weight the query text vector according to the path attention vector to obtain the query vector.

[0212] In one embodiment, the query encoding module 706 is further configured to obtain the intermediate vectors of the first-order attribute path and the second-order attribute path through the path attention mechanism of the encoding model; and to obtain the attention vector of the path based on the preset attention weight, the preset attention offset, the intermediate vectors of the first-order attribute path and the intermediate vectors of the second-order attribute path.

[0213] In one embodiment, the search suggestion generation device further includes a construction module, configured to acquire data from an asset management database of the target business domain, construct multiple attributes and corresponding data texts; extract attributes, first-order attribute paths, and second-order attribute paths based on the corresponding data texts; preprocess the extracted attributes, first-order attribute paths, and second-order attribute paths to obtain first-order attribute path vectors corresponding to the first-order attribute paths and second-order attribute path vectors corresponding to the second-order attribute paths; and construct a knowledge graph of the target business domain based on the first-order attribute path vectors and second-order attribute path vectors of each attribute.

[0214] In one embodiment, the construction module is further configured to extract keywords based on the first-order attribute path and the second-order attribute path of the extracted attributes; obtain the first-order target text based on the keywords of the first-order attribute path of the attributes; obtain the second-order target text based on the keywords of the second-order attribute path of the attributes; obtain the first-order text vector of the first-order target text and the second-order text vector of the second-order target text based on the word vector pre-training model; and encode the first-order text vector and the second-order text vector to obtain the first-order attribute path vector of the first-order text vector and the second-order attribute path vector of the second-order text vector.

[0215] In one embodiment, the data text contains a target attribute. The processing module 708 is further configured to extract the first-order path of the query text from the knowledge graph, starting from the target attribute, to obtain the first-order attribute path related to the target attribute; and to extract the second-order path of the query text from the knowledge graph, starting from the target attribute, to obtain the second-order attribute path related to the target attribute.

[0216] The modules in the aforementioned search suggestion generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0217] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores first-order and second-order attribute path vector data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a method for generating search suggestions.

[0218] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0219] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above method steps.

[0220] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above method steps.

[0221] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the above method steps.

[0222] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0223] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0224] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for generating search suggestions, characterized in that, The method includes: Get the user's query text; Based on the word vector pre-training model, the query text vector of the query text is obtained; First-order attribute paths and second-order attribute paths related to the query text are extracted from the data text in the pre-constructed knowledge graph. First-order attribute path vectors and second-order attribute path vectors are obtained respectively through a pre-trained encoding model. The first-order attribute path includes first-order attributes, which are attributes on a one-hop path in the knowledge graph. The second-order attribute path contains second-order attributes, which are attributes on a two-hop path in the knowledge graph. The query text vector is weighted based on the attention mechanism of the encoding model to obtain the query vector; The query vector is matched with the first-order attribute path vector and the second-order attribute path vector for similarity, and the path with the larger similarity value between the first-order attribute path vector and the second-order attribute path vector is output as the search suggestion for the query text.

2. The method according to claim 1, characterized in that, The attention mechanism based on the encoding model weights the query text vector to obtain a query vector, including: The path attention vector is obtained through the path attention mechanism of the encoding model. The query vector is obtained by weighting the query text vector based on the attention vector of the path.

3. The method according to claim 2, characterized in that, The process of obtaining the attention vector of a path through the path attention mechanism of the encoding model includes: The path attention mechanism of the encoding model is used to obtain the intermediate vectors of the first-order attribute path and the intermediate vectors of the second-order attribute path. The attention vector of the path is obtained based on the preset attention weight, the preset attention offset, the intermediate vector of the first-order attribute path, and the intermediate vector of the second-order attribute path.

4. The method according to any one of claims 1 to 3, characterized in that, The method for constructing a knowledge graph includes: Data is retrieved from the asset management database of the target business area, and multiple attributes and corresponding data text are constructed. Based on the data text corresponding to the attribute, extract the attribute, the first-order attribute path of the attribute, and the second-order attribute path of the attribute; The extracted attributes, the first-order attribute paths of the attributes, and the second-order attribute paths of the attributes are preprocessed to obtain the first-order attribute path vectors corresponding to the first-order attribute paths and the second-order attribute path vectors corresponding to the second-order attribute paths. A knowledge graph of the target business domain is constructed based on the first-order attribute path vector and the second-order attribute path vector of each attribute.

5. The method according to claim 4, characterized in that, The preprocessing of the extracted attributes, their first-order attribute paths, and their second-order attribute paths to obtain the first-order attribute path vectors corresponding to the first-order attribute paths and the second-order attribute path vectors corresponding to the second-order attribute paths includes: Keyword extraction is performed based on the first-order attribute paths and second-order attribute paths of the extracted attributes. The first-order target text is obtained based on the keywords of the first-order attribute path of the attribute; The second-order target text is obtained based on the keywords of the second-order attribute path of the attribute; Based on the word vector pre-training model, the first-order text vector of the first-order target text and the second-order text vector of the second-order target text are obtained. The first-order text vector and the second-order text vector are encoded to obtain the first-order attribute path vector of the first-order text vector and the second-order attribute path vector of the second-order text vector.

6. The method according to claim 1, characterized in that, The data text contains target attributes. Extracting first-order and second-order attribute paths related to the query text from the data text in the pre-constructed knowledge graph includes: Starting from the target attribute in the knowledge graph, the first-order path of the query text is extracted to obtain the first-order attribute path related to the target attribute. Starting from the target attribute in the knowledge graph, the second-order path of the query text is extracted to obtain the second-order attribute path related to the target attribute.

7. A search suggestion generation device, characterized in that, The device includes: The retrieval module is used to retrieve the user's query text; The word vector module is used to obtain the query text vector of the query text based on the word vector pre-trained model; The query encoding module is used to extract first-order attribute paths and second-order attribute paths related to the query text from the data text in the pre-built knowledge graph. The first-order attribute path vector and the second-order attribute path vector are obtained by a pre-trained encoding model. The first-order attribute path includes a first-order attribute, which is an attribute on a one-hop path in the knowledge graph. The second-order attribute path contains a second-order attribute, which is an attribute on a two-hop path in the knowledge graph. The processing module is used to weight the query text vector based on the attention mechanism of the encoding model to obtain the query vector; The calculation module is used to perform similarity matching between the query vector and the first-order attribute path vector and the second-order attribute path vector, respectively, and output the path corresponding to the larger similarity value between the first-order attribute path vector and the second-order attribute path vector as the search suggestion for the query text.

8. The apparatus according to claim 7, characterized in that, The query encoding module is further configured to obtain the path attention vector through the path attention mechanism of the encoding model; and to weight the query text vector according to the path attention vector to obtain the query vector.

9. The apparatus according to claim 8, characterized in that, The query encoding module is further configured to obtain the intermediate vectors of the first-order attribute path and the second-order attribute path through the path attention mechanism of the encoding model; and to obtain the attention vector of the path based on the preset attention weight, the preset attention offset, the intermediate vectors of the first-order attribute path and the intermediate vectors of the second-order attribute path.

10. The apparatus according to any one of claims 7 to 9, characterized in that, The device further includes: a construction module, configured to acquire data from an asset management database of the target business domain, construct multiple attributes and corresponding data texts; extract attributes, first-order attribute paths, and second-order attribute paths based on the corresponding data texts; preprocess the extracted attributes, first-order attribute paths, and second-order attribute paths to obtain first-order attribute path vectors corresponding to the first-order attribute paths and second-order attribute path vectors corresponding to the second-order attribute paths; and construct a knowledge graph of the target business domain based on the first-order attribute path vectors and second-order attribute path vectors of each attribute.

11. The apparatus according to claim 10, characterized in that, The construction module is further configured to extract keywords based on the first-order attribute path and the second-order attribute path of the extracted attributes; obtain the first-order target text based on the keywords of the first-order attribute path of the attributes; obtain the second-order target text based on the keywords of the second-order attribute path of the attributes; obtain the first-order text vector of the first-order target text and the second-order text vector of the second-order target text based on the word vector pre-training model; and encode the first-order text vector and the second-order text vector to obtain the first-order attribute path vector of the first-order text vector and the second-order attribute path vector of the second-order text vector.

12. The apparatus according to claim 7, characterized in that, The data text contains a target attribute. The processing module is further configured to extract the first-order path of the query text from the knowledge graph, starting from the target attribute, to obtain the first-order attribute path related to the target attribute; and to extract the second-order path of the query text from the knowledge graph, starting from the target attribute, to obtain the second-order attribute path related to the target attribute.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Text processing method and device, equipment and storage medium

    CN113139037A

  • Complex question answering method and device based on knowledge graph and storage medium

    CN113468311A