An e-commerce knowledge graph-based commodity information automatic question answering method
By calculating relationships and entity scores in an e-commerce knowledge graph, and combining the BERT model with a hop count attention mechanism, the accuracy and efficiency issues of e-commerce question answering methods are solved, achieving more efficient automatic question answering of product information.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG UNIV OF TECH
- Filing Date
- 2023-05-17
- Publication Date
- 2026-05-01
AI Technical Summary
Existing e-commerce product information Q&A methods have low accuracy and are inefficient, making it difficult to efficiently understand user needs and provide accurate product information.
By extracting feature vectors from questions, calculating scores for each relation and entity in the e-commerce knowledge graph, encoding question semantics using a BERT pre-trained model, and combining hop count attention mechanism and interpretable path reasoning model, the model is trained to improve the accuracy and efficiency of question answering.
It achieves a more accurate understanding of question semantics, improves the accuracy and interpretability of automatic question answering for product information, enhances the model's running efficiency and training speed, avoids local optima, and strengthens the model's robustness.
Smart Images

Figure CN116881409B_ABST
Abstract
Description
An automatic question-answering method for product information based on e-commerce knowledge graph Technical Field
[0001] This invention relates to an automatic question-answering method for product information based on e-commerce knowledge graphs, belonging to the field of natural language processing technology. Background Technology
[0002] With the steady improvement of economic level, the rapid development of science and technology, and the widespread popularization of Internet technology, my country's economy and business model have entered the "Internet+" era, enabling people to purchase all kinds of goods without leaving home. Product information refers to messages or data related to products that can be received by users and meet their needs, satisfying people's daily online shopping needs.
[0003] Automatic question answering for product information refers to searching a knowledge base based on a user's natural language question and providing the user with the information they are interested in. E-commerce knowledge graph-based automatic question answering for business information leverages the structural characteristics of knowledge graphs. Starting with the user's question, it performs semantic understanding and demand analysis, utilizing the product-related information in the question to predict the reasoning path for the user's desired product information on the e-commerce knowledge graph, and using the content of the last node in the path as the answer. Due to the complexity and vast amount of product information in e-commerce, efficient question answering methods that achieve satisfactory prediction accuracy and efficiency are essential. Summary of the Invention
[0004] To overcome the low accuracy of existing e-commerce product information question-answering methods and improve their efficiency, this invention proposes an automatic product information question-answering method based on an e-commerce knowledge graph. This method first extracts the feature vector of the question, calculates the score of each relation and each hop in the e-commerce knowledge graph based on the feature vector, and then calculates and updates the score of each entity in the e-commerce knowledge graph to train the model. This proposed path reasoning model can more accurately understand the semantics of the question, reason out a reasonable knowledge graph path to the answer, and this path has a certain degree of interpretability.
[0005] This invention discloses a novel automatic question-answering method for product information based on e-commerce knowledge graphs, primarily for knowledge graph question-answering tasks in the e-commerce field. The method first counts the number of entities and relations in the e-commerce knowledge graph and assigns them initial scores. Then, it segments the user's natural language question into words and extracts the topic entity. Starting from the corresponding entity node in the e-commerce knowledge graph, it calculates the tail entity score using the head entity score and relation score of the triple and updates the entity score set, resulting in an interpretable knowledge graph question-answering core path reasoning model. This method improves the accuracy and interpretability of automatic question answering for product information by extracting feature vectors from the natural language question to calculate the reasoning path in the e-commerce knowledge graph.
[0006] To achieve the above objectives, the technical solution of the present invention is as follows: an automatic question-and-answer method for product information based on e-commerce knowledge graphs, the specific steps of which are as follows:
[0007] Step 1) Analyze the e-commerce knowledge graph and understand the meaning of each part;
[0008] Step 2) Assign a corresponding index to each entity and relation in the e-commerce knowledge graph, and construct an index matrix accordingly;
[0009] Step 3) Encode the user's question using the BERT pre-trained model to obtain the question vector and word vector matrix, segment the question into words and construct the masking vector;
[0010] Step 4) Initialize the entity score set;
[0011] Step 5) Calculate the transition vector of the problem using the problem vector from Step 3);
[0012] Step 6) Calculate the integrated vector of the problem using the transition vector from Step 5) and the eigenvector from the previous step 8).
[0013] Step 7) Calculate the weight distribution of each word in the problem using the word vector matrix and masking vector from Step 3);
[0014] Step 8) Calculate the feature vector of the problem using the weight distribution in Step 7) and the word vector matrix in Step 3);
[0015] Step 9) Calculate the relationship score matrix and jump count score matrix in the e-commerce knowledge graph using the feature vectors from Step 8);
[0016] Step 10) Extract the index vectors of the head entity, relation and tail entity of each triple in the e-commerce knowledge graph using the index matrix in Step 2), and calculate the score of each head entity and the score of each relation using the relation score matrix in Step 9.
[0017] Step 11) Calculate the tail entity score of the e-commerce knowledge graph using the score of the head entity and the score of each relation from Step 10) and update the entity score set.
[0018] Step 12) Calculate the final score of each entity in the e-commerce knowledge graph using the jump count score matrix from Step 9) and the entity score set from Step 11);
[0019] Step 13) Calculate the model loss function using the final score of each entity from Step 12);
[0020] Step 14) Repeat steps 6) to 13). The calculation ends when the loss is less than the specified minimum loss value. The entity with the highest final score is the answer.
[0021] In step 1), the e-commerce knowledge graph with K entities and L types of relationships is represented as G = (E, R, TR), where E = {e1, ..., e2}. K} represents the set of entities in an e-commerce knowledge graph, consisting of product names, origins, types, and prices, where R = {r1, ..., r}. L} represents the set of relationships between entities in the e-commerce knowledge graph; TR represents the set of all triples (h, r, t) in the e-commerce knowledge graph, where h, t∈E represent the head entity and the tail entity respectively, and r∈R represents the relationship between h and t;
[0022] In step 2), each entity and relation in the e-commerce knowledge graph is assigned a corresponding index. Then, the head entity, tail entity and relation of all triples in the e-commerce knowledge graph are replaced with the corresponding indexes to obtain the triple index matrix TM.
[0023] Step 3) uses a BERT pre-trained model to encode the natural language question raised by e-commerce users, obtaining a d-dimensional question vector QV and a word vector matrix WVM. A word segmenter is then used to segment the user's natural language question into a word sequence {w1,…,w} of length n. n}, identify the topic entities and generate a masking vector MV for masking padding tags, then find the topic entities from the e-commerce knowledge graph;
[0024] In step 4), create a set S of length S equal to the number of entity types. E The initial score of 1 is entered at the position pointed to by the subject entity index, and the initial score of 0 is entered at the other positions. E Represented as
[0025]
[0026] in Represents entity ei The fraction, initialized to T=0;
[0027] Step 5) calculates the transition vector for the natural language questions raised by e-commerce users.
[0028] V q =Maxpool(ReLU(Conv(QV))) (2)
[0029] Where V q ∈R d Conv represents convolution operation; ReLU is the activation function; Maxpool represents max pooling operation.
[0030] Step 6) calculates the integration vector of the natural language question raised by the e-commerce user at time T.
[0031]
[0032] Where Tanh is the activation function, the symbol | represents vector concatenation, and T is a positive integer starting from 1. The feature vector representing the problem at time T-1, MLP(x,y) represents a multilayer perceptron that takes vector x as input and outputs a vector of dimension y.
[0033] In step 7), select the i-th word in the natural language problem and calculate the weight distribution of the i-th word in the problem at time T.
[0034]
[0035] in
[0036]
[0037] in Let [x] represent the similarity between the i-th word in the natural language question and the question at time T. The symbol × represents the dot product operation. i This means retrieving the i-th element of vector x, where MV ∈ R. l Represents the masking vector; iterates through all words in the natural language problem and calculates the weight distribution of all words;
[0038] Step 8) calculates the eigenvector of the problem at time T.
[0039]
[0040] in symbol Indicates WD TEach element in the function is multiplied by all elements of the corresponding row in the WVM, using the sum function. col The function (x) adds the elements of each column of matrix x.
[0041] Step 9) first calculates the relation score matrix of the e-commerce knowledge graph.
[0042]
[0043] Each element represents a score corresponding to a relationship; then the jump score matrix is calculated.
[0044]
[0045] Each element represents the score for the corresponding reasoning jump.
[0046] In step 10), the index vectors Sub, Rel, and Obj of the head entity, relation, and tail entity of each triple in the e-commerce knowledge graph are extracted in batches from TM.
[0047] Sub,Rel,Obj=TM(0),TM(1),TM(2) (9)
[0048] Where TM(x) represents the extraction of the x-th column of the TM matrix; calculate the score of each head entity and the score of each relation in the e-commerce knowledge graph.
[0049]
[0050] Where SubS and RelS represent the score sets of the head entity and relation, respectively; the D(x,y) function represents extracting the score from x with the y value as the index;
[0051] Step 11) calculates the tail entity score set of the e-commerce knowledge graph at time T.
[0052] ObjS=(∑(SubS×RelS) SO ) OI (11)
[0053] Where ∑(x) SO This represents adding the fractions in x that point to entities with the same tail, (x). OI This means updating the score of the corresponding element in the ObjS collection based on the score in x according to the index of the tail entity;
[0054] Step 12) calculates the final score for each entity in the e-commerce knowledge graph.
[0055]
[0056] Calculate the loss function in step 13).
[0057]
[0058] Where |E| represents the total number of e-commerce entities.
[0059] W = Answer × PW + 1 (17)
[0060] Where PW is an adjustable parameter; Answer represents a One-Hot vector with only the answer entity having a value of 1;
[0061] In step 14), backpropagation updates the network parameters. Steps 6 to 13 are repeated. Each time, T = T + 1. The calculation ends when the loss is less than the specified minimum loss value. The entity with the highest final score is the answer.
[0062] Compared with the prior art, the advantages of the present invention are as follows:
[0063] 1) This invention proposes a feature information enhancement method. Compared with traditional methods, this method fuses the feature vector and question vector of the previous moment into a question vector with historical information, so that the model can accurately judge the progress of question parsing, thereby enabling the model to better understand and answer multi-hop questions.
[0064] 2) This invention proposes a feature extraction method for natural language questions. Compared with traditional methods, this method uses a BERT pre-trained model to encode the question and calculates the semantic contribution of each word in the question. Based on this, feature vectors with richer semantic information are extracted from the word vector matrix of the question, which helps the model to understand the semantics of the question more accurately.
[0065] 3) This invention proposes a hop count attention mechanism. The model calculates an attention score for each hop. When calculating the final score of an entity in the e-commerce knowledge graph, the entity score after each hop is combined with the corresponding attention score to calculate the final result. This method enables the model to stop reasoning in a timely manner when the problem is solved, thereby improving the model's running efficiency.
[0066] 4) This invention proposes a batch calculation method for relation scores and hop scores in e-commerce knowledge graphs. This method inputs the feature vector of the problem into a multilayer perceptron and adjusts the output dimension of the multilayer perceptron according to the calculation target, thereby obtaining the scores of each relation and each hop in batches. This method is simple to operate and has a fast calculation speed, which improves the training speed of the model.
[0067] 5) This invention proposes a differentiable score truncation mechanism. First, the highest score in each training batch is obtained and the average value is calculated. This average value is used as a threshold, and scores above the threshold are replaced with the threshold value, while scores below the threshold value remain unchanged. This mechanism enables the model to avoid getting trapped in local optima and improves the robustness of the model. Attached Figure Description
[0068] Figure 1 is a flowchart of the automatic question-and-answer method for product information learning and answering. Detailed Implementation
[0069] The implementation process of the present invention will be described in detail below with reference to the embodiments and accompanying drawings.
[0070] Example 1: Referring to Figure 1, this invention is an automatic question-answering method for product information based on e-commerce knowledge graphs, including the following steps:
[0071] Step 1) Represent the e-commerce knowledge graph with K entities and L relationships as G = (E, R, TR), where E = {e1, ..., e2} K} represents the set of entities in an e-commerce knowledge graph, consisting of product names, origins, types, and prices, where R = {r1, ..., r}. L} represents the set of relationships between entities in the e-commerce knowledge graph; TR represents the set of all triples (h, r, t) in the e-commerce knowledge graph, where h, t∈E represent the head entity and the tail entity respectively, and r∈R represents the relationship between h and t;
[0072] Step 2) Assign a corresponding index to each entity and relation in the e-commerce knowledge graph. Then replace the head entity, tail entity and relation of all triples in the e-commerce knowledge graph with the corresponding index to obtain the triple index matrix TM.
[0073] Step 3) Use the BERT pre-trained model to encode the natural language question raised by the e-commerce user, obtaining a d-dimensional question vector QV and a word vector matrix WVM. Use a word segmenter to segment the natural language question raised by the user, transforming the question into a word sequence {w1,…,w} of length n. n}, identify the topic entities and generate a masking vector MV for masking padding tags, then find the topic entities from the e-commerce knowledge graph;
[0074] Step 4) Create a set S of length S equal to the number of entity types. E The initial score of 1 is entered at the position pointed to by the subject entity index, and the initial score of 0 is entered at the other positions. E Represented as
[0075]
[0076] in Represents entity e i The fraction, initialized to T=0;
[0077] Step 5) Calculate the transition vector for the natural language questions raised by e-commerce users.
[0078] V q =Maxpool(ReLU(Conv(QV))) (2)
[0079] Where V q ∈R d Conv represents convolution operation; ReLU is the activation function; Maxpool represents max pooling operation.
[0080] Step 6) Calculate the integration vector of the natural language question raised by the e-commerce user at time T.
[0081]
[0082] Where Tanh is the activation function, the symbol | represents vector concatenation, and T is a positive integer starting from 1. The feature vector representing the problem at time T-1, MLP(x,y) represents a multilayer perceptron that takes vector x as input and outputs a vector of dimension y.
[0083] Step 7) Select the i-th word in the natural language problem and calculate the weight distribution of the i-th word in the problem at time T.
[0084]
[0085] in
[0086]
[0087] in Let [x] represent the similarity between the i-th word in the natural language question and the question at time T. The symbol × represents the dot product operation. i This means retrieving the i-th element of vector x, where MV ∈ R. l Represents the masking vector; iterates through all words in the natural language problem and calculates the weight distribution of all words;
[0088] Step 8) calculates the eigenvector of the problem at time T.
[0089]
[0090] in symbol Indicates WD T Each element in the function is multiplied by all elements of the corresponding row in the WVM, using the sum function. col The function (x) adds the elements of each column of matrix x.
[0091] Step 9) First, calculate the relation score matrix of the e-commerce knowledge graph.
[0092]
[0093] Each element represents a score corresponding to a relationship; then the jump score matrix is calculated.
[0094]
[0095] Each element represents the score for the corresponding reasoning jump.
[0096] Step 10) Extract the index vectors Sub, Rel, and Obj of each triplet (head entity, relation, and tail entity) from the TM in batches.
[0097] Sub,Rel,Obj=TM(0),TM(1),TM(2) (9)
[0098] Where TM(x) represents the extraction of the x-th column of the TM matrix; calculate the score of each head entity and the score of each relation in the e-commerce knowledge graph.
[0099]
[0100] Where SubS and RelS represent the score sets of the head entity and relation, respectively; the D(x,y) function represents extracting the score from x with the y value as the index;
[0101] Step 11) Calculate the tail entity score set of the e-commerce knowledge graph at time T.
[0102] ObjS=(∑(SubS×RelS) SO ) OI (11)
[0103] Where ∑(x) SO This represents adding the fractions in x that point to entities with the same tail, (x). OI This means updating the score of the corresponding element in the ObjS collection based on the score in x according to the index of the tail entity;
[0104] Step 12) Calculate the final score for each entity in the e-commerce knowledge graph.
[0105]
[0106] Step 13) Calculate the loss function
[0107]
[0108] Where |E| represents the total number of e-commerce entities.
[0109] W = Answer × PW + 1 (17)
[0110] Where PW is an adjustable parameter; Answer represents a One-Hot vector with only the answer entity having a value of 1;
[0111] Step 14) Backpropagate to update network parameters. Repeat steps 6 to 13. Each time, T = T + 1. The calculation ends when the loss is less than the specified minimum loss value. The entity with the highest final score is the answer.
Claims
1. An automatic question-answering method for product information based on e-commerce knowledge graph, comprising the following steps: Step 1) Analyzing the e-commerce knowledge graph and understanding the meaning of each part; Step 2) Assigning corresponding indexes to each entity and relation in the e-commerce knowledge graph, and constructing an index matrix accordingly; Step 3) Using... The pre-trained model encodes the user question to obtain a question vector and a word vector matrix, segments the question into words, and constructs a mask vector; step 4) initializes the entity score set; specifically including: Create a collection of length equal to the number of entity types. The initial score is entered at the location pointed to by the topic entity index. Fill in the remaining positions with the initial score. Initialization Represented as: in Representing entities The score, during initialization Step 5) Calculate the transition vector of the problem using the problem vector from Step 3). Step 6) Calculate the integrated vector of the problem using the transition vector from step 5) and the feature vector from the previous time step; specifically, this includes calculating the current time step... Integration vector of natural language questions raised by e-commerce users: in It is an activation function, symbol Represents the concatenation of vectors. A positive integer starting from 1. represent The problem feature vector at time step, initially , Represents the vector Input multilayer perceptron and output A dimensional vector; Step 7) Calculate the weight distribution of each word in the problem using the word vector matrix and masking vector from Step 3); Specifically, this includes: arbitrarily selecting the first word in the natural language problem... 1 word, calculate the current In the time problem, the first Weight distribution of each word in in , express The first in the time-based natural language problem Similarity between each word and the question, symbol Represents dot product operation, symbol Indicates obtaining vector The One element, Represents the masking vector; iterate through all words in the natural language problem and calculate the weight distribution of all words; step 8) calculates the feature vector of the problem using the weight distribution in step 7) and the word vector matrix in step 3); specifically including: calculating the current... Eigenvectors of the time-matter problem: in ,symbol Indicates will Each element in Multiply all elements of the corresponding row in the function. Its function is to transform the matrix Add the elements of each column; Step 9) Calculate the relation score matrix and hop count score matrix in the e-commerce knowledge graph using the feature vectors from Step 8); specifically, this includes: first, calculating the relation score matrix of the e-commerce knowledge graph: Each element represents a score corresponding to a relationship; then the jump score matrix is calculated. Each element represents the score of the corresponding reasoning jump; step 10) extracts the index vectors of the head entity, relation, and tail entity of each triplet in the e-commerce knowledge graph using the index matrix in step 2), and calculates the score of each head entity and the score of each relation using the relation score matrix in step 9); specifically including: from Medium-scale extraction of index vectors for head entity, relation, and tail entity of each triple in e-commerce knowledge graph. 、 and , in Indicate extraction Matrix number Column; Calculate the score of each head entity and the score of each relation in the e-commerce knowledge graph. in These represent the fraction sets of the head entity and the relation, respectively. The function represents from Extracting The value is used as the index score; Step 11) Calculate the tail entity score of the e-commerce knowledge graph using the head entity score and the score of each relation from Step 10) and update the entity score set; specifically including: calculating the current The set of tail entity scores in the e-commerce knowledge graph at any given moment: in The representative will The middle pointer adds the fractions of entities with the same tail. This represents using the index of the tail entity. Score updates The score of the corresponding element in the set; Step 12) Calculate the final score of each entity in the e-commerce knowledge graph using the jump count score matrix in Step 9) and the entity score set in Step 11); The formula is as follows: Step 13) Calculate the model loss function using the final score of each entity from Step 12); Step 14) Repeat Step 6). Step 13): The calculation ends when the loss is less than the specified minimum loss value. The entity with the highest final score is the answer.
2. The automatic question-answering method for product information based on e-commerce knowledge graph as described in claim 1, characterized in that: Step 1) specifically includes: having individual entities and The e-commerce knowledge graph representation of the relationship is as follows ,in This represents the set of entities in an e-commerce knowledge graph, composed of product names, origins, types, and prices. This represents the set of relationships between entities in an e-commerce knowledge graph. Represents all triples in the e-commerce knowledge graph The set of, where , representing the head entity and the tail entity respectively. ,express and The relationship between entities and relations; Step 2) specifically includes: assigning a corresponding index to each entity and relation in the e-commerce knowledge graph, and then replacing the head entity, tail entity, and relation of all triples in the e-commerce knowledge graph with the corresponding index to obtain the triple index matrix. Step 3) specifically includes: using The pre-trained model encodes the natural language questions raised by e-commerce users. dimensional problem vector With word vector matrix The user's natural language question is segmented using a word segmenter, transforming the question into a word of length [length missing]. word sequence Identify the main entities and generate masking vectors for masking padding tags. Then, the thematic entities are found from the e-commerce knowledge graph.
3. The automatic question-answering method for product information based on e-commerce knowledge graph as described in claim 1, characterized in that: Step 5) specifically includes: calculating the transition vector for the natural language questions raised by e-commerce users: in Represents the convolution operation; For activation functions; This represents the max pooling operation.
4. The automatic question-answering method for product information based on e-commerce knowledge graph as described in claim 1, characterized in that: In step 13), the loss function is calculated: in This indicates the total number of all e-commerce entities. in It is an adjustable parameter; The value representing only the answer entity is One-Hot vector.
5. The automatic question-answering method for product information based on e-commerce knowledge graph as described in claim 1, characterized in that: Step 14) specifically includes: backpropagating to update network parameters, and repeating step 6. Step 13, executed each time ,when The calculation ends when the value is less than the specified minimum loss value, and the entity with the highest final score is the answer.
Citation Information
Patent Citations
Knowledge graph embedding-based interpretable multi-hop question and answer method and system
CN114168719A
Question and answer method based on combination of semantic analysis and vector modeling
CN114896407A