Knowledge question-answering method based on natural language processing
Through natural language processing technology, including preprocessing, semantic understanding of deep learning models and cosine similarity matching, the accuracy problem of traditional question answering systems in processing complex natural language questions has been solved, and efficient and accurate knowledge question and answer has been achieved, improving improve user experience and system performance.
Patent Information
- Application Number
- CN202410648695.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-20
AI Technical Summary
Traditional question answering systems are difficult to provide accurate answers when processing complex or diverse natural language questions. Especially when users' questioning methods are flexible and semantically complex, they cannot efficiently extract key information and perform knowledge base matching.
Adopt methods based on natural language processing, including preprocessing natural language questions, using deep learning models such as Transformer for semantic understanding, forming high-dimensional vector representations, and using cosine similarity matching functions to find relevant entries in the knowledge base to generate natural language Answers and adjust the model and knowledge base through user feedback.
It improves the retrieval efficiency and answer accuracy of the question and answer system, can more accurately understand user intentions, generate intuitive answers that conform to users' reading habits, meet the needs of intelligent question and answer systems, and improve user experience.
Smart Images

Figure CN118673109A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of knowledge question answering, and in particular to a knowledge question answering method based on natural language processing. Background Art
[0002] With the rapid development of Internet technology and the explosive growth of information, people are increasingly relying on intelligent question-answering systems to obtain accurate and timely information. Traditional question-answering systems are mainly based on keyword matching or template matching, which often seem to be unable to cope with complex or diverse natural language questions. In particular, when users ask questions in a flexible and varied manner with complex semantics, traditional question-answering systems often cannot provide accurate and satisfactory answers. In recent years, the rapid development of natural language processing (NLP) technology has provided new solutions for intelligent question-answering systems. Question-answering systems based on NLP technology can more deeply understand the semantics of user questions, thereby more accurately retrieving relevant information from the knowledge base and generating answers. However, how to efficiently process natural language questions, accurately extract key information from questions, and match them with entries in the knowledge base is still an important challenge facing intelligent question-answering systems. Therefore, we make improvements to this and propose a knowledge question-answering method based on natural language processing. Summary of the invention
[0003] The purpose of the present invention is to solve the problem of how to efficiently process natural language questions, accurately extract key information in the questions, and match them with entries in a knowledge base.
[0004] In order to achieve the above-mentioned object of the invention, the present invention provides a knowledge question answering method based on natural language processing to improve the above-mentioned problem.
[0005] The specific application is as follows: A knowledge question answering method based on natural language processing comprises the following steps: a. Receive a natural language question input by the user; b. Preprocess the received natural language questions, including word segmentation, part-of-speech tagging and syntactic analysis; c. Use the natural language processing model to understand the semantics of the preprocessed question, extract the key information in the question, and form the question representation q, where the question representation q is a high-dimensional vector obtained through the output layer of the deep learning model (such as the Transformer model), and its calculation formula is: (q=f_{\text{model}}(w_1, w_2...w_n)); Among them, (w_1, w_2...w_n) is the word vector representation of each word in the question, (f_{\text{model}}) is the function representation of the deep learning model; d. Set a matching function (F(q, k)), where (q) represents the problem representation and (k) represents the knowledge item representation in the knowledge base. Find the knowledge item that matches the problem representation by calculating the similarity of (F(q, k)). The similarity calculation formula is based on cosine similarity, which is: (\text{similarity}(q,k)=\frac{q\cdotk}{|q|\cdot|k|}); Among them, (q\cdotk) is the dot product of the problem representation and the knowledge item representation, (|q|) and (|k|) are their L2 norms respectively; e. Generate a natural language answer based on the matched knowledge items and return it to the user.
[0006] As the preferred technical solution of the present application, the natural language processing model used in step c is a deep learning model, including a recurrent neural network (RNN), a long short-term memory network (LSTM), a gated recurrent unit (GRU), and a Transformer model. The model learns the mapping relationship from natural language questions to question representations through training data, and its loss function is a cross entropy loss function, and the calculation formula is: (\text{loss}=-\sum_{i=1}^{N}y_i\log(p_i)); Where (N) is the number of training examples, (y_i) is the true label (usually one-hot encoded), and (p_i) is the probability distribution predicted by the model.
[0007] As the preferred technical solution of the present application, the knowledge base in step d contains structured data, unstructured data or a mixture of the two. For structured data, knowledge items are represented by relational triples (subject, predicate, object) and converted into embedded vectors for matching. For unstructured data, key information is extracted through information extraction technology and converted into vector representation.
[0008] As a preferred technical solution of the present application, generating a natural language answer in step e also includes post-processing the answer, and the post-processing step includes rule-based grammar checking and semantic coherence checking and redundant information removal based on information extraction technology.
[0009] As the preferred technical solution of this application, the following steps are also included: f. Collect user feedback on the returned answers; g. Set an update function (U(f,\theta)), where (f) represents user feedback, (\theta) represents model parameters or knowledge base content, adjust the parameters of the natural language processing model or update the knowledge base based on user feedback, and the update function is based on gradient descent: (\theta_{t+1}=\theta_t-\eta\nabla_{\theta}\text{loss}(\theta_t)); Among them, (\theta_t) is the current model parameter, (\eta) is the learning rate, and (\nabla_{\theta}\text{loss}(\theta_t)) is the gradient of the loss function with respect to the model parameters.
[0010] As a preferred technical solution of this application, the knowledge entry representation k in the knowledge base is obtained through knowledge embedding technology (such as TransE, TransR, etc.). The knowledge embedding technology embeds the entities and relationships in the knowledge base into a low-dimensional vector space. The calculation of knowledge embedding is based on the loss function of the margin: [\mathcal{L}=\sum_{(s,p,o)\inS}\sum_{(s',p,o')\inS'_{(s,p,o)}}\max(0,\gamma+d(s+p,o)-d(s'+p,o'))]; Among them, (S) is the set of correct triplets, (S'_{(s,p,o)}) is the set of negative samples generated for each correct triple ((s,p,o)), (\gamma) is the margin hyperparameter, and (d(\cdot)) is the distance function (such as L1 or L2 distance).
[0011] As the preferred technical solution of the present application, in order to improve the scalability and accuracy of the question-answering system, the knowledge base in step d is updated and expanded in an automatic or semi-automatic manner, including crawling new data from the Internet, extracting information through natural language processing technology, and verifying and integrating it using machine learning or deep learning models.
[0012] As the preferred technical solution of the present application, in order to handle multi-round conversations and context-dependent situations, it also includes session state maintenance. The session state maintenance contains question and answer information from previous rounds. When generating answers, the context information in the session state is considered to improve the accuracy and coherence of the answers.
[0013] As a preferred technical solution of the present application, a field classification step is also included, between steps a and b, for determining the field or subject to which the natural language question input by the user belongs, so as to more accurately match the relevant knowledge base or model in the subsequent steps; As the preferred technical solution of this application, the field classification step specifically includes: Data preparation: collect and organize question data labeled with domain or topic tags. These data come from existing knowledge bases, online forums, and customer service records to ensure that the data covers a wide range of fields and topics and has sufficient diversity. Feature extraction: pre-processing the questions, including word segmentation, part-of-speech tagging, and syntactic analysis; extracting features that help identify the domain or topic, such as keywords, phrases, syntactic structures, named entities, etc., and using TF-IDF, Word2Vec, and BERT word embedding methods to convert text into numerical vectors for easy processing by machine learning models; Model training: select a suitable classification model, including support vector machine (SVM), random forest, logistic regression, deep neural network (DNN) or convolutional neural network (CNN), and use the labeled dataset to train the model so that it can learn the mapping relationship from question features to domain or topic labels; Model evaluation and optimization: Use the validation set to evaluate the performance of the model, such as accuracy, recall, F1 score, etc. Adjust model parameters, feature selection, or try different model structures based on the evaluation results, and iteratively optimize the model until satisfactory performance is achieved; Real-time classification: When a user enters a new question, it is first preprocessed and feature extracted, and the extracted features are input into the trained classification model to obtain the predicted domain or topic label; Post-processing and integration: Post-process the labels output by the model, such as using thresholds to filter low-confidence prediction results. If necessary, the results of multiple classifiers can be integrated to improve the accuracy and robustness of classification; Continuous learning and updating: over time, new user questions and domain / topic labels are collected to update and expand the dataset, and the model is retrained regularly to adapt to new data and changes in domains and topics. User feedback and adjustment: Collect user feedback on classification results, understand the causes and types of classification errors, and adjust classification strategies, model parameters, or add new features based on user feedback.
[0014] Compared with the prior art, the present invention has the following beneficial effects: In the scheme of this application: The present application pre-processes the natural language questions input by the user, including word segmentation, part-of-speech tagging and syntactic analysis, so as to more accurately understand the semantics and structure of the questions and provide strong support for subsequent processing; the deep learning model (such as the Transformer model) is used to understand the semantics of the pre-processed questions, so as to accurately extract the key information in the questions and represent them as high-dimensional vectors. This representation method not only retains the semantic information of the questions, but also facilitates the subsequent matching with the entries in the knowledge base; by setting a matching function to calculate the similarity between the question representation and the entry representation in the knowledge base, the knowledge entries matching the question representation can be efficiently found, which not only improves the retrieval efficiency of the question-answering system, but also improves the accuracy of the answers; according to the matched knowledge entries, a natural language answer is generated and returned to the user, so that the user can obtain the required information more intuitively. This answer method not only conforms to the user's reading habits, but also improves the user experience; in summary, the present application provides an efficient and accurate knowledge question-answering method, which can meet the user's growing demand for intelligent question-answering systems and has good application prospects and promotion value. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A schematic diagram of the knowledge question answering method based on natural language processing provided in this application. DETAILED DESCRIPTION
[0016] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0017] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features and technical solutions in the embodiments may be combined with each other.
[0018] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0019] Example 1, please refer to Figure 1 , a knowledge question answering method based on natural language processing, comprising the following steps: a. Receive natural language questions input by users. Directly receive questions input by users without any specific format, which improves the usability and flexibility of the question-answering system and captures the natural language text input by users through the user interface or API interface; b. Preprocess the received natural language questions, including word segmentation, part-of-speech tagging and syntactic analysis. The preprocessing step can simplify the subsequent processing process and improve the accuracy of semantic understanding. Word segmentation enables the system to identify independent words in the question, part-of-speech tagging provides grammatical function information of the words, and syntactic analysis further reveals the syntactic relationship between words; use natural language processing toolkits (such as NLTK, jieba, etc.) to perform word segmentation, part-of-speech tagging and syntactic analysis on the questions; c. Use the natural language processing model to understand the semantics of the preprocessed question, extract the key information in the question, and form the question representation q, where the question representation q is a high-dimensional vector obtained through the output layer of the deep learning model (such as the Transformer model), and its calculation formula is: (q=f_{\text{model}}(w_1, w_2...w_n)); Among them, (w_1, w_2...w_n) is the word vector representation of each word in the question, (f_{\text{model}}) is the function representation of the deep learning model; By using deep learning models to understand the semantics of questions, we can capture the deep meaning of questions and improve the accuracy of the question-answering system. The specific implementation method is to use deep learning models such as the Transformer model to encode the preprocessed questions and generate a high-dimensional vector as the question representation q. This high-dimensional vector contains the semantic information of the question. d. Set a matching function (F(q, k)), where (q) represents the problem representation and (k) represents the knowledge item representation in the knowledge base. Find the knowledge item that matches the problem representation by calculating the similarity of (F(q, k)). The similarity calculation formula is based on cosine similarity, which is: (\text{similarity}(q,k)=\frac{q\cdotk}{|q|\cdot|k|}); Among them, (q\cdotk) is the dot product of the problem representation and the knowledge item representation, (|q|) and (|k|) are their L2 norms respectively; Through similarity calculation, we can efficiently and accurately retrieve items related to the question from the knowledge base, providing a basis for generating accurate answers. Implementation method: define a matching function F(q, k), where q is the question representation and k is the item representation in the knowledge base. Use cosine similarity or other similarity measurement methods to calculate the similarity between q and k, and find the item with the highest similarity as the matching result. e. Generate answers in natural language based on the matched knowledge items and return them to the user; Convert the matched knowledge items into answers in natural language so that users can directly understand and obtain the required information, improving the user experience; Implementation method: Generate answers in natural language based on the matched knowledge items in combination with template generation or natural language generation technology, and return them to the user through the user interface or API interface. You can use predefined answer templates or train generation models to generate more flexible and natural answers.
[0020] Furthermore, the natural language processing model used in step c is a deep learning model, including a recurrent neural network (RNN), a long short-term memory network (LSTM), a gated recurrent unit (GRU), and a Transformer model. The model learns the mapping relationship from natural language questions to question representations through training data. Its loss function is a cross entropy loss function, and the calculation formula is: (\text{loss}=-\sum_{i=1}^{N}y_i\log(p_i)); Where (N) is the number of training samples, (y_i) is the true label (usually one-hot encoded), and (p_i) is the probability distribution predicted by the model; These deep learning models can effectively process the complex semantics and syntactic structures in natural language questions and capture the deep meaning of questions, thereby improving the accuracy of question representation and the performance of the question-answering system. The model parameters are updated through the back-propagation algorithm and gradient descent method, so that the model is gradually optimized.
[0021] Furthermore, the knowledge base in step d contains structured data, unstructured data or a mixture of the two. For structured data, knowledge items are represented by relation triples (subject, predicate, object) and converted into embedded vectors for matching. For unstructured data, key information is extracted through information extraction technology and converted into vector representation. For structured data, knowledge items are represented by relational triples (subject, predicate, object) and converted into embedded vectors for matching, which can efficiently retrieve items related to the question. For unstructured data, key information is extracted through information extraction technology and converted into vector representation, which can handle a wider range of knowledge sources and improve the coverage and accuracy of the question-answering system. Implementation method: For structured data, first define the representation of relation triples and convert them into embedding vectors. Then, use the question representation generated in step c to calculate the similarity with the knowledge item representation, and find the item with the highest similarity as the matching result. For unstructured data, use information extraction technology (such as named entity recognition, relation extraction, etc.) to extract key information from the text and convert it into a vector representation. Then, use the similarity calculation to find the item that matches the question representation.
[0022] Furthermore, generating the answer in natural language form in step e also includes post-processing the answer, and the post-processing step includes rule-based grammar checking and semantic coherence checking and redundant information removal based on information extraction technology; Post-processing steps can further improve the quality and readability of answers. Grammar checking and semantic coherence checking can ensure the grammatical and semantic correctness of answers, while redundant information removal can make answers more concise and clear. Implementation method: Rule-based grammar checking and semantic coherence checking define a series of rules to check grammatical errors and semantic incoherence in answers, and make corresponding corrections. Redundant information removal based on information extraction technology uses information extraction technology to extract key information from answers and remove repeated or irrelevant information to make answers more refined. These post-processing steps can be performed immediately after the answer is generated or before it is returned to the user.
[0023] Embodiment 2 further optimizes the knowledge question answering method based on natural language processing provided in Embodiment 1, and specifically, further includes the following steps: f. Collect user feedback on the returned answers. By collecting user feedback on the answers, we can understand the user's satisfaction with the system performance and potential problems, and provide data support for subsequent model optimization and knowledge base updates. Implementation method: Set up a user feedback mechanism in the question-and-answer system, such as ratings, comments, or satisfaction surveys. After using the system and receiving answers, users can give evaluations or feedback on the answers. The system collects these feedbacks for subsequent analysis and processing. g. Set an update function (U(f,\theta)), where (f) represents user feedback, (\theta) represents model parameters or knowledge base content, adjust the parameters of the natural language processing model or update the knowledge base based on user feedback, and the update function is based on gradient descent: (\theta_{t+1}=\theta_t-\eta\nabla_{\theta}\text{loss}(\theta_t)); Among them, (\theta_t) is the current model parameter, (\eta) is the learning rate, and (\nabla_{\theta}\text{loss}(\theta_t)) is the gradient of the loss function with respect to the model parameters; dynamically adjusting the model parameters or updating the knowledge base according to user feedback can gradually optimize the performance of the question-answering system and improve the accuracy of the answers and user satisfaction; implementation method: set an update function (U(f,\theta)), where (f) represents user feedback, (\theta) represents the model parameters or the knowledge base content, and the gradient descent-based optimization algorithm can be used to adjust the model parameters, such as using the formula (\theta_{t+1}=\theta_t-\eta\nabla_{\theta}\text{loss}(\theta_t)) to update the parameters. For the update of the knowledge base, knowledge items can be added, modified or deleted according to user feedback.
[0024] Furthermore, the knowledge entry representation k in the knowledge base is obtained through knowledge embedding technology (such as TransE, TransR, etc.). The knowledge embedding technology embeds the entities and relations in the knowledge base into a low-dimensional vector space. The calculation of knowledge embedding is based on the margin loss function: [\mathcal{L}=\sum_{(s,p,o)\inS}\sum_{(s',p,o')\inS'_{(s,p,o)}}\max(0,\gamma+d(s+p,o)-d(s'+p,o'))]; Where (S) is the set of correct triplets, (S'_{(s, p, o)}) is the set of negative samples generated for each correct triple ((s, p, o)), (\gamma) is the margin hyperparameter, and (d(\cdot)) is the distance function (such as L1 or L2 distance); By embedding entities and relationships in the knowledge base into a low-dimensional vector space through knowledge embedding technology, the similarities and relationships between them can be easily calculated, thereby improving the efficiency of knowledge base query and matching.
[0025] Furthermore, in order to improve the scalability and accuracy of the question answering system, the knowledge base in step d is updated and expanded in an automatic or semi-automatic manner, including crawling new data from the Internet, extracting information through natural language processing technology, and verifying and integrating it using machine learning or deep learning models; By automatically or semi-automatically updating and expanding the knowledge base, new knowledge entries and relationships can be continuously added to improve the coverage and accuracy of the question-answering system. Specifically, new data can be crawled from the Internet using web crawlers, and information can be extracted using natural language processing technology to extract relevant entities, attributes, and relationships. Then, machine learning or deep learning models are used to verify and integrate these data to ensure their quality and accuracy. Finally, new data is added to the knowledge base and the relevant embedding vectors are updated.
[0026] Furthermore, in order to handle multi-round dialogues and context-dependent situations, it also includes session state maintenance, which contains the question and answer information from the previous round. When generating answers, the context information in the session state is considered to improve the accuracy and coherence of the answers. By maintaining the conversation state and considering contextual information, the accuracy and coherence of the question-answering system in multi-round dialogues and context-dependent situations can be improved. Specifically, a conversation state maintenance mechanism is implemented in the question-answering system to record the questions and answers in previous rounds. When generating new answers, the contextual information in the conversation state, such as the user's historical questions, answers, and intentions, is considered. This can be achieved by adding additional context vectors to the model input or using sequence-based models (such as RNN, LSTM, etc.). By considering contextual information, the system can better understand the user's intentions and needs, and generate more accurate and coherent answers.
[0027] Example 3 further optimizes the knowledge question answering method based on natural language processing provided in Example 1 or 2. Specifically, it also includes a field classification step, between steps a and b, for determining the field or topic to which the natural language question input by the user belongs, so as to more accurately match the relevant knowledge base or model in subsequent steps.
[0028] Furthermore, the field classification step specifically includes: Data preparation: collect and organize question data labeled with domain or topic tags. These data come from existing knowledge bases, online forums, and customer service records. Ensure that the data covers a wide range of fields and topics and has sufficient diversity. Collect and organize question data labeled with domain or topic tags. Ensure that the data covers a wide range of fields and topics, provide basic data for subsequent training models, and increase the generalization ability of the model in practical applications. Specifically, crawlers are used to collect data from existing knowledge bases, online forums, customer service records and other channels, and data cleaning and labeling are performed to ensure data accuracy and diversity. Feature extraction: preprocess the questions, including word segmentation, part-of-speech tagging, and syntactic analysis; extract features that help identify the field or topic, such as keywords, phrases, syntactic structures, named entities, etc., and use TF-IDF, Word2Vec, and BERT word embedding methods to convert text into numerical vectors for easy processing by machine learning models; preprocess and extract features from questions to capture the field or topic information contained in the questions and convert this information into numerical vectors to facilitate subsequent model processing and classification. Specifically, use natural language processing technologies such as word segmentation, part-of-speech tagging, and syntactic analysis to preprocess the questions, extract features such as keywords, phrases, syntactic structures, and named entities, and use TF-IDF, Word2Vec, and BERT word embedding methods to convert text into numerical vectors; Model training: select a suitable classification model, including support vector machine (SVM), random forest, logistic regression, deep neural network (DNN) or convolutional neural network (CNN), and use annotated datasets to train the model so that it can learn the mapping relationship from question features to domain or topic labels. By selecting a suitable classification model and training it with annotated datasets, the model can learn the mapping relationship from question features to domain or topic labels, providing reliable prediction capabilities for subsequent classification tasks. Specifically, according to the characteristics and requirements of the problem, select a suitable classification model (such as SVM, random forest, logistic regression, DNN, CNN, etc.), and use annotated datasets for training. During the training process, the model reduces prediction errors and improves classification performance through iterative optimization. Model evaluation and optimization: Use the validation set to evaluate the performance of the model, such as accuracy, recall, F1 score, etc. According to the evaluation results, adjust the model parameters, feature selection, or try different model structures, and iteratively optimize the model until satisfactory performance is achieved. By evaluating the performance of the model, you can understand the performance of the model in practical applications, and optimize the model according to the evaluation results to improve the accuracy and robustness of the model. Specifically, use the validation set to evaluate the performance of the model, including indicators such as accuracy, recall, and F1 score. According to the evaluation results, you can adjust the model parameters, feature selection, or try different model structures to optimize the performance of the model. Real-time classification: when a user inputs a new question, it is first preprocessed and feature extracted, and the extracted features are input into the trained classification model to obtain the predicted domain or topic label; when a user inputs a new question, the domain or topic classification can be performed in real time to provide accurate information for subsequent knowledge base matching or model application. Specifically, the newly input question is preprocessed and feature extracted, and the extracted features are input into the trained classification model to obtain the predicted domain or topic label; Post-processing and integration: Post-process the labels output by the model, such as using thresholds to filter low-confidence prediction results. If necessary, the results of multiple classifiers can be integrated to improve the accuracy and robustness of classification. Post-processing the labels output by the model can improve the accuracy and reliability of the classification results. At the same time, by integrating the results of multiple classifiers, the accuracy and robustness of classification can be further improved. Continuous learning and updating: As time goes by, new user questions, domains, and topic labels are collected to update and expand the data set, and the model is retrained regularly to adapt to the changes in new data, domains, and topics. As time goes by, new user questions, domains, and topic labels continue to emerge. By retraining the model regularly, it can be ensured that the model always remains in the best state and adapts to the changes in new data, domains, and topics. Specifically, new user questions, domains, and topic labels are collected to update and expand the data set. When the data set accumulates to a certain extent, the model can be retrained regularly and the old model can be replaced, which ensures that the model always learns and predicts based on the latest data. User feedback and adjustment: collect user feedback on classification results, understand the causes and types of classification errors, and adjust classification strategies, model parameters, or add new features based on user feedback; by collecting user feedback on classification results, we can understand the causes and types of classification errors, and adjust classification strategies, model parameters, or add new features based on user feedback to continuously improve classification accuracy and user experience. Specifically, set up a user feedback mechanism in the system, such as ratings, comments, or satisfaction surveys, collect user feedback on classification results, and conduct statistics and analysis based on the feedback results. Based on the analysis results, adjust the classification strategy, model parameters, or add new features to optimize classification performance.
[0029] Obviously, the embodiments described above are only some embodiments of the present invention, rather than all embodiments. The preferred embodiments of the present invention are given in the accompanying drawings, but they do not limit the patent scope of the present invention. The present invention can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive. Although the present invention has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific embodiments, or to perform equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of the present invention, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present invention.
Claims
1. A knowledge question answering method based on natural language processing, characterized in that: The following steps are involved: a. Receive natural language questions input by the user; b. Preprocess the received natural language questions, including word segmentation, part-of-speech tagging and syntactic analysis; c. Use the natural language processing model to perform semantic understanding on the preprocessed question, extract the key information in the question, and form the question representation q, where the question representation q is a high-dimensional vector obtained through the output layer of the deep learning model. Its calculation formula is: (q=f_{\text{model}}(w_1, w_2...w_n)); Among them, (w_1, w_2...w_n) is the word vector representation of each word in the question, (f_{\text{model}}) is the function representation of the deep learning model; d. Set a matching function (F(q, k)), where (q) represents the problem representation and (k) represents the knowledge item representation in the knowledge base. Find the knowledge item that matches the problem representation by calculating the similarity of (F(q, k)). The similarity calculation formula is based on cosine similarity, which is: (\text{similarity}(q,k)=\frac{q\cdotk}{|q|\cdot|k|}); Among them, (q\cdotk) is the dot product of the problem representation and the knowledge item representation, (|q|) and (|k|) are their L2 norms respectively; e. Generate a natural language answer based on the matched knowledge items and return it to the user.
2. A knowledge question answering method based on natural language processing according to claim 1, characterized in that: The natural language processing model used in step c is a deep learning model, including a recurrent neural network (RNN), a long short-term memory network (LSTM), a gated recurrent unit (GRU), and a Transformer model. The model learns the mapping relationship from natural language questions to question representations through training data. Its loss function is the cross entropy loss function, and the calculation formula is: (\text{loss}=-\sum_{i=1}^{N}y_i\log(p_i)); Where (N) is the number of training samples, (y_i) is the true label, and (p_i) is the probability distribution predicted by the model.
3. The knowledge question answering method based on natural language processing according to claim 1, characterized in that: The knowledge base in step d contains structured data, unstructured data, or a mixture of the two. For structured data, knowledge items are represented by relation triplets (subject, predicate, object) and converted into embedded vectors for matching. For unstructured data, key information is extracted through information extraction technology and converted into vector representation.
4. The knowledge question answering method based on natural language processing according to claim 1, characterized in that: Generating a natural language answer in step e also includes post-processing the answer, and the post-processing step includes rule-based grammar checking and semantic coherence checking and redundant information removal based on information extraction technology.
5. The knowledge question answering method based on natural language processing according to claim 1, characterized in that: The following steps are also included: f. Collect user feedback on the returned answers; g. Set an update function (U(f,\theta)), where (f) represents user feedback, (\theta) represents model parameters or knowledge base content, adjust the parameters of the natural language processing model or update the knowledge base based on user feedback, and the update function is based on gradient descent: (\theta_{t+1}=\theta_t-\eta\nabla_{\theta}\text{loss}(\theta_t)); Among them, (\theta_t) is the current model parameter, (\eta) is the learning rate, and (\nabla_{\theta}\text{loss}(\theta_t)) is the gradient of the loss function with respect to the model parameters.
6. The knowledge question answering method based on natural language processing according to claim 1, characterized in that: The knowledge entry representation k in the knowledge base is obtained through knowledge embedding technology. The knowledge embedding technology embeds the entities and relationships in the knowledge base into a low-dimensional vector space. The calculation of knowledge embedding is based on the margin loss function: [\mathcal{L}=\sum_{(s,p,o)\inS}\sum_{(s',p,o')\inS'_{(s,p,o)}}\max(0,\gamma+d(s+p,o)-d(s'+p,o'))]; Among them, (S) is the set of correct triplets, (S'_{(s, p, o)}) is the set of negative samples generated for each correct triple ((s, p, o)), (\gamma) is the margin hyperparameter, and (d(\cdot)) is the distance function.
7. The knowledge question answering method based on natural language processing according to claim 1, characterized in that: The knowledge base in step d is updated and expanded in an automatic or semi-automatic manner, including crawling new data from the Internet, extracting information through natural language processing technology, and verifying and integrating it using machine learning or deep learning models.
8. The knowledge question answering method based on natural language processing according to claim 1, characterized in that: It also includes session state maintenance, which contains question and answer information from previous rounds. When generating answers, the context information in the session state is taken into account.
9. The knowledge question answering method based on natural language processing according to claim 1, characterized in that: The method also includes a domain classification step, between steps a and b, for determining the domain or topic to which the natural language question input by the user belongs, so as to more accurately match the relevant knowledge base or model in the subsequent steps.
10. A knowledge question answering method based on natural language processing according to claim 9, characterized in that: The field classification steps include: Data preparation: collect and organize question data labeled with domain or topic tags. These data come from existing knowledge bases, online forums, and customer service records to ensure that the data covers a wide range of fields and topics and has sufficient diversity. Feature extraction, preprocessing of questions, including word segmentation, part-of-speech tagging, and syntactic analysis; using TF-IDF, Word2Vec, and BERT word embedding methods to convert text into numerical vectors; Model training: select a suitable classification model, including support vector machine (SVM), random forest, logistic regression, deep neural network (DNN) or convolutional neural network (CNN), and use the labeled dataset to train the model so that it can learn the mapping relationship from question features to domain or topic labels; Model evaluation and optimization: Use the validation set to evaluate the performance of the model, adjust model parameters, feature selection, or try different model structures based on the evaluation results, and iteratively optimize the model until satisfactory performance is achieved; Real-time classification: When a user enters a new question, it is first preprocessed and feature extracted, and the extracted features are input into the trained classification model to obtain the predicted domain or topic label; Post-processing and integration: post-processing the labels output by the model; Continuous learning and updating: over time, new user questions and domain / topic labels are collected to update and expand the dataset, and the model is retrained regularly to adapt to new data and changes in domains and topics. User feedback and adjustment: Collect user feedback on classification results, understand the causes and types of classification errors, and adjust classification strategies, model parameters, or add new features based on user feedback.
Citation Information
Patent Citations
A construction method of a knowledge map question answering system in the field of electric power communication based on deep learning
CN109271506A
Interactive knowledge interaction system based on knowledge base and large language model
CN118013001A
Cited By
Emotion analysis method and system based on multi-modal feature fusion and SVM classification
CN119312813A
Data analysis method and system and storage medium
CN119557424A
A data analysis method, system and storage medium
CN119557424B
Question answering method based on knowledge base and knowledge question answering system
CN120653750A
Intelligent teaching processing method and system based on intention recognition and cognitive tracking
CN121117214A
