Question response method and device, electronic equipment, storage medium and system
By combining comprehensive methods of vector search, word segmentation search and keyword search in the knowledge database, the problem of search degradation in the existing technology is solved, the search efficiency and accuracy of the knowledge database are improved, and the fast and accurate response is achieved.
Patent Information
- Application Number
- CN202411324828.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-12-27
AI Technical Summary
In the prior art, when a vector-based search method stores a large amount of data in a knowledge database or problems raised by users are too brief, search degradation will occur, resulting in a significant reduction in search efficiency and accuracy, thereby reducing the response rate to user questions and Accuracy.
By obtaining the problem text and converting it into vector text and word segmentation text, combining vector search, word segmentation search and keyword search, a knowledge database of multiple search methods is constructed, and the results of the three search methods are combined to determine the response text.
Improve the hit rate and efficiency of retrieval, achieve fast and accurate response, and enhance the ability to handle user problems.
Smart Images

Figure CN119202186A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a question answering method, device, electronic device, storage medium, and system. Background Art
[0002] At present, in order to speed up the circulation of internal information and knowledge in enterprises and realize the sharing of knowledge within the organization, enterprises generally store their knowledge by establishing knowledge databases. Knowledge databases are structured, easy-to-operate, easy-to-use, easy-to-store and inheritable knowledge data clusters formed in enterprises. They include not only the enterprise's macro-development plans and corporate culture, but also all the knowledge content of various micro-departments, such as training materials, customer information, product information, market information and many other aspects.
[0003] Among them, for the application of knowledge database, in order to facilitate users to quickly retrieve the desired knowledge data from the large amount of knowledge data stored in the knowledge database, the existing technology is generally based on the RAG (Retrieval-augmented Generation) method, combined with a large language model and system optimization, so that users only need to ask their own questions, and the corresponding knowledge data can be retrieved from the knowledge database for the questions raised by the users.
[0004] However, the above-mentioned RAG-based retrieval system is generally a vector-based retrieval method, which can search for knowledge data similar to the questions raised by users. However, when a large amount of knowledge data is stored in the knowledge database or the questions raised by users are too short, the above-mentioned vector-based retrieval method will have the problem of retrieval degradation, which greatly reduces the efficiency and accuracy of the retrieval, thereby reducing the rate and accuracy of answering questions raised by users. Summary of the invention
[0005] The present application provides a question answering method, device, electronic device, storage medium and system to solve the technical problem in the prior art that when retrieving knowledge data related to a question, a large amount of knowledge data is stored in the knowledge database or the question asked by the user is too short, the existing vector-based retrieval method will experience retrieval degradation, which greatly reduces the efficiency and accuracy of the retrieval, thereby reducing the speed and accuracy of answering questions asked by the user.
[0006] In a first aspect, the present application provides a question answering method, the method comprising:
[0007] Obtaining a question text, converting the question text into a vector text, and performing word segmentation processing on the question text to obtain a word segmentation text;
[0008] Searching a preset knowledge database according to the vector text to obtain a plurality of first knowledge data, and searching the knowledge database according to the word segmentation text to obtain a plurality of second knowledge data;
[0009] Searching a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data; wherein the keyword knowledge database includes knowledge data having keywords in the knowledge database and keywords of each of the knowledge data;
[0010] sorting the first knowledge data and the second knowledge data to obtain a preset number of fourth knowledge data, where the fourth knowledge data is the first knowledge data or the second knowledge data;
[0011] An answer text for the question text is determined based on the third knowledge data and the fourth knowledge data.
[0012] As a possible implementation manner, the obtaining of the question text includes:
[0013] Receive the text of the initial question posed by the subject;
[0014] Determine whether there is a historical conversation text of the subject in a preset database, the historical conversation text including a historical question text raised by the subject in a historical time period and a historical answer text corresponding to the historical question text;
[0015] In the case where it is determined that the historical conversation text exists, the historical conversation text and the initial question text are input into a preset question model to obtain a complete question text output by the question model; and the complete question text is determined as the question text;
[0016] In the case where it is determined that the historical dialogue text does not exist, the initial question text is determined as the question text.
[0017] As a possible implementation, the knowledge database includes a plurality of pre-stored knowledge data and a text vector of each of the knowledge data, and each of the knowledge data corresponds to at least one channel authority;
[0018] The step of searching a preset knowledge database according to the vector text to obtain a plurality of first knowledge data includes:
[0019] Determining the similarity between the vector text and each of the text vectors;
[0020] Determine the knowledge data corresponding to the text vectors whose similarity is greater than a preset similarity threshold as the first initial knowledge data, and obtain a plurality of first initial knowledge data;
[0021] Determine the target object for raising the question text, and obtain the object channel authority of the target object;
[0022] Determine a first target channel authority corresponding to each of the first initial knowledge data;
[0023] For each of the first initial knowledge data, determine whether the object channel authority includes the first target channel authority corresponding to the first initial knowledge data; if it is determined that the object channel authority includes the first target channel authority, determine the first initial knowledge data as the first knowledge data.
[0024] As a possible implementation, the knowledge database includes a plurality of pre-stored knowledge data and a preset question text corresponding to each of the knowledge data, and each of the knowledge data corresponds to at least one channel authority;
[0025] The step of searching the knowledge database according to the segmented text to obtain a plurality of second knowledge data includes:
[0026] Matching the segmented text with a preset question text corresponding to each piece of knowledge data to obtain a matching score between each preset question text and the segmented text;
[0027] Determine the knowledge data corresponding to the preset question text whose matching score is greater than the preset score threshold as the second initial knowledge data, and obtain a plurality of second initial knowledge data;
[0028] Determine the target object for raising the question text, and obtain the object channel authority of the target object;
[0029] Determine the second target channel authority corresponding to each of the second initial knowledge data;
[0030] For each second initial knowledge data, determine whether the object channel authority includes the second target channel authority corresponding to the second initial knowledge data; if it is determined that the object channel authority includes the second target channel authority, determine the second initial knowledge data as the second knowledge data.
[0031] As a possible implementation method, the knowledge database is constructed in the following manner:
[0032] Acquire a plurality of preset knowledge data question-answer pairs and a knowledge data document, wherein the knowledge data question-answer pairs include a plurality of preset knowledge data questions and knowledge data answers, and the knowledge data document includes a plurality of knowledge data paragraphs;
[0033] Constructing a plurality of knowledge data, as well as a text vector and a preset question text corresponding to each knowledge data according to the knowledge data question-answer pair and the knowledge data document;
[0034] The channel authority corresponding to each piece of knowledge data is obtained, and a corresponding relationship between the knowledge data and the channel authority is established.
[0035] As a possible implementation, constructing a plurality of knowledge data, as well as a text vector and a preset question text corresponding to each knowledge data according to the knowledge data question-answer pair and the knowledge data document includes:
[0036] Determining the knowledge data answer in the knowledge data question-answer pair as knowledge data;
[0037] For each knowledge data question corresponding to the knowledge data answer, convert the knowledge data question into a question vector using a pre-trained vector model, determine the question vector as a text vector of the knowledge data, and determine the knowledge data question as a preset question text of the knowledge data;
[0038] For the knowledge data document, split the knowledge data document into a plurality of paragraphs of knowledge data according to a preset splitting rule, and determine each paragraph of knowledge data as knowledge data;
[0039] Using a pre-trained vector model to convert each of the paragraph knowledge data into a paragraph vector, and determining the paragraph vector as a text vector of the knowledge data;
[0040] Each of the paragraph knowledge data is summarized using a pre-trained summary model to obtain a question text corresponding to each of the paragraph knowledge data, and the question text corresponding to each of the paragraph knowledge data is determined as a preset question text of the knowledge data.
[0041] As a possible implementation, the keyword knowledge database includes a plurality of pre-stored knowledge data and keywords corresponding to each of the knowledge data, and each of the knowledge data corresponds to at least one channel authority;
[0042] The method searches a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data, including:
[0043] Matching the segmented text with each keyword in the keyword knowledge database to obtain a matching score corresponding to each keyword and the segmented text;
[0044] Determine the knowledge data corresponding to the keyword whose matching score is greater than a preset score threshold as the third initial knowledge data;
[0045] Determine the target object for raising the question text, and obtain the object channel authority of the target object;
[0046] Determining the third target channel authority corresponding to each of the third initial knowledge data;
[0047] For each of the third initial knowledge data, determine whether the object channel authority includes the third target channel authority corresponding to the third initial knowledge data; if it is determined that the object channel authority includes the third target channel authority, determine the third initial knowledge data as the third knowledge data.
[0048] As a possible implementation manner, determining the answer text of the question text according to the third knowledge data and the fourth knowledge data includes:
[0049] Combining the third knowledge data and the fourth knowledge data into a target knowledge data sequence;
[0050] The question text and the target knowledge data sequence are input into a pre-trained response model to obtain a response text output by the response model.
[0051] In a second aspect, the present application provides a question answering device, the device comprising:
[0052] An acquisition module is used to acquire a question text, convert the question text into a vector text, and perform word segmentation processing on the question text to obtain a word segmentation text;
[0053] A first retrieval module is used to search a preset knowledge database according to the vector text to obtain a plurality of first knowledge data, and to search the knowledge database according to the segmented text to obtain a plurality of second knowledge data;
[0054] A second search module is used to search a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data; wherein the keyword knowledge database includes knowledge data with keywords in the knowledge database and keywords of each of the knowledge data;
[0055] a sorting module, used to sort the first knowledge data and the second knowledge data to obtain a preset number of fourth knowledge data, where the fourth knowledge data is the first knowledge data or the second knowledge data;
[0056] A determination module is used to determine the answer text of the question text according to the third knowledge data and the fourth knowledge data.
[0057] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory, wherein the processor is used to execute a question answering program stored in the memory to implement the question answering method described in any one of the first aspects.
[0058] In a fourth aspect, the present application provides a storage medium storing one or more programs, wherein the one or more programs can be executed by one or more processors to implement the question answering method described in any one of the first aspects.
[0059] In a fifth aspect, the present application provides a question answering system, the system comprising: a question answering terminal and a question answering server, the question answering terminal and the question answering server being communicatively connected;
[0060] The question answering terminal is used to collect question text and send the question text to the question answering service end;
[0061] The question answering server is used to obtain the question text and execute the question answering method described in any one of the first aspects to determine the question and answer text of the question text.
[0062] The technical solution provided by the embodiment of the present application obtains a question text, converts the question text into a vector text, and performs word segmentation processing on the question text to obtain a word segmentation text, searches a preset knowledge database according to the vector text to obtain multiple first knowledge data, and searches the knowledge database according to the word segmentation text to obtain multiple second knowledge data, searches a preset keyword knowledge database according to the above-mentioned word segmentation text to obtain multiple third knowledge data, wherein the above-mentioned keyword knowledge database includes knowledge data with keywords in the knowledge database, and keywords of each knowledge data, sorts the above-mentioned first knowledge data and second knowledge data to obtain a preset number of fourth knowledge data, the above-mentioned fourth knowledge data is the above-mentioned first knowledge data or the second knowledge data, and determines the question and answer text of the question text according to the above-mentioned third knowledge data and fourth knowledge data. This technical solution pre-builds a knowledge database that can perform vector retrieval and word segmentation retrieval at the same time, as well as a keyword knowledge database that can perform keyword retrieval. Based on this, vector retrieval and word segmentation retrieval can be performed on the preset knowledge database for the acquired question text, and keyword retrieval can be performed on the keyword knowledge database. The knowledge data retrieved by the three retrieval methods can be combined to determine the answer text corresponding to the question text. The combination of the knowledge data retrieved by the three retrieval methods can increase the retrieval hit rate, thereby improving the efficiency and accuracy of retrieving knowledge data, thereby achieving quick and accurate responses to questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0064] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0065] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0066] Figure 1 A flowchart of an embodiment of a question answering method provided in an embodiment of the present application;
[0067] Figure 2 A flowchart of an embodiment of a knowledge database construction method provided in an embodiment of the present application;
[0068] Figure 3 A flowchart of another method for constructing a knowledge database provided in an embodiment of the present application;
[0069] Figure 4 A flowchart of another method for answering questions provided in an embodiment of the present application;
[0070] Figure 5 A block diagram of an embodiment of a question answering device provided in an embodiment of the present application;
[0071] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the embodiments of the present application. Obviously, the embodiments described in the text are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0073] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described in detail below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0074] In order to solve the technical problem in the prior art that when retrieving knowledge data related to a question, the existing retrieval method stores a large amount of knowledge data in the knowledge database or the question asked by the user is too short, retrieval degradation will occur, which greatly reduces the efficiency and accuracy of the retrieval, thereby reducing the rate and accuracy of answering the questions asked by the user, the present application provides a question answering method, device, electronic device, storage medium and system, which can pre-construct a knowledge database that can simultaneously perform vector retrieval and word segmentation retrieval, and a keyword knowledge database that can perform keyword retrieval. Based on this, vector retrieval and word segmentation retrieval can be performed on the preset knowledge database for the acquired question text, and keyword retrieval can be performed on the keyword knowledge database, so as to determine the answer text corresponding to the question text by integrating the knowledge data retrieved by the three retrieval methods. Integrating the knowledge data retrieved by the three retrieval methods can increase the retrieval hit rate, thereby improving the efficiency and accuracy of retrieving knowledge data, thereby achieving fast and accurate answers to questions.
[0075] The question answering method provided in the present application is further explained below with reference to specific embodiments in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present application.
[0076] See also Figure 1 , is a flow chart of an embodiment of a question answering method provided in an embodiment of the present application. Figure 1 As shown, the process may include the following steps:
[0077] Step 101: Obtain a question text, convert the question text into a vector text, and perform word segmentation processing on the question text to obtain a word segmentation text.
[0078] The above question text is the text corresponding to the question to be answered by the executive entity of the embodiment of the present application.
[0079] In one embodiment, the execution subject of the embodiment of the present application may obtain a pre-stored question text from a preset storage medium.
[0080] In another embodiment, the execution subject of the embodiment of the present application may use a preset sound pickup component (such as a microphone) to collect the question voice uttered by the user, and recognize the question voice to determine the question text corresponding to the question voice.
[0081] In yet another embodiment, the user may input a question text through a visual interface, based on which the executing entity of the embodiment of the present application may obtain the question text through the visual interface.
[0082] Furthermore, in order to obtain a more accurate question text, the execution subject of the embodiment of the present application can adjust the question text according to the historical conversation text of the object that raises the question text in the historical time period to obtain a question text that can more accurately express the object's intention.
[0083] As an optional implementation method, the execution subject of the embodiment of the present application may use the obtained question text as the initial question text raised by the received object. Afterwards, it may be determined whether there is a historical conversation text of the object in the preset database, the historical conversation text including the historical question text raised by the object to the execution subject of the embodiment of the present application in the historical time period, and the historical response text made by the execution subject of the embodiment of the present application to the historical question text.
[0084] Optionally, when it is determined that there is a historical conversation text of the object, the historical conversation text and the initial question text can be input into a preset question model, and the question model can adjust the initial question text according to the input historical conversation text to obtain a relatively complete complete question text, and output the complete question text. Based on this, the execution subject of the embodiment of the present application can obtain the completed question text output by the question model, and determine the complete question text as the final question text.
[0085] On the contrary, when it is determined that there is no historical conversation text of the object, the execution subject of the embodiment of the present application may not adjust the initial question text, and therefore, the initial question text may be directly determined as the final question text.
[0086] In one embodiment, after obtaining the question text, the execution subject of the embodiment of the present application may process the question text in different ways in order to perform different methods of retrieval on the question text.
[0087] As an optional implementation, the question text can be converted into vector text so that vector retrieval of the question text can be performed in subsequent steps. At the same time, the question text can be segmented to obtain segmented text so that segmentation retrieval and keyword retrieval can be performed on the question text in subsequent steps.
[0088] As an exemplary implementation, the execution subject of the embodiment of the present application may train a vector model in advance according to the knowledge data in the knowledge database, and based on this, the vector model may be used to convert the question text into a vector text.
[0089] As an exemplary implementation, the execution subject of the embodiment of the present application can use the knowledge data in the knowledge database to build a word segmentation library. Based on this, when performing word segmentation processing on the question text, the word segmentation library can be used to divide the question text into multiple word segmentation texts.
[0090] Step 102: Search a preset knowledge database according to the vector text to obtain a plurality of first knowledge data, and search the knowledge database according to the word segmentation text to obtain a plurality of second knowledge data.
[0091] The above-mentioned knowledge database is a pre-built database for storing knowledge data. Furthermore, in order to adapt to different retrieval methods, the above-mentioned knowledge database can store multiple knowledge data and the retrieval data required for different retrieval methods corresponding to each knowledge data, such as the text vector of each knowledge data and the preset question text corresponding to each knowledge data, which is used for word segmentation retrieval.
[0092] The above-mentioned knowledge data can be data corresponding to a certain enterprise, organization, or an industry. For example, it can be the enterprise's macro development plan, corporate culture, etc., as well as all the knowledge content of each micro department, such as: training materials, customer information, product information, market information, and many other aspects.
[0093] In an embodiment of the present application, after determining the vector text corresponding to the question text, the execution subject of the embodiment of the present application can search the preset knowledge database according to the above vector text to obtain multiple first knowledge data.
[0094] As an optional implementation method, the above-mentioned knowledge database may include multiple pre-stored knowledge data and a text vector of each knowledge data. Furthermore, in order to ensure the security of each knowledge data, each knowledge data stored in the knowledge database may correspond to at least one channel authority. Only if the object that raises the question text has the channel authority corresponding to the knowledge data, the executing subject of the embodiment of the present application can obtain the knowledge data for the question text raised by the object.
[0095] Based on this, the execution subject of the embodiment of the present application can determine the similarity between the vector text corresponding to the question text and the text vector corresponding to each knowledge data. Afterwards, the knowledge data corresponding to the text vector with a similarity greater than a preset similarity threshold can be determined as the first initial knowledge data, and through the preliminary search of the above vector similarity, multiple first initial knowledge data matching the question text can be obtained from the knowledge database.
[0096] Furthermore, in order to improve the security of knowledge data, the execution subject of the embodiment of the present application can determine the target object of the question text and obtain the object channel authority of the target object. As an exemplary implementation, the above target object can correspond to an account, and the account can have corresponding channel authority when registered. Based on this, the object channel authority of the target object can be directly determined from the corresponding account of the target object.
[0097] Afterwards, the first target channel authority corresponding to each first initial knowledge data determined above can be determined, and for each first initial knowledge data, it can be determined whether the object channel authority of the target object includes the first target channel authority corresponding to the first initial knowledge data.
[0098] Optionally, when it is determined that the object channel authority includes the above-mentioned first target channel authority, it means that the target object has the authority to obtain the first initial knowledge data, and therefore, the first initial knowledge data can be determined as the first knowledge data.
[0099] On the contrary, when it is determined that the object channel authority does not include the above-mentioned first target channel authority, it means that the target object does not have the authority to obtain the first initial knowledge data. Therefore, the first initial knowledge data can be determined as non-first knowledge data.
[0100] At the same time, after determining the segmented text corresponding to the question text, the execution subject of the embodiment of the present application can search the knowledge database according to the segmented text to obtain multiple second knowledge data.
[0101] As an optional implementation method, the above-mentioned knowledge database may include multiple pre-stored knowledge data and preset question texts for each knowledge data. Furthermore, in order to ensure the security of each knowledge data, each knowledge data stored in the knowledge database may correspond to at least one channel authority. Only if the object that raises the question text has the channel authority corresponding to the knowledge data, the executing subject of the embodiment of the present application can obtain the knowledge data based on the question text raised by the object.
[0102] Based on this, the execution subject of the embodiment of the present application can match the segmented text with the preset question text corresponding to each knowledge data to obtain the matching score of each preset question text and the segmented text. Afterwards, the knowledge data corresponding to the preset question text with a matching score greater than the preset score threshold can be determined as the second initial knowledge data, and through the preliminary search of the above matching scores, multiple second initial knowledge data matching the question text can be obtained from the knowledge database.
[0103] Furthermore, in order to improve the security of knowledge data, the execution subject of the embodiment of the present application can determine the target object of the question text and obtain the object channel authority of the target object. As an exemplary implementation, the above target object can correspond to an account, and the account can have corresponding channel authority when registered. Based on this, the object channel authority of the target object can be directly determined from the corresponding account of the target object.
[0104] Afterwards, the second target channel authority corresponding to each second initial knowledge data determined above can be determined, and for each second initial knowledge data, it can be determined whether the object channel authority of the target object includes the second target channel authority corresponding to the second initial knowledge data.
[0105] Optionally, when it is determined that the object channel authority includes the second target channel authority, it means that the target object has the authority to obtain the second initial knowledge data, and therefore, the second initial knowledge data can be determined as the second knowledge data.
[0106] On the contrary, when it is determined that the object channel authority does not include the second target channel authority, it means that the target object does not have the authority to obtain the second initial knowledge data. Therefore, the second initial knowledge data can be determined as non-second knowledge data.
[0107] According to the above method, a plurality of first knowledge data and a plurality of second knowledge data can be matched from a preset knowledge database.
[0108] As for how the above knowledge database is constructed, it can be seen in the following Figure 2 The process shown is explained and will not be described in detail here.
[0109] Step 103: Search a preset keyword knowledge database according to the above segmented text to obtain a plurality of third knowledge data, wherein the above keyword knowledge database includes knowledge data with keywords in the above knowledge database and keywords of each knowledge data.
[0110] The above-mentioned keyword knowledge database can be a pre-built database for storing knowledge data and keywords corresponding to each knowledge data. Furthermore, in order to improve the security of each knowledge data, each knowledge data can correspond to a channel authority. Only when the object that raises the question text has the channel authority for the knowledge data, the executing subject of the embodiment of the present application can obtain the knowledge data for the question text.
[0111] Optionally, in order to facilitate the construction of a keyword knowledge database, the above-mentioned keyword knowledge database may be a sub-database of the knowledge database, that is, the keyword knowledge database includes knowledge data with keywords in the knowledge database, and keywords for each knowledge data, wherein a user may set one or more keywords for any knowledge data in the knowledge database, and the keywords may be high-frequency search terms that appear in a search engine. Based on this, when the executing entity of an embodiment of the present application detects that keywords have been set for the knowledge data, it may store the knowledge data, the keywords of the knowledge data, the channel permissions of the knowledge data, and the correspondence between the three in a sub-database in the knowledge database, that is, in the keyword knowledge database.
[0112] In one embodiment, after determining the segmented text of the question text, the execution subject of the embodiment of the present application may search the keyword knowledge database constructed above according to the segmented text to obtain a plurality of third knowledge data.
[0113] As an optional implementation, the keyword knowledge database may include a plurality of pre-stored knowledge data and keywords corresponding to each knowledge data, and each knowledge data corresponds to at least one channel authority. Based on this, the execution subject of the embodiment of the present application may match the segmented text with each keyword in the keyword knowledge database to obtain a matching score corresponding to each keyword and the segmented text.
[0114] Afterwards, the knowledge data corresponding to the keywords with matching scores greater than the preset score threshold can be determined as the third initial knowledge data. Through the preliminary retrieval of the above matching scores, multiple third initial knowledge data matching the question text can be obtained from the keyword knowledge database.
[0115] Furthermore, in order to improve the security of knowledge data, the execution subject of the embodiment of the present application can determine the target object of the question text and obtain the object channel authority of the target object. As an exemplary implementation, the above target object can correspond to an account, and the account can have corresponding channel authority when registered. Based on this, the object channel authority of the target object can be directly determined from the corresponding account of the target object.
[0116] Afterwards, the third target channel authority corresponding to each third initial knowledge data determined above can be determined, and for each third initial knowledge data, it can be determined whether the object channel authority of the target object includes the third target channel authority corresponding to the third initial knowledge data.
[0117] Optionally, when it is determined that the object channel authority includes the third target channel authority, it means that the target object has the authority to obtain the third initial knowledge data, and therefore, the third initial knowledge data can be determined as the third knowledge data.
[0118] On the contrary, when it is determined that the object channel authority does not include the third target channel authority, it means that the target object does not have the authority to obtain the third initial knowledge data. Therefore, the third initial knowledge data can be determined as non-third knowledge data.
[0119] According to the above method, a plurality of third knowledge data can be matched from the preset keyword knowledge database.
[0120] Step 104: sort the first knowledge data and the second knowledge data to obtain a preset number of fourth knowledge data, where the fourth knowledge data is the first knowledge data or the second knowledge data.
[0121] Step 105: Determine the question and answer text of the question text based on the third knowledge data and the fourth knowledge data.
[0122] The following is a unified description of step 104 and step 105:
[0123] In the embodiment of the present application, since the first knowledge data and the second knowledge data are knowledge data acquired from the knowledge database through vector retrieval and word segmentation retrieval respectively, and the third knowledge data is knowledge data acquired through keyword retrieval, which is obtained by matching keywords with word segmentation texts, and the degree of matching between the knowledge data text itself and the question text is low, the execution subject of the embodiment of the present application can sort the first knowledge data and the second knowledge data, and does not sort the third knowledge data.
[0124] As an optional implementation, the execution subject of the embodiment of the present application may use a preset sorting model to remove duplicates from the first knowledge data and the second knowledge data and then sort them to obtain a knowledge data sequence. The knowledge data sequence may be arranged in order from high to low matching degree with the question text, or may be arranged in order from low to high matching degree, and the embodiment of the present application does not limit this. Furthermore, the knowledge data in the knowledge data sequence may include the first knowledge data and the second knowledge data.
[0125] Based on this, in order to obtain knowledge data with a high degree of matching with the question text, the execution subject of the embodiment of the present application can obtain a preset amount of knowledge data (hereinafter referred to as the fourth knowledge data for the sake of distinction) from the above-mentioned knowledge data sequence. It can be understood that since the knowledge data included in the knowledge data sequence is the first knowledge data and the second knowledge data, each of the above-mentioned fourth knowledge data can be the first knowledge data or the second knowledge data.
[0126] Optionally, if the above-mentioned knowledge data sequence is arranged in descending order of the matching degree with the question text, then the knowledge data that is located in the front of a preset number of the knowledge data sequence can be selected as the fourth knowledge data.
[0127] Optionally, if the above-mentioned knowledge data sequence is arranged in order of low to high matching degree with the question text, then the last preset number of knowledge data in the knowledge data sequence can be selected as the fourth knowledge data.
[0128] In one embodiment, after comprehensively sorting the first knowledge data and the second knowledge data and selecting a preset number of fourth knowledge data, the executing entity of the embodiment of the present application can further determine the answer text of the question text based on the third knowledge data and the fourth knowledge data.
[0129] As an optional implementation, the execution subject of the embodiment of the present application may combine the third knowledge data and the fourth knowledge data into a target knowledge data sequence obtained by comprehensive retrieval. Optionally, the third knowledge data may be placed before the fourth knowledge data to obtain a target knowledge data sequence.
[0130] Afterwards, the above question text and target knowledge data sequence may be input into a pre-trained response model to obtain a response text output by the response model for the question text and target knowledge data sequence.
[0131] The technical solution provided by the embodiment of the present application obtains a question text, converts the question text into a vector text, and performs word segmentation processing on the question text to obtain a word segmentation text, searches a preset knowledge database according to the vector text to obtain multiple first knowledge data, and searches the knowledge database according to the word segmentation text to obtain multiple second knowledge data, searches a preset keyword knowledge database according to the above-mentioned word segmentation text to obtain multiple third knowledge data, wherein the above-mentioned keyword knowledge database includes knowledge data with keywords in the above-mentioned knowledge database, and keywords of each knowledge data; sorts the above-mentioned first knowledge data and second knowledge data to obtain a preset number of fourth knowledge data, the above-mentioned fourth knowledge data is the above-mentioned first knowledge data or the second knowledge data, and determines the question and answer text of the question text according to the above-mentioned third knowledge data and fourth knowledge data. This technical solution pre-builds a knowledge database that can perform vector retrieval and word segmentation retrieval at the same time, as well as a keyword knowledge database that can perform keyword retrieval. Based on this, vector retrieval and word segmentation retrieval can be performed on the preset knowledge database for the acquired question text, and keyword retrieval can be performed on the keyword knowledge database. The knowledge data retrieved by the three retrieval methods can be combined to determine the answer text corresponding to the question text. The combination of the knowledge data retrieved by the three retrieval methods can increase the retrieval hit rate, thereby improving the efficiency and accuracy of retrieving knowledge data, thereby achieving quick and accurate responses to questions.
[0132] See also Figure 2, which is a flow chart of an embodiment of a knowledge database construction method provided in an embodiment of the present application. Figure 2 The process shown in Figure 1 Based on the process shown in the figure, this paper describes how to build a knowledge database. Figure 2 As shown, the process may include the following steps:
[0133] Step 201: Obtain a plurality of preset knowledge data question-answer pairs and knowledge data documents.
[0134] The above-mentioned knowledge data question and answer pair includes a plurality of preset knowledge data questions and knowledge data answers.
[0135] The above-mentioned knowledge data document includes a plurality of knowledge data paragraphs. For example, a file includes a plurality of paragraphs, and each paragraph text may be a knowledge data paragraph.
[0136] In an embodiment of the present application, the execution subject of the embodiment of the present application can obtain multiple knowledge data question and answer pairs and knowledge data documents, and use the knowledge data question and answer pairs and knowledge data documents as data sources to build a knowledge database.
[0137] As an optional implementation, the execution subject of the embodiment of the present application can obtain the above-mentioned knowledge data question-answer pair from a preset first database, and obtain the knowledge data document from a second database. The above-mentioned first database and the second database can be the same database or different databases. For example, the first database can be a database searched by a preset search engine, and the above-mentioned second database can be a database within the enterprise. The embodiment of the present application does not limit this.
[0138] Step 202: construct multiple knowledge data, as well as a text vector and a preset question text corresponding to each knowledge data based on the above-mentioned knowledge data question-answer pairs and knowledge data documents.
[0139] Step 203: Obtain the channel authority corresponding to each piece of knowledge data, and establish a corresponding relationship between the knowledge data and the channel authority.
[0140] The following is a unified description of step 202 and step 203:
[0141] As can be seen from the description in step 102, the knowledge database may include multiple knowledge data, each knowledge data may correspond to a text vector and a preset question text, and each knowledge data may correspond to at least one channel authority.
[0142] Based on this, after obtaining multiple knowledge data question and answer pairs and knowledge data documents, the executing entity of the embodiment of the present application can use the above-mentioned knowledge data question and answer pairs and knowledge data documents as data sources to construct multiple knowledge data, as well as the text vectors and preset question texts corresponding to each knowledge data.
[0143] Afterwards, the channel authority corresponding to each knowledge data can be obtained, and the corresponding relationship between knowledge data and channel authority can be constructed, so that a knowledge database can be constructed including multiple knowledge data, text vectors and preset question texts corresponding to each knowledge data, and at least one channel authority corresponding to each knowledge data.
[0144] As an optional implementation method, the executing entity of the embodiment of the present application may determine the knowledge data answers in the knowledge data question and answer pairs as knowledge data, and for each knowledge data question corresponding to the knowledge data answer, use a pre-trained vector model to convert the knowledge data question into a question vector, and determine the question vector as a text vector of the knowledge data (that is, the corresponding knowledge data answer), and determine the knowledge data question as a preset question text of the knowledge data.
[0145] Accordingly, for the above-mentioned knowledge data document, the knowledge data document can be split into multiple paragraphs of knowledge data according to the preset splitting rules, and each paragraph of knowledge data can be determined as knowledge data. Among them, the above-mentioned splitting rules can be split according to the number of words, and / or split according to punctuation marks, etc., which are not limited in the embodiments of the present application. For example, the above-mentioned splitting rules can be splitting the knowledge data document according to 500 words, and before each segmented document reaches 500 words, find the nearest end symbol (period, exclamation mark, line break, etc.) to split it, so as to keep each segmented text relatively complete.
[0146] Based on this, each paragraph knowledge data can be converted into a paragraph vector using a pre-trained vector model, and the paragraph vector is determined as the text vector of the knowledge data (i.e., paragraph knowledge data). Afterwards, each paragraph knowledge data can be summarized using a pre-trained summary model to summarize a question text for each paragraph knowledge data, thereby obtaining the question text corresponding to each paragraph knowledge data, and determining the question text corresponding to each paragraph knowledge data as the preset question text of the knowledge data (i.e., paragraph knowledge data).
[0147] In addition, the user can set one or more keywords for any knowledge data determined above. The keywords can be words that are used frequently in search engines. Based on this, the executive entity of the embodiment of the present application can copy the knowledge data with set keywords, the keywords of the knowledge data, and the channel permissions of the knowledge data to the sub-database in the knowledge database, thereby constructing a keyword knowledge database.
[0148] The technical solution provided in the embodiment of the present application obtains multiple preset knowledge data question-answer pairs and knowledge data documents, and constructs multiple knowledge data, as well as the text vector and preset question text corresponding to each knowledge data according to the above knowledge data question-answer pairs and knowledge data documents, obtains the channel authority corresponding to each knowledge data, and constructs the corresponding relationship between knowledge data and channel authority. This technical solution uses data question-answer pairs and knowledge data documents as data sources to construct knowledge data in the knowledge database, the text vector and preset question text corresponding to each knowledge data, and the channel authority of each knowledge data, thereby realizing a comprehensive and efficient construction of the knowledge database.
[0149] See also Figure 3 , is a flow chart of another embodiment of a method for constructing a knowledge database provided in an embodiment of the present application. Figure 3 As shown, the process may include the following:
[0150] S1: Use Elasticsearch 8 as the vector database (hereinafter referred to as the knowledge database), which can support both vector search and word segmentation search. The knowledge data entered into the knowledge database mainly includes the fields of title, content, vector, channel, keyword (optional), and additional content.
[0151] S2: Develop a knowledge management module: Design encyclopedia (question-answer pairs) and document library (documents) as knowledge input sources:
[0152] (1) The encyclopedia supports batch entry into the knowledge database. The knowledge data questions are the texts that are retrieved by vectors and word segmentation (i.e., text vectors and preset question texts), and the knowledge data answers are the knowledge data in the knowledge database.
[0153] (2) After the document library is input, the content is split and entered into the search database. The segmented content is used as the text to be searched by the vector (i.e., the text vector). The content is then summarized using the large model and a matching question is output as the text for word segmentation search, i.e., the preset question text.
[0154] The text retrieved by the vector is converted into a text vector through a vector model for storage; if an SEO (Search Engine Optimization) keyword is configured, the knowledge point is synchronously stored in a keyword knowledge database (multiple ones are possible).
[0155] Furthermore, permission control can be added to each knowledge data, and channel permissions can be used as permission control. When knowledge is entered, if the corresponding channel is set, it will be stored in the retrieval database at the same time, otherwise it will be set to be completely public (all objects using the knowledge database can search).
[0156] Further, based on Figure 3 The knowledge database established by the process shown in the figure can be executed by the execution subject of the embodiment of the present application through Figure 4 The process shown is to answer questions.
[0157] See also Figure 4 , which is a flow chart of an embodiment of another question answering method provided in an embodiment of the present application. Figure 4 The process shown can be found in Figure 3 The knowledge database established by the process shown in the figure is searched. Figure 4 As shown, the process may include the following:
[0158] S1. Developing a search system: The execution subject of the embodiment of the present application can enter the search system and perform three types of searches simultaneously according to user questions:
[0159] (1) Vector retrieval: The question text is converted into vector text through a vector model, and the knowledge data with the highest similarity is recalled based on the vector. Then, the data is filtered by channel authority and the top K pieces of data are returned.
[0160] (2) Word segmentation retrieval: Segment the question text and retrieve K pieces of knowledge data with the highest word segmentation text retrieval score and that meet the channel authority;
[0161] (3) SEO search: Segment the question text and retrieve up to three pieces of data that hit the SEO keywords, have the highest matching degree, and meet the channel authority.
[0162] The above three types of searches all add channel-based permission filtering. For example: User A is a financial employee, and their knowledge permissions are financial channels and fully public content. Other data such as human resources related data will be filtered out.
[0163] The vector search and word segmentation search are rearranged through the ranking model to obtain the K highest ranked data.
[0164] Afterwards, the SEO search can be merged at the front, and the merged result K+3 data can be returned to ensure that the amount of data returned is within a controllable range.
[0165] Furthermore, the above SEO search data can be used as a human intervention priority. For example, in an after-sales system, there is a currently popular knowledge point "trade-in" process. By setting this keyword and associating it with this knowledge, when users search for this keyword, this knowledge will be forced to be returned to cope with the scenario of high-frequency questions.
[0166] S2: Develop question-answering module:
[0167] (1) During the entire question-and-answer process, if it is not the first time a question is asked, the historical question-and-answer content plus the user's latest question needs to be submitted to the preset large model to generate a complete question.
[0168] (2) Call the retrieval system based on the first question or the regenerated question to obtain the returned results.
[0169] Submit the question and search results to the big model for reading comprehension, select multiple appropriate results from them, summarize them, and return them to the user, thereby providing the answer text corresponding to the question text raised by the user.
[0170] The technical solution provided by the embodiment of the present application optimizes document entry before retrieval: after the document is disassembled, the large model is used to summarize the content of each disassembled section, and a matching question is output for subsequent use in word segmentation search. Based on this, the hybrid search consists of three methods: (1) vector search: based on the internal knowledge of the enterprise, a proprietary vector model is trained; (2) word segmentation search: based on the internal word library of the enterprise, the entire word segmentation word library is improved, and the word segmentation search is based on the questions of each knowledge point (including the questions summarized after disassembly) for retrieval; (3) SEO search: high-frequency knowledge points are set with keywords, and the keywords are returned in this search mode. Based on the above search, data permission verification can be performed: when the search results are recalled, permission filtering is performed based on the channel field, so that different users can obtain different search results according to their permissions. Finally, according to the results of vector and word segmentation recall, a second-order rearrangement is performed through the trained sorting model, combining the advantages of both, to obtain more accurate search results. The rearranged results are merged with SEO search to increase the expected return results. It is achieved that the knowledge data corresponding to the question text is retrieved in the knowledge database more efficiently and accurately, thereby achieving efficient and accurate answering of questions.
[0171] join Figure 5 , is a block diagram of an embodiment of a question answering device provided in an embodiment of the present application. Figure 5 As shown, the device may include:
[0172] The acquisition module 51 is used to acquire the question text, convert the question text into a vector text, and perform word segmentation processing on the question text to obtain a word segmentation text;
[0173] A first retrieval module 52 is used to search a preset knowledge database according to the vector text to obtain a plurality of first knowledge data, and to search the knowledge database according to the segmented text to obtain a plurality of second knowledge data;
[0174] A second search module 53 is used to search a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data; wherein the keyword knowledge database includes knowledge data with keywords in the knowledge database and keywords of each of the knowledge data;
[0175] A sorting module 54, configured to sort the first knowledge data and the second knowledge data to obtain a preset number of fourth knowledge data, where the fourth knowledge data is the first knowledge data or the second knowledge data;
[0176] The determination module 55 is used to determine the answer text of the question text according to the third knowledge data and the fourth knowledge data.
[0177] like Figure 6 As shown, it is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, including a processor 61, a communication interface 62, a memory 63, a communication bus 64 and at least two drive modules 65, wherein the processor 61, the communication interface 62, and the memory 63 communicate with each other through the communication bus 64.
[0178] Memory 63, used for storing computer programs;
[0179] A driving module 65, used to drive the vehicle;
[0180] In one embodiment of the present application, the processor 61 is used to implement the question answering method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 63, including:
[0181] Obtaining a question text, converting the question text into a vector text, and performing word segmentation processing on the question text to obtain a word segmentation text;
[0182] Searching a preset knowledge database according to the vector text to obtain a plurality of first knowledge data, and searching the knowledge database according to the word segmentation text to obtain a plurality of second knowledge data;
[0183] Searching a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data; wherein the keyword knowledge database includes knowledge data having keywords in the knowledge database and keywords of each of the knowledge data;
[0184] sorting the first knowledge data and the second knowledge data to obtain a preset number of fourth knowledge data, where the fourth knowledge data is the first knowledge data or the second knowledge data;
[0185] An answer text for the question text is determined based on the third knowledge data and the fourth knowledge data.
[0186] An embodiment of the present application also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the question answering method provided in any of the aforementioned method embodiments are implemented.
[0187] The embodiment of the present application further provides a question answering system, which may include a question answering terminal and a question answering server, and the question answering terminal and the question answering server may be communicatively connected.
[0188] The question answering terminal can be used to collect question text and send the question text to the question answering server;
[0189] The question answering server may be used to obtain the question text and execute the steps of the question answering method provided in any one of the aforementioned method embodiments to determine the answer text of the question text.
[0190] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0191] Through the text of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.
[0192] It should be understood that the terms used in the text are only for the purpose of the specific example implementation of the text, and are not intended to be limited. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text can also be represented to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of the stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or their combinations. The method steps, processes, and operations of the text in the text are not interpreted as necessarily requiring them to be performed in the specific order of the text or description, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps can be used.
[0193] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A question answering method, characterized in that: The method comprises: Obtaining a question text, converting the question text into a vector text, and performing word segmentation processing on the question text to obtain a word segmentation text; Searching a preset knowledge database according to the vector text to obtain a plurality of first knowledge data, and searching the knowledge database according to the word segmentation text to obtain a plurality of second knowledge data; Searching a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data; wherein the keyword knowledge database includes knowledge data having keywords in the knowledge database and keywords of each of the knowledge data; sorting the first knowledge data and the second knowledge data to obtain a preset number of fourth knowledge data, where the fourth knowledge data is the first knowledge data or the second knowledge data; An answer text for the question text is determined based on the third knowledge data and the fourth knowledge data.
2. The method according to claim 1, characterized in that The obtaining of the question text includes: Receive the text of the initial question posed by the subject; Determine whether there is a historical conversation text of the subject in a preset database, the historical conversation text including a historical question text raised by the subject in a historical time period and a historical answer text corresponding to the historical question text; In the case where it is determined that the historical conversation text exists, the historical conversation text and the initial question text are input into a preset question model to obtain a complete question text output by the question model; and the complete question text is determined as the question text; In the case where it is determined that the historical dialogue text does not exist, the initial question text is determined as the question text.
3. The method according to claim 1, characterized in that The knowledge database includes a plurality of pre-stored knowledge data and a text vector of each of the knowledge data, and each of the knowledge data corresponds to at least one channel authority; The step of searching a preset knowledge database according to the vector text to obtain a plurality of first knowledge data includes: Determining the similarity between the vector text and each of the text vectors; Determine the knowledge data corresponding to the text vectors whose similarity is greater than a preset similarity threshold as the first initial knowledge data, and obtain a plurality of first initial knowledge data; Determine the target object for raising the question text, and obtain the object channel authority of the target object; Determine the first target channel authority corresponding to each of the first initial knowledge data; For each of the first initial knowledge data, determine whether the object channel authority includes the first target channel authority corresponding to the first initial knowledge data; if it is determined that the object channel authority includes the first target channel authority, determine the first initial knowledge data as the first knowledge data.
4. The method according to claim 1, characterized in that: The knowledge database includes a plurality of pre-stored knowledge data and a preset question text corresponding to each of the knowledge data, and each of the knowledge data corresponds to at least one channel authority; The step of searching the knowledge database according to the segmented text to obtain a plurality of second knowledge data includes: Matching the segmented text with a preset question text corresponding to each piece of knowledge data to obtain a matching score between each preset question text and the segmented text; Determine the knowledge data corresponding to the preset question text whose matching score is greater than the preset score threshold as the second initial knowledge data, and obtain a plurality of second initial knowledge data; Determine the target object for raising the question text, and obtain the object channel authority of the target object; Determine the second target channel authority corresponding to each of the second initial knowledge data; For each second initial knowledge data, determine whether the object channel authority includes the second target channel authority corresponding to the second initial knowledge data; if it is determined that the object channel authority includes the second target channel authority, determine the second initial knowledge data as the second knowledge data.
5. The method according to claim 3 or 4, characterized in that: The knowledge database is constructed in the following way: Acquire a plurality of preset knowledge data question-answer pairs and a knowledge data document, wherein the knowledge data question-answer pairs include a plurality of preset knowledge data questions and knowledge data answers, and the knowledge data document includes a plurality of knowledge data paragraphs; Constructing a plurality of knowledge data, as well as a text vector and a preset question text corresponding to each knowledge data according to the knowledge data question-answer pair and the knowledge data document; The channel authority corresponding to each piece of knowledge data is obtained, and a corresponding relationship between the knowledge data and the channel authority is established.
6. The method according to claim 5, characterized in that The step of constructing a plurality of knowledge data, a text vector corresponding to each knowledge data, and a preset question text according to the knowledge data question-answer pair and the knowledge data document includes: Determining the knowledge data answer in the knowledge data question-answer pair as knowledge data; For each knowledge data question corresponding to the knowledge data answer, convert the knowledge data question into a question vector using a pre-trained vector model, determine the question vector as a text vector of the knowledge data, and determine the knowledge data question as a preset question text of the knowledge data; For the knowledge data document, split the knowledge data document into a plurality of paragraphs of knowledge data according to a preset splitting rule, and determine each paragraph of knowledge data as knowledge data; Using a pre-trained vector model to convert each of the paragraph knowledge data into a paragraph vector, and determining the paragraph vector as a text vector of the knowledge data; Each of the paragraph knowledge data is summarized using a pre-trained summary model to obtain a question text corresponding to each of the paragraph knowledge data, and the question text corresponding to each of the paragraph knowledge data is determined as a preset question text of the knowledge data.
7. The method according to claim 1, characterized in that The keyword knowledge database includes a plurality of pre-stored knowledge data and keywords corresponding to each of the knowledge data, and each of the knowledge data corresponds to at least one channel authority; The method searches a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data, including: Matching the segmented text with each keyword in the keyword knowledge database to obtain a matching score corresponding to each keyword and the segmented text; Determine the knowledge data corresponding to the keyword whose matching score is greater than a preset score threshold as the third initial knowledge data; Determine the target object for raising the question text, and obtain the object channel authority of the target object; Determining the third target channel authority corresponding to each of the third initial knowledge data; For each of the third initial knowledge data, determine whether the object channel authority includes the third target channel authority corresponding to the third initial knowledge data; if it is determined that the object channel authority includes the third target channel authority, determine the third initial knowledge data as the third knowledge data.
8. The method according to claim 1, characterized in that: The step of determining the answer text of the question text according to the third knowledge data and the fourth knowledge data includes: Combining the third knowledge data and the fourth knowledge data into a target knowledge data sequence; The question text and the target knowledge data sequence are input into a pre-trained response model to obtain a response text output by the response model.
9. A question answering device, characterized in that: The device comprises: An acquisition module is used to acquire a question text, convert the question text into a vector text, and perform word segmentation processing on the question text to obtain a word segmentation text; A first retrieval module is used to search a preset knowledge database according to the vector text to obtain a plurality of first knowledge data, and to search the knowledge database according to the segmented text to obtain a plurality of second knowledge data; A second search module is used to search a preset keyword knowledge database according to the segmented text to obtain a plurality of third knowledge data; wherein the keyword knowledge database includes knowledge data with keywords in the knowledge database and keywords of each of the knowledge data; a sorting module, used to sort the first knowledge data and the second knowledge data to obtain a preset number of fourth knowledge data, where the fourth knowledge data is the first knowledge data or the second knowledge data; A determination module is used to determine the answer text of the question text according to the third knowledge data and the fourth knowledge data.
10. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is used to execute a question answering program stored in the memory to implement the question answering method according to any one of claims 1 to 8.
11. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the question answering method according to any one of claims 1 to 8.
12. A question answering system, characterized in that: The system comprises: a question answering terminal and a question answering server, wherein the question answering terminal and the question answering server are in communication connection; The question answering terminal is used to collect question text and send the question text to the question answering service end; The question answering server is used to obtain the question text and execute the question answering method according to any one of claims 1 to 8 to determine the question and answer text of the question text.
Citation Information
Patent Citations
Text retrieval method, model training method, text retrieval device and storage medium
CN111274808A
Intelligent question and answer method, device and equipment and storage medium
CN117591658A
Information retrieval method and device, electronic equipment and storage medium
CN118394916A
Private domain document question and answer method and device, electronic equipment and storage medium
CN118467699A
Cited By
Natural language query method and system for relational database
CN119917519A
Vector database retrieval system, method and computer readable medium based on retrieval augmented generation
TWI931005B
