Operation method and device of AI question-answering system, equipment and medium
By using vector similarity matching and domain feature segmentation, question units and knowledge units are generated, which solves the problems of low accuracy and response speed in existing AI question answering systems and achieves more accurate and faster answer acquisition.
Patent Information
- Application Number
- CN202610178675.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-06
- Publication Date
- 2026-05-26
AI Technical Summary
Existing AI question-answering systems, in their semantic similarity-based retrieval mode, are prone to introducing noise, which reduces accuracy and response speed, making it impossible to accurately answer users' questions about single knowledge points.
By transforming query requests into query vectors, performing vector similarity matching, obtaining the matched information units, and dividing the target document based on domain feature information, question units and knowledge units are generated to provide information interaction services.
It improves the accuracy and response speed of AI question-answering systems, reduces the "illusion" of large models, and makes answers more accurate and retrieval time shorter.
Smart Images

Figure CN122087080A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and in particular to a method, apparatus, device and medium for operating an AI question-answering system. Background Technology
[0002] AI question-answering systems include a knowledge base, which is an electronic collection of professional knowledge that is systematically organized, stored, and managed. It can structurally integrate scattered information, data, experience, and rules, enabling them to be efficiently retrieved, accessed, and applied.
[0003] Most existing knowledge base question answering systems adopt a "question-to-paragraph" (Q2P) retrieval model. When a user asks a question, the system converts the user's question into a semantic vector, directly calculates the similarity between it and unstructured text fragments (such as paragraphs from a product manual) stored in the knowledge base, and then recalls the text fragment with the highest similarity as the answer.
[0004] However, document fragments typically contain dense descriptive information, covering multiple potential knowledge points, while user questions are often short texts targeting a single knowledge point. This makes retrieval based solely on semantic similarity prone to introducing significant noise and creating a "model illusion." For example, a paragraph containing multiple functions might be incorrectly recalled because it includes some keywords, even though the paragraph doesn't directly answer the user's specific question, thus reducing the accuracy of the question-answering system and the user experience. Furthermore, the Q2P retrieval model requires recalling the most similar text fragments from unstructured text fragments as answers, which takes longer and also degrades the user experience.
[0005] Therefore, improving the accuracy and response speed of AI question-answering systems is a pressing technical problem that needs to be solved. Summary of the Invention
[0006] The present invention aims to provide a method, apparatus, device and medium for operating an AI question-answering system.
[0007] According to a first aspect of the present invention, a method for operating an AI question-answering system is provided, comprising performing a first-level retrieval based on a query request input by a user, including: converting the query request into a query vector; performing vector similarity matching in question units based on the query vector; if the vector similarity matching is successful, obtaining the matched information unit associated with the question unit, and returning the information unit as a standard answer to the user.
[0008] Preferably, the process involves acquiring a target document and determining its domain feature information; dividing the target document based on the domain feature information to obtain information units; obtaining question units corresponding to the information units; and obtaining knowledge units based on the question units and the information units, wherein the knowledge units are used to provide information interaction services.
[0009] Preferably, the target document is preprocessed to construct a document semantic vector; based on the document semantic vector, the semantic similarity value between the target document and each candidate domain is obtained; based on a preset domain structure template, the structure fit value of the target document is obtained; based on the semantic similarity value and the structure fit value, the final domain feature information is determined.
[0010] Preferably, based on the first formula
[0011] The document semantic vector is obtained, where V doc The document's semantic vector is represented by n; the total number of words in the target document is represented by w. i This represents the i-th word in the word sequence of the target document; E(w) i ) represents the word vector of the i-th word; λ i The weight value representing the term frequency-inverse document frequency of the i-th word.
[0012] Preferably, based on the second formula
[0013] The semantic similarity value is obtained, where Val sem (j) represents the semantic similarity value; V doc Represents the document semantic vector; μ j Represents the preset center vector of the j-th candidate region; ||V doc || represents the length of the document semantic vector; ||μ j || represents the vector length of the preset center vector; Cosine() represents the cosine similarity function.
[0014] Preferably, based on the third formula
[0015] The structural fit value is obtained, where Val str (j) represents the structure fit value; D represents the target document; P j N represents the domain structure template; match (D,P) j This indicates that the domain structure template P of the candidate domain was successfully matched in the target document D.j The total number of paragraphs; N para β represents the total number of paragraphs in the target document D; β is the amplification factor; γ represents the bias factor; and Sigmoid() is the activation function.
[0016] Preferably, based on the fourth formula
[0017] The domain feature information is obtained, where TargetDomain represents the domain feature information; C represents the candidate domain set; C j The expression within parentheses represents the candidate neighborhood with the largest value; argmax() represents finding the candidate neighborhood C in the set of candidate neighborhoods C that maximizes the value of the expression within the parentheses. j ω1 is the semantic weight; ω2 is the structural weight; Val str (j) is the structural fit value; Val sem (j) represents the semantic similarity value.
[0018] Preferably, the document semantic vector is constructed based on the title and / or all content of the target document.
[0019] Preferably, a sequence of logical segmentation points in the target document is determined based on a set of logical boundary rules that match the domain feature information; based on the sequence of logical segmentation points, text segments between adjacent logical segmentation points in the sequence of logical segmentation points are aggregated to generate initial semantic units; the initial semantic units are subjected to semantic self-sufficiency processing to generate corresponding information units.
[0020] Preferably, based on the fifth formula
[0021] The logical segmentation point sequence is obtained, where L represents the logical segmentation point sequence; i represents an integer index; N para This represents the total number of paragraphs in the target document D; D i R represents the i-th paragraph in the target document D; bound `<match()>` represents the set of logical boundary rules; `Match()` represents the regular expression matching function; `True` indicates that the expression is correct.
[0022] Preferably, based on the sixth formula
[0023] The initial semantic unit is obtained, wherein U init_i Indicates the initial semantic unit; Start i The line number indicating the beginning of the semantic jurisdiction; End i Indicates the terminating line number of the semantic jurisdiction; D kThis represents the k-th line of text in the target document D; k represents the circular index; Concat() represents the text concatenation operation.
[0024] Preferably, based on the seventh formula
[0025] The information unit is obtained, wherein U final_i Represents the information unit; U init_i The initial semantic unit is represented by p; p represents a pronoun; e represents an entity noun; p set Indicated in the initial semantic unit U init_i The set of pronouns p detected in E; set This represents the set of entity nouns e extracted in the context window; Model(p,e) represents the scoring function of the coreference resolution model; θ represents the replacement threshold; Replace() represents the text replacement operation.
[0026] Preferably, the target document is segmented using a preset character length, a specified character set, or a large language model.
[0027] Preferably, based on the information unit, a generative prompt word is obtained; the generative prompt word is input into a pre-trained language model to obtain an initial question set; the initial question set is subjected to consistency verification to obtain the question unit.
[0028] Preferably, generative prompts are obtained based on the dimensions of role instructions, task constraints, and context injection.
[0029] Preferably, the generative prompt words are parsed to obtain a parsing result; semantic inference is performed on the parsing result to generate a text stream containing multiple natural language questions; the text stream is parsed and encapsulated to obtain the initial question set.
[0030] Preferably, a semantic consistency verification module is used to perform consistency verification on the initial problem set; the semantic consistency verification module includes a loopback verification mechanism.
[0031] Preferably, based on the eighth formula
[0032] The initial question set is subjected to a consistency check to obtain the question unit, where Precision represents precision, Recall represents recall, and F1 Score represents the overall score.
[0033] Preferably, the problem units are classified and / or graded.
[0034] Preferably, the query request is decomposed into several independent sub-questions based on the semantic distribution of keywords.
[0035] Preferably, if the first-level search fails, a second-level search is performed, including: switching the search target from the question unit to the information unit; calculating the vector similarity between the query vector and each of the information units; and if the vector similarity matches, returning the corresponding information unit as the answer to the user.
[0036] Preferably, if the second-level search fails to find a match, a third-level search is performed, including: extracting keywords from the user's input query request; performing keyword retrieval on the information unit based on the keywords; and displaying the information unit as a candidate answer list to the user if the information unit contains the keywords.
[0037] According to a second aspect of the present invention, an operating apparatus for an AI question-answering system is provided, characterized in that it comprises: a document acquisition module, configured to acquire a target document and determine the domain feature information of the target document; an information unit generation module, configured to divide the target document into information units based on the domain feature information; a question unit generation module, configured to obtain question units corresponding to the information units based on the information units; and a knowledge unit generation module, configured to encapsulate the question units and the information units to form knowledge units, thereby providing information interaction services.
[0038] According to a third aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the computer program is loaded and executed by the processor to perform the operations performed in the operation method of the AI question-answering system in the embodiments of the present application.
[0039] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, characterized in that the computer program, when executed by a processor, performs operations as performed in the operation method of the AI question-answering system in the embodiments of the present application.
[0040] This invention provides a method, apparatus, device, and medium for operating an AI question-answering system. Traditional AI question-answering systems typically use a question-to-document matching approach, resulting in low accuracy in the answers. This invention obtains a target document and determines its domain feature information; based on the domain feature information, the target document is divided into information units; based on the information units, corresponding question units are obtained; and based on the question units and information units, knowledge units are obtained. These knowledge units are used to provide an information interaction service, thus improving the accuracy of the AI question-answering system.
[0041] This invention provides an AI question-answering system to address the technical problems inherent in the aforementioned Q2P retrieval model. This AI question-answering system eliminates the need for the Q2P retrieval model to first match text paragraphs in a knowledge base and then extract / generate answers from those paragraphs. This reduces the "illusion" of large models, resulting in more accurate answers and faster response times. Attached Figure Description
[0042] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings:
[0043] Figure 1 This is a schematic diagram of the implementation environment of the operation method of the AI question-answering system provided in the embodiments of this application;
[0044] Figure 2 This is a schematic diagram of the composition structure of a server according to an embodiment of this application;
[0045] Figure 3 This is a flowchart illustrating the operation method of the AI question-answering system provided in the embodiments of this application;
[0046] Figure 4 This is a flowchart illustrating the implementation of step S301, as provided in the embodiments of this application, to determine the domain feature information of the target document.
[0047] Figure 5 This is a flowchart illustrating the implementation of step S302, which involves obtaining the information unit, according to an embodiment of this application.
[0048] Figure 6 This is a flowchart illustrating the implementation of step S303 in the embodiments of this application to obtain the problem unit corresponding to the information unit;
[0049] Figure 7 This is a fallback flowchart for the online question-and-answer phase on the user side, provided according to an embodiment of this application.
[0050] Figure 8 This is a schematic diagram of the operating device of the AI question-answering system provided in the embodiments of this application. Detailed Implementation
[0051] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0052] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0053] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0054] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0055] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0056] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0057] Before providing a further detailed description of the embodiments of this application, the nouns and terms that may be involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0058] Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technical field within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to have perception, reasoning, and decision-making capabilities. AI technology is a comprehensive discipline involving a wide range of fields, encompassing both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, pre-trained model technology, operating / interactive systems, and mechatronics. Pre-trained models, also known as large models or foundational models, can be widely applied to downstream tasks in various AI fields after fine-tuning. AI software technologies mainly include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0059] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP deals with natural language, the language people use in daily life, and is closely related to linguistics; it also involves computer science and mathematics. Pre-trained models, a crucial technique for model training in artificial intelligence, evolved from large language models (also known as pre-trained language models) in NLP. After fine-tuning, these large language models can be widely applied to downstream tasks. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0060] Large language models (LLMs) are language models based on artificial neural networks. The "large" in their name refers to the large number of parameters and the massive scale of training data. LLMs typically employ self-supervised machine learning methods, enabling training on vast amounts of unlabeled text. They are specifically designed for natural language processing tasks, particularly language generation.
[0061] The following describes some key terms or abbreviations that may be involved in the embodiments of this application.
[0062] AI question-answering system: This refers to an AI product, or simply a system, that utilizes AI technology to develop an artificial intelligence product capable of intelligent interaction with users. For example, the AI product can engage in question-and-answer dialogues with users, or interact with users through sensory means based on user commands. Optionally, the aforementioned AI product may include intelligent robots, intelligent question-answering platforms, etc.
[0063] Knowledge Unit: A question-and-answer session with a certain level of knowledge content.
[0064] User search statements: including user voice and text input.
[0065] "Catch-up" refers to the strategies and mechanisms employed by an intelligent question-answering or dialogue system when a user's query fails to match any intent, entity, or standard question in the system's existing knowledge base. The purpose of this catch-up mechanism is to ensure a reasonable and helpful response is provided to the user in all circumstances, avoiding negative experiences such as no response or a "I don't know" reply, thereby maintaining the continuity of the dialogue and user satisfaction.
[0066] The implementation environment of the knowledge unit operation method provided in the embodiments of this application will be described below.
[0067] Figure 1 This is a schematic diagram illustrating the implementation environment of the AI question-answering system operation method provided in the embodiments of this application. The implementation environment includes: terminal 101 and server 102.
[0068] In this embodiment of the application, the terminal 101 can be a client such as a smartphone, tablet computer, laptop computer, or desktop computer. An AI question-and-answer system can be configured on the terminal 101. Users can input relevant questions through the AI question-and-answer system on the terminal 101 and send the relevant questions to the server 102 through the network between the terminal 101 and the server 102.
[0069] Optionally, terminal 101 generally refers to one or more of a plurality of terminals, and this application embodiment only uses the above-mentioned terminal 101 as an example for illustration. Those skilled in the art will know that the number of the above-mentioned terminals 101 can be more. For example, there may be dozens or hundreds of terminals 101, or even more. In this case, the implementation environment of the above-mentioned AI question-answering system operation method also includes other terminals. This application embodiment does not limit the number and type of terminals.
[0070] In this embodiment of the application, the server 102 is used to provide the terminal 101 with services such as data acquisition, data processing and data storage.
[0071] For example, a user opens the consultation interface of a legal service application on their mobile phone and enters questions such as "How to protect my rights when my upstairs neighbor's apartment leaks water?" into the input box. The question is then transmitted over the network to the server 102. Based on the user's input, the server 102 retrieves relevant question units from the pre-built knowledge base of the AI question-answering system and generates a final response based on the information units contained in the knowledge units corresponding to the retrieved question units. Specifically, before providing question-answering services to the user on the terminal 101, the server 102 pre-establishes knowledge bases for various designed products, which contain several knowledge units.
[0072] It should be noted that each of the above-mentioned AI question-answering systems may contain one or more of the above-mentioned knowledge units in its knowledge base. After receiving the question sent by the above-mentioned terminal 101, the above-mentioned server 102 may directly search for the corresponding answer in the knowledge base of the above-mentioned AI question-answering system that contains all the knowledge units, or it may first determine the above-mentioned knowledge base corresponding to the above-mentioned question and then search for the answer in the above-mentioned knowledge base.
[0073] In this embodiment, the server 102 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0074] In order to implement the corresponding functions on the server 102, the memory of the server 102 needs to store the program that implements the corresponding function. To facilitate understanding of the hardware configuration of the server 102, the server 102 will be described below.
[0075] like Figure 2 The diagram shown is a schematic diagram of the composition structure of the server 102 described above in this application. The server 102 in this embodiment may include: a processor 201, a memory 202, a communication interface 203, an input unit 204, a display 205, and a communication bus 206.
[0076] The processor 201, the memory 202, the communication interface 203, the input unit 204, and the display 205 all communicate with each other through the communication bus 206.
[0077] In this embodiment, the processor 201 can be a central processing unit, an application-specific integrated circuit, a digital signal processor, an off-the-shelf programmable gate array, or other programmable logic devices.
[0078] The processor 201 can call programs stored in the memory 202. Specifically, the processor 201 can execute the operations performed on the server side in the following embodiments of the AI question-answering system operation method.
[0079] The aforementioned memory 202 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the aforementioned memory 202 stores at least a program for implementing the following functions: acquiring a target document and determining the domain feature information of the target document; dividing the target document based on the domain feature information to obtain information units; obtaining question units corresponding to the information units based on the information units; wherein, the question units and the information units are encapsulated to form a knowledge unit, and the knowledge unit is used to provide information interaction services.
[0080] Optionally, the memory 202 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function (such as paragraph division). The data storage area may store data created during computer use, such as the information unit, the problem unit, and the knowledge unit.
[0081] Optionally, the memory 202 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0082] Optionally, the aforementioned communication interface 203 can be an interface of a communication module.
[0083] It should be noted that, Figure 2 The structure of server 102 shown above does not constitute a limitation on the server in the embodiments of this application. In practical applications, the server may include more than [other components]. Figure 2 More or fewer components as shown, or combinations of certain components.
[0084] like Figure 3 The diagram shown is a flowchart illustrating the operation method of the AI question-answering system provided in this application embodiment. The method specifically includes the following steps:
[0085] Step S301: Obtain the target document and determine the domain feature information of the target document.
[0086] The target document mentioned above refers to the original data source to be transformed into the knowledge base of the AI question-answering system. It can be in the form of various unstructured or semi-structured files. The domain feature information mentioned above refers to the business category or data type to which the document belongs (e.g., laws and regulations, product manuals, casual conversation corpora, etc.). Target documents in different domains often have different text structures and logical densities. Therefore, determining the domain feature information is the basis for selecting the optimal semantic strategy (i.e., how to segment).
[0087] For example, the server receives an electronic document of the Civil Code of the People's Republic of China uploaded by the user. The server identifies hierarchical keywords such as "compilation", "chapter", "section", and "article" by analyzing the text of the document title and preceding content, thereby determining that the above-mentioned domain feature information of the target document is legal and regulatory. Based on the above-mentioned domain feature information, the AI question answering system will automatically load the semantic parsing configuration specifically for processing legal provisions, rather than the general text segmentation configuration.
[0088] Preferably, the target document includes at least one paragraph, which facilitates the AI question-answering system in determining the domain feature information.
[0089] Step S302: Based on the above domain feature information, the above target document is divided to obtain information units.
[0090] It should be noted that, since the original target documents mentioned above are usually quite long and not suitable for direct retrieval, the purpose of this step is to break down the continuous document content into finer-grained information units. These information units are the basic carriers of knowledge and can be either a single physical paragraph or a combination of multiple logically related paragraphs. Furthermore, the rules for obtaining these information units are not fixed but dynamically adjusted according to the type of the target document to ensure the independent readability of each information unit.
[0091] For example, when the AI question-answering system processes Article 1254 of the Civil Code (regarding the provisions on throwing objects from high-rise buildings), the original text may contain multiple paragraphs (such as prohibited circumstances, administrative responsibilities, property management responsibilities, etc.). This step will not divide it into three independent fragments, but will merge all the natural paragraphs under the article and encapsulate them into a complete information unit.
[0092] Optionally, this step does not limit the division of the Civil Code into sections, encapsulating each article as an independent information unit. Furthermore, this step does not restrict the segmentation method.
[0093] Optionally, the aforementioned information unit may include at least one paragraph, or may contain at least a portion of the content of a paragraph.
[0094] Step S303: Based on the above information units, obtain the problem units corresponding to the above information units.
[0095] The aforementioned question units serve as a bridge between users' colloquial questions and specialized document content. Traditional retrieval methods often rely on direct matching between user questions and document content. However, since documents are typically declarative language while user questions are interrogative, a natural semantic gap exists, limiting matching accuracy. This step transforms the declarative information units into interrogative question units by introducing these question units, thereby optimizing the retrieval task from "question-document matching" to "question-question matching," significantly improving the accuracy of the responses.
[0096] For example, for the above information unit about "objects thrown from high-rise buildings", multiple question units can be obtained: (1) scenario-based questions: "What if someone is injured by something thrown from upstairs and it is impossible to find out who threw it?"; (2) liability-related questions: "Does the property management of the community have to bear responsibility for objects thrown from high-rise buildings because it has failed to fulfill its safety guarantee obligations?"; (3) definition-related questions: "How does the Civil Code stipulate the liability for harm caused by objects thrown from high-rise buildings?". This approach makes the answers to users more accurate.
[0097] Step S304: Based on the above-mentioned problem unit and information unit, a knowledge unit is obtained, which is used to provide information interaction services.
[0098] The aforementioned knowledge unit is the smallest retrieval entity stored in a vector database and / or relational database. It establishes a strong mapping relationship from question to answer. This structure ensures that no matter how the user changes the wording of the question, as long as the question unit is hit, the system can accurately retrieve the aforementioned information unit from the corresponding knowledge unit to provide an answer.
[0099] For example, the core content field of the aforementioned knowledge unit encapsulates the aforementioned information unit (i.e., the complete content of Article 1254 of the Civil Code); the index attribute field of the aforementioned knowledge unit encapsulates the aforementioned question unit (such as "What to do if someone throws an object from a high-rise building and can't be found?", "Who compensates for damage to a car caused by something thrown from upstairs?", etc.). When a user enters "Someone in my community threw something and damaged my car" on the consultation interface, the aforementioned AI question-answering system first matches the aforementioned question unit in the aforementioned knowledge unit through semantic matching, and finally outputs the information unit contained in the knowledge unit to the user as legal basis.
[0100] Preferably, in the knowledge base, the aforementioned information units and question units can be combined to form the first knowledge unit, or the aforementioned information units can independently form the second knowledge unit. The first knowledge unit and the second knowledge unit can coexist in the knowledge base, or they can exist separately in the knowledge base. This configuration allows users to have a multi-level fallback strategy when searching; if the first knowledge unit cannot retrieve and return an answer, the user can jump to the second knowledge unit for further retrieval.
[0101] Preferably, the AI question-answering system described above can receive the aforementioned knowledge units imported from external sources.
[0102] Figure 4 This is a flowchart illustrating the implementation of step S301, which determines the domain feature information of the target document, according to an embodiment of this application. The process specifically includes the following steps:
[0103] Step S401: Perform feature preprocessing on the target document to construct a document semantic vector.
[0104] The formula for calculating the semantic vector of the document mentioned above is as follows:
[0105] ,
[0106] Among them, V doc is the document semantic vector of the target document mentioned above; n is the total number of words in the target document mentioned above; w i This represents the i-th word in the word sequence of the target document mentioned above; E(w) i ) represents the word vector of the i-th word mentioned above; λ i This represents the weight value of the term frequency-inverse document frequency of the i-th word mentioned above.
[0107] Specifically, step S401 above also includes: First, the AI question-answering system receives the original target document and performs text cleaning on the target document, removing headers, footers, special symbols, and garbled characters to obtain a clean text sequence; Second, a word segmentation tool (such as Jieba segmentation) is used to segment the text sequence to obtain an ordered word sequence W={w1,w2,...,w... n The third step involves introducing a word weighting mechanism to obtain each of the aforementioned words w in the word sequence W. i The above word vector E(w) i ) and the above-mentioned vocabulary w i The weighted values λi of the word frequency-inverse document frequency in the current context; and the document semantic vector generated by the weighted aggregation.
[0108] It should be noted that E(w) i( ) are pre-trained static vectors.
[0109] In the actual processing of the above target document, the above target document often contains a large number of common words with high frequency but no actual semantic contribution, such as "of", "is", "we", etc. If the vectors of all words are simply averaged, the noise of these common words will drown out the proprietary words that truly have domain differentiability. Therefore, this step introduces the term frequency-inverse document frequency algorithm to automatically reduce the weights of the above common words and increase the weights of the above proprietary words, so as to ensure that the document semantic vector can accurately point to the true business domain to which the document belongs in the high-dimensional space.
[0110] Exemplarily, assume that the above target document is an electronic version of the "Civil Code of the People's Republic of China". For the common auxiliary word "of", the above AI Q&A system calculates the weight value of its term frequency-inverse document frequency ≈ 0.01 (extremely low); for the core noun "civil", the system calculates the weight value of its term frequency-inverse document frequency ≈ 0.85 (high); for the core verb "rights and interests", the system calculates the weight value of its term frequency-inverse document frequency ≈ 0.82 (high). Based on the formula in step S401 above, since the weight of "of" is extremely small, its corresponding word vector has almost no impact on the final result, while the word vectors of "civil" and "rights and interests" dominate the synthesis direction.
[0111] Preferably, the above document semantic vector can be constructed based on all the content of the above target document or based on the title of the above target document.
[0112] Step S402: Based on the above document semantic vector, obtain the semantic similarity value between the above target document and each candidate field.
[0113] The calculation formula for the above semantic similarity value is:
[0114] ,
[0115] where Val sem (j) is the semantic similarity value. The closer the value is to 1, the higher the probability that the above target document belongs to the j-th above candidate field in terms of semantic content; V doc is the above document semantic vector; μ j is the preset central vector of the j-th above candidate field; ||V doc || is the vector length of the above document semantic vector; ||μ j || is the vector length of the above preset central vector; Cosine() is the cosine similarity function.
[0116] In step S402 above, firstly, the AI question-answering system pre-constructs a set C={C1,C2,...,C...} containing multiple candidate domain categories. k (For example, C1 = legal and regulatory field, C2 = program operation and maintenance field, C3 = casual conversation field), for each of the above candidate fields C j The aforementioned AI question-answering systems all possess a pre-defined center vector μ of Cj in a high-dimensional semantic space. j Secondly, calculate the semantic vector V of the above documents respectively. doc The aforementioned preset center vector μ of each of the aforementioned candidate domains j The cosine of the angle between the two vectors in the vector space is calculated, and the result is output as the semantic similarity value mentioned above. Furthermore, the cosine similarity function essentially measures whether two vectors point in the same direction in a multidimensional space to determine the domain to which the target document belongs.
[0117] For example, whether the Civil Code is the full text (hundreds of thousands of words) or just one article (a few dozen words), as long as its core terms (such as "rights" and "obligations") are consistent, they will point to the same things in the vector space.
[0118] Step S403: Based on the preset domain structure template, obtain the structure fit value of the target document.
[0119] The formula for calculating the above structural fit value is:
[0120] ,
[0121] Val str (j) represents the structure fit value; D represents the target document; P j This represents the above-mentioned domain structure template; N match (D,P) j This indicates that the above candidate domain C was successfully matched in the target document D. j The above-mentioned domain structure template P j The total number of paragraphs; N para This represents the total number of paragraphs in the target document D; β is the amplification factor used to widen the score gap; γ is the bias factor used to set the activation threshold; and Sigmoid() is the activation function that ensures the output structure fit value Val. str (j) falls within the interval (0,1).
[0122] Optionally, the above amplification factor β=10 and the above bias factor γ=5 are set in this way to make the structural fit value more accurate.
[0123] It should be noted that this step introduces a structural feature verification mechanism independent of the semantic dimension. In step S403 above, firstly, the AI question answering system first verifies the structural features of each of the above candidate domains C. j The corresponding domain structure template P has been configured. j The above-mentioned domain structure template P j Specifically, this manifests as a pre-defined set of regular expression rules used to digitally describe the inherent characteristics of documents in a specific domain, such as paragraph beginnings, punctuation, or writing format. Secondly, the AI question-answering system loads the domain structure template P corresponding to the current candidate domain. j The process involves iterating through and matching each paragraph of the target document D, and then counting the paragraphs in the target document D that successfully match the domain structure template P. j The number of paragraphs according to any rule is used to calculate the structural fit value Val based on the number of paragraphs mentioned above. str (j).
[0124] In practice, many documents may have similar semantics but vastly different business attributes. For example, a news report about the promulgation of the Civil Code and the original text of the Civil Code may have highly overlapping keywords (such as "code" and "rights"), making them indistinguishable based on semantics alone. Therefore, step S403 above is primarily used to assess whether the document's writing style conforms to the norms of a specific domain.
[0125] For example, assuming the target document is the original text of the Civil Code: the system loads the legal field structure template P. legal The document contained 1260 paragraphs, of which 1100 paragraphs were matched, i.e., N. match =1100; Substituting into the formula, due to the extremely high structural density, the final output structural fit value approaches 0.95, thus accurately determining that the document complies with the structural specifications of the legal provisions.
[0126] Step S404: Based on the above semantic similarity value and the above structural fit value, determine the final domain feature information.
[0127] The formula for calculating the above-mentioned domain feature information is as follows:
[0128] ,
[0129] Where TargetDomain represents the final determined domain feature information; C represents the set of candidate domains mentioned above; C j The argmax() function represents the candidate neighborhood C that maximizes the value of the expression within the parentheses; it searches the set C of candidate neighborhoods for the candidate neighborhood C that maximizes the value of the expression within the parentheses. jω1 and ω2 are semantic weights and structural weights, respectively, used to adjust the contribution of different dimensions in decision-making; Val str (j) is the structure fit value mentioned above; Val sem (j) The above are semantic similarity values.
[0130] It should be noted that, in this step, based on the weight coefficients of the semantic similarity value and the weight coefficients of the structural fit value, the region with the largest weighted sum is searched in the candidate region set C, and the target region with the largest weighted sum is determined as the region feature information of the target document.
[0131] For example, suppose that when determining the affiliation of the Civil Code document, the candidate domain set C = {Legal, News} is set, with semantic weight ω1 = 0.4 and structural weight ω2 = 0.6; for the legal domain: domain feature information = 0.4 x 0.88 (high semantics) + 0.6 x 0.95 (high structurals) = 0.922; for the news domain: domain feature information = 0.4 x 0.88 (high semantics) + 0.6 x 0.01 (low structurals) = 0.346; since 0.922 > 0.346, the domain feature information of the document is finally determined to be legal regulations.
[0132] Figure 5 This is a flowchart illustrating the implementation of step S302, which involves obtaining an information unit, according to an embodiment of this application. The process specifically includes the following steps:
[0133] Step S501: Based on the set of logical boundary rules that match the above-mentioned domain feature information, determine the sequence of logical segmentation points in the above-mentioned target document.
[0134] The formula for calculating the above logical segmentation point sequence is:
[0135] ,
[0136] Where: L is the logical partition sequence, in the form {l1,l2,...,l...} m}, and satisfy l1 <l2<...<l m m is the total number of logical split points; i is an integer index, traversing from 1 to N. para A continuous integer interval N; para The total number of paragraphs in the target document D; D i R represents the i-th paragraph in the target document mentioned above; bound This represents the logical boundary rule set; Match() is the regular expression matching function; True indicates that the expression is correct.
[0137] Specifically, in step S501, firstly, based on the domain feature information mentioned in step S404, the corresponding and preset logical boundary rule set R is retrieved and loaded from the AI question-answering system. bound The above logical boundary rule set R bound The system includes at least one set of logical boundary rules (i.e., feature identifiers) for accurately locating the starting position of the content of the target document D; secondly, the AI question-answering system utilizes the aforementioned set of logical boundary rules R. bound The target document D is scanned line by line or paragraph by paragraph. When the i-th paragraph meets the trigger condition (i.e., the position of the aforementioned feature identifier is scanned), the AI question-answering system marks the index position of the paragraph as a logical segmentation point. Finally, the AI question-answering system outputs a logical segmentation point sequence L containing multiple of the aforementioned logical segmentation points.
[0138] For example, assuming the system has determined that the target document, the Civil Code, belongs to the "Laws and Regulations" domain: Loading rules: The system retrieves the corresponding logical boundary rule set (e.g., indicating that only paragraphs starting with "Article..." are matched); when the system scans to line 50, the content is "Part One General Provisions", which does not match (belongs to chapter title rules, not article rules, and can be configured as needed); when the system scans to line 58, the content is "Article 1254 prohibits throwing objects from buildings...", which matches successfully and records l1=58; when the system scans to line 60, the content is "The authorities shall investigate according to law...", although it is a new paragraph, it does not start with "Article X", so the match fails and is skipped; when the system scans to line 65, the content is "Article 1255...", which matches successfully and records l2=65. Finally, the output result is: L={58,65}.
[0139] Step S502: Based on the above logical segmentation point sequence, aggregate the text segments between adjacent logical segmentation points in the above logical segmentation point sequence to generate initial semantic units.
[0140] The formula for generating the above initial semantic units is:
[0141] ,
[0142] Among them, U init_i Start is the initial semantic unit. i This indicates the starting line number of the semantic jurisdiction; End i That is, the terminating line number of the semantic jurisdiction mentioned above; D k This represents the k-th line of text in the target document D; k represents the circular index, meaning that the text in the k-th line of the target document D is integrated according to the order of the circular index k. init_iConcat() represents a text concatenation operation.
[0143] In this step, we first iterate through the above sequence of logical split points, and for the i-th logical split point l in the above sequence of logical split points... i Determine its semantic jurisdiction, which typically begins at the current segmentation point l. i Terminates at the next dividing point l i+1 Previously (i.e., l) i+1 -1); then, extract all natural paragraphs contained within the semantic jurisdiction mentioned above, and perform a structured merging operation to generate the corresponding initial semantic unit mentioned above.
[0144] For example, continuing with the aforementioned Civil Code example, receiving the above logical segmentation point sequence L={58,65}, the current segmentation point l i =58 (corresponding to "Article 1254..."), next dividing point l i+1 =65 (corresponding to "Article 1255..."), thus the semantic jurisdiction is [58,64]; then, the relevant content is extracted: "Line 58: Throwing objects from buildings is prohibited... (main clause), Line 59: (blank line, skip), Line 60: The authorities shall investigate according to law... (subordinate paragraph 1), ..., Line 63: Property service enterprises... fail to fulfill their security obligations... (subordinate paragraph 2), Line 64: (blank line, skip)"; finally, the contents of lines 58, 60, and 63 are concatenated with line breaks to generate an initial semantic unit, that is, a data block containing three complete text segments. This data block fully covers the definition of throwing objects from high-rise buildings, investigation responsibilities, and property management joint liability, thus obtaining the above-mentioned initial semantic unit.
[0145] Step S503: Perform semantic self-sufficiency processing on the above initial semantic units to generate corresponding information units.
[0146] The calculation formula for the above information unit is as follows:
[0147] ,
[0148] Among them, U final_i This represents the aforementioned information unit; U init_i This represents the initial semantic unit mentioned above; p is a pronoun; e is an entity noun; p set In the above initial semantic unit U init_i The set of pronouns detected in E; setThis is the set of entity nouns extracted from the context window; Model(p,e) is the scoring function of the coreference resolution model, which outputs the probability value (range 0~1) that p refers to e; θ is the replacement threshold (e.g. 0.85), which is used to ensure that the original text is modified only when the model is very confident, to prevent errors; Replace() is the text replacement operation.
[0149] Since the aforementioned initial semantic units are extracted from long documents, they often contain a large number of context-dependent pronouns (such as "this article," "the preceding paragraph," "its," "the organization," etc.). In step S503, the AI question-answering system processes the i-th initial semantic unit U... init_i Syntactic analysis is performed to identify all the aforementioned pronouns; simultaneously, potential entity nouns are extracted from the current unit or the title of the preceding unit; then, the coreference probability of each of the aforementioned pronouns pointing to each of the aforementioned entity nouns is calculated; if the probability is greater than a preset confidence threshold, the aforementioned pronouns are replaced with the corresponding entity nouns, thereby generating the aforementioned semantically self-sufficient information unit.
[0150] For example, continuing with the aforementioned Civil Code example, the initial semantic unit "objects thrown from high-rise buildings" is received, and the pronouns in the third paragraph ("they failed to take necessary...") are identified. The entity nouns ("property service enterprise", "administrative agency") in the third paragraph are extracted. Through the coreference probability, the coreference probability of the property service enterprise pointing to "it" is calculated to be 0.98, and the coreference probability of the administrative agency pointing to "it" is 0.02. Since 0.98>θ, "it" is replaced with "property service enterprise". Finally, "...if the property service enterprise and other building managers fail to take necessary safety measures, they shall bear legal responsibility..." is generated, resulting in the aforementioned information unit that is completely semantically independent.
[0151] Preferably, the target document can be divided based on a preset character length to obtain the aforementioned information units.
[0152] Preferably, the target document can be segmented based on specified characters to obtain the aforementioned information units.
[0153] Preferably, the target document can be input into a large language model for semantic segmentation to obtain the aforementioned information units.
[0154] Figure 6 The flowchart for obtaining the problem unit corresponding to the information unit according to step S303 provided in the embodiment of this application is as follows: The above process specifically includes the following steps:
[0155] Step S601: Based on the above information units, generate prompt words.
[0156] Preferably, the generative prompts mentioned above are constructed by including dimensions such as role instructions, task constraints, and context injection.
[0157] It should be noted that the above-mentioned role instructions are used to define the interactive identity of the large language model (e.g., set as "senior legal advisor" or "equipment repair expert") to activate the model's potential knowledge reserves in specific domains; the above-mentioned context injection fills the above-mentioned information units into the designated area of the template as the sole factual basis for model generation, preventing the model from using outdated information from the training data to answer; the above-mentioned task constraints require the model to simulate the colloquial expression habits of real users and generate prompt words from multiple dimensions such as "fact definition" and "application scenario". The system combines the above three parts to construct the above-mentioned generative prompt words. By introducing multi-dimensional task constraints, this step forces the model to go beyond simple text paraphrasing, thereby covering the ever-changing questioning methods of users in actual consultations.
[0158] For example, if the received information unit content is: "...If building managers such as property service companies fail to take necessary security measures, they shall bear tort liability for failing to fulfill their security obligations in accordance with the law...", then based on the above role instruction, the following constraints are generated: You are a professional legal consultant, skilled at explaining legal provisions in plain language; based on the above context injection, the following constraint is generated: If building managers such as property service companies fail to take necessary security measures, they shall bear tort liability for failing to fulfill their security obligations in accordance with the law. Based on the above task constraints, the following constraints are generated: From the perspective of an ordinary citizen, generate 3 consultation questions, requiring: colloquial language: avoid piling up legal jargon, simulate a real consultation scenario, and finally obtain the above-mentioned generative prompts: Responsibility-related: includes a question about "who should pay compensation"; Scenario-related: includes a specific scenario question about "the lack of surveillance cameras in the community leading to injuries caused by falling debris".
[0159] Step S602: Input the above generative prompts into the pre-trained language model to obtain the initial question set.
[0160] It should be noted that the inference interface of the pre-deployed large language model is invoked, and the aforementioned generative prompts are passed to the large language model as input parameters. Based on its internal attention mechanism and massive pre-trained corpus knowledge, the large language model first parses the generative prompts to obtain the parsing results; then, the large language model performs semantic inference on the parsing results to generate a text stream containing multiple natural language questions; finally, the text stream is formatted to obtain parsed text, and the parsed text is extracted and encapsulated into the aforementioned initial question set.
[0161] For example, the system sends the prompt word about "high-altitude littering" from step S601 above to the large language model, which outputs a set of questions: "1. Scenario: If you are accidentally hit by an ashtray thrown from upstairs and you can't find out who threw it, is the whole building liable for compensation? 2. Liability: Does the property management of the community have a supervisory responsibility for high-altitude littering? If they haven't installed surveillance cameras, do they have to pay compensation? 3. Definition: How does the Civil Code stipulate the liability for damage caused by high-altitude littering?"
[0162] Step S603: Perform a consistency check on the initial problem set to determine the final problem units.
[0163] It should be noted that step S603 above, based on the aforementioned initial question set, calls the semantic consistency verification module to perform consistency verification. This module introduces a loopback verification mechanism to determine whether there is a logical implication relationship between each initial question and the information unit in step S601. Specifically, the system uses the information unit as a premise of the hypothesis, and the questions in the initial question set as the hypotheses to be verified, determining whether the premise contains the necessary information to answer the question. If the determination result is implication or relevance, it means that the information unit can fully answer the question, and the system marks the questions in the initial question set as valid and adds them to the final question unit. If the determination result is contradiction or irrelevance, it means that although the questions in the initial question set are generated by the model, they are outside the scope of the information unit, and the system marks the questions in the initial question set as invalid and removes them.
[0164] For example, regarding the verification object 1: "If you are accidentally hit by an ashtray thrown from upstairs and the perpetrator cannot be found, is the entire building liable for compensation?", the comparison result is as follows: The above information unit clearly mentions that "if it is difficult to determine the specific tortfeasor after investigation, the users of the building who may have caused the harm shall provide compensation, unless they can prove that they are not the tortfeasor." Therefore, the conclusion is to retain the object. Regarding the verification object 2: "Will throwing objects from a height that cause death result in the death penalty?", the comparison result is as follows: The original semantic block only discusses civil concepts such as "compensation" and "tort liability" throughout, without involving criminal concepts such as "death penalty" and "imprisonment." Therefore, the conclusion is to render the object invalid and remove it.
[0165] Preferably, the consistency of the initial problem set is checked using the following formula:
[0166] ,
[0167] in, ;
[0168] TP represents true positives, i.e., the number of statements contained in the response that also exist in the reference standard; FP represents false positives, i.e., the number of statements contained in the response that do not exist in the reference standard; FN represents the number of statements that exist in the reference standard but do not appear in the response; Precision represents precision, i.e., whether the generated question unit is supported by the information unit; Recall represents recall, i.e., the degree to which the core knowledge points in the above information unit are covered by the above question unit; F1 Score represents the overall score, i.e., the overall score of the above initial question set. Questions in the above initial question set will only be collected if the above F1 Score of the above initial question set is greater than a preset threshold; otherwise, questions in the above initial question set will be removed. After filtering the questions in the above initial question set, the above question units are finally determined.
[0169] Preferably, after determining the final problem units, classification and / or hierarchical processing can be performed on the problem units.
[0170] Specifically, firstly, based on the role instructions, task constraints, and context injection constraints set in step S601, the semantic dimension of each valid question is analyzed, and corresponding category labels (such as 'scenario layer,' 'responsibility layer,' or 'definition layer') are matched for it. Secondly, based on the matching value of different category labels in natural language retrieval, differentiated retrieval priority weights are assigned to each question. For example, considering that actual users often use uncontrolled colloquial expressions to ask questions, the AI question-answering system preferably assigns higher weight values to 'scenario layer' and 'responsibility layer' pseudo-questions than to 'definition layer' questions. Through this step, the AI question-answering system upgrades the undifferentiated text list into a weighted structured index object, thereby ensuring that high-value questions that better match the user's potential intent are prioritized in subsequent searches.
[0171] Figure 7 This is a flowchart of the retrieval fallback process for the online question-and-answer stage on the user side, provided according to an embodiment of this application. This process aims to solve the retrieval failure problem that may be caused by a single indexing mode through a multi-level matching and fallback mechanism, and specifically includes the following steps:
[0172] Step S701: Receive the above query request, perform a first-level search based on the question unit, perform semantic similarity matching between the user's question and the "question" in the above question unit, and return the answer to the user.
[0173] Specifically, in step S701 above, firstly, the AI question-answering system receives a natural language query request input by the user and converts it into a query vector; secondly, the AI question-answering system prioritizes vector similarity matching within the question units, calculating the similarity score between the query vector and the question vector of each question in the question unit. If the highest similarity score is greater than a preset first confidence threshold (e.g., 0.85), it is determined to be a first-level search hit, and the AI question-answering system directly obtains the information unit associated with the hit question unit and returns it to the user as the standard answer.
[0174] Preferably, when the AI question-answering system receives the query request, it can break down the query request into several independent sub-questions based on the semantic distribution of keywords.
[0175] Specifically, firstly, the AI question-answering system performs intent recognition and keyword extraction. If it detects that the query request contains multiple parallel semantic keyword groups or explicit logical connectors (such as "and", "as well as", "...how to judge"), it determines that the query is a compound query. Secondly, using natural language processing algorithms, with keywords as the core, the compound query is decoupled into several semantically simple independent sub-problems.
[0176] For example, the AI question-answering system described above breaks down the query request "A and B" into "sub-question A" and "sub-question B". If a subject is missing in a sub-question, the system automatically completes the subject based on the context.
[0177] Step S702: If the first-level search does not find a match, a second-level search is triggered based on the information unit. The user question is matched with the text paragraph content in the information unit, and the answer is extracted / generated from the paragraph and returned to the user.
[0178] Specifically, in step S702 above, firstly, when the highest similarity score in step S701 is lower than the first confidence threshold, the first-level retrieval is automatically determined to be invalid, and a second-level retrieval strategy is triggered; secondly, the AI question-answering system switches the retrieval target from the question unit to the information unit, and calculates the similarity score between the query vector and each of the information unit vectors. Since the content density of the information unit differs from that of a spoken question, the AI question-answering system uses a lower second confidence threshold (e.g., 0.75); finally, if the highest score is greater than the second confidence threshold, it is determined that the second-level retrieval has been successful, and the AI question-answering system returns the corresponding information unit to the user.
[0179] Step S703: If the second-level search does not find a match, a third-level search is triggered based on the keywords. Keywords are extracted from the user's question and searched in the above information unit. The above information unit is then displayed to the user as a list of candidate answers.
[0180] Specifically, in step S703 above, firstly, the AI question-answering system performs word segmentation and stop word removal on the user's query request to extract keywords; secondly, the AI question-answering system performs keyword retrieval on the information unit based on the keywords. If the information unit contains the keywords, the AI question-answering system displays the information unit as a candidate result list to the user, along with a "may be relevant" prompt.
[0181] Step S704: If the above third-level search does not find a match, obtain the corresponding query answer based on an external network search.
[0182] Specifically, in step S704 above, firstly, the AI question-answering system performs query rewriting and searching: firstly, it uses a large language model to transform the user's natural language question into search engine-friendly query keywords, and calls an external general search engine interface to obtain relevant online document fragments or webpage summaries; secondly, it uses the user's original question as the question and the obtained online document fragments as temporary context to construct reading comprehension prompts; finally, it inputs the prompts into a generative artificial intelligence model, requiring the model to generate a response based solely on the searched online information, and outputs the final generative answer.
[0183] According to embodiments of the present invention, an operating device for an AI question-answering system is provided, such as... Figure 8 As shown, it includes: a document acquisition module 801, used to acquire a target document and determine the domain feature information of the target document; an information unit generation module 802, used to divide the target document into information units based on the domain feature information; a question unit generation module 803, used to obtain question units corresponding to the information units based on the information units; and a knowledge unit generation module 804, used to obtain knowledge units based on the question units and the information units, and provide information interaction services.
[0184] According to embodiments of the present invention, a computer program product is provided, comprising a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the operation method of the AI question-answering system described in the embodiments of this application.
[0185] According to embodiments of the present invention, an electronic device is provided, which may include a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. The processor may invoke logical instructions in the memory to execute an AI question-answering system operation method, including: acquiring a target document and determining the domain feature information of the target document; dividing the target document based on the domain feature information to obtain information units; obtaining question units corresponding to the information units based on the information units; wherein, based on the question units and the information units, knowledge units are obtained, and the knowledge units are used to provide information interaction services; furthermore, the electronic device may execute the AI question-answering system operation method described in the embodiments of this application.
[0186] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, external hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0187] According to embodiments of the present invention, a computer-readable storage medium is provided, wherein computer-executable instructions or computer programs are stored, and when the computer-executable instructions or computer programs are executed by a processor, the processor will execute the operation method of the AI question-answering system provided in the above embodiments of the present application.
[0188] According to embodiments of the present invention, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0189] According to embodiments of the present invention, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that stores other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0190] According to embodiments of the present invention, computer-executable instructions may be deployed to execute on an electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed at multiple locations and interconnected via a communication network.
[0191] According to embodiments of the present invention, the term "module" or "unit" refers to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0192] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
[0193] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations.
[0194] Those skilled in the art will understand that the steps, measures, and solutions in the various operations, methods, and processes discussed in this application can be alternated, modified, combined, or deleted. Furthermore, other steps, measures, and solutions in the various operations, methods, and processes discussed in this application can also be alternated, modified, rearranged, decomposed, combined, or deleted. Furthermore, steps, measures, and solutions in the prior art that are similar to those disclosed in this application can also be alternated, modified, rearranged, decomposed, combined, or deleted.
[0195] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for operating an AI question and answer system, the method comprising: Based on a query request input by a user, a first-level retrieval is performed, comprising: transforming the query request into a query vector; performing vector similarity matching in a question unit based on the query vector; if the vector similarity matching hits, obtaining the information unit associated with the question unit that hits and returning the information unit as a standard answer to the user. 2.The operation method of the AI question and answer system of claim 1, wherein, Further comprising: obtaining a target document and determining the domain feature information of the target document; based on the domain feature information, dividing the target document to obtain the information unit; based on the information unit, obtaining the question unit corresponding to the information unit; wherein, based on the question unit and the information unit, a knowledge unit is obtained, which is used to provide information interaction services. 3.The operation method of the AI Q&A system of claim 2, wherein, The obtaining of the target document and the determination of the domain feature information of the target document comprises: performing feature preprocessing on the target document to construct a document semantic vector; based on the document semantic vector, obtaining the semantic similarity value between the target document and each candidate domain; based on a preset domain structure template, obtaining the structure adaptation degree value of the target document; based on the semantic similarity value and the structure adaptation degree value, determining the final domain feature information. 4.The operation method of the AI Q&A system of claim 3, wherein, The feature preprocessing of the target document to construct a document semantic vector comprises: based on a first formula , obtaining the document semantic vector, wherein V doc represents the document semantic vector; n represents the total number of words of the target document; w i represents the i-th word in the word sequence of the target document; E(w i ) represents the word vector of the i-th word; λ i represents the term frequency-inverse document frequency weight value of the i-th word. 5.The operation method of the AI Q&A system of claim 4, wherein, The obtaining of the semantic similarity value between the target document and each candidate domain based on the document semantic vector comprises: based on a second formula , obtaining the semantic similarity value, wherein Val sem (j) represents the semantic similarity value; V doc represents the document semantic vector; μ j represents the preset center vector of the jth candidate field; ||V doc || represents the vector length of the document semantic vector; ||μ j || represents the vector length of the preset center vector; Cosine() represents a cosine similarity function. 6.The operation method of the AI Q&A system of claim 5, wherein, The obtaining of the structure adaptation degree value of the target document based on a preset domain structure template comprises: based on a third formula , obtaining the structure fitness value, wherein Val str (j) represents the structure fitness value; D represents the target document; P j represents the domain structure template; N match (D, P j ) represents the total number of paragraphs in the target document D that are successfully matched to the domain structure template P j of the candidate domain; N para represents the total number of paragraphs of the target document D; β is a magnification coefficient; γ represents a bias coefficient; and Sigmoid() is an activation function.
7. The operation method of the AI question and answer system according to claim 6, wherein The determination of the final domain feature information based on the semantic similarity value and the structure adaptation degree value comprises: based on a fourth formula , obtain the domain feature information, wherein TargetDomain represents the domain feature information; C represents a candidate domain set; C j represents the candidate domain with the maximum value; argmax() represents the candidate domain C in the candidate domain set C with the maximum value of the expression in the parentheses j ; ω1 is a semantic weight; ω2 is a structure weight; Val str (j) is the structure fitness value; Val sem (j) is the semantic similarity value. 8.The operation method of the AI Q&A system of claim 7, wherein, The document semantic vector is constructed based on the title and / or all content of the target document. 9.The operation method of the AI Q&A system of claim 2, wherein, The division of the target document based on the domain feature information to obtain the information unit comprises: based on a set of logical boundary rules matched with the domain feature information, determining a sequence of logical segmentation points in the target document; based on the sequence of logical segmentation points, aggregating the text paragraphs between adjacent logical segmentation points in the sequence of logical segmentation points to generate an initial semantic unit; performing semantic self-sufficiency processing on the initial semantic unit to generate the corresponding information unit. 10.The method of claim 9, wherein, The determination of the sequence of logical segmentation points in the target document based on a set of logical boundary rules matched with the domain feature information comprises: based on a fifth formula , obtaining the sequence of logical break points, where L denotes the sequence of logical break points; i denotes an integer index; N para denotes the total number of paragraphs in the target document D; D i denotes the i-th paragraph in the target document D; R bound denotes a set of logical boundary rules; Match() denotes a regular matching function: True denotes correct.
11. The operation method of the AI question and answer system according to claim 10, wherein, The aggregation of the text paragraphs between adjacent logical segmentation points in the sequence of logical segmentation points to generate an initial semantic unit based on the sequence of logical segmentation points comprises: based on a sixth formula , obtaining the initial semantic unit, wherein U init_i represents the initial semantic unit; Start i represents the start line number of the semantic jurisdiction range; End i represents the end line number of the semantic jurisdiction range; D k represents the kth line of text in the target document D; k represents a loop index; Concat() represents a text concatenation operation.
12. The operation method of the AI question and answer system according to claim 11, wherein, The semantic self-sufficiency processing of the initial semantic unit to generate the corresponding information unit comprises: based on a seventh formula , obtaining the information unit, wherein U final_i represents the information unit; U init_i represents the initial semantic unit; p represents a pronoun; e represents an entity noun; p set represents a set of the pronouns p detected in the initial semantic unit U init_i ; E set represents a set of the entity nouns e extracted in a context window; Model(p, e) represents a scoring function of a coreference resolution model; θ represents a replacement threshold; Replace() represents a text replacement operation. 13.The method of claim 2, wherein, The division of the target document based on the domain feature information to obtain the information unit comprises: dividing the target document by a preset character length, a specified character, or a large language model.
14. The operation method of the AI question and answer system according to claim 2, wherein The obtaining of the question unit corresponding to the information unit based on the information unit comprises: Based on the information unit, a generative prompt word is obtained; The generative prompt word is input into a pre-trained language model to obtain an initial question set; Consistency checking is performed on the initial question set to obtain the question unit.
15. The operation method of the AI Q&A system according to claim 14, wherein The generative prompt word based on the information unit includes: Based on the role instruction, task constraint and context injection dimension, the generative prompt word is obtained.
16. The operation method of the AI Q&A system according to claim 15, wherein The generative prompt word is input into a pre-trained language model to obtain an initial question set, including: The generative prompt word is parsed to obtain a parsing result; The semantic deduction is performed on the parsing result to generate a text stream containing multiple natural language questions; The text stream is parsed and encapsulated to obtain the initial question set.
17. The operation method of the AI Q&A system according to claim 16, wherein The consistency checking is performed on the initial question set using a semantic consistency checking module to obtain the question unit. The semantic consistency checking module includes a loop verification mechanism. The consistency checking is performed on the initial question set to obtain the question unit, including:
18. The operation method of the AI Q&A system according to claim 16, wherein Based on the eighth formula After the consistency checking is performed on the initial question set to obtain the question unit, it further includes: The consistency check is performed on the initial question set to obtain the question unit, where Precision represents precision rate, Recall represents recall rate, and F1 Score represents comprehensive score.
19. The operation method of the AI Q&A system of claim 14, wherein, The question unit is classified and / or graded. If the first-level retrieval is not hit, the second-level retrieval is performed, including:
20. The operation method of the AI question and answer system according to claim 1, wherein Switching the retrieval target from the question unit to the information unit; Based on the query vector, the vector similarity matching is performed in the information unit; If the vector similarity matching is hit, the corresponding information unit is returned as an answer to the user. If the second-level retrieval is not hit, the third-level retrieval is performed, including:
21. The operation method of the AI Q&A system according to claim 20, wherein Extracting keywords from the query request input by the user; Based on the keywords, keyword retrieval is performed on the information unit; If the information unit contains the keywords, the information unit is displayed as a candidate answer list to the user. The first-level retrieval based on the query request input by the user includes:
22. The operation method of the AI question and answer system according to claim 1, wherein Based on the keyword semantic distribution, the query request is disassembled into several independent sub-questions. Including:
23. An operation device of an AI question and answer system, characterized by, A document acquisition module is configured to acquire a target document and determine the domain feature information of the target document; An information unit generation module is configured to divide the target document based on the domain feature information to obtain an information unit; A question unit generation module is configured to obtain a question unit corresponding to the information unit based on the information unit; A knowledge unit generation module is configured to obtain a knowledge unit based on the question unit and the information unit, and provide an information interaction service. Including:
24. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, The processor executes the program to realize the operation method of the AI question and answer system according to any one of claims 1 to 22. Including:
25. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the operation method of the AI question and answer system according to any one of claims 1 to 22.
