Customer demand intelligent question and answer method based on improved editing distance-knowledge graph

By improving the editing distance algorithm and knowledge graph technology, combining the BERT model and synonym forest, a more accurate and efficient intelligent question-and-answer system for customer demands is built, solving the shortcomings of traditional methods in dealing with complex contexts and structured data, and significantly improving user experience and service efficiency.

CN119807226APending Publication Date: 2025-04-11YICHANG POWER SUPPLY CO OF STATE GRID HUBEI ELECTRIC POWER CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411881672.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

Traditional editing distance algorithms have limited effects when dealing with synonyms, polysynonyms, context changes and long texts, and cannot cope with the complex needs of language variations or structured data, resulting in insufficient accuracy and efficiency in smart Q&A in customer demands.

Method used

The intelligent question-and-answer method of customer demand based on improved edit distance-knowledge graph is adopted. By constructing a smart powered service knowledge base, the BERT model is used to extract entities and relationships in customer questions, and combined with synonyms forests and improved edit distance algorithms, semantic similarity measurement and answer matching are performed.

Benefits of technology

It significantly improves the quality of customer service and the practicality of smart assistants, can understand user questions more accurately, quickly match answers, improve user experience and response efficiency, and reduce operational costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807226A_ABST
    Figure CN119807226A_ABST
Patent Text Reader

Abstract

A customer demand intelligent question and answer method based on an improved editing distance-knowledge graph comprises the following steps: constructing a corresponding intelligent power supply service knowledge base by using a knowledge graph technology according to customer problem demands; training a named entity recognition model based on BERT by using the constructed intelligent power supply service knowledge base, and extracting entities in the customer problems; on the basis of the constructed BERT-based named entity recognition model, an improved semantic similarity measurement method of the editing distance is put forward, and an answer with the maximum relevancy with the customer problem is output; and the output answers are optimized, the most appropriate answer is selected, and a final reply is generated. According to the method, manual intervention can be reduced, and more personalized services can be provided; compared with traditional manual data statistical analysis, the method can more accurately understand user questions, quickly match answers, and significantly improve user experience and response efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of digital analysis in the electric power industry, and in particular to an intelligent question-answering method for customer demands based on an improved edit distance-knowledge graph. Background Art

[0002] In today's society, with the development of digital technology, the digital characteristics of the power system are becoming increasingly prominent. Therefore, mining multi-source heterogeneous data of various businesses and promoting the transparent and efficient application of massive data are of great significance for further building a new power system and realizing the digital transformation of the energy and power industry. However, with the explosive growth of information, it has greatly increased the difficulty of accurately and quickly obtaining valuable information.

[0003] Knowledge graphs describe the complex relationships between concepts and entities in the objective world in a structured way, showing complex information that is closer to human cognition. In recent years, with the penetration of knowledge graph concepts in various fields, intelligent question-answering systems based on knowledge graphs have gradually become one of the research hotspots. Intelligent question-answering systems combine the intention and understanding of users' questions with knowledge search, and can directly answer questions without human intervention. On the basis of ensuring the accuracy of the answers, a lot of data search time and human resources are saved.

[0004] At present, intelligent question-answering systems based on knowledge graphs have been widely studied. The traditional edit distance algorithm is a classic algorithm for measuring the difference between two strings. It measures the similarity of two strings by calculating the minimum number of editing operations (including insertion, deletion, and substitution) required to convert one string into another. This algorithm is widely used in fields such as spelling checking, text comparison, and information retrieval. However, the traditional edit distance algorithm only relies on character-level operations to measure string similarity, ignoring the semantics and contextual information of the vocabulary. Therefore, it has limited effect when dealing with synonyms, polysemous words, context changes, and long texts, and cannot cope with the complex requirements of language variation or structured data. Summary of the invention

[0005] In order to address the shortcomings of traditional customer demand question-answering methods, the present invention provides a customer demand intelligent question-answering method based on improved edit distance-knowledge graph, which can reduce manual intervention and provide more personalized services; compared with traditional manual data statistical analysis, this method can more accurately understand user questions, quickly match answers, and significantly improve user experience and response efficiency.

[0006] The technical solution adopted by the present invention is:

[0007] The customer demand intelligent question answering method based on improved edit distance-knowledge graph includes the following steps:

[0008] Step 1: Based on customer demands, use knowledge graph technology to construct a corresponding smart power supply service knowledge base;

[0009] Step 2: Use the smart power supply service knowledge base constructed in step 1 to train a BERT-based named entity recognition model to extract entities in customer questions;

[0010] Step 3: Based on the BERT-based named entity recognition model built in step 2, an improved semantic similarity measurement method of edit distance is proposed to output the answer that is most relevant to the customer's question;

[0011] Step 4: Optimize the answers outputted in step 3, select the most appropriate answer, and generate the final reply. Step 1 includes the following steps:

[0012] S1.1: Data collection and integration:

[0013] Collect customer request ticket data and other business system related information, including various basic information and fault description data related to fault handling, service response and customer feedback. The data in these languages ​​is called corpus.

[0014] S1..2: Data preprocessing:

[0015] The maximum bidirectional segmentation algorithm is used to segment the professional terms in the data. First, forward segmentation is used to scan the work order content from left to right, and the longest matching word in the text is identified through dictionary matching. Then, reverse segmentation is used to scan from right to left to ensure that some long words or parts that may be missed by forward segmentation are captured. Next, the results of forward and reverse segmentation are compared, and a segmentation scheme that covers more valid vocabulary is selected.

[0016] Through this process, customer information, power issues, and time-critical entities in the work order can be accurately identified.

[0017] S1.3: Knowledge base construction:

[0018] By storing the pre-processed data of S1.2 into the Neo4j graph database, a knowledge graph of power grid customer demands, namely the smart power supply service knowledge base, is constructed. The knowledge graph integrates demand work orders and power service data and stores them in a structured manner in the graph database.

[0019] In step 2, the BERT-based named entity recognition model consists of a BERT pre-trained language model, a bidirectional gated recurrent neural network layer, and a conditional random field layer. The model is divided into three layers, where the BERT pre-trained language model is the first layer, which segments the input work order text and converts each word or subword into a token. Then, these tokens are mapped to a low-dimensional vector of a fixed dimension by looking up the BERT embedding matrix;

[0020] Secondly, the bidirectional gated recurrent neural network layer, by forward and backward transmission of the input work order text, can capture the keywords and semantic relationships in the customer's demands while also capturing the changes in the time series in the text and identifying information such as the time when the complaint occurred and the response time.

[0021] Finally, the Conditional Random Field layer is used to identify and annotate key entities in customer tickets.

[0022] In step 2, when using the BERT model to extract named entities from the power grid customer demand text, we first fine-tune the pre-trained BERT and use the power grid customer demand data with named entities labeled for training. Through BERT's bidirectional self-attention mechanism, the model can effectively capture the contextual information in the text and identify entities such as customer names and demand content; during training, by labeling each word, the model can eventually output labeled named entities and provide accurate entity recognition capabilities.

[0023] In terms of potential semantic understanding, BERT is used to encode text sequences, that is, given a sentence consisting of n words W = (w1, w2, … w t ),W t Represents the tth word in the sentence, and uses BERT to convert the word W in the sentence t Transform the corresponding vector x t , as shown in formula (1):

[0024] x t =BERT(w t )(1);

[0025] In step 2, the bidirectional gated recurrent neural network layer is composed of a forward gated recurrent unit and a backward gated recurrent unit connected to the same output layer; in the power grid customer demands, the bidirectional gated recurrent neural network layer extracts key information such as customer needs, problem types and fault descriptions through bidirectional learning of text sequences.

[0026] For time t, the cell state calculation formula of the gated recurrent unit (GRU) is:

[0027] r t =σ(ω r ·[ht-1 ,x t ]+b r )(2);

[0028] z t =σ(ω z ·[h t-1 ,x t ]+b z )(3);

[0029]

[0030] Among them, σ represents the sigmoid function; ω r ,ω z ,ω h represents the weight matrix; b r 、b z 、b h represents the bias function; x t represents the input vector at time step t; h t represents the hidden state, which is also the output vector, containing all valid information of the previous t times; h t-1 It represents the hidden state of the previous moment. In the calculation of the gated recurrent unit, it participates in updating the hidden state h of the current moment together with the current input. t ;z t represents the update gate, which is used to control the influence of the previous unit hidden layer output on the current unit state. The larger the update gate value, the greater the influence of the previous unit hidden layer output on the current unit state. t Represents the reset gate, which is used to control h t-1 right The importance of the reset gate is that the smaller the value of the reset gate is, the greater the degree to which the hidden layer information of the previous unit is ignored; Indicates the information that needs to be updated in the current unit.

[0031] The hidden layer of the forward gated recurrent unit is represented as The hidden layer of the backward gated recurrent unit is represented as The hidden layer output of the unidirectional gated recurrent unit at time t is obtained through equations (2) to (5), as shown in equations (4) and (5). The hidden state output of the bidirectional gated recurrent unit at time t is concatenated by the hidden layer output of the forward gated recurrent unit and the backward gated recurrent unit, and the calculation formula is:

[0032]

[0033]

[0034] in, represents the forward propagation hidden state at time t-1; represents the backward propagated hidden state at time t-1.

[0035] For the conditional random field layer, it marks the sequence data by establishing a probability model; for a given input sequence x = (x1,…,x n ) and the corresponding label sequence y=(y1,…,y n ), x1,…,x n They are represented as the feature representations of the 1st to the nth words, y1,…,y n Represents the named entity labels corresponding to the 1st to the nth words in the input sequence, and the sequence labeling formula is defined as shown in formula (9):

[0036]

[0037] In the formula, x represents the given input sequence; y represents the output sequence corresponding to the input sequence x; i represents the i-th label; t k (y i-1 ,y i ,x,i) represents the transfer feature function, which is used to capture the label y i-1 to label y i Transfer characteristics of l (y i ,x,i) is the state feature function, which represents the characteristics of the i-th label in the label sequence and the corresponding observation sequence median; λ k and μ l is the parameter of the model, λ k and μ l The values ​​of are estimated from the training data, and these parameters are related to the transfer feature function t k (y i-1 ,y i ,x,i) and state characteristic function s l (y i ,x,i) association, which controls the weight of the feature in calculating the conditional probability; z(x) represents the normalization factor, and the expression is shown in formula (10):

[0038] z(x)=∑ y exp[∑ i,k λ k t k (y i-1 ,y i ,x,i)+∑ i,l μ l s l (y i ,x,i)](10);

[0039] In step 3, an improved semantic similarity measurement method of edit distance is proposed, including:

[0040] (1) Based on the completed customer demands and installation-specific vocabulary, the maximum bidirectional segmentation algorithm is used to segment the input question 1 "The transformer fails and the power supply is interrupted" and the question set 2 in the question bank.

[0041] (2) Use the BERT model based on the knowledge graph to perform semantic understanding and context analysis on the text, and automatically identify the proper nouns and concepts related to the power grid. In other words, extract entities in question 1. For example, in the customer's question, the BERT model will extract the words "transformer" and "fault" as specific entities through semantic understanding of the two words.

[0042] (3) Load the synonym forest:

[0043] The entities in question 1 usually contain some professional vocabulary, equipment names, and fault descriptions, and it is necessary to identify synonyms for the entities in question 1. Through such synonym identification, a list of synonyms that need to be matched with the question library is obtained. This list contains the entities in question 1 and their possible synonymous expressions. When matching the question library, the system can compare these synonyms with the questions in the question library to improve the accuracy and fault tolerance of the match.

[0044] (4) Based on the question entity vocabulary 3, it is matched with question set 4. Question set 4 is the word set of question 2 in the question library. If the words contained in question set 4 exist in the question entity synonym list 3, the questions are selected, that is, the questions are filtered to obtain question set 5, which further narrows the calculation scope of the edit distance.

[0045] (5) After calculating the word segmentation, the synonyms of word segmentation problem 1 are corrected to problem set 5. Using the synonym library, the words in problem 1 are modified to the words in problem 5.

[0046] (6) After the modification is completed, the edit distance algorithm is used to calculate the number of editing operations between the two questions. Finally, the system will output the matching questions and corresponding answers.

[0047] In step 4, in the BERT-based named entity recognition model, the top five relevant answers are screened out by the improved semantic similarity measurement method of the edit distance, and further optimization steps include:

[0048] First, BERT is used to perform deep semantic matching analysis on each candidate answer and customer question, and the semantic similarity score is calculated by using cosine similarity, as shown in formula (11):

[0049]

[0050] In the formula, the vector E Q Represents the problem Q; vector E A Represents the candidate answer A. By calculating the angle between the two vectors, the closer the value is to 1, the more similar the semantics are, and the closer the value is to 0, the less similar the semantics are.

[0051] Then, based on the contextual information, determine whether the candidate answer accurately addresses the customer's needs, ensuring the accuracy, completeness and practicality of the answer.

[0052] Finally, the semantic matching score and contextual adaptation are combined to form a comprehensive score:

[0053] Comprehensive score = α × semantic similarity + β × contextual adaptation (12);

[0054] Among them, α and β are weight coefficients, which can be adjusted according to actual needs. If semantic matching is more important, α can be set higher. The candidate answers are sorted according to the comprehensive score. The answer with the highest score is the most appropriate answer and is returned to the customer as the final reply to ensure the best fit between the information content and customer needs.

[0055] The present invention provides a customer demand intelligent question-answering method based on improved edit distance-knowledge graph, and the technical effects are as follows:

[0056] 1) In response to the problem of lack of digital means for real-time attribution analysis and intelligent judgment of customer demands, the method of the present invention introduces the synonym forest into the edit distance algorithm, and uses the knowledge graph to construct a BERT-based named entity recognition model to extract entities and relationships in customer questions, thereby improving the recognition accuracy and the ability to handle complex contexts, which can significantly improve the quality of customer service and the practicality of intelligent assistants, while promoting the innovative development of enterprise efficiency and knowledge management, improving user experience and reducing operating costs in practical applications.

[0057] 2) The present invention proposes a customer demand intelligent question-answering method based on improved edit distance-knowledge graph to address the shortcomings of traditional customer demand question-answering methods. This customer demand intelligent question-answering method based on improved edit distance-knowledge graph combines the improved edit distance algorithm with the knowledge graph, which can more accurately match user questions and reduce misunderstandings and irrelevant answers.

[0058] 3) The customer demand intelligent question-answering method based on the improved edit distance-knowledge graph of the present invention is of great significance for improving the efficiency and quality of customer service with its powerful semantic analysis ability and rich knowledge base support, and has practical application value for improving the operation and management of the power system. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The present invention will be further described below in conjunction with the accompanying drawings and examples;

[0060] Figure 1 This is a flowchart of the intelligent question-answering method for customer demands based on improved edit distance-knowledge graph.

[0061] Figure 2 This is the flow chart of the maximum bidirectional segmentation algorithm.

[0062] Figure 3 Knowledge graph for power grid customer demands.

[0063] Figure 4 This is a structural diagram of the BERT-based named entity recognition model.

[0064] Figure 5 This is a flowchart based on the improved edit distance algorithm model.

[0065] Figure 6 This is a performance graph of the customer demand intelligent question answering method based on the improved edit distance-knowledge graph. DETAILED DESCRIPTION

[0066] The customer demand intelligent question answering method based on improved edit distance-knowledge graph includes the following steps:

[0067] Step 1: Based on customer demands, use knowledge graph technology to construct a corresponding smart power supply service knowledge base;

[0068] Step 2: Use the smart power supply service knowledge base constructed in step 1 to train a BERT-based named entity recognition model to extract entities in customer questions;

[0069] Step 3: Based on the BERT-based named entity recognition model built in step 2, an improved semantic similarity measurement method of edit distance is proposed to output the answer that is most relevant to the customer's question;

[0070] Step 4: Optimize the answers output in step 3, select the most appropriate answer, and generate the final response.

[0071] This makes the method proposed in the present invention have a better performance effect and provides a scientific reference for improving the accuracy of the system and user experience.

[0072] The step 1 comprises the following steps:

[0073] S1.1: Data collection and integration:

[0074] Collect customer request ticket data and other business system related information, including various basic information and fault descriptions related to fault handling, service response and customer feedback as shown in Table 6. The data in these languages ​​is called corpus.

[0075] Table 6 Customer work order data table

[0076]

[0077] S1.2: Data preprocessing:

[0078] The maximum bidirectional segmentation algorithm is used to segment the professional terms in these data. The flowchart of the algorithm is as follows: Figure 2 As shown in the figure, first, the algorithm uses forward segmentation to scan the work order content from left to right, and identifies the longest matching word in the text through dictionary matching, such as "power failure" or "electricity consultation"; then, reverse segmentation is performed from right to left to ensure that some long words or parts that may be missed by forward segmentation are captured, especially some words ending with specific suffixes or phrases; then, the algorithm compares the results of forward and reverse segmentation, and selects a segmentation scheme that covers more valid words, thereby improving the accuracy of word segmentation. Through this process, key entities such as customer information, power problems, and time in the work order can be accurately identified, thereby providing an accurate textual basis for building a customer demand knowledge graph or conducting subsequent data analysis.

[0079] S1.3: Knowledge base construction:

[0080] By storing the data processed by S1.2 into the Neo4j graph database, a Figure 3 The knowledge graph of power grid customer demands is the smart power supply service knowledge base. The knowledge graph integrates demand work orders and power service data and stores them in a structured manner in a graph database. The advantage of the Neo4j graph database lies in its powerful graph structure, which can efficiently represent the relationship between customer demands and power problems, service status, etc. This integration and structuring process enables power companies to analyze customer needs more accurately, improve service quality, and provide data support for future intelligent decision-making and fault prediction.

[0081] In step 2, the BERT-based named entity recognition model consists of a BERT pre-trained language model, a bidirectional gated recurrent neural network layer, and a conditional random field layer, such as Figure 4As shown in the figure, the model is divided into three layers, among which the BERT pre-trained language model is the first layer, which segments the input work order text and converts each word or subword into a token. Then, these tokens are mapped to a low-dimensional vector of a fixed dimension by looking up the BERT embedding matrix; secondly, the bidirectional gated recurrent neural network layer, by forward and backward passing the input work order text, can capture the keywords and semantic relationships in the customer's demands while also capturing the changes in the time series in the text, and identifying information such as the time when the complaint occurred and the response time. Through bidirectional processing, the model can understand the exact meaning of each word in the context, and can automatically learn the time features related to power failures, service requests, etc.

[0082] Finally, the conditional random field layer is used to identify and label key entities in customer work orders, such as "power failure" and "bill problem", to ensure the semantic consistency of these labels in the entire sentence. By considering the conditional probability between labels, CRF can avoid isolated and incorrect label assignments, making the label sequence in the text more consistent with the actual context and task requirements, thereby improving the automatic classification and problem identification capabilities of power grid customer service.

[0083] In step 2, the BERT model can better understand the meaning of words in different contexts by pre-training the power supply service knowledge base and combining bidirectional context information. When using the BERT model to extract named entities from the power grid customer demand text, the pre-trained BERT is first fine-tuned and trained using the power grid customer demand data labeled with named entities. Through BERT's bidirectional self-attention mechanism, the model can effectively capture contextual information in the text and can identify entities such as customer names and demand content. During training, by labeling each word, the model can eventually output labeled named entities, such as "customer name", "power grid company name", etc., providing accurate entity recognition capabilities.

[0084] In terms of potential semantic understanding, BERT is used to encode text sequences, that is, given a sentence consisting of n words W = (w1, w2, … w t ),W t Represents the tth word in the sentence, and uses BERT to convert the word W in the sentence t Transform the corresponding vector x t , as shown in formula (1):

[0085] x t =BERT(w t )(1);

[0086] In step 2, the bidirectional gated recurrent neural network layer is composed of a forward gated recurrent unit and a backward gated recurrent unit connected to the same output layer; the introduction of the bidirectional loop enables the output at the current moment to be connected to the state of the previous moment and the next moment, making up for the defect that the unidirectional gated recurrent unit cannot capture contextual information and reducing the loss of sequence features; in the power grid customer demands, the bidirectional gated recurrent neural network layer can extract key information such as customer needs, problem types and fault descriptions through bidirectional learning of text sequences.

[0087] For time t, the cell state calculation formula of the gated recurrent unit (GRU) is:

[0088] r t =σ(ω r ·[h t-1 ,x t ]+b r )(2);

[0089] z t =σ(ω z ·[h t-1 ,x t ]+b z )(3);

[0090]

[0091] Among them, σ represents the sigmoid function; ω r ,ω z ,ω h represents the weight matrix; b r 、b z 、b h represents the bias function; x t represents the input vector at time step t; h t represents the hidden state, which is also the output vector, containing all valid information of the previous t times; h t-1 It represents the hidden state of the previous moment. In the calculation of the gated recurrent unit, it participates in updating the hidden state h of the current moment together with the current input. t ;z t represents the update gate, which is used to control the influence of the previous unit hidden layer output on the current unit state. The larger the update gate value, the greater the influence of the previous unit hidden layer output on the current unit state. t Represents the reset gate, which is used to control h t-1 right The importance of the reset gate is that the smaller the value of the reset gate is, the greater the degree to which the hidden layer information of the previous unit is ignored; Indicates the information that needs to be updated in the current unit.

[0092] The hidden layer of the forward gated recurrent unit is represented as The hidden layer of the backward gated recurrent unit is represented as The hidden layer output of the unidirectional gated recurrent unit at time t is obtained through equations (2) to (5), as shown in equations (4) and (5). The hidden state output of the bidirectional gated recurrent unit at time t is concatenated by the hidden layer output of the forward gated recurrent unit and the backward gated recurrent unit, and the calculation formula is:

[0093]

[0094] in, represents the forward propagation hidden state at time t-1; represents the backward propagated hidden state at time t-1.

[0095] For the conditional random field layer, it marks the sequence data by establishing a probability model; for a given input sequence x = (x1,…,x n ) and the corresponding label sequence y=(y1,…,y n ), x1,…,x n They are represented as the feature representations of the first to nth words, such as the literal values ​​"fault" and "repair", etc., y1,...,y n Represents the named entity labels corresponding to the 1st to the nth words in the input sequence, and the sequence labeling formula is defined as shown in formula (9):

[0096]

[0097] In the formula, x represents the given input sequence; y represents the output sequence corresponding to the input sequence x; i represents the i-th label; t k (y i-1 ,y i ,x,i) represents the transfer feature function, which is used to capture the label y i-1 to label y i Transfer characteristics of l (y i ,x,i) is the state feature function, which represents the characteristics of the i-th label in the label sequence and the corresponding observation sequence median; λ k and μ l is the parameter of the model, λ k and μ l The values ​​of are estimated from the training data, and these parameters are related to the transfer feature function t k (y i-1 ,y i ,x,i) and state characteristic function s l (y i,x,i) association, which controls the weight of the feature in calculating the conditional probability; z(x) represents the normalization factor, and the expression is shown in formula (10):

[0098] z(x)=∑ y exp[∑ i,k λ k t k (y i-1 ,y i ,x,i)+∑ i,l μ l s l (y i ,x,i)](10);

[0099] In the sequence labeling task of power grid customer demand text, the conditional random field layer optimizes the prediction results of the label sequence by modeling the dependencies between labels.

[0100] In step 3, in order to effectively avoid identifying semantically inconsistent phrases as semantically similar phrases, the edit distance is selected for model construction to strictly ensure the consistency of the question expression with the question bank, thereby ensuring the accuracy of the output answer. An improved semantic similarity measurement method of edit distance is proposed; in order to avoid matching confusion caused by synonyms, a synonym forest is used when performing text similarity analysis based on edit distance. The algorithm flow chart is shown in the figure below. Figure 5 It effectively improves the analysis performance of the edit distance and makes up for the shortcomings of the edit distance in semantic recognition. The edit distance calculation method based on the synonym forest is as follows:

[0101] (1) Based on the completed customer requirements and installation vocabulary, use Figure 3 The maximum bidirectional segmentation algorithm shown performs word segmentation on the input question 1 "The transformer fails and the power supply is interrupted" and the question set 2 in the question bank to ensure that the proprietary vocabulary is correctly segmented. For example, there is a word like "power installation" in the proprietary vocabulary. The system needs to ensure that it will not be segmented into two words "power" and "installation" during word segmentation, but keep it as a whole.

[0102] (2) Use Figure 4 The BERT model based on the knowledge graph performs semantic understanding and context analysis on the text, and automatically identifies the proper nouns and concepts related to the power grid, that is, extracting entities in question 1. For example, in the customer's question, the BERT model will extract the "transformer failure" as a specific entity through the semantic understanding of the two words "transformer" and "fault".

[0103] (3) Load the synonym forest.

[0104] The entities in question 1 usually contain some professional vocabulary, equipment names, fault descriptions, etc., and it is necessary to identify the synonyms of the entities in question 1. For example, "transformer failure" in question 1 may have corresponding synonyms in the synonym forest, such as "voltage conversion equipment damage" or "power transformer failure", etc. All these synonymous expressions belong to the same entity category. Through such synonym identification, a list of synonyms that need to be matched with the question library is obtained, as shown in Table 1. This list contains the entities in question 1 and their possible synonymous expressions. When matching the question library, the system can compare these synonyms with the questions in the question library to improve the accuracy and fault tolerance of the match.

[0105] Table 1 Synonym list

[0106] Entity Name Synonyms 1 Synonyms 2 Synonyms 3 Transformer failure Damage to voltage conversion equipment Power transformer failure Substation equipment issues Distribution network failure Power grid outage Power distribution system failure Power outage Power outage power failure Power outage Stop power supply

[0107] (4) Based on the question entity vocabulary list 3, it is matched with question set 4, which is the word set of question 2 in the question library, as shown in Table 2. If the words contained in question set 4 exist in the question entity synonym list 3, the questions are selected, that is, the questions are filtered to obtain question set 5, which further narrows the calculation scope of the edit distance.

[0108] Table 2 Question Set 4

[0109]

[0110]

[0111] Table 3 Question Set 5

[0112] Question Number Word segmentation results Matching entities (from question 1) Question 2-1 ["transformer","damage","power","interruption"] Transformer failure, power outage Question 2-2 ["grid","fault","electricity","outage"] Power outage Question 2-3 ["transformer","fault","power","outage","interruption"] Transformer failure, power outage

[0113] (5) After calculating the segmentation, the synonyms of the segmentation problem 1 are corrected to the problem set 5. Using the synonym library, the words in problem 1 are modified to the words in problem 5. The modified problem 1 becomes "Transformer failure, power outage".

[0114] Table 4 Synonym database

[0115] Synonyms 1 Synonyms 2 Replacement rules occur Fault Occurrence->Failure supply Outage Supply->Stop Interrupt power failure Interruption -> Shutdown

[0116] (6) After the modification is completed, the edit distance algorithm is used to calculate the number of edit operations between the two questions. The calculation results are shown in Table 5. Finally, the system will output the matching questions and the corresponding answers.

[0117] Table 5 Calculation results

[0118]

[0119] In the step 4, the top 5 relevant answers are screened out by the semantic similarity measurement method of the improved edit distance in the BERT-based named entity recognition model, and the further optimization step includes: performing a refined evaluation of the semantic consistency and context adaptability of these candidate answers; specifically;

[0120] First, BERT is used to perform deep semantic matching analysis on each candidate answer and customer question, and the semantic similarity score is calculated by using cosine similarity, as shown in formula (11):

[0121]

[0122] In the formula, the vector E Q Represents the problem Q; vector E A Represents the candidate answer A. By calculating the angle between the two vectors, the closer the value is to 1, the more similar the semantics are, and the closer the value is to 0, the less similar the semantics are.

[0123] Then, based on the contextual information, determine whether the candidate answer accurately addresses the customer's needs, ensuring the accuracy, completeness and practicality of the answer.

[0124] Finally, the semantic matching score and contextual adaptation are combined to form a comprehensive score:

[0125] Comprehensive score = α × semantic similarity + β × contextual adaptation (12);

[0126] Among them, α and β are weight coefficients, which can be adjusted according to actual needs. If semantic matching is more important, α can be set higher. The candidate answers are sorted according to the comprehensive score. The answer with the highest score is the most appropriate answer and is returned to the customer as the final reply to ensure the best fit between the information content and customer needs.

[0127] Example:

[0128] To illustrate the feasibility and effectiveness of the method proposed in the invention, 95,598 customer demand work order data of a power supply company in a certain city in the past three years were used as a question database. The data set contains a total of 3,673 questions and answers. The professional vocabulary in the data set comes from relevant professional documents, with a total of 18,842 words. In addition, there are 2,421 sets of pre-trained triple data. 80% of the data were randomly selected as training sets and 20% as test sets. In order to comprehensively evaluate the advantages of the method proposed in the present invention, the average precision (MAP), top 5 accuracy (Accuracy@5, top-N) and mean reciprocal rank (MRR) were used for verification. The calculation formulas for each indicator are as follows:

[0129] Average Precision (MAP):

[0130]

[0131] Q represents the total number of questions in the evaluation set. AveP is the precision. C i is the answer set. A i is the correct answer set. The AveP calculation formula is as follows:

[0132]

[0133] In formula (14), m represents the number of correct answer sentences for the input question. n represents the number of retrieved sentences. P(k) represents the true ranking of the standard answer sentence / the ranking given by the model. rel(k) represents whether the kth sentence is the true answer. If the kth sentence is the true answer sentence, rel(k) represents 1, otherwise it is 0.

[0134] Accuracy@5,top-N:

[0135]

[0136] In formula (15), δ(C i ,A i ) represents the N precisions of the i-th problem in the evaluation set, C i represents the set of N candidate answers predicted by the model for the i-th question. If the correct answer is A i Included in C i If the answer is in the correct answer, it is recorded as 1, otherwise it is recorded as 0. Sum the results of each question and then take the average. The higher the average accuracy value obtained, the better the performance of the question-answering system.

[0137] Mean Reciprocal Rank (MRR):

[0138]

[0139] In formula (16), rank i Denotes the i-th question Q i The first correct answer in the predicted answer set C i The higher the position of the correct answer, the higher the MRR value, which means the better the performance of the smart question answering.

[0140] Figure 6 This is a performance diagram of the customer demand intelligent question answering method based on the improved edit distance-knowledge graph. Figure 6It can be seen that the method proposed in the present invention can better reflect the characteristics of customer questions and achieve accurate matching of questions and answers. In addition, according to the top-N index, the 5 questions and answers output by the question-answering method contain 94% accurate answers to the questions, indicating that it is feasible to apply this method to intelligent question-answering of customer demands.

Claims

1. An intelligent question-answering method for customer demands based on improved edit distance-knowledge graph, characterized by The following steps are involved: Step 1: Based on customer demands, use knowledge graph technology to construct a corresponding smart power supply service knowledge base; Step 2: Use the smart power supply service knowledge base constructed in step 1 to train a BERT-based named entity recognition model to extract entities in customer questions; Step 3: Based on the BERT-based named entity recognition model built in step 2, an improved semantic similarity measurement method of edit distance is proposed to output the answer that is most relevant to the customer's question; Step 4: Optimize the answers output in step 3, select the most appropriate answer, and generate the final response.

2. The customer demand intelligent question answering method based on improved edit distance-knowledge graph according to claim 1, characterized in that: The step 1 comprises the following steps: S1.1: Data collection and integration: Collect customer request ticket data and other business system related information, including various basic information and fault description data related to fault handling, service response and customer feedback. The data in these languages ​​is called corpus. S1.2: Data preprocessing: Use the maximum bidirectional segmentation algorithm to segment the professional terms in the data. First, use forward segmentation to scan the work order content from left to right, and identify the longest matching word in the text through dictionary matching. Then, use reverse segmentation to scan from right to left to ensure that some long words or parts that may be missed by forward segmentation are captured. Then, compare the results of forward and reverse segmentation and choose a segmentation scheme that covers more valid words. Through this process, customer information, power issues, and time-critical entities in the work order can be accurately identified; S1.3: Knowledge base construction: By storing the pre-processed data of S1.2 into the Neo4j graph database, a knowledge graph of power grid customer demands, namely the smart power supply service knowledge base, is constructed; this knowledge graph integrates demand work orders and power service data and stores them in a structured manner in the graph database.

3. The customer demand intelligent question answering method based on improved edit distance-knowledge graph according to claim 1, characterized in that: In step 2, the BERT-based named entity recognition model consists of a BERT pre-trained language model, a bidirectional gated recurrent neural network layer, and a conditional random field layer. The model is divided into three layers, wherein the BERT pre-trained language model is the first layer, which segments the input work order text and converts each word or subword into a token; then, these tokens are mapped to a low-dimensional vector of a fixed dimension by searching the BERT embedding matrix; Secondly, the bidirectional gated recurrent neural network layer, by forward and backward transmission of the input work order text, can capture the keywords and semantic relationships in the customer's demands while also capturing the changes in the time series in the text, such as the time when the complaint occurred and the response time. Finally, the Conditional Random Field layer is used to identify and annotate key entities in customer tickets.

4. According to claim 3, the customer demand intelligent question answering method based on improved edit distance-knowledge graph is characterized by: When using the BERT model to extract named entities from power grid customer demand text, we first fine-tune the pre-trained BERT and use the power grid customer demand data with labeled named entities for training. Through BERT's bidirectional self-attention mechanism, the model can effectively capture the contextual information in the text and identify entities such as customer names and demand content. During training, by labeling each word, the model can eventually output labeled named entities and provide accurate entity recognition capabilities.

5. According to claim 4, the customer demand intelligent question answering method based on improved edit distance-knowledge graph is characterized by: In terms of potential semantic understanding, BERT is used to encode text sequences, that is, given a sentence consisting of n words W = (w1, w2, … w t ),W t Represents the tth word in the sentence, and uses BERT to convert the word W in the sentence t Transform the corresponding vector x t , as shown in formula (1): x t =BERT(w t )(1)。 6. According to claim 3, the method for intelligent question answering of customer demands based on improved edit distance-knowledge graph is characterized by: The bidirectional gated recurrent neural network layer consists of a forward gated recurrent unit and a backward gated recurrent unit connected to the same output layer. In the power grid customer demands, the bidirectional gated recurrent neural network layer extracts key information such as customer needs, problem types, and fault descriptions through bidirectional learning of text sequences. For time t, the cell state calculation formula of the gated recurrent unit (GRU) is: r t =σ(ω r ·[h t-1 ,x t ]+b r )(2); z t =σ(ω z ·[h t-1 ,x t ]+b z )(3); Among them, σ represents the sigmoid function; ω r ,ω z ,ω h represents the weight matrix; b r 、b z 、b h represents the bias function; x t represents the input vector at time step t; h t represents the hidden state, which is also the output vector, containing all valid information of the previous t times; h t-1 It represents the hidden state of the previous moment. In the calculation of the gated recurrent unit, it participates in updating the hidden state h of the current moment together with the current input. t ;z t represents the update gate, which is used to control the influence of the previous unit hidden layer output on the current unit state. The larger the update gate value, the greater the influence of the previous unit hidden layer output on the current unit state. t Represents the reset gate, which is used to control h t-1 right The importance of the reset gate is that the smaller the value of the reset gate is, the greater the degree to which the hidden layer information of the previous unit is ignored; Indicates the information that needs to be updated in the current unit; The hidden layer of the forward gated recurrent unit is represented as The hidden layer of the backward gated recurrent unit is represented as The hidden layer output of the unidirectional gated recurrent unit at time t is obtained by equations (2) to (5), as shown in equations (4) and (5); the hidden state output of the bidirectional gated recurrent unit at time t is concatenated by the hidden layer outputs of the forward gated recurrent unit and the backward gated recurrent unit, and the calculation formula is: in, represents the forward propagation hidden state at time t-1; represents the backward propagated hidden state at time t-1.

7. According to claim 3, the customer demand intelligent question answering method based on improved edit distance-knowledge graph is characterized by: For the conditional random field layer, it marks the sequence data by establishing a probability model; for a given input sequence x = (x1,…,x n ) and the corresponding label sequence y=(y1,…,y n ), x1,…,x n They are represented as the feature representations of the 1st to the nth words, y1,…,y n Represents the named entity labels corresponding to the 1st to the nth words in the input sequence, and the sequence labeling formula is defined as shown in formula (9): In the formula, x represents the given input sequence; y represents the output sequence corresponding to the input sequence x; i represents the i-th label; t k (y i-1 ,y i ,x,i) represents the transfer feature function, which is used to capture the label y i-1 to label y i Transfer characteristics of l (y i ,x,i) is the state feature function, which represents the characteristics of the i-th label in the label sequence and the corresponding observation sequence median; λ k and μ l is the parameter of the model, λ k and μ l The values ​​of are estimated from the training data, and these parameters are related to the transfer feature function t k (y i-1 ,y i ,x,i) and state characteristic function s l (y i ,x,i) association, which controls the weight of the feature in calculating the conditional probability; z(x) represents the normalization factor, and the expression is shown in formula (10): z(x)=∑ y exp[∑ i,k λ k t k (y i-1 ,y i ,x,i)+∑ i,l μ l s l (y i ,x,i)](10)。 8. According to claim 1, the method for intelligent question answering of customer demands based on improved edit distance-knowledge graph is characterized by: In step 3, an improved semantic similarity measurement method of edit distance is proposed, including: (1) Based on the completed customer demands and installation-specific vocabulary, the maximum bidirectional segmentation algorithm is used to segment the input question 1 "The transformer fails and the power supply is interrupted" and the question set 2 in the question bank. (2) Use the BERT model based on the knowledge graph to perform semantic understanding and context analysis on the text, and automatically identify the proper nouns and concepts related to the power grid. In other words, extract the entity in question 1. In the customer question, the BERT model extracts the words "transformer" and "fault" as specific entities by understanding the semantics of the two words. (3) Load the synonym forest: The entities in question 1 usually contain some professional terms, equipment names, and fault descriptions, and the synonyms of the entities in question 1 need to be identified. Through such synonym identification, a list of synonyms that need to be matched with the question library is obtained. This list contains the entities in question 1 and their possible synonymous expressions. When matching the question library, the system can compare these synonyms with the questions in the question library to improve the accuracy and fault tolerance of the match. (4) Based on the question entity vocabulary 3, match it with question set 4, which is the word set of question 2 in the question library. If the words contained in question set 4 exist in the question entity synonym list 3, then the questions are selected, that is, the questions are filtered to obtain question set 5, which further narrows the calculation scope of the edit distance. (5) After calculating the segmentation, the synonyms of the segmentation problem 1 are corrected to the problem set 5; using the synonym library, the words in problem 1 are modified to the words in problem 5; (6) After the modification is completed, the edit distance algorithm is used to calculate the number of editing operations between the two questions. Finally, the system will output the matching questions and corresponding answers.

9. The customer demand intelligent question answering method based on improved edit distance-knowledge graph according to claim 8, characterized in that: In step 4, in the BERT-based named entity recognition model, the top five relevant answers are screened out by using the improved semantic similarity measurement method of the edit distance, including the following steps: First, BERT is used to perform deep semantic matching analysis on each candidate answer and customer question, and the semantic similarity score is calculated by using cosine similarity, as shown in formula (11): In the formula, the vector E Q Represents the problem Q; vector E A Represents candidate answer A; by calculating the angle between the two vectors, the closer the value is to 1, the more similar the semantics are, and the closer the value is to 0, the less similar the semantics are; Then, based on the contextual information, determine whether the candidate answer accurately addresses the customer's needs to ensure the accuracy, completeness and practicality of the answer; Finally, the semantic matching score and contextual adaptation are combined to form a comprehensive score: Comprehensive score = α × semantic similarity + β × contextual adaptation (12); Among them, α and β are weight coefficients, which can be adjusted according to actual needs. If semantic matching is more important, α can be set higher. The candidate answers are sorted according to the comprehensive scores, and the answer with the highest score is the most appropriate answer, which is returned to the customer as the final reply.

Citation Information

Cited By

  • Knowledge retrieval enhancement-based oral medical large model question and answer prediction method

    CN120196725A

  • Personalized intelligent question answering system based on artificial intelligence

    CN120371976A

  • Personalized intelligent question-answering system based on artificial intelligence

    CN120371976B