Intelligent question answering method and system based on keyword dictionary index table and priority graph method
Through the intelligent question-answering method based on the keyword dictionary index table and the priority graph method, the problems of irrelevant answers, low retrieval efficiency and high training cost in the existing technology are solved, and an intelligent question-answering solution with fast and accurate answer acquisition and low maintenance cost is realized.
Patent Information
- Application Number
- CN202411963476.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Existing intelligent customer service robot question-and-answer solutions have problems such as irrelevant or non-unique answers, low retrieval efficiency, and high training costs.
An intelligent question-answering method based on a keyword dictionary index table and a precedence diagram method is adopted. User input is formatted through regular expressions, the keyword dictionary index table is used to match and calculate the knowledge base index ID, and the precedence diagram method is used to calculate multi-dimensional weights to obtain the only optimal answer.
It achieves fast and accurate answer acquisition, reduces maintenance costs, and meets the company's requirements for normalized and standardized results.
Smart Images

Figure CN119848072B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of natural language processing technology, and more specifically, relates to an intelligent question-answering method and system based on a keyword dictionary index table and a priority graph method. Background Art
[0002] Meeting internal business and production needs for consulting services related to company regulations and processes, product information, and operational specifications has become a key requirement for intelligent customer service robots. Enterprises require intelligent customer service robot Q&A solutions that are highly efficient, low-maintenance, and provide reliable responses.
[0003] Existing intelligent customer service robot question-and-answer solutions mainly include the following two types: the first is a rule-based retrieval mechanism (such as keyword fuzzy retrieval, dialogue management, question-and-answer matching technology, etc.), which matches user questions with preset keywords and answer templates and provides corresponding answers; the second is a matching mechanism based on machine learning models (such as recurrent neural networks (RNNs) and long short-term memory (LSTMs), that is, through machine learning algorithms, customer service robots can learn from large amounts of dialogue data and continuously optimize their question-and-answer capabilities.
[0004] However, both of the above methods have some significant flaws: First, the rule-based retrieval mechanism only queries the knowledge base based on simple retrieval rules. Once the content involved in the knowledge base is complex and the keywords are repeated, multiple answers that are irrelevant to the expectations will appear. In addition, keyword fuzzy search cannot use indexes, resulting in very low efficiency and slow retrieval speed; Second, the matching mechanism based on machine learning models seems to provide users with a more natural human-computer interaction experience, but the model tuning and training process requires graphics card resources, which is very costly, and the answers to the same question are often different, so it cannot meet the company's requirements for normalized and standardized results. Summary of the Invention
[0005] In response to the defects of the existing technology, the purpose of this application is to provide an intelligent question-answering method and system based on a keyword dictionary index table and a priority graph method, aiming to solve the problems of irrelevant or non-unique answers, low retrieval efficiency and high training costs in existing intelligent question-answering.
[0006] A first aspect of the present application relates to an intelligent question-answering method based on a keyword dictionary index table and a priority graph method, the intelligent question-answering method comprising:
[0007] Step 1: Use regular expressions to format the character strings in the questions input by the user to obtain several formatted character strings;
[0008] Step 2: Match all formatted strings with the keyword dictionary index table. If there are matching keywords, obtain all matching keywords and proceed to step 3. Otherwise, inform the user that there is no corresponding answer or ask the user to ask again, ending the question.
[0009] Step 3: According to the index ID in the knowledge base response table corresponding to the matched keyword, obtain the corresponding knowledge information in the knowledge base response table as an alternative answer;
[0010] Step 4: If the user's security level meets the obtained knowledge information security level, proceed to step 5. Otherwise, inform the user that the level is insufficient and the corresponding answer cannot be obtained, or ask the user to ask again, and end the Q&A session.
[0011] Step 5: Calculate the index values of different dimensions of knowledge information corresponding to each knowledge base index ID;
[0012] Step 6: Using the indicator values of each dimension of knowledge information, use the priority diagram method to calculate the weight value of each alternative answer;
[0013] Step 7: Output the alternative answer with the largest weight as the final answer.
[0014] In some implementations, the keyword dictionary index table is a full keyword dictionary, including: a keyword, an index ID of the keyword in the knowledge base reply table, and a creation time of the keyword.
[0015] In some implementations, the keyword matching is performed using a direct comparison method.
[0016] In some embodiments, the different dimensional indicators include time distance, importance, user relevance, and question-answer relevance.
[0017] In some implementations, the time distance index value is calculated as follows:
[0018] For each piece of knowledge information obtained in step 3, obtain the corresponding creation time from the knowledge base reply table and calculate the number of days from the creation time to the current time. As the number of days of this knowledge information;
[0019] Sum up the days corresponding to all the knowledge information obtained in step 3 to get the total number of days ;
[0020] Calculate the time distance index value corresponding to each piece of knowledge information .
[0021] In some implementations, the importance index value is calculated as follows:
[0022] For each piece of knowledge information obtained in step 3, obtain the corresponding importance value from the knowledge base response table ;
[0023] Sum up the importance values corresponding to all the knowledge information obtained in step 3 to get the total importance value ;
[0024] Calculate the importance index value corresponding to each piece of knowledge information .
[0025] In some implementations, the user relevance index value is calculated as follows:
[0026] For each piece of knowledge information obtained in step 3, obtain the corresponding department type from the knowledge base response table; determine whether the user's department matches the department type, and if so, set the user relevance index value corresponding to the knowledge information If it is 1, otherwise, set the user relevance index value corresponding to the knowledge information is 0.
[0027] In some implementations, the question-answer relevance index value is calculated as follows:
[0028] For each piece of knowledge information obtained in step 3, the number of occurrences of the knowledge information is counted. ;
[0029] Calculate the question-answer relevance index value corresponding to each piece of knowledge information ,in, It represents the total number of occurrences of all knowledge information corresponding to all knowledge base index IDs.
[0030] The second aspect of the present application relates to an intelligent question-answering system based on a keyword dictionary index table and a priority diagram method, comprising: at least one memory for storing programs; at least one processor for entering the program stored in the memory; when the program stored in the memory is entered, the processor is used to enter the intelligent question-answering method as described in any embodiment of the present application.
[0031] A third aspect of the present application relates to a computer-readable storage medium storing a computer program. When the computer program runs on a processor, the processor enters the intelligent question-answering method as described in any embodiment of the present application.
[0032] It can be understood that the beneficial effects of the second to third aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0033] In general, the above technical solutions conceived by this application have the following beneficial effects compared with the existing technologies:
[0034] The present application proposes an intelligent question-answering method based on a keyword dictionary index table and a precedence graph method. Through a pre-established keyword dictionary index table, it can quickly and intuitively determine whether there are keywords matching the question string in the pre-established keyword dictionary index table, solving the technical problem that fuzzy search cannot use keywords, resulting in very low efficiency and slow retrieval speed; using the precedence graph calculation method in the weight to comprehensively calculate the weights of multiple dimensions, and obtain the only optimal solution for the answer from them, thereby solving the technical problems that the matching mechanism based on the machine learning model requires a large amount of parameter adjustment and training process, which increases the cost, and the answer results are different each time; the combination of the two can solve the problem that the existing rule-based retrieval mechanism has multiple answers that are irrelevant to expectations once the content involved in the knowledge base is complex and the keywords are repeated. The architecture of the present application adopts a relational database combined with natural language recognition. The implementation method is simple, easy to maintain, and the maintenance cost is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is a flow chart of an intelligent question-answering method based on a keyword dictionary index table and a priority diagram method provided in an embodiment of the present application.
[0036] Figure 2 This is a schematic diagram of a keyword dictionary index table provided in an embodiment of the present application.
[0037] Figure 3 It is a schematic diagram of the knowledge base information table provided in the embodiment of the present application.
[0038] Figure 4 It is a schematic diagram of the sorted priority chart provided in the embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0040] The term "and / or" as used herein describes an association between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. The symbol " / " as used herein indicates that the related objects are in an "or" relationship, for example, A / B means either A or B.
[0041] The terms "first" and "second" in this specification and claims are used to distinguish different objects rather than to describe a specific order of objects. For example, "first response message" and "second response message" are used to distinguish different response messages rather than to describe a specific order of response messages.
[0042] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0043] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more, for example, multiple processing units means two or more processing units, etc.; multiple elements means two or more elements, etc.
[0044] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.
[0045] like Figure 1 As shown, the present application discloses an intelligent question-answering method based on a keyword dictionary index table and a priority graph method, the intelligent question-answering method comprising:
[0046] Step 1: Use regular expressions to format the character strings in the questions input by the user to obtain several formatted character strings.
[0047] The user may input a question by text or voice, and the character string in the question input by the user is such as "Which optical fiber has ultra-low scattering and low nonlinear coefficient?".
[0048] The system also obtains the user's identity information, including user ID, name, position, department, employee status (e.g., employed, retired), and security level. For guest users, the system generates default identity information and sets the security level to the lowest.
[0049] This application uses regular expressions to format a string. The formatting process includes: 1) unifying the case of Latin characters in the string; 2) preparing a stop word list in advance, and then removing the stop words in the list when processing the text. The stop word list may include stop words and punctuation marks. For example, the stop words are "hello", "yes", etc., and the punctuation marks are "!", "¥", etc.; 3) combining multiple words involving professional terms in the string into professional terms, for example, combining "dispersion" and "optical fiber" into "dispersion optical fiber", thereby obtaining a preprocessed string.
[0050] Step 2: Match all formatted strings with the keyword dictionary index table. If there are matching keywords, obtain all matching keywords and proceed to step 3. Otherwise, inform the user that there is no corresponding answer or ask the user to ask again, and end this question and answer session.
[0051] In some embodiments, the keyword dictionary index table is a full keyword dictionary. The keyword dictionary index table is pre-established, such as Figure 2 As shown, it includes: keywords, the index ID of the keyword in the knowledge base reply table and the creation time of the keyword.
[0052] In some implementations, the keyword matching is performed using a direct comparison method.
[0053] For example, the formatted string is "bend-resistant optical fiber". Since this application uses a full search method to establish a keyword dictionary, which stores the keywords "bend-resistant", "optical fiber", and "bend-resistant optical fiber", direct comparison is used to directly match the last keyword "bend-resistant optical fiber".
[0054] Step 3: According to the index ID in the knowledge base response table corresponding to the matched keyword, the corresponding knowledge information is obtained from the knowledge base response table as an alternative answer.
[0055] The knowledge base reply table is pre-established, such as Figure 3 As shown, it includes the knowledge base index ID, the corresponding knowledge information, the security level of the knowledge information (for example, from 1 to 5, where 5 has the highest security level), the importance value of the knowledge information, the department type involved in the knowledge information (such as production, sales, human resources, etc.), and the creation time of the knowledge information.
[0056] According to each knowledge base index ID, the corresponding knowledge information is obtained in the knowledge base reply table, and the number of occurrences of each repeated reply data in the retrieved knowledge base reply table is counted.
[0057] Step 4: If the user's security level reaches the obtained knowledge information security level, proceed to step 5. Otherwise, inform the user that the level is insufficient and the corresponding answer cannot be obtained, or ask the user to ask the question again, and end this question and answer session.
[0058] This application pre-sets the user security level and knowledge information security level, and improves the safety factor of intelligent question answering by matching the security levels.
[0059] Step 5: Calculate the index values of different dimensions of knowledge information corresponding to each knowledge base index ID.
[0060] In some embodiments, the different dimensional indicators include time distance, importance, user relevance, and question-answer relevance.
[0061] This application prioritizes four dimensions: time distance, importance, user relevance, and question-response relevance. Time distance corresponds to the timeliness of the retrieved knowledge information; user relevance and importance together correspond to the practicality of the retrieved knowledge information; and question-response relevance corresponds to the consistency and accuracy of the retrieved knowledge information. This application expands on the relevant weight parameters, thereby obtaining more accurate answers by adding weight dimensions, which enhances scalability.
[0062] In some implementations, the time distance index value is calculated as follows:
[0063] For each piece of knowledge information obtained in step 3, obtain the corresponding creation time from the knowledge base reply table and calculate the number of days from the creation time to the current time. As the number of days of this knowledge information;
[0064] Sum up the days corresponding to all the knowledge information obtained in step 3 to get the total number of days ;
[0065] Calculate the time distance index value corresponding to each piece of knowledge information .
[0066] In some implementations, the importance index value is calculated as follows:
[0067] For each piece of knowledge information obtained in step 3, obtain the corresponding importance value from the knowledge base response table ;
[0068] Sum up the importance values corresponding to all the knowledge information obtained in step 3 to get the total importance value ;
[0069] Calculate the importance index value corresponding to each piece of knowledge information .
[0070] In some implementations, the user relevance index value is calculated as follows:
[0071] For each piece of knowledge information obtained in step 3, obtain the corresponding department type from the knowledge base response table; determine whether the user's department matches the department type, and if so, set the user relevance index value corresponding to the knowledge information If it is 1, otherwise, set the user relevance index value corresponding to the knowledge information is 0.
[0072] In some implementations, the question-answer relevance index value is calculated as follows:
[0073] For each piece of knowledge information obtained in step 3, the number of occurrences of the knowledge information is counted. ;
[0074] Calculate the question-answer relevance index value corresponding to each piece of knowledge information ,in, It represents the total number of occurrences of all knowledge information corresponding to all knowledge base index IDs.
[0075] Step 6: Use the indicator values of each dimension of knowledge information and the priority diagram method to calculate the weight value of each alternative answer.
[0076] For the For each knowledge base index ID, the time distance weight value, importance weight value, relevance weight value, and frequency weight value corresponding to the keyword are summed up and the average value is taken as the value of the first knowledge base index ID. The average value corresponding to the knowledge base index ID.
[0077] Initialize an empty weight matrix whose number of rows and columns is equal to the total number of knowledge base index IDs obtained in step 3 .
[0078] The weight matrix is filled according to the average value corresponding to the knowledge base index ID to obtain the final weight matrix.
[0079] Specifically, the weight matrix Rank The value of the column is the first index ID of all knowledge bases in step 3. The knowledge base index ID and The correlation between the knowledge base index IDs is The average value of the knowledge base index ID is If the difference between the average values of the knowledge base index IDs is greater than 0, the association degree is set to 1; if it is equal to 0, the association degree is set to 0.5; if it is less than 0, the association degree is set to 0, where: and All belong to ,like Figure 4 shown.
[0080] Sum the values of each row in the final weight matrix to obtain the summation result corresponding to the row as the weight value of the alternative answer.
[0081] Step 7: Output the alternative answer with the largest weight as the final answer.
[0082] Get the row corresponding to the maximum value of the sum result, and determine whether the number of rows obtained is greater than 1. If so, randomly select a row from the multiple rows obtained, and obtain the knowledge base answer corresponding to the knowledge base index ID corresponding to the row as the final answer, and the process ends. Otherwise, the knowledge base answer corresponding to the knowledge base index ID corresponding to the row is used as the final answer, and the process ends.
[0083] It is understandable that the detailed functional implementation of each of the above units / modules can be found in the introduction of the aforementioned method embodiment, and will not be repeated here.
[0084] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method and will not be repeated here.
[0085] Based on the method in the above embodiment, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.
[0086] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method in the above embodiment.
[0087] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0088] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC.
[0089] The above embodiments can be implemented in whole or in part using software, hardware, firmware, or any combination thereof. When implemented using software, they can be implemented in whole or in part in the form of a computer program product. The computer program product comprises one or more computer instructions. When loaded and executed on a computer, the computer program instructions fully or partially produce the processes or functions described in the embodiments of this application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state drive (SSD)).
[0090] It will be understood that the various numerical numbers involved in the embodiments of the present application are merely distinctions for the convenience of description and are not intended to limit the scope of the embodiments of the present application.
[0091] It is easy for those skilled in the art to understand that the above is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. An intelligent question-answering method based on a keyword dictionary index table and a priority graph method, characterized in that: include: Step 1: Use regular expressions to format the character strings in the questions input by the user to obtain several formatted character strings; Step 2: Match all formatted strings with the keyword dictionary index table. If there are matching keywords, obtain all matching keywords and proceed to step 3. Otherwise, inform the user that there is no corresponding answer or ask the user to ask again, ending the question. Step 3: According to the index ID in the knowledge base response table corresponding to the matched keyword, obtain the corresponding knowledge information in the knowledge base response table as an alternative answer; Step 4: If the user's security level meets the obtained knowledge information security level, proceed to step 5. Otherwise, inform the user that the level is insufficient and the corresponding answer cannot be obtained, or ask the user to ask again, and end the Q&A session. Step 5: Calculate the index values of different dimensions of knowledge information corresponding to each knowledge base index ID; Step 6: Using the indicator values of each dimension of knowledge information, use the priority diagram method to calculate the weight value of each alternative answer; Step 7: Output the alternative answer with the largest weight as the final answer.
2. The intelligent question-answering method according to claim 1, wherein: The keyword dictionary index table is a full keyword dictionary, including: keywords, index IDs of the keywords in the knowledge base reply table, and creation time of the keywords.
3. The intelligent question-answering method according to claim 2, wherein: The keyword matching adopts a direct comparison method.
4. The intelligent question-answering method according to claim 1, wherein: The different dimensional indicators include time distance, importance, user relevance and question response relevance.
5. The intelligent question-answering method according to claim 4, wherein: The calculation process of the time distance index value is as follows: For each piece of knowledge information obtained in step 3, obtain the corresponding creation time from the knowledge base reply table and calculate the number of days from the creation time to the current time. As the number of days of this knowledge information; Sum up the days corresponding to all the knowledge information obtained in step 3 to get the total number of days ; Calculate the time distance index value corresponding to each piece of knowledge information .
6. The intelligent question-answering method according to claim 4, wherein: The calculation process of the importance index value is as follows: For each piece of knowledge information obtained in step 3, obtain the corresponding importance value from the knowledge base response table ; Sum up the importance values corresponding to all the knowledge information obtained in step 3 to get the total importance value ; Calculate the importance index value corresponding to each piece of knowledge information .
7. The intelligent question-answering method according to claim 4, wherein: The calculation process of the user relevance index value is as follows: For each piece of knowledge information obtained in step 3, obtain the corresponding department type from the knowledge base response table; determine whether the user's department matches the department type, and if so, set the user relevance index value corresponding to the knowledge information If it is 1, otherwise, set the user relevance index value corresponding to the knowledge information is 0.
8. The intelligent question-answering method according to claim 4, wherein: The calculation process of the question-answer relevance index value is as follows: For each piece of knowledge information obtained in step 3, the number of occurrences of the knowledge information is counted. ; Calculate the question-answer relevance index value corresponding to each piece of knowledge information ,in, It represents the total number of occurrences of all knowledge information corresponding to all knowledge base index IDs.
9. An intelligent question-answering system based on a keyword dictionary index table and a priority graph method, characterized in that: include: at least one memory for storing a program; At least one processor is used to enter the program stored in the memory. When the program stored in the memory is entered, the processor is used to enter the intelligent question-answering method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program runs on a processor, the processor enters the intelligent question-answering method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Vertical domain-oriented intelligent question and answer system
CN105843897A
Intelligent question answering method and system based on domain knowledge graph
CN117648984A