Knowledge base sensitive question test method, system, equipment and medium

By constructing a semantic vector model and intent recognition model, combining pre-trained language models to optimize answers, and making sensitivity judgments and revisions, the accuracy and sensitive information processing problems of traditional testing methods when processing massive data and complex semantics are solved, and an efficient, accurate and safe question-and-answer system is realized.

CN119807683APending Publication Date: 2025-04-11GUANGZHOU SANQI DREAM NETWORK TECH CO LTD
View PDF 0 Cites 10 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Traditional knowledge base testing methods are difficult to accurately judge the correlation and accuracy of the returned results when processing massive data and complex semantics, and there are challenges in the filtering and processing of sensitive information.

Method used

By constructing a semantic vector model of the knowledge base, we retrieve knowledge points that are highly correlated with the questions to be tested, combine the intention recognition model to judge the user's intention to ask questions, select the appropriate answer generation strategy, and optimize the answers through pre-trained language models, and finally judge and revise the answers to avoid sensitive content.

Benefits of technology

It improves the accuracy and sensitivity processing capabilities of the Q&A system, ensures the accuracy and security of the answers, and enhances the user experience and the intelligence level of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807683A_ABST
    Figure CN119807683A_ABST
Patent Text Reader

Abstract

The invention is applicable to the technical field of data processing, and discloses a knowledge base sensitive question test method, which comprises the following steps of: firstly, constructing a semantic vector model of a knowledge base for efficiently retrieving knowledge points with high relevancy with a to-be-tested question to form a candidate answer set; performing intention judgment on user questions by using an intention recognition model, and distinguishing factual verification or emotion expression; selecting knowledge points with the highest confidence degree from the candidate answer set as answers according to the fact verification type questions; responding to emotion expression questions based on an emotion response library; on the basis, the answers are further optimized in combination with the context of the questions; judging whether the optimized answer contains sensitive content or not, and performing necessary revision on the answer according to a sensitivity judgment result; and outputting the revised answer as a test result. The method effectively improves the question answering accuracy and sensitivity processing capacity of the knowledge base, and is suitable for various scenes needing intelligent question answering and knowledge base application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a knowledge base sensitive question testing method, system, equipment and medium. Background Art

[0002] Currently, knowledge base systems are widely used in various applications, such as intelligent customer service, search engines, and automatic question-answering systems. These systems can quickly respond to user queries by storing and managing large amounts of information. However, with the increasing demand for information security and privacy protection, knowledge base systems need to have a certain degree of sensitivity when processing queries involving sensitive information to prevent the leakage of sensitive information or misleading answers.

[0003] However, traditional testing methods face many challenges when dealing with massive amounts of data and complex semantics. On the one hand, due to the complexity and diversity of natural language, accurately judging the relevance and accuracy of returned results becomes a difficult task. On the other hand, filtering and processing sensitive information is also a major problem, and inappropriate remarks or extreme emotions may cause negative impacts. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a knowledge base sensitive question testing method, system, device and medium.

[0005] In a first aspect, the present application proposes a knowledge base sensitive question testing method, comprising: constructing a semantic vector model of the knowledge base;

[0006] Retrieving a number of knowledge points with high relevance to the question to be tested as a set of candidate answers through the semantic vector model;

[0007] The intent recognition model is used to judge the intention of the user's question and determine whether the question is intended to verify facts or express emotions.

[0008] If the question is intended to verify facts, the knowledge point with the highest confidence is selected from the candidate answer set as the final answer; if the question is intended to express emotions, a response is made based on the emotional response library;

[0009] Based on the candidate answer set and the emotional response library, combined with the context of the question, the answer is optimized through a pre-trained language model;

[0010] Determine whether the optimized answer contains sensitive content, obtain a sensitivity determination result, revise the answer according to the sensitivity determination result, and output the revised answer as the final test result.

[0011] More specifically, in the above technical solution, the intention of the user's question is judged by the intention recognition model to determine whether the question is intended to verify facts or express emotions, including:

[0012] Obtaining user questions, performing word segmentation processing on the user questions, and obtaining question features;

[0013] Obtain a pre-built user profile, wherein the user profile includes historical question data of the user;

[0014] Generate a personalized answer using a question-answer pair generation model according to the question characteristics and the user portrait, wherein the personalized answer includes a language style and a degree of detail that matches the user portrait;

[0015] Calculating semantic similarity between the personalized answer and the user question to determine whether the relevance between the personalized answer and the user question meets a preset relevance threshold;

[0016] If the relevance satisfies the preset relevance threshold, determining the personalized answer as a candidate answer;

[0017] If the relevance does not meet the preset relevance threshold, the parameters of the question-answer pair generation model are adjusted to regenerate a personalized answer.

[0018] More specifically, in the above technical solution, if the question is intended to verify facts, the knowledge point with the highest confidence is selected from the candidate answer set as the final answer; if the question is intended to express emotions, a response is made based on the emotional response library, including:

[0019] If the question intention type is fact-seeking, then the inverted index technology is used to retrieve candidate answers related to the question intention from the pre-built knowledge base, calculate the similarity between each candidate answer and the question intention, and select the knowledge point with the highest confidence as the final answer according to the similarity sorting;

[0020] If the question intention type is emotional expression, sentiment analysis technology is used to perform emotional tendency analysis on the question intention, identify the user's emotional state, match a response template from a preset emotional response library according to the emotional state, fill in keyword information related to the question in the response template, filter sensitive words, and generate response content.

[0021] More specifically, in the above technical solution, based on the candidate answer set and the emotional response library, combined with the context of the question, the answer is optimized through a pre-trained language model, including:

[0022] Obtaining an input conversation text, and performing feature extraction on the input conversation text using a pre-trained language model to obtain a text feature vector;

[0023] Inputting the text feature vector into a classification model to determine the scene category to which the input dialogue text belongs;

[0024] According to the scenario category, matching a corresponding candidate answer set from a pre-built candidate answer library;

[0025] Calculating the semantic similarity score between each candidate answer in the candidate answer set and the input dialogue text, and selecting the candidate answer with the highest semantic similarity score as the basic answer;

[0026] Performing grammar and fluency analysis on the basic answer to determine whether it meets a preset fluency threshold; if not, optimizing the basic answer using a predefined grammar rule library to obtain an optimized basic answer;

[0027] Using a named entity recognition tool to extract core entities and their associated attributes from the optimized basic answers, and constructing a knowledge graph subgraph based on the core entities and their associated attributes;

[0028] Applying a graph neural network-based reasoning algorithm on the knowledge graph subgraph, by matching and reasoning the known information in the optimized basic answer with the implicit information in the knowledge graph subgraph, the missing implicit information in the optimized basic answer is completed to obtain a complete semantic structured representation;

[0029] Inputting the input dialogue text and the optimized basic answer into a Seq2Seq model based on an attention mechanism to generate a transition sentence connecting the input dialogue text and the optimized basic answer;

[0030] The transition statement is concatenated with the optimized basic answer to obtain a final answer.

[0031] More specifically, in the above technical solution, determining whether the optimized answer contains sensitive content, obtaining a sensitivity determination result, revising the answer according to the sensitivity determination result, and outputting the revised answer as the final test result includes:

[0032] Get the optimized answer text and use it as input;

[0033] Load the pre-built sensitive word library to determine whether the answer text contains sensitive words;

[0034] If a sensitive word is matched, the sensitive word and its context are used as input to perform sentiment analysis to obtain a sentiment score;

[0035] According to a preset emotional tendency threshold, judging whether the context in which the sensitive word is located belongs to an extreme emotion, wherein the judgment standard of the extreme emotion is that the emotional tendency score exceeds the positive or negative extreme value of the threshold;

[0036] If it contains extreme emotions, it will be judged as sensitive content and marked;

[0037] For all text fragments marked as sensitive content, filtering is performed to replace the text fragments of the sensitive content with symbols;

[0038] The filtered answer text is used as the intermediate result, and the BERT language model is used to restore and optimize its semantics.

[0039] More specifically, in the above technical solution, determining whether the optimized answer contains sensitive content, obtaining a sensitivity determination result, revising the answer according to the sensitivity determination result, and outputting the revised answer as the final test result includes:

[0040] Obtain the answer content to be tested, and determine whether the answer content contains sensitive information based on a preset sensitive information judgment rule library;

[0041] If the answer content contains sensitive information, obtaining the type and severity of the sensitive information defined in the sensitive information judgment rule base, and determining a corresponding revision strategy according to the type and severity;

[0042] The answer content is modified by adopting the revision strategy, avoiding the sensitive information by synonym replacement and semantic reorganization, and obtaining a revised answer by using dependency syntactic analysis and named entity recognition natural language processing technology, wherein the revised answer does not contain sensitive information;

[0043] The revised answers are input into the subsequent testing process and verified through manual evaluation and question-answer comparison. The verification content includes the readability, coherence and consistency of the revised answers with the original answers.

[0044] More specifically, in the above technical solution, the semantic vector model for constructing the knowledge base includes:

[0045] Obtain text data, use word embedding technology to map each word into a low-dimensional dense vector, and build a word vector model;

[0046] According to the word vector model, a semantic vector representation of each text is calculated;

[0047] Using clustering algorithms, texts with similar semantics are aggregated to form different semantic clusters;

[0048] Based on each semantic cluster, calculate the center point of the text semantic vector in the cluster to obtain the semantic topic vector of the cluster;

[0049] The semantic vector model is used to retrieve several knowledge points that are highly relevant to the question to be tested as a set of candidate answers, including:

[0050] Obtaining a question to be tested, performing word segmentation, part-of-speech tagging and semantic analysis on the question to be tested, and obtaining keywords and semantic information of the question to be tested;

[0051] Constructing a semantic representation vector of the problem to be tested according to the keywords and semantic information;

[0052] Acquire knowledge points related to the problem to be tested in the knowledge base, and construct semantic representation vectors of the knowledge points;

[0053] Calculating the cosine similarity between the semantic representation vector of the question and the semantic representation vector of each of the knowledge points;

[0054] The knowledge points are sorted according to the cosine similarity, and several knowledge points with high similarity are selected as a candidate answer set.

[0055] In a second aspect, the present application proposes a knowledge base sensitive question testing system, the system comprising:

[0056] The first processing module: constructing a semantic vector model of the knowledge base;

[0057] The second processing module: retrieves several knowledge points with high relevance to the question to be tested through the semantic vector model as a set of candidate answers;

[0058] The third processing module: uses the intention recognition model to determine the intention of the user's question, and determines whether the question is intended to verify facts or express emotions;

[0059] Fourth processing module: if the question is intended to verify facts, the knowledge point with the highest confidence is selected from the candidate answer set as the final answer; if the question is intended to express emotions, a response is made based on the emotional response library;

[0060] The fifth processing module: based on the candidate answer set and the emotional response library, combined with the context of the question, optimize the answer through the pre-trained language model;

[0061] The sixth processing module: determines whether the optimized answer contains sensitive content, obtains a sensitivity determination result, revises the answer according to the sensitivity determination result, and outputs the revised answer as the final test result.

[0062] In a third aspect, the present application further proposes a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described above when executing the computer program.

[0063] In a fourth aspect, the present application further proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described in any one of the above items is implemented.

[0064] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0065] 1. By constructing a semantic vector model of the knowledge base, the present invention can efficiently retrieve knowledge points that are highly relevant to the question to be tested and form an accurate set of candidate answers; use the intention recognition model to judge the intention of user questions, distinguish whether they are fact verification or emotional expression, and thus select the appropriate answer generation strategy, further improving the accuracy of questions and answers; for fact verification questions, the knowledge point with the highest confidence is selected from the candidate answer set as the answer; for emotional expression questions, responses are made based on the emotional response library to ensure the pertinence and accuracy of the answers.

[0066] 2. During the answer generation process, the present invention performs sensitivity judgment on the optimized answers, and judges whether the answers contain sensitive content such as inappropriate remarks and extreme emotions through sensitive word library matching, sentiment tendency analysis and other means; according to the sensitivity judgment results, the answers are appropriately revised to avoid sensitive points as much as possible without affecting the integrity and accuracy of the answers, thereby effectively enhancing the sensitivity processing capabilities.

[0067] 3. Based on the candidate answers and in combination with the specific context of the question, the present invention optimizes the answer through a pre-trained language model, so that the answer is more in line with the current dialogue scenario and improves semantic coherence; by matching and inferring the known information in the optimized basic answer with the implicit information in the knowledge graph subgraph, the answer content is further enriched and improved, and the quality and readability of the answer are improved; the model is continuously optimized and trained so that the system can continuously learn and improve, generate more accurate and personalized answers, and improve user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0069] Figure 1It is a flowchart of a knowledge base sensitive question testing method provided by an embodiment of the present invention;

[0070] Figure 2 It is a structural diagram of a knowledge base sensitive question testing system provided by an embodiment of the present invention;

[0071] Figure 3 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0073] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0074] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0075] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0076] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0077] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0078] See also Figure 1 The present application proposes a method for testing sensitive questions of a knowledge base, including: S101, constructing a semantic vector model of the knowledge base; S102, retrieving a number of knowledge points with high relevance to the question to be tested through the semantic vector model as a set of candidate answers; S103, operating the user through the application; judging the intention of the user's question through the intention recognition model, and judging whether the intention of the question is to verify the fact or to express emotion; S104, if the intention of the question is to verify the fact, then selecting the knowledge point with the highest confidence from the candidate answer set as the final answer, and if the intention of the question is to express emotion, then responding based on the emotional response library; S105, based on the candidate answer set and the emotional response library, combined with the context of the question, optimizing the answer through a pre-trained language model; S106, judging whether the optimized answer contains sensitive content, obtaining a sensitivity judgment result, revising the answer according to the sensitivity judgment result, and outputting the revised answer as the final test result.

[0079] In some embodiments, a semantic vector model of a knowledge base is constructed, including:

[0080] According to the user behavior characteristics, the K-means clustering algorithm is used to group users, and the silhouette coefficient is used to evaluate the quality of the clustering results. For each user, according to their historical behavior data and the user portrait of the group they belong to, the item-based collaborative filtering algorithm is used to generate a personalized product recommendation list. When users browse the product details page or add to the shopping cart, the Apriori association rule mining algorithm is used to recommend products related to the current product based on the user's real-time behavior and the recommendation list.

[0081] Specifically, preprocessing text data is to improve the efficiency and accuracy of subsequent text processing and analysis tasks.

[0082] Preprocessing generally includes removing special characters, stop words, punctuation marks, and performing operations such as word form restoration or stemming.

[0083] For example, if there is an online news article, after preprocessing, the web page tags, advertising links and emoticons can be removed, leaving only the core news content.

[0084] Word embedding technology maps each word into a low-dimensional dense vector, also known as a word vector.

[0085] These word vectors can capture the semantic relationship between words. For example, "king" and "queen" will be very close in the vector space, while "apple" and "car" will be far apart.

[0086] Commonly used word embedding methods include Word2Vec, GloVe, and FastText.

[0087] For example, by training a news corpus with Word2Vec, you can get the word vector for each word. For example, the word "football" may be represented as a 100-dimensional vector, which contains the semantic information of the word "football" in the corpus.

[0088] After the word vector model is built, the semantic vector of each text can be calculated.

[0089] This is usually obtained by taking a weighted average of the word vectors of all words in the text or using more complex methods such as document vectors (Doc2Vec).

[0090] Continuing with the previous example, for the sentence "The football match was very exciting", the word vectors of the four words "football", "match", "very", and "exciting" in this sentence can be weighted averaged to obtain the semantic vector of this sentence.

[0091] In this way, each sentence is represented by a vector, and the similarity between sentences can be easily calculated.

[0092] Then, a clustering algorithm is used to group semantically similar texts together to form different semantic clusters.

[0093] There are many clustering algorithms, such as K-Means, hierarchical clustering, and DBSCAN.

[0094] Using the K-Means algorithm, a large number of news headlines can be divided into several categories based on their semantic similarity, such as sports, entertainment, and technology.

[0095] If you want to classify 1,000 news headlines into five categories, the K-Means algorithm will iteratively calculate and eventually group news headlines with similar semantics into the same cluster, such as grouping all news headlines about sports games into one cluster.

[0096] Finally, the center point of the text semantic vector in each semantic cluster is calculated as the semantic topic vector of the cluster.

[0097] This topic vector can represent the core semantic information of the cluster.

[0098] In the previous example, by averaging the semantic vectors of sports news headlines, we can get the topic vector for sports.

[0099] This topic vector represents the core semantics of the entire sports news and can be used to represent the topic of this type of news.

[0100] For example, if there are 200 news headlines in a sports cluster, the semantic vectors of these 200 headlines are added together and averaged, and the resulting vector is the semantic topic vector of this sports cluster.

[0101] This is done to effectively organize and understand large amounts of text data.

[0102] Representing text as vectors allows for easy calculation and comparison;

[0103] Through clustering, similar texts can be grouped into one category, which is convenient for summarization and analysis;

[0104] By calculating the topic vector, we can extract the core information of each cluster and help understand the main content of each cluster.

[0105] For example, a company collects a large number of user reviews. Through the above steps, the user reviews can be divided into different topics, such as product quality, customer service, logistics speed, etc., and then a detailed analysis can be conducted on each topic to find out the problems and improve products and services.

[0106] Doing so can help companies better understand user needs and pain points and improve user satisfaction.

[0107] For example, in a library's bibliographic management system, semantic vectorization and clustering of the content summary of each book can quickly discover books on different topics and facilitate readers' retrieval.

[0108] For example, in social media public opinion analysis, clustering user comments can discover hot topics and main opinions, thereby providing decision-making reference for relevant departments.

[0109] These methods can be applied to a variety of scenarios to provide a deeper understanding of text data.

[0110] After calculating the semantic vector of each text using the word embedding model, the semantic similarity between texts can be measured by calculating the cosine similarity between vectors.

[0111] The value of cosine similarity is between -1 and 1. The larger the value, the more similar the semantics of the two texts are.

[0112] For example, by calculating the cosine similarity of the semantic vectors of the two sentences "I like watching football games" and "I love watching football", we may get a value close to 1, indicating that the semantics of the two sentences are very similar.

[0113] Similarly, after converting the news headlines into semantic vectors and calculating the cosine similarity between them, we can find that the similarity between "the athlete won the gold medal" and "the event was a complete success" is higher, but the similarity with "a company released a new product" is lower.

[0114] Such analysis results can further verify the rationality of the clustering effect. If texts with similar semantics are clustered into the same cluster, their cosine similarity should be high.

[0115] By calculating the average cosine similarity between the text within the cluster and the cluster center vector, the degree of aggregation of the text within the cluster can also be evaluated.

[0116] The higher the average value, the tighter the text semantics within the cluster.

[0117] Through these methods, unstructured text data can be converted into vector data that can be quantified and calculated, and then in-depth semantic analysis and understanding can be performed.

[0118] This has wide applications in various fields of natural language processing, such as information retrieval, text classification, machine translation, and sentiment analysis.

[0119] In summary, this series of steps and technical means are aimed at extracting valuable information and knowledge from text data to help better understand and utilize these data.

[0120] In some embodiments, for the question to be tested, several knowledge points with high relevance to the question are retrieved from the knowledge base semantic vector model as a set of candidate answers, including:

[0121] Obtain a question to be tested, perform word segmentation, part-of-speech tagging and semantic analysis on the question to obtain keywords and semantic information of the question; construct a semantic representation vector of the question based on the keywords and semantic information; obtain knowledge points related to the question in a knowledge base and construct a semantic representation vector of the knowledge points; calculate the cosine similarity between the semantic representation vector of the question and the semantic representation vector of each knowledge point; sort the knowledge points according to the similarity, and select several knowledge points with the highest similarity as a set of candidate answers.

[0122] Specifically, obtain the question to be tested, perform word segmentation, part-of-speech tagging and semantic analysis on the question, and obtain the keywords and semantic information of the question. For example, suppose the question raised by the user is "How to improve English speaking ability". First, the question is decomposed into words such as "how", "improve", "English", "spoken", and "ability" through word segmentation technology. Then, part-of-speech tagging is performed to identify that "improve" is a verb, "English" and "spoken" are nouns, and "ability" is a noun. Finally, through semantic analysis, it is determined that "improving English speaking ability" is the core demand of the user, and the keywords "improve", "English", "spoken", and "ability" are extracted. According to the keywords and semantic information, the semantic representation vector of the question is constructed. Specifically, pre-trained language models such as Word2Vec or BERT can be used to convert each keyword into a corresponding vector representation, and then these vectors are weighted averaged or spliced ​​to form a semantic representation vector of the question. For example, assuming that the vector representation of "improvement" is \[0.1, 0.2, 0.3\], the vector representation of "English" is \[0.4, 0.5, 0.6\], the vector representation of "oral" is \[0.7, 0.8, 0.9\], and the vector representation of "ability" is \[1.0, 1.1, 1.2\], then the semantic representation vector of the problem can be obtained by weighted average \[0.475, 0.525, 0.575\]. Obtain the knowledge points related to the problem in the knowledge base and construct the semantic representation vector of the knowledge point. Assume that the knowledge base has the following knowledge points: "English oral practice method", "techniques to improve English listening", "English grammar learning guide", etc. Also use the pre-trained language model to convert these knowledge points into corresponding semantic representation vectors. For example, the vector representation of "English speaking practice method" is \[0.2, 0.3, 0.4\], the vector representation of "techniques to improve English listening" is \[0.5, 0.6, 0.7\], and the vector representation of "English grammar learning guide" is \[0.8, 0.9, 1.0\]. The cosine similarity between the semantic representation vector of the question and the semantic representation vector of each knowledge point is calculated. Cosine similarity is used to measure the angle between two vectors. The closer the value is to 1, the more similar the two vectors are. For example, the cosine similarity between the question vector \[0.475,0.525,0.575\] and the "English speaking practice method" vector \[0.2,0.3,0.4\] is 0.9, the cosine similarity between the question vector \[0.5,0.6,0.7\] and the "techniques for improving English listening" vector \[0.5,0.6,0.7\] is 0.8, and the cosine similarity between the question vector \[0.8,0.9,1.0\] and the "English grammar learning guide" vector \[0.8,0.9,1.0\] is 0.7. The knowledge points are sorted according to the similarity, and the knowledge points with the highest similarity are selected as the candidate answer set.For example, by sorting from high to low according to the cosine similarity, we get "English speaking practice method" (0.9), "techniques to improve English listening" (0.8), and "English grammar learning guide" (0.7). The first two knowledge points with the highest similarity, namely "English speaking practice method" and "techniques to improve English listening", are selected as the candidate answer set. The advantage of this is that through word segmentation, part-of-speech tagging and semantic analysis, the core intention of the user's question can be accurately captured and a high-quality semantic representation vector can be constructed. Using the pre-trained language model, the text can be converted into a deep vector representation, thereby improving the accuracy of similarity calculation. By sorting by cosine similarity, the knowledge points most relevant to the user's question can be quickly screened out, and the accuracy of the recommended answer can be improved. In the end, the user can get answers that are highly relevant to his or her question, improving the user experience and satisfaction. In addition, this method can also be applied to other scenarios, such as intelligent customer service and search engine optimization. In intelligent customer service, semantic analysis technology can accurately understand the user's consultation intention and provide accurate answers. In search engine optimization, by calculating the similarity between the user query and the web page content, the matching degree of the search results can be improved, and the user's search experience can be improved. For example, in the intelligent customer service scenario, the user asks "how to replace the mobile phone screen". Through word segmentation and part-of-speech tagging, the keywords "replace", "mobile phone", and "screen" are extracted. The semantic representation vector of the question is constructed using the pre-trained model, and the similarity is calculated with the knowledge points such as "mobile phone screen replacement steps" and "mobile phone repair guide" in the knowledge base, and finally the most relevant answer is recommended to the user. In the search engine optimization scenario, the user searches for "how to increase website traffic". Through word segmentation and part-of-speech tagging, the keywords "improve", "website", and "traffic" are extracted. The semantic representation vector of the question is constructed, and the similarity is calculated with the web page content, and the most relevant web pages are ranked at the top of the search results to improve the user's search efficiency. Through these specific application scenarios, it can be seen that the technology based on semantic analysis and similarity calculation can effectively improve the accuracy of information retrieval and recommendation and meet the diverse needs of users.

[0123] In some embodiments, the intent recognition model is used to judge the intent of the user's question to determine whether the purpose of the question is to verify facts or express emotions, so as to select an appropriate answer generation strategy. This includes:

[0124] A user question is obtained, and word segmentation processing is performed on the user question to obtain question features; a pre-constructed user portrait is obtained, and the user portrait includes the user's historical question data; a question-answer pair generation model is used to generate a personalized answer based on the question features and the user portrait, and the personalized answer includes a language style and a degree of detail that matches the user portrait; a semantic similarity is calculated between the personalized answer and the user question to determine whether the correlation between the personalized answer and the user question meets a preset correlation threshold; if the correlation meets the preset correlation threshold, the personalized answer is determined to be a candidate answer; if the correlation does not meet the preset correlation threshold, the parameters of the question-answer pair generation model are adjusted to regenerate a personalized answer; feedback information of the user on the candidate answer is obtained, and according to the feedback information, a reinforcement learning algorithm is used to adjust the strategy parameters of the question-answer pair generation model to obtain an optimized question-answer pair generation model; a final answer is generated using the optimized question-answer pair generation model, and the final answer is output.

[0125] Specifically, obtain the user's question, perform word segmentation processing on the user's question, and obtain the question feature. For example, the user asks "how to improve English speaking ability", through word segmentation processing, keywords such as "improve", "English", "speaking", and "ability" can be obtained, and these keywords constitute the characteristics of the question. Obtain a pre-built user portrait, which includes the user's historical question data. Assume that the user portrait shows that the user has asked questions about English learning many times and prefers concise and clear answers. The construction of the user portrait can form a comprehensive description of the user's interests, preferences, and knowledge level by analyzing the user's historical question records, browsing behavior, interactive data and other multi-dimensional information. According to the question features and the user portrait, a question-answer pair generation model is used to generate personalized answers. The question-answer pair generation model can be based on deep learning technology, such as the Transformer architecture, combined with the user's question features and portrait information, to generate answers that meet the user's preferences. For example, for the question "how to improve English speaking ability", the personalized answer generated by the model may be: "listen to English radio more, imitate pronunciation, and participate in oral corner exercises". Such answers are concise and practical and meet the user's preferences. The personalized answer is subjected to semantic similarity calculation with the user's question to determine whether the correlation between the personalized answer and the user's question meets a preset correlation threshold. The semantic similarity calculation can be implemented by natural language processing technologies such as cosine similarity and Word2Vec. Assuming that the preset correlation threshold is 0.8, if the calculated similarity is 0.85, it is considered that the answer correlation is strong and meets the threshold requirement. If the correlation meets the preset correlation threshold, the personalized answer is determined to be a candidate answer. For example, the above calculation results show that the generated answer is highly correlated with the user's question and can be used as a candidate answer. If the correlation does not meet the preset correlation threshold, the parameters of the question-answer pair generation model are adjusted to regenerate the personalized answer. The adjustment parameters can be to increase training data, optimize the model structure, adjust hyperparameters, etc. For example, if the similarity is only 0.7 and does not meet the threshold, the model can be retrained by adding more question-answer data about English learning to improve the correlation of the generated answer. The user's feedback information on the candidate answer is obtained, and according to the feedback information, the strategy parameters of the question-answer pair generation model are adjusted using a reinforcement learning algorithm to obtain an optimized question-answer pair generation model. User feedback can be in the form of likes, comments, and re-asking. Reinforcement learning algorithms such as Q-learning and PolicyGradient can continuously optimize the model generation strategy through user feedback. For example, if the user is satisfied with the candidate answer and likes it, the model will strengthen the strategy for generating such answers; if the user feedback is not good, the model will adjust the strategy to avoid generating similar answers. The optimized question-answer pair generation model is used to generate the final answer and output the final answer.The optimized model will more accurately match the user's needs and preferences when generating answers. For example, the final answer may be: "Practice oral English for 30 minutes every day, use voice recognition software to correct pronunciation, and participate in online English corner activities." Such an answer is not only specific and feasible, but also fully considers the user's preferences and needs. Through the above steps, the system can continuously learn and optimize, generate more accurate and personalized answers, and improve the user experience. Word segmentation and semantic analysis ensure the accuracy of question understanding, the introduction of user portraits makes the answers more targeted, and the application of question-answering generation models and reinforcement learning algorithms achieves continuous optimization of answers. This multi-level synergy ultimately enables the system to respond to user questions efficiently and accurately, improving the overall performance of the question-answering system and user satisfaction.

[0126] In some embodiments, if the question is intended to verify facts, the knowledge point with the highest confidence is selected from the candidate answer set as the final answer; if the question is intended to express emotions, a response that soothes emotions and avoids the main issue is generated.

[0127] Obtain user questions, use natural language processing technology to perform word segmentation on the questions, extract keywords and part-of-speech features, and determine the intent type of the questions; if the intent type is fact-seeking, use inverted index technology to retrieve candidate answers related to the questions from a pre-built knowledge base, calculate the similarity between each candidate answer and the questions, and select the knowledge point with the highest confidence as the final answer according to the similarity sorting; if the intent type is emotional expression, use sentiment analysis technology to perform sentiment tendency analysis on the questions, identify the user's emotional state, match response templates from a preset emotional response library according to the emotional state, fill in keyword information related to the questions in the response templates, filter sensitive words, and generate response content; return the final answer or the response content to the user; obtain the user's feedback information on the final answer or the response content, and use the questions, the final answers or the response content, and the feedback information as training data to optimize the dialogue model and knowledge base.

[0128] Specifically, the user's question is obtained, and the natural language processing technology is first used to perform word segmentation on the question. For example, the user asks "What are the transmission routes of the new coronavirus?" The word segmentation technology is used to split it into words such as "new coronavirus", "transmission", "path", "which", etc., and extract the keywords "new coronavirus" and "transmission route", and mark the part of speech, such as "new coronavirus" as a noun and "transmission" as a verb. Then, the intention type of the question is determined based on the extracted keywords and part of speech features. If the intention type is fact verification, such as the above question is obviously for obtaining specific information, the inverted index technology is used to retrieve relevant candidate answers from the pre-built knowledge base. Assuming that the knowledge base contains multiple pieces of information about the transmission routes of the new coronavirus, the inverted index is used to quickly locate relevant entries, such as "droplet transmission", "contact transmission", "aerosol transmission", etc. The similarity between each candidate answer and the question can be calculated using methods such as cosine similarity. For example, the candidate answer "droplet transmission is one of the main transmission routes of the new coronavirus" has a high similarity with the question, and the calculated similarity is 0.85. According to the similarity sorting, the knowledge point with the highest confidence is selected as the final answer, that is, "Droplet transmission is one of the main transmission routes of the new coronavirus". If the intent type is emotional expression, for example, the user asks "I always feel anxious recently, what should I do?", the sentiment analysis technology is used to analyze the sentiment tendency of the question and identify the user's emotional state as "anxiety". According to the user's emotional state, the response template is matched from the preset emotional response library, such as "Feeling anxious is a very common emotional reaction. You can try to take a deep breath to relax, or talk to a friend". Fill the response template with keyword information related to the question and generate the response content, such as "Feeling anxious is a very common emotional reaction. You can try to take a deep breath to relax, or talk to a friend and share your feelings". At the same time, filter sensitive words to ensure the appropriateness of the response content. Return the final answer or response content to the user, such as "Droplet transmission is one of the main transmission routes of the new coronavirus" or "Feeling anxious is a very common emotional reaction. You can try to take a deep breath to relax, or talk to a friend". Obtain the user's feedback information on the final answer or response content, such as the user saying "I understand" or "I feel better". This information, together with the original question, final answer or response content, is used as training data to optimize the dialogue model and knowledge base. In this way, the system can continuously learn and improve, improve the accuracy of identifying user intentions and the personalization of responses. For example, after multiple trainings, the model may learn to automatically recommend some ways to relax when it recognizes that the user is depressed, or provide more detailed and accurate answers when the user asks for specific information. Using inverted index technology to retrieve relevant candidate answers from a pre-built knowledge base can greatly improve retrieval efficiency.For example, for a knowledge base containing millions of records, the system can locate entries related to "new coronavirus transmission routes" in milliseconds through inverted indexing, significantly improving the user experience. The application of sentiment analysis technology enables the system to understand the user's emotional state more delicately. For example, by analyzing the vocabulary and tone in the user's questions, the system can identify the user's anxiety, anger, or sadness, and provide more targeted responses. The preset emotional response library contains response templates for various emotional states, such as "take a deep breath and relax" for anxiety and "calm down and speak slowly" for anger. By matching the user's emotional state, the system can generate more appropriate response content. Filtering sensitive words is an important part of ensuring the appropriateness of the response content. For example, for some words that may cause discomfort or controversy, the system will automatically filter or replace them to ensure that the response content is gentle and appropriate. Using the user's questions, final answers or response content, and feedback information as training data can continuously optimize the dialogue model and knowledge base. For example, by analyzing user feedback, the system can find problems where some responses are not accurate or appropriate enough, and then adjust the model parameters to improve the quality of the response. Through the comprehensive application of these technologies and methods, the system can accurately understand and efficiently respond to user questions, improve user satisfaction and system intelligence. For example, after multiple optimizations, the system may learn to not only provide common relaxation methods when a user asks "how to relieve stress", but also recommend some personalized suggestions based on the user's historical question data, such as "you can try yoga, based on your previous questions, you are interested in yoga." This comprehensive application not only improves the practicality and intelligence of the system, but also provides users with a more personalized and accurate service experience.

[0129] In some embodiments, based on the candidate answers and in combination with the specific context of the question, the answer is optimized through a pre-trained language model to make the answer more suitable for the current conversation scenario and improve semantic coherence. This includes:

[0130] The input dialogue text is obtained, and a pre-trained language model is used to extract features of the input dialogue text to obtain a text feature vector; the text feature vector is input into a classification model to determine the scene category to which the input dialogue text belongs; according to the scene category, a corresponding candidate answer set is matched from a pre-constructed candidate answer library; a semantic similarity score between each candidate answer in the candidate answer set and the input dialogue text is calculated, and the candidate answer with the highest semantic similarity score is selected as the basic answer; a grammar and fluency analysis is performed on the basic answer to determine whether it meets a preset fluency threshold. If not, a pre-defined grammar rule library is used to optimize the sentence of the basic answer to obtain an optimized basic answer; named entity recognition is used The tool extracts core entities and their associated attributes from the optimized basic answer, and constructs a knowledge graph subgraph based on the core entities and their associated attributes; applies a graph neural network-based reasoning algorithm to the knowledge graph subgraph, and completes the missing implicit information in the optimized basic answer by matching and reasoning with the known information in the optimized basic answer and the implicit information in the knowledge graph subgraph to obtain a complete semantic structured representation; inputs the input dialogue text and the optimized basic answer into a Seq2Seq model based on an attention mechanism to generate a transition sentence connecting the input dialogue text and the optimized basic answer; and concatenates the transition sentence with the optimized basic answer to obtain a final answer.

[0131] Specifically, the input dialogue text is obtained. For example, when a user asks "How to prevent infection with the new coronavirus?", a pre-trained language model such as BERT is first used to extract features from the input dialogue text. The BERT model can capture contextual information in the text through a multi-layer Transformer structure and generate a text feature vector containing rich semantic information. Assume that the generated feature vector is a 768-dimensional vector, and each dimension represents the features of the text at different semantic levels. The obtained text feature vector is input into a classification model, such as a classifier based on SVM or neural network, to determine the scene category to which the input dialogue text belongs. The classification model can identify whether the text belongs to categories such as "health consultation", "travel advice" or "daily life" by training a large amount of labeled data. In this example, the model determines that "How to prevent infection with the new coronavirus?" belongs to the "health consultation" category. According to the determined scene category "health consultation", the corresponding candidate answer set is matched from the pre-built candidate answer library. Assume that the candidate answer library contains multiple pieces of information about preventing the new coronavirus, such as "wearing a mask", "washing hands frequently", "maintaining social distance", etc. Through category matching, the system quickly locates these relevant candidate answers. The semantic similarity score between each candidate answer in the candidate answer set and the input dialogue text is calculated. The calculation can be performed using methods such as cosine similarity and Jaccard similarity. For example, the candidate answer "wearing a mask can effectively prevent the infection of the new coronavirus" has a high similarity with the question, and the calculated similarity is 0.92. According to the similarity sorting, the candidate answer with the highest semantic similarity score is selected as the basic answer, that is, "wearing a mask can effectively prevent the infection of the new coronavirus". The basic answer is analyzed for grammar and fluency to determine whether it meets the preset fluency threshold. A grammar analysis tool such as StanfordParser can be used to check sentence structure and grammatical errors. If the basic answer "wearing a mask can effectively prevent the infection of the new coronavirus" has grammatical problems or is not fluent enough, the predefined grammar rule library is used to optimize the sentence, such as adjusting it to "wearing a mask is an effective measure to prevent the infection of the new coronavirus". Using a named entity recognition tool such as SpaCy, the core entities and their associated attributes are extracted from the optimized basic answers. For example, "new coronavirus" is identified as a disease entity, and "wearing a mask" is identified as a preventive measure entity. Based on these core entities and their associated attributes, a knowledge graph subgraph is constructed. The knowledge graph subgraph contains the relationship between "new coronavirus" and "wearing a mask", as well as other related entities such as "wash hands frequently" and "maintain social distance". Apply graph neural network-based reasoning algorithms, such as GCN (graph convolutional network), to the knowledge graph subgraph. By matching and reasoning the known information in the optimized basic answer with the implicit information in the knowledge graph subgraph, the missing implicit information in the basic answer is completed. For example, it is inferred that "in addition to wearing a mask, washing hands frequently and maintaining social distance are also important measures to prevent the new coronavirus", and a complete semantic structured representation is obtained.Input the input dialogue text and the optimized basic answer to a Seq2Seq model based on the attention mechanism, such as the Transformer model. Through the attention mechanism, the model can capture the correlation information between the input text and the basic answer and generate a transition sentence connecting the two. For example, generate a transition sentence "In order to effectively prevent the infection of the new coronavirus, you can take the following measures." The transition sentence is spliced ​​with the optimized basic answer to get the final answer: "In order to effectively prevent the infection of the new coronavirus, you can take the following measures: Wearing a mask is an effective measure to prevent the infection of the new coronavirus. In addition, washing hands frequently and maintaining social distance are also very important." In this way, the system can accurately understand and efficiently respond to user questions. The application of the pre-trained language model enables the system to deeply understand the semantic information of the text; the classification model helps the system to quickly locate relevant answers; semantic similarity calculation ensures that the most relevant answer is selected; grammar and fluency analysis ensure the quality of the answer; named entity recognition and knowledge graph reasoning complete the implicit information of the answer; the transition sentence generated by the attention mechanism makes the answer more natural and fluent. The comprehensive application of these technologies and methods improves the intelligence level of the system and user experience. For example, in another scenario, the user asked "How to relieve work stress?" The system, through a similar process, determined that it was in the "mental health" category, matched with candidate answers such as "exercise moderately" and "maintain a good work and rest routine", and finally generated the answer "To relieve work stress, you can try to exercise moderately, maintain a good work and rest habit, and also relieve stress by communicating with friends." This multi-level answer generation mechanism ensures that the system can provide high-quality, personalized responses in different scenarios. Through continuous optimization and training, the system can better understand user intentions and provide more accurate and appropriate answers, thereby significantly improving user satisfaction and the practicality of the dialogue system.

[0132] In some embodiments, the optimized answers are subjected to sensitivity judgment, and whether the answers contain sensitive content such as inappropriate speech and extreme emotions is judged through sensitive word library matching and sentiment tendency analysis. Including:

[0133] Obtain the optimized answer text and use it as input; load the pre-built sensitive word library, match the answer text, and determine whether it contains sensitive words; if a sensitive word is matched, use the word and its context as input, use the naive Bayes algorithm to perform sentiment analysis, and obtain a sentiment score; according to the preset sentiment threshold, determine whether the context of the sensitive word belongs to extreme emotions, wherein the judgment criterion for extreme emotions is that the sentiment score exceeds the positive or negative extreme value of the threshold; if it belongs to extreme emotions, determine the part of the content as sensitive content and mark it; for all text fragments marked as sensitive content, use regular expression matching to filter and replace them with specific symbols; use the filtered answer text as the intermediate result, use the BERT language model to perform semantic restoration and optimization on it, and maintain the semantics and logic of the original answer; use the semantically restored answer text as the final output, which also conforms to the main idea of ​​the original answer.

[0134] Specifically, the optimized answer text is obtained, for example, "Recently, a serious flood disaster occurred in a certain area of ​​my country, resulting in a large number of property losses of residents. The government has urgently launched rescue measures." It is used as input. The pre-built sensitive word library is loaded, which contains words such as "serious", "disaster", "property loss" and other words that may cause negative emotions. Matching is performed on the answer text, and it is found that "serious", "disaster", and "property loss" are all sensitive words. These sensitive words and their context are used as input, and the naive Bayes algorithm is used to perform sentiment tendency analysis. The naive Bayes algorithm is based on the Bayesian theorem. By calculating the probability of each word in different sentiment categories, the sentiment tendency score of the entire sentence is comprehensively obtained. Assume that the probability of "serious" in the negative sentiment category is 0.8 and the probability in the positive sentiment category is 0.2; the probability of "disaster" in the negative sentiment category is 0.9 and the probability in the positive sentiment category is 0.1; the probability of "property loss" in the negative sentiment category is 0.7 and the probability in the positive sentiment category is 0.3. Through comprehensive calculation, the sentiment tendency score of the sentence is -0.8 (assuming that the score range is -1 to 1, and negative values ​​represent negative emotions). According to the preset sentiment tendency threshold, such as -0.6, it is determined whether the context in which the sensitive word is located belongs to extreme emotions. Since -0.8 is lower than -0.6, the sentence is determined to belong to extreme emotions and is marked as sensitive content. For all text fragments marked as sensitive content, regular expression matching is used for filtering. For example, the regular expression "serious|disaster|property loss" can match these sensitive words and replace them with a specific symbol "*". The processed text becomes: "Recently, a certain area of ​​our country has experienced *floods*, resulting in a large number of residents' *property*, and the government has urgently launched rescue measures." The filtered answer text is used as an intermediate result, and the BERT language model is used to restore and optimize its semantics. The BERT (Bidirectional Encoder Representations from Transformers) model can capture the contextual information in the text through the bidirectional Transformer structure, thereby generating semantically coherent sentences. After inputting the filtered text, the BERT model will generate sentences such as "Recently, a major flood occurred in a certain area of ​​my country, resulting in a large number of residents' property being affected. The government has urgently launched rescue measures." This not only maintains the semantics and logic of the original answer, but also avoids the use of sensitive words. The answer text after semantic restoration is used as the final output. This text not only conforms to the main idea of ​​the original answer, but also reduces the negative emotions that may be caused through sensitive word filtering and semantic restoration, thereby improving the dissemination effect of information. Why do we need to filter sensitive words and analyze sentiment tendency? Because in the process of information dissemination, the expression of extreme emotions may cause public panic or dissatisfaction and affect social stability.Through this method, while ensuring accurate information transmission, unnecessary negative impact can be avoided. In addition, another technical effect of semantic recovery using the BERT model is that it can maintain the natural fluency of the text. The traditional sensitive word replacement method may cause the semantic incoherence of the sentence, while the BERT model can generate reasonable alternative words according to the context to ensure the integrity and readability of the information. For another example, suppose the optimized answer text is: "A company was severely punished by the China Securities Regulatory Commission for financial fraud, and its stock price fell sharply." Loading the sensitive word library, it is found that "financial fraud", "severe punishment", and "stock price fell sharply" are all sensitive words. Through the analysis of the naive Bayes algorithm, the sentiment tendency score is -0.7, which is lower than the threshold of -0.6, and it is judged as extreme emotion, and marked and filtered. The filtered text is: "A company was severely punished by the China Securities Regulatory Commission for *, and its stock price *." The semantics are restored by the BERT model, generating: "A company was severely punished by the China Securities Regulatory Commission for illegal operations, and its stock price has declined significantly." The final output text not only conveys the original meaning, but also avoids the use of sensitive words, reducing the spread of negative emotions. Through these steps, not only can the emotional risks in information dissemination be effectively managed, but also the accuracy and readability of information can be ensured, and the overall dissemination effect can be improved.

[0135] In some embodiments, the answers are appropriately revised based on the sensitivity judgment results to avoid sensitive points as much as possible without affecting the completeness and accuracy of the answers. The revised answers are output as the final test results. Including:

[0136] The answer content to be tested is obtained, and according to the preset sensitive information judgment rule library, regular expression matching and text classification methods are used to determine whether the answer content contains sensitive information; if the answer content contains sensitive information, the type and severity of the sensitive information defined in the rule library are obtained, and the corresponding revision strategy is determined according to the type and severity; the answer content is modified using the revision strategy, and the sensitive information is avoided by synonym replacement and semantic reorganization, and dependency syntax analysis and named entity recognition natural language processing technology are used to obtain a revised answer, which does not contain sensitive information and keeps the core content of the original answer unchanged; the revised answer is input into the subsequent test process, and verified by manual evaluation and question-answer comparison, focusing on the readability, coherence and consistency of the revised answer with the original answer, optimizing and adjusting the sensitive information judgment rule library and the revision strategy to improve the recognition accuracy of sensitive information and the revision quality; the revised answer that has passed the test verification replaces the original answer containing sensitive information as the final output result.

[0137] Specifically, to obtain the answer content to be tested, it is necessary to first identify the text to be tested. This text may contain sensitive information and needs to be further judged. According to the preset sensitive information judgment rule base, the rule base may contain multiple definitions and matching rules of sensitive information. Regular expression matching can be used to quickly locate these sensitive words. The text classification method can classify the text through a machine learning model to determine whether it contains sensitive information. For example, using a naive Bayes classifier, the text feature vector is input into the model, and the model output result may show that the text belongs to the "sensitive information" category. If the answer content contains sensitive information, it is necessary to obtain the type and severity of the sensitive information defined in the rule base. According to this type and severity, determine the corresponding revision strategy. For information that is "politically sensitive" and has a "high" severity, the revision strategy may include "synonym replacement" and "semantic reorganization". The revision strategy is used to modify the answer content. Dependency syntactic analysis and named entity recognition technology are used to ensure the semantic coherence of the revised text. For example, dependency parsing can identify sentence structures to ensure that the grammatical relationship of replaced words in the sentence remains unchanged; named entity recognition can identify place names, institution names, etc. in the text to ensure that such information is not replaced by mistake. Get the revised answer. The revised answer does not contain sensitive information and keeps the core content of the original answer unchanged. Enter the revised answer into the subsequent testing process and verify it through manual evaluation and question-answer comparison. Manual evaluation may include multiple reviewers scoring the readability, coherence, and consistency of the revised answer with the original answer. For example, reviewers may give scores of 8 for readability, 9 for coherence, and 7 for consistency. Question-answer comparison compares the revised answer with the original answer to ensure that the revised answer does not deviate from the original meaning. Focus on the readability, coherence, and consistency of the revised answer with the original answer. For example, if the reviewer feedbacks that the revised answer has problems in readability, it may be necessary to adjust the revision strategy, such as adding more synonym options or optimizing the semantic reorganization method. Optimize and adjust the sensitive information judgment rule base and revision strategy to improve the recognition accuracy and revision quality of sensitive information. For example, by adding more sensitive words and their context rules, the accuracy of regular expression matching is optimized; by adjusting the parameters of the text classification model, the classification accuracy is improved. The revised answers that have passed the test are used to replace the original answers containing sensitive information as the final output results. Through the above steps, sensitive information in the answers can be effectively identified and processed to ensure that the output answers meet the content review requirements while maintaining the accuracy and integrity of the information. This processing method not only improves the security of the content, but also enhances the user experience and avoids potential risks caused by sensitive information.

[0138] See also Figure 2 , the present application also proposes a knowledge base sensitive question testing system, comprising:

[0139] First processing module 201: constructing a semantic vector model of the knowledge base;

[0140] Second processing module 202: Retrieving a number of knowledge points with high relevance to the question to be tested through the semantic vector model as a set of candidate answers;

[0141] The third processing module 203: using the intention recognition model to determine the intention of the user's question, to determine whether the question is intended to verify facts or express emotions;

[0142] Fourth processing module 204: if the question is intended to verify facts, select the knowledge point with the highest confidence from the candidate answer set as the final answer; if the question is intended to express emotions, respond based on the emotional response library;

[0143] Fifth processing module 205: Based on the candidate answer set and the emotional response library, combined with the context of the question, optimize the answer through a pre-trained language model;

[0144] The sixth processing module 206: determines whether the optimized answer contains sensitive content, obtains a sensitivity determination result, revises the answer according to the sensitivity determination result, and outputs the revised answer as the final test result.

[0145] It is understandable that if Figure 1 The contents of the knowledge base sensitive questioning test method embodiment shown in the figure are all applicable to the knowledge base sensitive questioning test system embodiment. The functions specifically implemented by the knowledge base sensitive questioning test system embodiment are similar to those in the embodiment shown in the figure. Figure 1 The knowledge base sensitive question testing method embodiment shown is the same as that shown in FIG. Figure 1 The beneficial effects achieved by the embodiment of the knowledge base sensitive question testing method shown are also the same.

[0146] It should be noted that the information interaction, execution process and other contents between the above-mentioned systems are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0147] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0148] See also Figure 3 The embodiment of the present invention further provides a computer device 3, comprising: a memory 302 and a processor 301 and a computer program 303 stored in the memory 302. When the computer program 303 is executed on the processor 301, the knowledge base sensitive question testing method described in any one of the above methods is implemented.

[0149] The computer device 3 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that Figure 3 It is only an example of computer device 3 and does not constitute a limitation on computer device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.

[0150] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0151] In some embodiments, the memory 302 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 302 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 3. Further, the memory 302 may also include both an internal storage unit of the computer device 3 and an external storage device. The memory 302 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 302 may also be used to temporarily store data that has been output or is to be output.

[0152] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the knowledge base sensitive question testing method as described in any one of the above methods is implemented.

[0153] In this embodiment, if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0154] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A knowledge base sensitive question testing method, characterized in that: include: Construct a semantic vector model of the knowledge base; Retrieving a number of knowledge points with high relevance to the question to be tested as a set of candidate answers through the semantic vector model; The intent recognition model is used to judge the intention of the user's question and determine whether the question is intended to verify facts or express emotions. If the question is intended to verify facts, the knowledge point with the highest confidence is selected from the candidate answer set as the final answer; if the question is intended to express emotions, a response is made based on the emotional response library; Based on the candidate answer set and the emotional response library, combined with the context of the question, the answer is optimized through a pre-trained language model; Determine whether the optimized answer contains sensitive content, obtain a sensitivity determination result, revise the answer according to the sensitivity determination result, and output the revised answer as the final test result.

2. The knowledge base sensitive question testing method according to claim 1 is characterized in that: The intent recognition model is used to judge the user's question intention and determine whether the question intention is to verify facts or express emotions, including: Obtaining user questions, performing word segmentation processing on the user questions, and obtaining question features; Obtain a pre-built user profile, wherein the user profile includes historical question data of the user; Generate a personalized answer using a question-answer pair generation model according to the question characteristics and the user portrait, wherein the personalized answer includes a language style and a degree of detail that matches the user portrait; Calculating semantic similarity between the personalized answer and the user question to determine whether the relevance between the personalized answer and the user question meets a preset relevance threshold; If the relevance satisfies the preset relevance threshold, determining the personalized answer as a candidate answer; If the relevance does not meet the preset relevance threshold, the parameters of the question-answer pair generation model are adjusted to regenerate a personalized answer.

3. The knowledge base sensitive question testing method according to claim 1 is characterized in that: If the question is intended to verify facts, the knowledge point with the highest confidence is selected from the candidate answer set as the final answer. If the question is intended to express emotions, a response is made based on the emotional response library, including: If the question intention type is fact-seeking, then the inverted index technology is used to retrieve candidate answers related to the question intention from the pre-built knowledge base, calculate the similarity between each candidate answer and the question intention, and select the knowledge point with the highest confidence as the final answer according to the similarity sorting; If the question intention type is emotional expression, sentiment analysis technology is used to perform emotional tendency analysis on the question intention, identify the user's emotional state, match a response template from a preset emotional response library according to the emotional state, fill in keyword information related to the question in the response template, filter sensitive words, and generate response content.

4. The knowledge base sensitive question testing method according to claim 1 is characterized in that: Based on the candidate answer set and the emotional response library, combined with the context of the question, the answer is optimized through a pre-trained language model, including: Obtaining an input conversation text, and performing feature extraction on the input conversation text using a pre-trained language model to obtain a text feature vector; Inputting the text feature vector into a classification model to determine the scene category to which the input dialogue text belongs; According to the scenario category, matching a corresponding candidate answer set from a pre-built candidate answer library; Calculating the semantic similarity score between each candidate answer in the candidate answer set and the input dialogue text, and selecting the candidate answer with the highest semantic similarity score as the basic answer; Performing grammar and fluency analysis on the basic answer to determine whether it meets a preset fluency threshold; if not, optimizing the basic answer using a predefined grammar rule library to obtain an optimized basic answer; Using a named entity recognition tool to extract core entities and their associated attributes from the optimized basic answers, and constructing a knowledge graph subgraph based on the core entities and their associated attributes; Applying a graph neural network-based reasoning algorithm on the knowledge graph subgraph, by matching and reasoning the known information in the optimized basic answer with the implicit information in the knowledge graph subgraph, the missing implicit information in the optimized basic answer is completed to obtain a complete semantic structured representation; Inputting the input dialogue text and the optimized basic answer into a Seq2Seq model based on an attention mechanism to generate a transition sentence connecting the input dialogue text and the optimized basic answer; The transition statement is concatenated with the optimized basic answer to obtain a final answer.

5. The knowledge base sensitive question testing method according to claim 1 is characterized in that: Determining whether the optimized answer contains sensitive content, obtaining a sensitivity determination result, revising the answer according to the sensitivity determination result, and outputting the revised answer as the final test result, including: Get the optimized answer text and use it as input; Load the pre-built sensitive word library to determine whether the answer text contains sensitive words; If a sensitive word is matched, the sensitive word and its context are used as input to perform sentiment analysis to obtain a sentiment score; According to a preset emotional tendency threshold, determining whether the context in which the sensitive word is located belongs to an extreme emotion, wherein the determination criterion for the extreme emotion is that the emotional tendency score exceeds the positive or negative extreme value of the threshold; If it contains extreme emotions, it will be judged as sensitive content and marked; For all text fragments marked as sensitive content, filtering is performed to replace the text fragments of the sensitive content with symbols; The filtered answer text is used as the intermediate result, and the BERT language model is used to restore and optimize its semantics.

6. The knowledge base sensitive question testing method according to claim 1 is characterized in that: Determining whether the optimized answer contains sensitive content, obtaining a sensitivity determination result, revising the answer according to the sensitivity determination result, and outputting the revised answer as the final test result, including: Obtain the answer content to be tested, and determine whether the answer content contains sensitive information based on a preset sensitive information judgment rule library; If the answer content contains sensitive information, obtaining the type and severity of the sensitive information defined in the sensitive information judgment rule base, and determining a corresponding revision strategy according to the type and severity; The answer content is modified by adopting the revision strategy, avoiding the sensitive information by synonym replacement and semantic reorganization, and obtaining a revised answer by using dependency syntactic analysis and named entity recognition natural language processing technology, wherein the revised answer does not contain sensitive information; The revised answers are input into the subsequent testing process and verified through manual evaluation and question-answer comparison. The verification content includes the readability, coherence and consistency of the revised answers with the original answers.

7. The knowledge base sensitive question testing method according to claim 1 is characterized in that: The semantic vector model for constructing the knowledge base includes: Obtain text data, use word embedding technology to map each word into a low-dimensional dense vector, and build a word vector model; According to the word vector model, a semantic vector representation of each text is calculated; Using clustering algorithms, texts with similar semantics are aggregated to form different semantic clusters; Based on each semantic cluster, calculate the center point of the text semantic vector in the cluster to obtain the semantic topic vector of the cluster; The semantic vector model is used to retrieve several knowledge points that are highly relevant to the question to be tested as a set of candidate answers, including: Obtaining a question to be tested, performing word segmentation, part-of-speech tagging and semantic analysis on the question to be tested, and obtaining keywords and semantic information of the question to be tested; Constructing a semantic representation vector of the problem to be tested according to the keywords and semantic information; Acquire knowledge points related to the problem to be tested in the knowledge base, and construct semantic representation vectors of the knowledge points; Calculating the cosine similarity between the semantic representation vector of the question and the semantic representation vector of each of the knowledge points; The knowledge points are sorted according to the cosine similarity, and several knowledge points with high similarity are selected as a candidate answer set.

8. A knowledge base sensitive question testing system, characterized in that: include: The first processing module: constructing a semantic vector model of the knowledge base; The second processing module: retrieves several knowledge points with high relevance to the question to be tested through the semantic vector model as a set of candidate answers; The third processing module: uses the intention recognition model to determine the intention of the user's question, and determines whether the question is intended to verify facts or express emotions; Fourth processing module: if the question is intended to verify facts, the knowledge point with the highest confidence is selected from the candidate answer set as the final answer; if the question is intended to express emotions, a response is made based on the emotional response library; The fifth processing module: based on the candidate answer set and the emotional response library, combined with the context of the question, optimize the answer through the pre-trained language model; The sixth processing module: determines whether the optimized answer contains sensitive content, obtains a sensitivity determination result, revises the answer according to the sensitivity determination result, and outputs the revised answer as the final test result.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Intelligent interaction method and system for reproductive health questions and answers

    CN120670553A

  • Article attribute question and answer method and system

    CN120821886A

  • An item attribute question answering method and system

    CN120821886B

  • Construction equipment operation and maintenance session interaction method and system based on AIGC

    CN120911593A

  • Intelligent agent-based sensitive data grading method and device, equipment and storage medium

    CN121188200A