Similar question matching method and user similar question matching system

By decomposing user problems into main clauses and secondary clauses, identifying question types, extracting keywords and building text semantic networks, the problems of poor matching flexibility and low accuracy in the existing technology are solved, and high Matching effect of precision and flexibility.

CN114936277BActive Publication Date: 2024-11-15CHINA UNIONPAY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210109967.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-28
Publication Date
2024-11-15
Estimated Expiration
2042-01-28

AI Technical Summary

Technical Problem

In the matching of user similar problem, the rule-based template method has poor flexibility and difficulty in maintaining, while the model-based method has low accuracy in matching new problems and requires frequent retraining.

Method used

The problem to be matched and the target problem is decomposed into main clauses and secondary clauses, the question type is identified, keywords are extracted, and word vectors and weights are calculated by constructing a text semantic network, and sentence vectors are generated to judge similarity.

Benefits of technology

Achieving similar problem matching with high accuracy and flexibility reduces dependence on training data, reduces personnel costs, and improves the ability to match new problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114936277B_ABST
    Figure CN114936277B_ABST
Patent Text Reader

Abstract

The present invention relates to a user similar question matching method and system thereof. The method comprises: extracting keywords for different types of questions of the main clauses of the to-be-matched question and the target question respectively, so as to obtain keywords of the to-be-matched question and keywords of the target question; for the target question, constructing a text semantic network based on the keywords of the target question, calculating the word vectors of the keywords and the weights of the keywords in the text semantic network, generating sentence vectors of the target question according to the weights of the keywords and the word vectors of the keywords; and calculating the similarity between the to-be-matched question and the target question based on the word vectors of the keywords of the to-be-matched question and the sentence vectors of the target question, and judging whether the to-be-matched question and the target question are similar based on the similarity. According to the present invention, a similar question matching method with high accuracy and good flexibility can be provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to computer technology, and in particular to a similar question matching method and a similar question matching system. Background Art

[0002] Currently, there are two main methods for matching similar user questions: one is a matching method based on rule templates, and the other is to match similar questions by training an end-to-end classification model.

[0003] Based on the rule template method, business experts mainly extract rule templates representing a type of questions based on the literal expression of the user's questions, which is somewhat similar to regular expressions, and then combine them with dictionaries to achieve matching of the same type of user questions. When user questions are more complicated, especially when the user's language habits are more complex, the workload of sorting out rule templates will be very large, and it is easy to cause conflicts between rules, the maintenance workload is very large, and the flexibility is poor.

[0004] The model-based method is mainly trained based on supervised classification algorithms. This method first requires manual classification of user historical questions, then labels different types of questions to form training data, and then trains the user question matching model based on the classification algorithm. The accuracy of question matching in this method is greatly affected by the training data, and it will fail for newly added user questions. It is necessary to re-label new user questions and retrain the model. Summary of the invention

[0005] In view of the above problems, the present invention aims to provide a similar question matching method and a similar question matching system with high accuracy and great flexibility.

[0006] A similar question matching method according to one aspect of the present invention is characterized in that the method is used to match a to-be-matched question with a target question, and the method comprises:

[0007] For the problem to be matched and the target problem, problem decomposition is performed respectively to decompose the problem to be matched and the target problem into main clauses and secondary clauses;

[0008] For the to-be-matched question and the target question, the main clauses are classified respectively to identify the question types of the main clauses of the to-be-matched question and the target question;

[0009] Extract keywords for different types of questions of the main clauses of the to-be-matched question and the target question respectively, so as to obtain keywords of the to-be-matched question and keywords of the target question;

[0010] For a target question, construct a text semantic network based on keywords of the target question, calculate word vectors of the keywords and weights of the keywords in the text semantic network, and generate a sentence vector of the target question according to the weights of the keywords and the word vectors of the keywords; and

[0011] The similarity between the question to be matched and the target question is calculated based on the word vector of the keyword of the question to be matched and the sentence vector of the target question, and whether the question to be matched and the target question are similar is determined based on the similarity.

[0012] Optionally, the performing problem decomposition on the to-be-matched problem and the target problem respectively to decompose the to-be-matched problem and the target problem into main clauses and secondary clauses includes: using a binary classification classifier to identify the main clauses and the secondary clauses.

[0013] Optionally, SVM or XGBoost is used as the binary classification classifier.

[0014] Optionally, for the binary classification classifier, during the training process of the classifier, training is performed based on the FastText classification model, the words and phrases in the input layer are formed into feature vectors, and the feature vectors are then mapped to the hidden layer through a linear transformation. The hidden layer solves the maximum likelihood function, constructs a Huffman tree according to the weight and model parameters of each category, and uses the Huffman tree as the output, and encodes the labels using Huffman coding.

[0015] Optionally, the classifying the main clauses of the question to be matched and the target question respectively to identify the question types of the main clauses of the question to be matched and the target question includes: using any one of the following algorithms to implement the classification of the main clauses: logistic regression, naive Bayes, support vector machine and XGBoost.

[0016] Optionally, the main clauses of the question to be matched and the target question are classified respectively to identify question type words of the main clauses of the question to be matched and the target question: a four-category model trained based on the FastText classification model is used to classify the main clauses into yes-no sentences, specific questions, positive and negative questions, and choice questions.

[0017] Optionally, extracting keywords for different types of questions of the main clauses of the question to be matched and the target question includes: extracting keywords respectively using three different keyword extraction algorithms, TF-IDF, TextRank and topic model, and merging the respectively extracted keywords by seeking a collection.

[0018] Optionally, generating a sentence vector for the target question includes the following sub-steps:

[0019] Using the keywords of the target question as nodes of the text semantic network to construct a text semantic network;

[0020] Calculating the weights of the nodes of the text semantic network as the weights of the keywords; and

[0021] The word vector of the keyword is calculated and the sentence vector of the target question is obtained according to the word vector of the keyword and the weight of the keyword.

[0022] Optionally, constructing a text semantic network by using the keywords of the target question as nodes of the text semantic network includes:

[0023] The keywords of the target question are used as nodes of the text semantic network to construct a text semantic network, wherein if the same words or phrases appear together in the same sentence, edges are generated between the nodes;

[0024] The establishment of the edges between nodes is completed based on the acquisition span of 1 or 2;

[0025] The network composed of each sentence is connected, the semantic similarity of each node is calculated and merged to construct a text semantic network.

[0026] Optionally, calculating the semantic similarity of each node and merging them includes:

[0027] Calculate the semantic similarity between nodes, merge the same nodes and edges, and merge the nodes and edges whose similarity is higher than a preset threshold and add the weights of the two edges when merging them.

[0028] Optionally, calculating the weights of the nodes of the text semantic network as the weights of the keywords includes:

[0029] Calculating the degree centrality of the node;

[0030] Calculating the node betweenness of the node; and

[0031] The weight of the keyword is obtained based on the node degree centrality of the node and the node betweenness of the node.

[0032] Optionally, calculating the word vector of the keyword and obtaining the sentence vector of the target question according to the word vector of the keyword and the weight of the keyword includes:

[0033] Obtain the vector representation of each keyword to obtain the word vector of the keyword; and

[0034] The sentence vector of the target question is obtained according to the word vector of the keyword and the weight of the keyword.

[0035] Optionally, the calculating the similarity between the question to be matched and the target question based on the keywords of the question to be matched and the sentence vector of the target question and judging whether the question to be matched and the target question are similar based on the similarity includes:

[0036] Calculate the cosine similarity between the keywords of the question to be matched and the sentence vector of the target question;

[0037] Calculating the similarity between the question to be matched and the target question based on the cosine similarity and the weight of the keywords of the question to be matched; and

[0038] Based on the similarity, it is determined whether the to-be-matched question is similar to the target question.

[0039] A similar question matching system according to one aspect of the present invention is characterized in that the system is used to match a to-be-matched question with a target question, comprising:

[0040] A question decomposition module, for the to-be-matched question and the target question, respectively, performs question decomposition to decompose the to-be-matched question and the target question into main clauses and secondary clauses;

[0041] A sentence category module, for the question to be matched and the target question, classifies the main clauses respectively to identify the question types of the main clauses of the question to be matched and the target question;

[0042] A keyword extraction module extracts keywords from different types of questions in the main clauses of the question to be matched and the target question to obtain keywords of the question to be matched and keywords of the target question;

[0043] A sentence vector generation module, for a target question, constructs a text semantic network based on the keywords of the target question, calculates the word vectors of the keywords and the weights of the keywords in the text semantic network, and generates a sentence vector of the target question according to the weights of the keywords and the word vectors of the keywords; and

[0044] The question matching module calculates the similarity between the question to be matched and the target question based on the word vector of the keyword of the question to be matched and the sentence vector of the target question, and determines whether the question to be matched is similar to the target question based on the similarity.

[0045] Optionally, in the question decomposition module, a binary classifier is used to identify the main clause and the secondary clause.

[0046] Optionally, in the problem decomposition module, SVM or XGBoost is used as the binary classification classifier.

[0047] Optionally, for the binary classification classifier, during the training process of the classifier, training is performed based on the FastText classification model, the words and phrases in the input layer are formed into feature vectors, and the feature vectors are then mapped to the hidden layer through a linear transformation. The hidden layer solves the maximum likelihood function, constructs a Huffman tree according to the weight and model parameters of each category, and uses the Huffman tree as the output, and encodes the labels using Huffman coding.

[0048] Optionally, in the sentence classification module, any one of the following algorithms is used to implement classification of the main clauses: logistic regression, naive Bayes, support vector machine and XGBoost.

[0049] Optionally, in the sentence classification module, a four-category model trained based on the FastText classification model is used to classify user questions into yes-no sentences, specific questions, positive and negative questions, and choice questions.

[0050] Optionally, in the keyword extraction module, three different keyword extraction algorithms, TF-IDF, TextRank and topic model, are used to extract keywords respectively, and the respectively extracted keywords are merged by seeking a collection.

[0051] Optionally, the sentence vector generation module includes the following submodules:

[0052] A text semantic network construction submodule, used to construct a text semantic network by using the keywords of the target question obtained by the keyword extraction module as nodes of the text semantic network;

[0053] A keyword weight calculation submodule, used to calculate the weight of the node of the text semantic network as the weight of the keyword; and

[0054] The sentence vector construction submodule is used to obtain the word vector of the keyword, and obtain the sentence vector of the main clause according to the word vector of the keyword and the weight of the keyword.

[0055] Optionally, the keyword text semantic network construction submodule performs the following actions:

[0056] The keywords of the target question obtained by the keyword extraction module are used as nodes of the text semantic network to construct a text semantic network, wherein if the same words or phrases appear together in the same sentence, edges are generated between the nodes;

[0057] The establishment of the edges between nodes is completed based on the acquisition span of 1 or 2;

[0058] The network composed of each sentence is connected, the semantic similarity of each node is calculated and merged to construct a text semantic network.

[0059] Optionally, calculating the semantic similarity of each node and merging them includes:

[0060] Calculate the semantic similarity between nodes, merge the same nodes and edges, and merge the nodes and edges whose similarity is higher than a preset threshold and add the weights of the two edges when merging them.

[0061] Optionally, the keyword weight calculation submodule performs the following actions:

[0062] Calculating the degree centrality of the node;

[0063] Calculating the node betweenness of the node; and

[0064] The weight of the keyword is obtained based on the node degree centrality of the node and the node betweenness of the node.

[0065] Optionally, the sentence vector construction submodule performs the following actions:

[0066] Obtain the vector representation of each keyword to obtain the word vector of the keyword; and

[0067] The sentence vector of the main clause is obtained according to the word vector of the keyword and the weight of the keyword.

[0068] Optionally, the question matching module performs the following actions:

[0069] Calculate the cosine similarity between the keywords of the question to be matched and the sentence vector of the target question;

[0070] Calculating the similarity between the question to be matched and the target question based on the cosine similarity and the weight of the keywords of the question to be matched; and

[0071] Based on the similarity, it is determined whether the to-be-matched question is similar to the target question.

[0072] A computer-readable medium according to one aspect of the present invention stores a computer program thereon, wherein the computer program implements the similar question matching method when executed by a processor.

[0073] A computer device according to one aspect of the present invention comprises a storage module, a processor, and a computer program stored in the storage module and executable on the processor, wherein the processor implements the similar question matching method when executing the computer program. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 It is a flowchart showing the similarity question matching method of the present invention.

[0075] Figure 2is an example of representing the classification of user questions into primary and secondary clauses.

[0076] Figure 3 Represents an example of a text semantic network.

[0077] Figure 4 It is a schematic diagram showing the word vector representation (200 dimensions) with "Yunsuanfu" as the keyword.

[0078] Figure 5 Schematic diagram showing the calculation of sentence vectors for question sentences.

[0079] Figure 6 It is a structural block diagram of the similar question matching system of the present invention. DETAILED DESCRIPTION

[0080] The following describes some of the various embodiments of the present invention, which are intended to provide a basic understanding of the present invention, but are not intended to identify the key or decisive elements of the present invention or to limit the scope of protection.

[0081] For brevity and illustrative purposes, the principles of the present invention are described herein mainly with reference to its exemplary embodiments. However, those skilled in the art will readily recognize that the same principles are equally applicable to and can be implemented in all types of similar question matching methods and similar question matching systems, and any such changes do not depart from the true spirit and scope of the present patent application.

[0082] Moreover, in the following description, reference is made to the accompanying drawings, which illustrate specific exemplary embodiments. Electrical, mechanical, logical and structural changes may be made to these embodiments without departing from the spirit and scope of the present invention. In addition, although the features of the present invention are disclosed in conjunction with only one of several implementations / embodiments, this feature may be combined with one or more other features of other implementations / embodiments as may be desirable and / or advantageous for any given or identifiable function. Therefore, the following description should not be regarded as limiting, and the scope of the present invention is defined by the appended claims and their equivalents.

[0083] Terms such as “having” and “including” indicate that in addition to the units (modules) and steps directly and explicitly stated in the specification and claims, the technical solution of the present invention does not exclude the situation where it has other units (modules) and steps that are not directly or explicitly stated.

[0084] Figure 1 It is a flowchart showing the similarity question matching method of the present invention.

[0085] like Figure 1 As shown, the similar question matching method of the present invention includes:

[0086] Question decomposition step S100: for the question to be matched and the target question, decompose the user question and identify the main clauses and secondary clauses of the question;

[0087] Sentence classification step S200: for the to-be-matched question and the target question, the main clauses of the user's question are classified to identify different question types;

[0088] Keyword extraction step S300: for the to-be-matched question and the target question, three different keyword extraction algorithms, namely TF-IDF, TextRank and topic model, are used to extract keywords from the questions of the same question type obtained in the sentence classification step S200; and

[0089] Sentence vector generation step S400: for the target question, based on the keywords obtained in the keyword extraction step S300, a graph network is constructed, the weights of different keywords are calculated, and a sentence vector is generated; and

[0090] Question matching step S500: calculating the similarity between the question to be matched and the target question based on the keywords of the question to be matched and the sentence vector of the target question, and judging whether the question to be matched is similar to the target question based on the similarity.

[0091] Here, the question decomposition step S100 to the keyword extraction step S300 are executed for both the to-be-matched question and the target question, while the sentence vector generation step S400 is only executed for the target question.

[0092] The specific contents of these steps are described in detail below.

[0093] First, the problem decomposition step S100 will be described.

[0094] A complete user question usually consists of multiple sentences. Some clauses contain a lot of information and are the main components of the question, while some clauses are redundant and invalid components. They are of little help in determining the type of user question and can be discarded. For example, "Excuse me, why can I only pay 5,000 when I use Cloud QuickPass to pay my credit card?" The first half "Excuse me" is a secondary part, and the second half "Why can I only pay 5,000 when I use Cloud QuickPass to pay my credit card?" is the main part of the question. First, it is necessary to identify the different parts of the question at the semantic level.

[0095] In the question decomposition step S100 , in order to identify the main clauses and the secondary clauses of the user question, a binary classification classifier is used, for example, a SVM classifier and an XGBoost algorithm.

[0096] The SVM (Support Vector Machine) classifier is a classification model widely adopted in the field of machine learning. When fully trained, its classification accuracy can reach over 90%.

[0097] The XGBOOST (Extreme Gradient Boosting) algorithm is an optimized distributed gradient boosting function. Specifically, it is an improvement on the boosting algorithm based on GBDT (Gradient Boosting Decision Tree). Its core lies in the optimization of the loss function and the solution algorithm. The XGBOOST loss function modeling method is based on maximum likelihood estimation. Specifically for each sample, it is actually a typical binomial distribution probability modeling method.

[0098] Next, the sentence classification step S200 will be described.

[0099] In the sentence classification step S200, the main clauses of the user questions classified in the problem decomposition step S100 are further classified to identify different question types.

[0100] Chinese interrogative sentence types are generally divided into five categories: yes-no questions, special questions, alternative questions, positive-negative questions, and rhetorical questions. Since rhetorical questions are generally not used by users to ask real business questions, in the present invention, rhetorical questions are not considered, and only the first four question types are considered:

[0101] (1) Yes-no questions: The characteristic of this type of question is that when the word "ma" indicating a question is removed, the sentence in front is also a complete and correct sentence. For example, "Does Yunshanfu have a transfer function?"

[0102] (2) Special questions: This type of question contains obvious interrogative words, mainly including the interrogative words of "5W1H". For example, "Excuse me, how to invite new users in Yunshanfu?" Here, "5W1H" refers to reason (Why), object (What), place (Where), time (When), person (Who), and method (How).

[0103] (3) Positive-negative questions: The characteristic of this type of interrogative sentence is that the verb or adjective is repeated, and the word "ma" is not used at the end of the sentence. Other modal particles such as "ne" or "a" can be used. For example, "Excuse me, is there still the activity of taking the bus for one cent?"

[0104] (4) Alternative questions: The characteristic of this type of question is that the conjunction "or" appears in the sentence, and the word "ma" is not used at the end of the sentence. Similarly, modal particles such as "ne" and "a" can be used. For example, "Tomorrow I will go to the preferential activity of Carrefour. Do I need to use Yunshanfu or must I swipe the card?"

[0105] The inventors of the present invention have found that different types of questions have a great impact on question matching. Usually, questions with similar or matching semantics have the same question type. Therefore, it is necessary to classify the main clauses of the original question.

[0106] The classification of question types is a four-class classification problem, which can be implemented using classification algorithms such as logistic regression, naive Bayes, support vector machine or XGBoost.

[0107] Logistic regression is a generalized linear regression analysis model.

[0108] The Bayesian method is based on the Bayesian principle and uses the knowledge of probability statistics to classify sample data sets. Due to its solid mathematical foundation, the Bayesian classification algorithm has a very low misjudgment rate. The characteristic of the Bayesian method is that it combines prior probability and posterior probability, which avoids the subjective bias of using only prior probability and the overfitting phenomenon of using sample information alone. The Bayesian classification algorithm shows a higher accuracy rate when the data set is large, and the algorithm itself is relatively simple.

[0109] Support Vector Machine (SVM) is a generalized linear classifier that performs binary classification on data using supervised learning.

[0110] Next, the keyword extraction step S300 will be described.

[0111] In the keyword extraction step S300, three different keyword extraction algorithms, namely TF-IDF, TextRank and topic model, are used to extract keywords from the questions of the same question type obtained in the sentence classification step S200.

[0112] (1) Extract question keywords using TF-IDF algorithm

[0113] TF-IDF (term frequency–inverse document frequency) is a commonly used weighting technique for information retrieval and data mining. TF stands for term frequency, and IDF stands for inverse document frequency. The main idea of ​​TF-IDF is that if a word or phrase appears in an article with a high frequency TF and rarely appears in other articles, it is considered that this word or phrase has good category discrimination ability and is suitable for classification.

[0114] The advantage of TF-IDF is that it is simple and efficient, but it only uses word frequency statistics as a criterion for measuring whether a word is important, which is not comprehensive enough and lacks a lot of important semantic information, such as part of speech.

[0115] The TF-IDF algorithm consists of two parts, and its calculation formula is as follows:

[0116]

[0117] Among them, t(i,j) represents the term frequency-inverse document frequency of feature word i in question j.

[0118] (2) Extracting question keywords using the Text-Rank algorithm

[0119] The TextRank algorithm is a keyword extraction algorithm applied to text. It is a graph-based ranking algorithm for keyword extraction and document summarization. It is improved from Google's page importance ranking algorithm PageRank algorithm. It uses the co-occurrence information (semantics) between words within a document to extract keywords. It can extract keywords and keyword groups from a given text, and use extractive automatic summarization methods to extract key sentences from the text. The basic idea of ​​the TextRank algorithm is to regard the document as a network of words, and the links in the network represent the semantic relationship between words.

[0120] The TextRank algorithm makes full use of the information contained in the text, but the TextRank algorithm only relies on the text itself and cannot establish connections with other corpora. Moreover, the algorithm assumes that the importance of each word is the same at the beginning, which is inconsistent with the actual situation.

[0121]

[0122] Among them, In(v i ) is pointing to node v i The set of all words, w i,j Represents the word v j Link to vi The weight of Represents node v j The sum of the weights of all links pointing to .

[0123] (3) Extracting question keywords using topic models

[0124] A topic model is a statistical model that clusters the implicit semantic structure of a collection of documents in an unsupervised learning manner. Topic models are mainly used for semantic analysis and text mining problems in natural language processing, such as collecting, classifying, and reducing the dimension of text by topic; they are also used in bioinformatics research.

[0125] The topic model not only considers the statistical information of the text, but also the semantic information of the text, mines the deep information of the text, and extracts the core information of the document as the keywords of the document.

[0126]

[0127] Among them, p(w i |q t ) represents question q t The word w appears in i The probability, p(w i |t m ) represents the subject t m The word w appears in i The probability, p(t m |q t ) represents question q t Theme m probability.

[0128] In the present invention, the advantages and disadvantages of the above three keyword extraction algorithms are taken into consideration, and the three keyword extraction algorithms are integrated, for example, by taking their collection, etc., thereby ensuring that keywords containing important semantic information in the question will not be missed.

[0129] Next, the sentence vector generation step S400 is explained.

[0130] In the vector generation step S400, for the target question, a graph network is constructed based on the keywords obtained in the keyword extraction step S300, and the weights of different keywords are calculated to generate a sentence vector.

[0131] Specifically, the sentence vector generation step S400 can be divided into three steps: (1) construction of keyword text semantic network; (2) calculation of keyword weight; and (3) construction of sentence vector.

[0132] (1) The construction of keyword text semantic network includes:

[0133] (a) The keywords extracted from all user questions obtained in the keyword extraction step S300 are used as nodes of the text semantic network to construct a network. When words or phrases co-occur in the same sentence, edges are generated between them, and the inverse of the number of co-occurrences is used as the weight of the edge.

[0134] (b) Based on the principle of a collection span of 1 or 2, complete the establishment of edges. If the collection distance is too short, such as only connecting adjacent words or phrases, it may lead to the loss of long-range relationships, while increasing the importance of some useless words in the network. If only the connection between two adjacent words or phrases is collected, some long-range associations may be lost, and many important relationships cannot be recorded; if the collection distance is too long, it may generate more redundant information, which increases the importance of some useless words in the network.

[0135] (c) Connect the network composed of each sentence, calculate the semantic similarity between each keyword node, merge the same nodes and edges, and merge the nodes and edges with similarity higher than the threshold. When merging edges, add the weights of the two edges to form a text semantic network.

[0136] (2) Calculation of keyword weight

[0137] There are two important statistical characteristics of text semantic network, namely, node degree centrality and node betweenness. The weighted node degree centrality of a node reflects the clustering of the node in a local area, that is, the importance of the node in the region. The calculation of the weight of keywords includes:

[0138] (a) Calculate the node degree centrality. The degree centrality refers to the number of nodes connected to the node in the network, which is actually the degree of the node. The larger the degree, the more important the node is. The node is in a central position and has more connections with other nodes, which means it has stronger local criticality. i The calculation formula of point degree centrality is as follows:

[0139]

[0140] Among them, node v i With node v j When directly connected in the network, v ij The value is 1, otherwise it is 0.

[0141] (b) Calculate the node betweenness. The node betweenness refers to the proportion of all shortest paths in the network that pass through the node, reflecting the influence of the node in the entire complex network and its impact on the information flow of the entire network.

[0142]

[0143] Among them, p(v) represents the node betweenness of node v, θ ij is the number of shortest paths between nodes i and j, θ ij (v) is the number of nodes passing through v in the direct shortest path between i and j, and N is the total number of network nodes.

[0144] (c) Calculate the weight of the keyword, which can reflect the influence of the node on the entire network, considering the importance of the node in the local network and paying attention to the influence of the node on the overall information flow of the network. The weight of the keyword is calculated as follows:

[0145] w i =αv i +(1-α)p(v)

[0146] Among them, α is an adjustable parameter, and its value range is 0≤α≤1.

[0147] (3) Construction of sentence vectors

[0148] First, we train the model based on the customer service dialogue corpus and the Chinese Wikipedia corpus to obtain the word vector representation of each word. The word vector set of keywords is:

[0149] K={k1,k2,...k j}

[0150] Among them, j is the number of keywords.

[0151] Then, the sentence vector of the main clause of the user's question is calculated by the following formula:

[0152]

[0153] Among them, q s is the sentence vector of question s, w i is the weight of the keyword, k m is the word vector corresponding to a keyword, and n is the number of keywords contained in question s.

[0154] Next, the question matching step S500 is described.

[0155] In the question matching step S500, question matching is performed based on the keywords of the question to be matched obtained in the keyword extraction step S300 and the sentence vector of the target question obtained in the vector generation step S400, specifically including:

[0156] In the process of calculating the similarity between the words in the target question and the matched question, in addition to using the statistical information of the question, that is, the weight of the word, the word vector containing semantic information is introduced and calculated through cosine similarity. The specific calculation formula is as follows:

[0157]

[0158] Among them, S sim (q,q s ) represents question q and question q s The final similarity, S cos (v i ,q s ) is the word v in question q i With question q s The cosine similarity of i Represents word v in question q i The corresponding weight.

[0159] Based on the calculation results of the similarity, questions with a similarity greater than a threshold can be classified into one category to achieve the classification of user hot issues.

[0160] As described above, the similar question matching method of the present invention is different from the traditional rule-based user question matching or end-to-end model training approach, and adopts a new similar question matching idea. First, for the original user question, the main and secondary clause recognition model is trained to realize the decomposition of the main clauses and secondary words of the user question, approaching the core part of the user question, and then the question classification model is trained to realize the recognition of different question types, narrowing the matching range of similar questions, and finally, by constructing a semantic network, the accurate calculation of keyword weights is realized to ensure the accurate matching of similar questions.

[0161] In the question matching method of the present invention, the main clauses and secondary clauses of the question are identified through the user question step S100, especially in the scenario where the user's colloquialism is serious and there is a lot of redundant information, which can effectively avoid the influence of redundant information on the matching of similar questions, and truly achieve accurate matching of core semantic information, overcoming the shortcomings of the end-to-end model method.

[0162] The question matching method proposed in the present invention is an unsupervised method. Therefore, during the implementation of the method, there is no need to label the user question training data, which not only saves a lot of manpower costs, but also improves the flexibility of user matching problems, and can easily achieve accurate matching and collection of new user questions.

[0163] In the keyword extraction step S300, not only the characteristics of TF-IDF in text word form statistics are considered, but also the characteristics of keyword extraction are fully utilized in combination with TextRank using the direct relationship between text elements. At the same time, the advantages of extracting implicit keywords in questions based on topic models are combined to greatly reduce the possibility of missing keywords.

[0164] In the sentence vector generation step S400, a weighted semantic network of keywords is constructed, and the point degree centrality of keyword nodes and the betweenness of nodes are combined to more accurately calculate the weight of keywords, thereby ensuring the accuracy of the sentence vector and question matching calculation of the question.

[0165] The above is an explanation of the user similar question matching method of the present invention. The user similar question matching method of the present invention can be applied to various application scenarios, such as search field, human-computer dialogue, semantic analysis, etc.

[0166] Here, a specific implementation of the similar question matching method of the present invention is listed. In this implementation, the similar question matching method of the present invention is applied to match and group user hot questions.

[0167] The following are specific examples of user questions:

[0168] “Why didn’t I get a 38% discount when I used UnionPay at Watsons at 12 noon today? Should I provide you with the QR code payment order number? Are you there?” (“Target Question”).

[0169] “Hello, I used UnionPay QR code to pay at Watsons in Chongqing but didn’t get a 38% discount? There was a discount at McDonald’s yesterday at noon. Where are you? Are you still there?” (“Questions to be matched”).

[0170] The implementation process of the similar question matching method of this embodiment includes steps 1 to 5, which are as follows:

[0171] 1. Step 1: Problem decomposition steps

[0172] In the problem decomposition step, the user problem is decomposed, the user problem is identified, and the user problem (including the target problem and the problem to be matched) is classified into main clauses and secondary clauses.

[0173] To identify the main clause and secondary clause of a question, you only need to train a binary classifier. In order to improve the efficiency of classifier training, in the specific training process, the FastText classification model (FastText is a word vector and text classification tool open sourced by Facebook) is used for training. The words and phrases in the input layer form feature vectors, and then the feature vectors are mapped to the hidden layer through linear transformation. The hidden layer solves the maximum likelihood function, and then constructs a Huffman tree based on the weights and model parameters of each category, and the Huffman tree is used as the output. Using Huffman coding to encode labels can greatly reduce the number of model prediction targets and greatly improve the efficiency of model training and prediction.

[0174] For the above sample data, we use the trained classification model to mark and decompose the question to obtain the following Figure 2 Sample results are shown. Figure 2 is an example of representing the classification of user questions into primary and secondary clauses.

[0175] Finally, all the main clauses can be formed into a question set S q , where n is the number of all main clauses:

[0176] S q ={q1, q2, ...q n ,}

[0177] 2. Step 2: Sentence classification step

[0178] In the sentence classification step, the main clauses of the user questions (including the target question and the question to be matched) are classified, and the main clauses of the user questions are classified to identify different question types.

[0179] The question set S generated by the problem decomposition step q , continue to train a four-classification model based on the FastText classification model, and divide user questions into four categories: yes or no questions, specific questions, positive and negative questions, and choice questions, and obtain four classification sets, which are:

[0180]

[0181]

[0182]

[0183]

[0184] Steps 3 to 5 are performed respectively for different question sets.

[0185] The following is an explanation using a set of specific question sentences as an example.

[0186] 3. Step 3: Keyword extraction step

[0187] In the keyword extraction step, all keywords of user questions (including target questions and questions to be matched) are extracted. Keywords of user questions are extracted using three different keyword extraction algorithms: TF-IDF, TextRank, and topic model. Keywords are then merged. The final keyword set is as follows:

[0188]

[0189] 4. Step 4: Sentence vector generation step (sentence vectors are generated only for the target question) Here, steps 1 to 3 are executed for both the question to be matched and the target question, and step 4 is only for the target question, that is, the sentence vector generation step is only executed for the target question.

[0190] In the sentence vector generation step, a graph network is constructed for the keywords of the target question obtained in step 3, the weights of different keywords are calculated, and the sentence vector is generated. Specifically, it includes:

[0191] 4.1 Construction of keyword text semantic network

[0192] (1) Based on the keywords extracted from all user questions in step 3, the network is constructed as nodes of the text semantic network. When words or phrases co-occur in the same sentence, edges are generated between them, and the inverse of the number of co-occurrences is used as the weight of the edge;

[0193] (2) Based on the principle that the acquisition span is 1 or 2, the connection edge is established;

[0194] (3) Connect the network composed of each sentence, calculate the semantic similarity between each keyword node, merge the same nodes and edges, and merge the nodes and edges with similarity higher than the threshold. When merging edges, add the weights of the two edges to form a text semantic network. Figure 3 Represents an example of a text semantic network.

[0195] 4.2 Calculation of keyword weight

[0196] Based on the keyword text semantic network constructed in 4.1, calculate the weights of different keywords.

[0197] First, calculate the degree centrality of each node, then calculate the node betweenness, and finally calculate the weight of the node keyword. Take the keyword "Yunsuanfu" as an example:

[0198]

[0199]

[0200] w i =αv i +(1-α)p(v)=0.5×0.673432+0.5×0.568734=0.621083

[0201] Among them, v i represents the point degree centrality of the keyword "Yunsuanfu" node v, p(v) represents the node betweenness of the keyword "Yunsuanfu" node v, w i is the weight of the keyword “Yunsuanfu”, among which α=0.5 has the best effect on the weight calculation of the keyword “Yunsuanfu”.

[0202] 4.3 Construction of sentence vectors

[0203] The sentence vector representation of each word is obtained through training based on the customer service dialogue corpus and the Wikipedia Chinese corpus.

[0204] In this implementation, the dimension of the word vector is selected to be 200 dimensions. Figure 4 It is a schematic diagram showing the word vector representation (200 dimensions) with "Yunsuanfu" as the keyword.

[0205] Next, the sentence vector of the main clause of the user's question is calculated using the following formula:

[0206]

[0207] Among them, q s is the sentence vector of question s, w i is the weight of the keyword, k m is the word vector corresponding to a keyword, and n is the number of keywords contained in question s.

[0208] Take "I used UnionPay to pay at Watsons at 12 noon today, why didn't I get a 38% discount?" as an example, the sentence vector of the question is calculated as follows Figure 5 shown. Figure 5 Schematic diagram showing the calculation of sentence vectors for question sentences.

[0209] 5. Step 5: Problem matching step

[0210] In the question matching step, question matching is performed based on the keywords of the question to be matched and the sentence vector of the target question.

[0211] Here, take the question to be matched "Hello, I use UnionPay QR code payment in Watsons in Chongqing. Is there a 68% discount?" as an example. This question contains 6 keywords: {Chongqing, Watsons, UnionPay, QR code, payment, 68% discount}. The similarity between these 6 keywords and the sentence vector of the target question in step 4 is calculated respectively, and the weighted sum is calculated. The specific calculation formula is as follows:

[0212]

[0213] Among them, S sim (q,q s ) represents question q and question q s The final similarity, S cos (v i ,q s ) is the word v in question q i With question q s The cosine similarity of i Represents word v in question q i The corresponding weight.

[0214] According to the implementation results, as an example, the matching threshold is preferably set to 0.75, which has the best effect on similarity. Here, the similarity value calculated is 0.952678, which is greater than the threshold value 0.75. Therefore, the question to be matched "Hello, I used UnionPay QR code payment in Watsons in Chongqing and did not get a 68% discount?" and the target question "Why didn't I get a 68% discount when I swiped UnionPay at Watsons at 12 noon today?" are relatively matched.

[0215] Next, the similar question matching system of the present invention is described.

[0216] Figure 6 It is a structural block diagram of the similar question matching system of the present invention.

[0217] like Figure 6 As shown, the similar question matching system of the present invention is characterized by comprising:

[0218] The question decomposition module 100 performs question decomposition on the to-be-matched question and the target question respectively to decompose the to-be-matched question and the target question into main clauses and secondary clauses;

[0219] The sentence category module 200 classifies the main clauses of the to-be-matched question and the target question respectively to identify the question types of the main clauses of the to-be-matched question and the target question;

[0220] The keyword extraction module 300 extracts keywords for different types of questions of the main clauses of the to-be-matched question and the target question respectively;

[0221] A sentence vector generation module 400, for a target question, constructs a text semantic network based on the extracted keywords, calculates word vectors of the keywords and weights of the keywords in the text semantic network, and generates a sentence vector of the target question according to the weights of the keywords and the word vectors of the keywords; and

[0222] The question matching module 500 calculates the similarity between the question to be matched and the target question based on the keywords of the question to be matched and the sentence vector of the target question, and determines whether the question to be matched is similar to the target question based on the similarity.

[0223] In the problem decomposition module 100, a binary classifier is used to identify the main clause and the secondary clause.

[0224] Wherein, in the problem decomposition module 100, SVM or XGBoost is used as the binary classification classifier.

[0225] Among them, for the binary classification classifier, during the training process of the classifier, training is performed based on the FastText classification model, the words and phrases in the input layer are used to form a feature vector, and the feature vector is then mapped to the hidden layer through a linear transformation. The hidden layer solves the maximum likelihood function, constructs a Huffman tree according to the weight and model parameters of each category, and uses the Huffman tree as the output, and encodes the label using Huffman coding.

[0226] Wherein, in the sentence classification module 200, any one of the following algorithms is used to implement the classification of the main clauses: logistic regression, naive Bayes, support vector machine and XGBoost.

[0227] In the sentence classification module 200, a four-category model trained based on the FastText classification model is used to classify user questions into yes-no sentences, specific questions, positive and negative questions, and choice questions.

[0228] In the keyword extraction module 300, three different keyword extraction algorithms, TF-IDF, TextRank and topic model, are used to extract keywords respectively, and the extracted keywords are merged by seeking a collection.

[0229] The sentence vector generation module 400 includes the following submodules (not shown):

[0230] A text semantic network construction submodule, used to construct a text semantic network by using the keywords obtained by the keyword extraction module as nodes of the text semantic network;

[0231] A keyword weight calculation submodule, used to calculate the weight of the node of the text semantic network as the weight of the keyword; and

[0232] The sentence vector construction submodule is used to obtain the word vector of the keyword based on corpus training, and obtain the sentence vector of the main clause according to the word vector of the keyword and the weight of the keyword.

[0233] The submodule for constructing the keyword text semantic network performs the following actions:

[0234] The keywords obtained by the keyword extraction module are used as nodes of the text semantic network to construct a text semantic network, wherein when the same words or phrases appear together in the same sentence, edges are generated between the nodes; the edges between the nodes are established based on a collection span of 1 or 2; the networks composed of the sentences are connected, the semantic similarity of each node is calculated and merged, and a text semantic network is constructed.

[0235] The calculating of the semantic similarity of each node and merging includes: calculating the semantic similarity between nodes, merging identical nodes and edges, and merging nodes and edges whose similarity is higher than a preset threshold and adding the weights of two edges when merging edges.

[0236] The keyword weight calculation submodule performs the following actions: calculating the node degree centrality of the node; calculating the node betweenness of the node; and obtaining the keyword weight based on the node degree centrality and the node betweenness of the node.

[0237] The sentence vector construction submodule performs the following actions: obtaining a vector representation of each keyword based on corpus training to obtain the word vector of the keyword; and obtaining the sentence vector of the main clause according to the word vector of the keyword and the weight of the keyword.

[0238] Among them, the question matching module 500 performs the following actions: calculating the cosine similarity between the keywords of the question to be matched and the sentence vector of the target question; calculating the similarity between the question to be matched and the target question based on the cosine similarity and the weight of the keywords of the question to be matched; and judging whether the question to be matched is similar to the target question based on the similarity.

[0239] The present invention also provides a computer-readable medium on which a computer program is stored. When the computer program is executed by a processor, the similar question matching method is implemented.

[0240] The present invention also provides a computer device, comprising a storage module, a processor, and a computer program stored in the storage module and executable on the processor, wherein the processor implements the similarity problem matching method when executing the computer program.

[0241] The above examples mainly illustrate the similarity question matching method and similarity question matching system of the present invention. Although only some of the specific embodiments of the present invention are described, it should be understood by those skilled in the art that the present invention can be implemented in many other forms without departing from its subject matter and scope. Therefore, the examples and embodiments shown are regarded as illustrative rather than restrictive, and the present invention may cover various modifications and substitutions without departing from the spirit and scope of the present invention as defined in the appended claims.

Claims

1. A similar question matching method, characterized in that: The method is used to match the to-be-matched question with the target question, and the method includes: For the problem to be matched and the target problem, problem decomposition is performed respectively to decompose the problem to be matched and the target problem into main clauses and secondary clauses; For the to-be-matched question and the target question, the main clauses are classified respectively to identify the question types of the main clauses of the to-be-matched question and the target question; For questions of the same question type as the main clauses of the question to be matched and the target question, keywords are extracted respectively to obtain keywords of the question to be matched and keywords of the target question; For a target question, construct a text semantic network based on keywords of the target question, calculate word vectors of the keywords and weights of the keywords in the text semantic network, and generate a sentence vector of the target question according to the weights of the keywords and the word vectors of the keywords; and The similarity between the question to be matched and the target question is calculated based on the word vector of the keyword of the question to be matched and the sentence vector of the target question, and whether the question to be matched and the target question are similar is determined based on the similarity.

2. The similar question matching method according to claim 1, characterized in that: The step of performing problem decomposition on the problem to be matched and the target problem respectively to decompose the problem to be matched and the target problem into main clauses and secondary clauses includes: using a binary classification classifier to identify the main clauses and the secondary clauses.

3. The similar question matching method according to claim 2, characterized in that: SVM or XGBoost is used as the binary classification classifier.

4. The similar question matching method according to claim 2, characterized in that: For the binary classification classifier, during the training process of the classifier, training is performed based on the FastText classification model, the words and phrases in the input layer are used to form a feature vector, and the feature vector is then mapped to the hidden layer through a linear transformation. The hidden layer solves the maximum likelihood function, constructs a Huffman tree according to the weight and model parameters of each category, and uses the Huffman tree as the output, and encodes the label using Huffman coding.

5. The similar question matching method according to claim 1, characterized in that: The step of classifying the main clauses of the question to be matched and the target question respectively to identify the question types of the main clauses of the question to be matched and the target question includes: using any one of the following algorithms to classify the main clauses: logistic regression, naive Bayes, support vector machine and XGBoost.

6. The similar question matching method according to claim 1, characterized in that: The main clauses of the question to be matched and the target question are classified respectively to identify the question type words of the main clauses of the question to be matched and the target question: a four-category model trained based on the FastText classification model is used to classify the main clauses into yes-no sentences, specific questions, positive and negative questions, and choice questions.

7. The similar question matching method according to claim 4, characterized in that: The extracting of keywords for the same question type of the main clauses of the question to be matched and the target question includes: extracting keywords respectively using three different keyword extraction algorithms, TF-IDF, TextRank and topic model, and merging the respectively extracted keywords by seeking a collection.

8. The similar question matching method according to claim 1, characterized in that: The generation of the sentence vector of the target question includes the following sub-steps: Using the keywords of the target question as nodes of the text semantic network to construct a text semantic network; Calculating the weights of the nodes of the text semantic network as the weights of the keywords; as well as The word vector of the keyword is calculated and the sentence vector of the target question is obtained according to the word vector of the keyword and the weight of the keyword.

9. The similar question matching method according to claim 8, characterized in that: The step of constructing a text semantic network by using the keywords of the target question as nodes of the text semantic network includes: The keywords of the target question are used as nodes of the text semantic network to construct a text semantic network, wherein if the same words or phrases appear together in the same sentence, edges are generated between the nodes; The establishment of the edges between nodes is completed based on the acquisition span of 1 or 2; The network composed of each sentence is connected, the semantic similarity of each node is calculated and merged to construct a text semantic network.

10. The similar question matching method according to claim 9, characterized in that: The calculating the semantic similarity of each node and merging the nodes comprises: Calculate the semantic similarity between nodes, merge the same nodes and edges, and merge the nodes and edges whose similarity is higher than a preset threshold and add the weights of the two edges when merging them.

11. The similar question matching method according to claim 8, characterized in that: The step of calculating the weights of the nodes of the text semantic network as the weights of the keywords includes: Calculating the degree centrality of the node; Calculating the node betweenness of the node; and The weight of the keyword is obtained based on the node degree centrality of the node and the node betweenness of the node.

12. The similar question matching method according to claim 8, characterized in that: The step of calculating the word vector of the keyword and obtaining the sentence vector of the target question according to the word vector of the keyword and the weight of the keyword includes: Obtain the vector representation of each keyword to obtain the word vector of the keyword; and The sentence vector of the target question is obtained according to the word vector of the keyword and the weight of the keyword.

13. The similar question matching method according to claim 12, characterized in that: The step of calculating the similarity between the question to be matched and the target question based on the keywords of the question to be matched and the sentence vectors of the target question and judging whether the question to be matched and the target question are similar based on the similarity comprises: Calculate the cosine similarity between the keywords of the question to be matched and the sentence vector of the target question; Calculating the similarity between the question to be matched and the target question based on the cosine similarity and the weight of the keywords of the question to be matched; and Based on the similarity, it is determined whether the to-be-matched question is similar to the target question.

14. A similar question matching system, characterized in that: The system is used to match the to-be-matched questions with the target questions, including: A question decomposition module, for the to-be-matched question and the target question, respectively, performs question decomposition to decompose the to-be-matched question and the target question into main clauses and secondary clauses; A sentence classification module, for the question to be matched and the target question, classifies the main clauses respectively to identify the question types of the main clauses of the question to be matched and the target question; A keyword extraction module extracts keywords from the same question type of the main clauses of the to-be-matched question and the target question, respectively, to obtain keywords of the to-be-matched question and keywords of the target question; A sentence vector generation module, for a target question, constructs a text semantic network based on the keywords of the target question, calculates the word vectors of the keywords and the weights of the keywords in the text semantic network, and generates a sentence vector of the target question according to the weights of the keywords and the word vectors of the keywords; and The question matching module calculates the similarity between the question to be matched and the target question based on the word vector of the keyword of the question to be matched and the sentence vector of the target question, and determines whether the question to be matched is similar to the target question based on the similarity.

15. The similar question matching system according to claim 14, characterized in that: In the question decomposition module, a binary classifier is used to identify main clauses and secondary clauses.

16. The similar question matching system according to claim 15, characterized in that: In the problem decomposition module, SVM or XGBoost is used as the binary classification classifier.

17. The similar question matching system according to claim 15, characterized in that: For the binary classification classifier, during the training process of the classifier, training is performed based on the FastText classification model, the words and phrases in the input layer are used to form a feature vector, and the feature vector is then mapped to the hidden layer through a linear transformation. The hidden layer solves the maximum likelihood function, constructs a Huffman tree according to the weight and model parameters of each category, and uses the Huffman tree as the output, and encodes the label using Huffman coding.

18. The similar question matching system according to claim 14, characterized in that: In the sentence classification module, any one of the following algorithms is used to classify the main clauses: logistic regression, naive Bayes, support vector machine, and XGBoost.

19. The similar question matching system according to claim 14, characterized in that: In the sentence classification module, a four-category model trained based on the FastText classification model is used to classify user questions into yes-no sentences, specific questions, positive and negative questions, and choice questions.

20. The similar question matching system according to claim 14, characterized in that: In the keyword extraction module, three different keyword extraction algorithms, TF-IDF, TextRank and topic model, are used to extract keywords respectively, and the extracted keywords are merged by seeking a collection.

21. The similar question matching system according to claim 14, characterized in that: The sentence vector generation module includes the following submodules: A text semantic network construction submodule, used to construct a text semantic network by using the keywords of the target question obtained by the keyword extraction module as nodes of the text semantic network; A keyword weight calculation submodule, used to calculate the weight of the nodes of the text semantic network as the weight of the keyword; as well as The sentence vector construction submodule is used to obtain the word vector of the keyword, and obtain the sentence vector of the main clause according to the word vector of the keyword and the weight of the keyword.

22. The similar question matching system according to claim 21, characterized in that: The keyword text semantic network construction submodule performs the following actions: The keywords of the target question obtained by the keyword extraction module are used as nodes of the text semantic network to construct a text semantic network, wherein if the same words or phrases appear together in the same sentence, edges are generated between the nodes; The establishment of the edges between nodes is completed based on the acquisition span of 1 or 2; The network composed of each sentence is connected, the semantic similarity of each node is calculated and merged to construct a text semantic network.

23. The similar question matching system according to claim 22, characterized in that: The calculating the semantic similarity of each node and merging the nodes comprises: Calculate the semantic similarity between nodes, merge the same nodes and edges, and merge the nodes and edges whose similarity is higher than a preset threshold and add the weights of the two edges when merging them.

24. The similar question matching system according to claim 21, characterized in that: The keyword weight calculation submodule performs the following actions: Calculating the degree centrality of the node; Calculating the node betweenness of the node; and The weight of the keyword is obtained based on the node degree centrality of the node and the node betweenness of the node.

25. The similar question matching system according to claim 21, characterized in that: The sentence vector construction submodule performs the following actions: Obtain the vector representation of each keyword to obtain the word vector of the keyword; and The sentence vector of the main clause is obtained according to the word vector of the keyword and the weight of the keyword.

26. The similar question matching system according to claim 25, characterized in that: The question matching module performs the following actions: Calculate the cosine similarity between the keywords of the question to be matched and the sentence vector of the target question; Calculate the similarity between the question to be matched and the target question based on the cosine similarity and the weight of the keyword of the question to be matched; as well as Based on the similarity, it is determined whether the to-be-matched question is similar to the target question.

27. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the similar question matching method described in any one of claims 1 to 13 is implemented.

28. A computer device comprising a storage module, a processor, and a computer program stored in the storage module and executable on the processor, characterized in that: When the processor executes the computer program, the similar question matching method described in any one of claims 1 to 13 is implemented.