Intelligent question and answer method and device, computer equipment and storage medium
By performing multi-dimensional analysis and text vector matching of user query problems, the problems of high computing resource consumption and slow response speed of large language models in the fields of medical health and financial technology are solved, and efficient and accurate intelligent question-and-answer are achieved, improving user experience and system efficiency.
Patent Information
- Application Number
- CN202510540149.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-08
AI Technical Summary
In the application of existing large language models in the fields of medical health and financial technology, there are problems such as high computing resource consumption, slow response speed, data privacy and security issues, limitations of semantic caching for non-semantic information processing, and insufficient answer accuracy and reliability.
By obtaining user query questions, performing multi-dimensional analysis to extract text content and non-semantic information, converting text content into text vectors and encoding them into additional keys, querying matching target additional keys and text vectors in the database, verifying that the similarity score exceeds the threshold, and returning answers from the cache to avoid repeated calls to large language models.
It realizes efficient and accurate intelligent Q&A, reduces computing resource consumption, improves response speed and user experience, and ensures the accuracy and security of answers.
Smart Images

Figure CN120448402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an intelligent question-answering method, apparatus, computer equipment, and computer-readable storage medium. Background Art
[0002] With the rapid development of artificial intelligence (AI), large language models (LLMs) have achieved remarkable results in natural language processing, enabling users to provide high-quality question-answering services. However, the inference process of large language models typically consumes a significant amount of computing resources and time, which can result in high costs and slow response times in practical applications, and there is also room for improvement in the accuracy of answers.
[0003] For example, in the healthcare sector, medical institutions must invest significant hardware resources to support the operation of large language models, which not only increases operating costs but also potentially increases energy consumption. Furthermore, the long inference time of large language models can delay treatment in emergency situations and reduce the user experience. Furthermore, privacy and security concerns regarding medical data, the limitations of semantic caching for processing non-semantic information, and the requirements for accurate and reliable answers all add to the complexity and challenges of applying large language models in healthcare.
[0004] For example, in the fintech sector, financial institutions need to invest significant hardware resources to support the operation of large language models, which not only increases operating costs but also potentially increases energy consumption. Furthermore, the long inference time of large language models can impact business efficiency and customer experience. Furthermore, data privacy and security concerns, the limitations of semantic caching for processing non-semantic information, and the requirements for accurate and reliable answers all add to the complexity and challenges of applying large language models in fintech.
[0005] Based on this, how to provide an intelligent question-answering method, device, computer equipment and computer-readable storage medium that can achieve efficient and accurate intelligent question-answering is a problem that urgently needs to be solved by technical personnel in this field. Summary of the Invention
[0006] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide an intelligent question-answering method, apparatus, computer device and computer-readable storage medium, aiming to solve the problem of how to achieve efficient and accurate intelligent question-answering.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] In a first aspect, the present invention provides an intelligent question-answering method, comprising:
[0009] Get the target user's query questions;
[0010] Perform multi-dimensional analysis on the query question to extract the text content and non-semantic information of the query question;
[0011] Converting the text content into a text vector using a semantic model, and encoding the non-semantic information as an additional key;
[0012] Searching an additional key database for a target additional key that matches the additional key, and determining a target text vector corresponding to the target additional key in a text vector database;
[0013] Verify the similarity between the target text vector and the text vector, and when the similarity score between the two is greater than a preset score threshold, return the target answer corresponding to the target text vector in the cache.
[0014] In a second aspect, the present invention provides an intelligent question-answering device, comprising:
[0015] The acquisition module is used to obtain the query questions of the target user;
[0016] An extraction module, configured to perform multi-dimensional analysis on the query question and extract the text content and non-semantic information of the query question;
[0017] a conversion and encoding module, configured to convert the text content into a text vector through a semantic model, and encode the non-semantic information as an additional key;
[0018] a query module, configured to query an additional key database for a target additional key that matches the additional key, and determine a target text vector corresponding to the target additional key in a text vector database;
[0019] The verification module is used to verify the similarity between the target text vector and the text vector, and when the similarity score between the two is greater than a preset score threshold, return the target answer corresponding to the target text vector in the cache.
[0020] In a third aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the intelligent question-answering method as described above when executing the computer program.
[0021] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program implements the intelligent question-answering method as described above when executed by a processor.
[0022] Compared with the prior art, the present invention provides an intelligent question-answering method, apparatus, computer device and computer-readable storage medium, wherein the method comprises the following steps: obtaining a query question of a target user; performing multi-dimensional analysis on the query question to extract the text content and non-semantic information of the query question; converting the text content into a text vector through a semantic model, and encoding the non-semantic information into an additional key; querying a target additional key matching the additional key in an additional key database, and determining a target text vector corresponding to the target additional key in a text vector database; verifying the similarity between the target text vector and the text vector, and returning a target answer corresponding to the target text vector in the cache when the similarity score between the two is greater than a preset score threshold; thereby, the present invention can achieve efficient and accurate intelligent question-answering. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 A schematic diagram of an application environment for an intelligent question-answering method provided by one embodiment of the present invention.
[0025] Figure 2 A flowchart of an intelligent question-answering method provided by one embodiment of the present invention.
[0026] Figure 3 A schematic diagram of program modules of an intelligent question-answering device provided in one embodiment of the present invention.
[0027] Figure 4 A schematic diagram of the structure of a computer device provided in one embodiment of the present invention.
[0028] Figure 5 Another structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0030] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0031] It will also be understood that the term "and / or" used in the present description and appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0032] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" 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" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0033] In addition, in the description of the present 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.
[0034] References to "one embodiment" or "some embodiments" in the present specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present invention. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0035] It should be understood that the order of execution of the steps in the following embodiments does not necessarily mean the order in which they are executed. The order in which each process is executed should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0036] In order to illustrate the technical solution of the present invention, specific embodiments are provided below.
[0037] An intelligent question-answering method provided by an embodiment of the present invention can be applied in Figure 1In the application environment shown, the client and server communicate via a network. The client includes, but is not limited to, PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud computing devices, personal digital assistants (PDAs), and other computer devices. The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0038] See also Figure 2 An embodiment of the present invention provides an intelligent question-answering method, wherein the method comprises the following steps:
[0039] S100: Obtain the query question of the target user;
[0040] S200: Perform multi-dimensional analysis on the query question to extract text content and non-semantic information of the query question;
[0041] S300, converting the text content into a text vector through a semantic model, and encoding the non-semantic information as an additional key;
[0042] S400, searching an additional key database for a target additional key that matches the additional key, and determining a target text vector corresponding to the target additional key in a text vector database;
[0043] S500: Verify the similarity between the target text vector and the text vector. When the similarity score between the two is greater than a preset score threshold, return the target answer corresponding to the target text vector in the cache.
[0044] During specific implementation, this embodiment realizes efficient and accurate intelligent question and answer by combining semantic understanding and non-semantic information matching. First, the query question uploaded by the user through the user interface is obtained and the text content and non-semantic information are parsed and extracted, the text content is converted into a text vector, and the non-semantic information is encoded as an additional key (extra_key). Then, the additional key is used to quickly locate the match in the additional key database, and then the similarity between the target text vector and the text vector is verified. When the similarity score of the two exceeds the preset score threshold, the corresponding answer is returned directly from the cache, avoiding the repeated call of the large language model in the prior art, significantly reducing the consumption of computing resources, and improving the response speed. At the same time, the method of this embodiment ensures the accuracy of questions and answers while ensuring high efficiency through the precise matching of additional keys and the similarity verification of text vectors.
[0045] It is understandable that the intelligent question-answering method provided by the embodiments of the present invention can be applied to intelligent question-answering scenarios related to the medical and health field. The following are two specific examples:
[0046] (1) Patients consult about drug side effects
[0047] In the healthcare field, imagine a patient asking a question on an online medical consultation platform: "What are the side effects of the drug MP0001?" The system first receives the question, then parses and extracts the text content "What are the side effects of the drug?" and the non-semantic information "MP0001." Next, the text content is converted into a text vector, and the non-semantic information "MP0001" is encoded as an additional key. The system then searches the additional key database for a target additional key that matches "MP0001" and finds the corresponding target text vector in the text vector database. The system then verifies the similarity between the target text vector and the query text vector. If the similarity score exceeds a preset threshold (e.g., 0.85), the target answer is returned from the cache, such as "Common side effects of the drug MP0001 include dizziness, nausea, and rash." This allows patients to quickly obtain accurate information on drug side effects without requiring the system to re-invoke a large language model for complex calculations, thereby improving the efficiency of medical consultations and user experience.
[0048] (2) Patients query examination report results
[0049] In the healthcare field, imagine a patient using a hospital's online service platform to ask, "What are the results of my medical examination report number R12345?" The system first receives the question, then parses and extracts the textual content "What are the results of the medical examination report?" and the non-semantic information "R12345." Next, the system converts the textual content into a text vector, encoding the non-semantic information "R12345" as an additional key. The system then searches the additional key database for a target additional key matching "R12345" and finds the corresponding target text vector in the text vector database. The system then verifies the similarity between the target text vector and the query text vector. If the similarity score exceeds a preset threshold (e.g., 0.85), the target answer is returned from the cache, such as "Your medical examination report number R12345 shows everything is normal; no abnormalities were found." This allows patients to quickly obtain accurate medical report results without requiring the system to re-invoke a large language model for complex computations, thereby improving healthcare efficiency and patient experience.
[0050] It is understandable that the intelligent question-answering method provided in the embodiment of the present invention can also be applied to intelligent question-answering scenarios related to the field of financial technology. The following is a specific example:
[0051] In the FinTech field, imagine a customer using a bank's online customer service platform to ask, "What is the balance of my account A12345?" The system first receives the question, then parses and extracts the textual content ("What is the balance of my account A12345") and the non-semantic information ("Account A12345"). Next, the system converts the textual content into a text vector, encoding the non-semantic information ("Account A12345") as an additional key. The system then searches the additional key database for a target additional key that matches "Account A12345" and finds the corresponding target text vector in the text vector database. The system then verifies the similarity between the target text vector and the query text vector. If the similarity score exceeds a preset threshold (e.g., 0.85), the target answer (e.g., "The current balance of your account A12345 is 10,000 yuan") is returned from the cache. This allows customers to quickly obtain accurate account balance information without requiring the system to re-invoke the large language model for complex calculations, thereby improving the efficiency of financial services and the customer experience.
[0052] Of course, it should be understood that the intelligent question-answering method provided by the embodiment of the present invention can also be applied to intelligent question-answering scenarios related to the insurance industry.
[0053] Furthermore, in one embodiment, the intelligent question answering method, wherein the multi-dimensional analysis of the query question and the extraction of the text content and non-semantic information of the query question specifically includes:
[0054] Preprocessing the query to remove irrelevant characters, including punctuation marks, stop words, and special symbols;
[0055] Using natural language processing technology to perform word segmentation and part-of-speech tagging on the query question, and extracting the text content of the query question;
[0056] The non-semantic information is extracted from the query question using a regular expression, and the non-semantic information is classified and marked.
[0057] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:
[0058] Step 1: Preprocess the query
[0059] Preprocess the user's query to remove irrelevant characters, including punctuation, stop words, and special symbols. This process is usually achieved with the help of word segmentation tools and a predefined stop word list to extract the core text content of the query, providing clearer and more accurate input for subsequent semantic analysis and matching.
[0060] Step 2: Extract text content
[0061] After preprocessing, natural language processing techniques are used to segment and tag the processed queries, extracting the core text content. This text content is then used for semantic vector conversion to facilitate similarity matching within the text vector database. The extracted text content should retain the main semantics of the query and remove irrelevant interference to ensure accuracy and efficiency in subsequent processing.
[0062] Step 3: Extract non-semantic information
[0063] At the same time, regular expressions and other techniques are used to extract non-semantic information from the original query, such as identifiers, numbers, and codes. Although this information does not directly contribute to semantic understanding, it plays a key role in question matching and answer retrieval, helping to quickly locate and filter records related to the question, improving the system's response speed and accuracy.
[0064] Step 4: Storing the Extraction Results
[0065] The extracted text content and non-semantic information are stored in a structured format for easy processing and querying. This step organizes the extracted data into a format that is easy to retrieve and manage, providing basic data support for the subsequent intelligent question-answering process and ensuring that the system can efficiently use this information for question matching and answer retrieval.
[0066] Through the above process, this embodiment can effectively parse the user's query questions, extract key text content and non-semantic information, and provide an important foundation for achieving efficient and accurate intelligent question answering.
[0067] Furthermore, in one embodiment, the intelligent question-answering method, wherein the converting of the text content into a text vector using a semantic model and encoding the non-semantic information as an additional key, specifically includes:
[0068] Based on the Transformer architecture, the pre-trained language model is fine-tuned to construct the semantic model;
[0069] Converting the text content into the text vector using the semantic model, wherein the text vector can effectively represent the semantic features of the text;
[0070] The non-semantic information is encoded as the additional key using a regular expression.
[0071] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:
[0072] Step 1: Build a semantic model
[0073] Based on the Transformer architecture, the pre-trained language model is fine-tuned to construct the semantic model;
[0074] Step 2: Text content vectorization
[0075] The extracted text content is input into the constructed semantic model, and the model's encoder converts the text content into a text vector. This step converts the semantic information of the text into a mathematical representation, which facilitates subsequent similarity calculation and retrieval.
[0076] Step 3: Extract non-semantic information
[0077] Use regular expressions to extract non-semantic information from the original query, such as identifiers, numbers, and codes. This information usually appears in a specific format and can be matched and extracted using predefined regular expression patterns.
[0078] Step 4: Encoding non-semantic information
[0079] Encode the extracted non-semantic information as an additional key. The additional key can be a string containing the extracted non-semantic information, organized in a specific format (such as key-value pairs or semicolon-delimited). The additional key is used for fast matching and filtering, improving query efficiency.
[0080] Step 5: Storing and Indexing
[0081] The generated text vectors and additional keys are stored in the corresponding database and indexed for fast retrieval. The text vectors are stored in the vector database for subsequent similarity calculations; the additional keys are stored in the additional key database for fast matching and filtering.
[0082] Through the above process, this embodiment can efficiently convert the user's query question into a text vector and additional keys that can be used for intelligent question answering, providing support for subsequent fast matching and accurate answers.
[0083] Furthermore, in one embodiment, the intelligent question-answering method, wherein the step of searching an additional key database for a target additional key that matches the additional key and determining a target text vector corresponding to the target additional key in a text vector database, specifically includes:
[0084] Constructing the additional key database and the text vector database;
[0085] Searching the additional key database for the target additional key that matches the additional key, and determining a unique identifier of the target additional key;
[0086] The target text vector corresponding to the target additional key is queried in the text vector database through the unique identifier of the target additional key.
[0087] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:
[0088] Step 1: Build additional key database and text vector database
[0089] Additional key database: Create a database to store additional keys (such as identifiers, numbers, codes, etc.) extracted from user questions and their unique identifiers. The additional key database can be implemented using a relational database or a key-value store.
[0090] Text vector database: Create a database to store text vectors and their corresponding unique identifiers. The text vector database can be implemented using a specialized vector database or a relational database.
[0091] Step 2: Query the additional key database for the matching target additional key
[0092] Match the extracted additional keys with records in the additional key database.
[0093] Use exact matching or fuzzy matching algorithms to find out whether there are records that are exactly the same or highly similar to the extracted additional keys.
[0094] If a matching record is found, get the unique identifier for that record.
[0095] Step 3: Query the target text vector in the text vector database using the unique identifier of the target additional key
[0096] Use the unique identifier obtained from the additional key database to find the corresponding target text vector in the text vector database.
[0097] Ensure that the text vector database can quickly respond to query requests, for example by building efficient indexes or using vector retrieval technology.
[0098] After obtaining the target text vector, it can be further used for similarity calculation or answer retrieval.
[0099] Through the above process, this embodiment can efficiently search for matching records in the additional key database and quickly locate the target text vector in the text vector database through its unique identifier, providing support for subsequent similarity calculation and answer retrieval.
[0100] Furthermore, in one embodiment, the intelligent question-answering method, wherein the verifying the similarity between the target text vector and the text vector, and returning the target answer corresponding to the target text vector in the cache when the similarity score between the two is greater than a preset score threshold, specifically includes:
[0101] Presetting the scoring threshold;
[0102] Calculating a similarity score between the target text vector and the text vector using a cosine similarity algorithm;
[0103] Comparing the similarity score with the score threshold, and when the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector;
[0104] The target answer is personalized adjusted according to the historical interaction record and preference information of the target user, and the adjusted target answer is returned to the terminal of the target user.
[0105] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:
[0106] Step 1: Pre-set scoring threshold
[0107] During the system initialization phase, a similarity scoring threshold is pre-set based on the application scenario and requirements. This scoring threshold is used to determine whether two text vectors are similar enough to decide whether to return the answer from the cache.
[0108] The selection of scoring thresholds can be adjusted based on historical data, experimental results, or business needs to ensure the accuracy and efficiency of the system.
[0109] Step 2: Calculate similarity score
[0110] The cosine similarity algorithm is used to calculate the similarity score between the target text vector and the query text vector. Cosine similarity is calculated by dividing the dot product of two vectors by the product of their modulos. The result ranges from -1 to 1, with values closer to 1 indicating greater similarity.
[0111] Step 3: Compare similarity score to threshold
[0112] The calculated similarity score is compared with the preset score threshold.
[0113] If the similarity score is greater than the preset score threshold, the query question is considered to be matched successfully with the target text vector, and the next step is entered; otherwise, the match is considered to have failed, and the user can be prompted that the question is not matched.
[0114] Step 4: Find the target answer from the cache
[0115] If the similarity score is greater than the preset score threshold, the target answer corresponding to the target text vector is searched from the cache.
[0116] The cache stores the text vectors of previous query questions and their corresponding answers, and quickly locates the target answer through the unique identifier of the target text vector.
[0117] Step 5: Return the target answer to the target user
[0118] Based on the target user's historical interaction records and preference information, the target answer is personalized (including adjusting the answer format, content expansion and semantic optimization), and the adjusted target answer is returned to the target user's terminal to complete the question-and-answer process.
[0119] If no matching answer is found in the cache, the large language model can be called for calculation, and the answer generated can be cached for subsequent queries.
[0120] Through the above process, this embodiment can efficiently verify the similarity between the target text vector and the query question text vector, and quickly return the answer in the cache when the conditions are met, thereby improving the system response speed and user experience.
[0121] Furthermore, in one embodiment, the intelligent question answering method, wherein the calculating the similarity score between the target text vector and the text vector using the cosine similarity algorithm, specifically includes:
[0122] Using a dot product formula, calculating the dot product between the target text vector and the text vector;
[0123] Using a modulus length formula, calculating the modulus lengths of the target text vector and the text vector;
[0124] The cosine similarity formula is used to divide the dot product by the product of the module length of the target text vector and the text vector to obtain the similarity score, and the similarity score is corrected by a context-aware adjustment factor.
[0125] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:
[0126] Step 1: Calculate the dot product
[0127] Use the dot product formula to calculate the dot product between the target text vector and the query text vector. The dot product is the sum of the products of corresponding elements in two vectors, reflecting the linear relationship between the two vectors. By calculating the dot product, we can obtain a scalar value for subsequent similarity calculations.
[0128] Step 2: Calculate the module length
[0129] Use the modulus formula to calculate the modulus of the target text vector and the query text vector. The modulus is the length of the vector and is used to normalize the dot product result. By calculating the modulus, the length of the vector is standardized, ensuring that subsequent similarity calculations are not affected by the vector length.
[0130] Step 3: Calculate the cosine similarity score
[0131] Using the cosine similarity formula, the dot product is divided by the product of the two vectors' moduli to obtain a similarity score, which is then adjusted using a context-aware adjustment factor. The cosine similarity score reflects the degree of directional similarity between two vectors, with values closer to 1 indicating greater similarity. By calculating the cosine similarity score, we can quantify the similarity between two vectors.
[0132] Through the above process, this embodiment can accurately calculate the similarity score between the target text vector and the query question text vector, providing an important basis for answer matching and decision-making in the intelligent question-answering system.
[0133] Furthermore, in one embodiment, the intelligent question-answering method, wherein the comparing the similarity score with the score threshold, and when the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector, specifically includes:
[0134] Comparing the similarity score with the score threshold to verify the magnitude of the similarity score and the score threshold;
[0135] When the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector;
[0136] When the similarity score is less than or equal to the score threshold, the target user is prompted to restate the query question.
[0137] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:
[0138] Step 1: Compare similarity score with score threshold
[0139] The calculated similarity score is compared with the preset score threshold to verify the relationship between the two. The purpose of this step is to determine whether the similarity between the query question and the target text vector meets the system's set standards.
[0140] Step 2: Determine whether the similarity score is greater than the score threshold
[0141] Based on the comparison results, determine whether the similarity score is greater than the score threshold:
[0142] If the similarity score is greater than the score threshold, it means that the query question and the target text vector are similar enough and it can be considered that a matching answer has been found.
[0143] If the similarity score is less than or equal to the score threshold, it means that the query question and the target text vector are not similar enough and no matching answer can be found.
[0144] Step 3: Find the target answer from the cache
[0145] When the similarity score exceeds the threshold, the target answer corresponding to the target text vector is searched from the cache. The cache stores the text vectors of previous queries and their corresponding answers. The target answer can be quickly located using the unique identifier of the target text vector.
[0146] Step 4: Prompt the user to rephrase the question
[0147] When the similarity score is less than or equal to the score threshold, the target user is prompted to rephrase the query. The purpose of this step is to guide the user to provide a more accurate or specific description of the question so that the system can find a more matching answer.
[0148] Step 5: Record the query results (optional)
[0149] Record query results, including similarity scores, whether matching answers were found, user feedback, and other information. These records can be used for subsequent system optimization and data analysis to help improve the performance and accuracy of the intelligent question-answering system.
[0150] Through the above process, this embodiment can effectively verify the similarity between the query question and the target text vector, and decide whether to return the answer from the cache or prompt the user to rephrase the query question based on the similarity score, thereby improving the accuracy of the intelligent question-answering system and user experience.
[0151] As can be seen from the above method embodiments, the intelligent question-answering method provided by the present invention includes: obtaining the query question of the target user; performing multi-dimensional analysis on the query question to extract the text content and non-semantic information of the query question; converting the text content into a text vector through a semantic model, and encoding the non-semantic information as an additional key; querying the target additional key that matches the additional key in the additional key database, and determining the target text vector corresponding to the target additional key in the text vector database; verifying the similarity between the target text vector and the text vector, and when the similarity score between the two is greater than a preset score threshold, returning the target answer corresponding to the target text vector in the cache. In this way, efficient and accurate intelligent question-answering can be achieved through the method of the present invention.
[0152] It should be understood that although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative work, and these operation steps are not necessarily performed in the order of the embodiments or flowcharts. The order of steps listed in the embodiments or flowcharts is only one way of executing the steps among many steps and does not represent the only execution order. It should be noted that there is not necessarily a certain order between the above steps. Those of ordinary skill in the art can understand from the description of the embodiments of the present invention that in different embodiments, the above steps may have different execution orders, that is, they may be executed in parallel, or they may be executed in an interchangeable manner, etc. Moreover, at least a portion of the steps in the embodiments or flowcharts may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be executed in turn, alternately or synchronously with other steps or at least a portion of the sub-steps or stages of other steps.
[0153] Based on the above method embodiment, please refer to Figure 3 Another embodiment of the present invention further provides an intelligent question-answering device, wherein the device comprises:
[0154] An acquisition module 11 is used to acquire the query question of the target user;
[0155] An extraction module 12 is configured to perform multi-dimensional analysis on the query question and extract the text content and non-semantic information of the query question;
[0156] a conversion and encoding module 13, configured to convert the text content into a text vector through a semantic model, and encode the non-semantic information as an additional key;
[0157] A query module 14 is configured to query an additional key database for a target additional key that matches the additional key, and determine a target text vector corresponding to the target additional key in a text vector database;
[0158] The verification module 15 is used to verify the similarity between the target text vector and the text vector, and when the similarity score between the two is greater than a preset score threshold, return the target answer corresponding to the target text vector in the cache.
[0159] Furthermore, in one embodiment, the intelligent question-answering device, wherein the multi-dimensional analysis of the query question to extract the text content and non-semantic information of the query question, specifically includes:
[0160] Preprocessing the query to remove irrelevant characters, including punctuation marks, stop words, and special symbols;
[0161] Using natural language processing technology to perform word segmentation and part-of-speech tagging on the query question, and extracting the text content of the query question;
[0162] The non-semantic information is extracted from the query question using a regular expression, and the non-semantic information is classified and marked.
[0163] Furthermore, in one embodiment, the intelligent question-answering device, wherein the converting of the text content into a text vector through a semantic model and encoding the non-semantic information as an additional key, specifically includes:
[0164] Based on the Transformer architecture, the pre-trained language model is fine-tuned to construct the semantic model;
[0165] Converting the text content into the text vector using the semantic model, wherein the text vector can effectively represent the semantic features of the text;
[0166] The non-semantic information is encoded as the additional key using a regular expression.
[0167] Furthermore, in one embodiment, the intelligent question-answering device, wherein the step of searching an additional key database for a target additional key that matches the additional key and determining a target text vector corresponding to the target additional key in a text vector database, specifically includes:
[0168] Constructing the additional key database and the text vector database;
[0169] Searching the additional key database for the target additional key that matches the additional key, and determining a unique identifier of the target additional key;
[0170] The target text vector corresponding to the target additional key is queried in the text vector database through the unique identifier of the target additional key.
[0171] Furthermore, in one embodiment, the intelligent question-answering device, wherein the verifying the similarity between the target text vector and the text vector, when the similarity score between the two is greater than a preset score threshold, returns the target answer corresponding to the target text vector in the cache, specifically includes:
[0172] Presetting the scoring threshold;
[0173] Calculating a similarity score between the target text vector and the text vector using a cosine similarity algorithm;
[0174] Comparing the similarity score with the score threshold, and when the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector;
[0175] The target answer is personalized adjusted according to the historical interaction record and preference information of the target user, and the adjusted target answer is returned to the terminal of the target user.
[0176] Furthermore, in one embodiment, the intelligent question-answering device, wherein the calculating the similarity score between the target text vector and the text vector using the cosine similarity algorithm, specifically includes:
[0177] Using a dot product formula, calculating the dot product between the target text vector and the text vector;
[0178] Using a modulus length formula, calculating the modulus lengths of the target text vector and the text vector;
[0179] The cosine similarity formula is used to divide the dot product by the product of the module length of the target text vector and the text vector to obtain the similarity score, and the similarity score is corrected by a context-aware adjustment factor.
[0180] Furthermore, in one embodiment, the intelligent question-answering device, wherein comparing the similarity score with the score threshold, and when the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector, specifically includes:
[0181] Comparing the similarity score with the score threshold to verify the magnitude of the similarity score and the score threshold;
[0182] When the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector;
[0183] When the similarity score is less than or equal to the score threshold, the target user is prompted to restate the query question.
[0184] It should be noted that, in the embodiment of the device of the present invention, the information interaction, execution process and other contents between the above modules 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 aforementioned method embodiment part and will not be repeated here.
[0185] Based on the above method embodiment, another embodiment of the present invention further provides a computer device, which can be a server, and its internal structure diagram can be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the functions or steps on the server side of the intelligent question-answering method in any of the above method embodiments are implemented.
[0186] Based on the above method embodiment, another embodiment of the present invention further provides a computer device, which can be a client, and its internal structure diagram can be as follows: Figure 5 As shown. The computer device includes a processor, memory, network interface, display screen and input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the functions or steps of the client side of the intelligent question-answering method in any of the above-mentioned method embodiments are implemented.
[0187] Those skilled in the art will understand that Figure 4 and Figure 5The structural diagram shown in the figure is only a schematic diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more components than shown in the figure, or combine certain components, or have a different component arrangement.
[0188] The processor referred to herein may be a CPU, other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (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.
[0189] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory can be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium can be a hard disk of the computer device, and in other embodiments, it can also be an external storage device of the computer device, for example, 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. Furthermore, the memory can also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program. The memory can also be used to temporarily store data that has been output or is about to be output.
[0190] Based on the above method embodiments, another embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the intelligent question-answering method described in any of the above method embodiments. The computer-readable storage medium may be non-volatile or volatile.
[0191] It should be noted that the above-mentioned functions or steps that can be implemented by computer-readable storage media or computer devices, and the technical effects brought about by the functions / steps, can be found in the relevant descriptions in the aforementioned method embodiments. To avoid repetition, they will not be described one by one here.
[0192] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM). The disclosed memory components or memories of the operating environments described herein are intended to comprise one or more of these and / or any other suitable types of memory.
[0193] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, in the embodiment of the device of the present invention, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual application, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device 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 into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into 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 the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. 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.
[0194] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0195] In the embodiments provided by the present invention, it should be understood that the disclosed apparatus / computer equipment and methods can be implemented in other ways. For example, the apparatus / computer equipment embodiments described above are merely illustrative. For example, the division of modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0196] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0197] It should be noted that if software tools or components other than those of the Company appear in the embodiments of this application, they are merely for illustration and do not represent actual use. The above embodiments are intended only to illustrate the technical solutions of the present invention, not to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein with equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. An intelligent question-answering method, characterized in that: include: Get the target user's query questions; Perform multi-dimensional analysis on the query question to extract the text content and non-semantic information of the query question; Converting the text content into a text vector using a semantic model, and encoding the non-semantic information as an additional key; Searching an additional key database for a target additional key that matches the additional key, and determining a target text vector corresponding to the target additional key in a text vector database; Verify the similarity between the target text vector and the text vector, and when the similarity score between the two is greater than a preset score threshold, return the target answer corresponding to the target text vector in the cache.
2. The intelligent question-answering method according to claim 1, wherein: The multi-dimensional analysis of the query question to extract the text content and non-semantic information of the query question includes: Preprocessing the query to remove irrelevant characters, including punctuation marks, stop words, and special symbols; Using natural language processing technology to perform word segmentation and part-of-speech tagging on the query question, and extracting the text content of the query question; The non-semantic information is extracted from the query question using a regular expression, and the non-semantic information is classified and marked.
3. The intelligent question-answering method according to claim 1, wherein: The converting the text content into a text vector through a semantic model and encoding the non-semantic information as an additional key includes: Based on the Transformer architecture, the pre-trained language model is fine-tuned to construct the semantic model; Converting the text content into the text vector using the semantic model, wherein the text vector can effectively represent the semantic features of the text; The non-semantic information is encoded as the additional key using a regular expression.
4. The intelligent question-answering method according to claim 1, wherein: The step of searching an additional key database for a target additional key that matches the additional key, and determining a target text vector corresponding to the target additional key in a text vector database, includes: Constructing the additional key database and the text vector database; Searching the additional key database for the target additional key that matches the additional key, and determining a unique identifier of the target additional key; The target text vector corresponding to the target additional key is queried in the text vector database through the unique identifier of the target additional key.
5. The intelligent question-answering method according to claim 1, wherein: The verifying the similarity between the target text vector and the text vector, and returning the target answer corresponding to the target text vector in the cache when the similarity score between the two is greater than a preset score threshold, includes: Presetting the scoring threshold; Calculating a similarity score between the target text vector and the text vector using a cosine similarity algorithm; Comparing the similarity score with the score threshold, and when the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector; The target answer is personalized adjusted according to the historical interaction record and preference information of the target user, and the adjusted target answer is returned to the terminal of the target user.
6. The intelligent question-answering method according to claim 5, characterized in that: The calculating the similarity score between the target text vector and the text vector using the cosine similarity algorithm includes: Using a dot product formula, calculating the dot product between the target text vector and the text vector; Using a modulus length formula, calculating the modulus lengths of the target text vector and the text vector; The cosine similarity formula is used to divide the dot product by the product of the module length of the target text vector and the text vector to obtain the similarity score, and the similarity score is corrected by a context-aware adjustment factor.
7. The intelligent question-answering method according to claim 5, characterized in that: The comparing the similarity score with the score threshold, and when the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector, comprises: Comparing the similarity score with the score threshold to verify the magnitude of the similarity score and the score threshold; When the similarity score is greater than the score threshold, searching the cache for the target answer corresponding to the target text vector; When the similarity score is less than or equal to the score threshold, the target user is prompted to restate the query question.
8. An intelligent question-answering device, characterized in that: include: The acquisition module is used to obtain the query questions of the target user; An extraction module, configured to perform multi-dimensional analysis on the query question and extract the text content and non-semantic information of the query question; a conversion and encoding module, configured to convert the text content into a text vector through a semantic model, and encode the non-semantic information as an additional key; a query module, configured to query an additional key database for a target additional key that matches the additional key, and determine a target text vector corresponding to the target additional key in a text vector database; The verification module is used to verify the similarity between the target text vector and the text vector, and when the similarity score between the two is greater than a preset score threshold, return the target answer corresponding to the target text vector in the cache.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the intelligent question-answering 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 intelligent question-answering method according to any one of claims 1 to 7 is implemented.