Question answering method and apparatus, computing device, storage medium, and computer program product
By identifying the question domain of the target question in the intelligent question-answering system, generating initial answers through matching vector and text libraries, and combining language models to improve answer accuracy, the problem of inaccurate question-answering caused by the uncertainty of user questions is solved, thereby improving the accuracy of the question-answering system and the user experience.
Patent Information
- Application Number
- PCT/IB2025/051262
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-07
- Filing Date
- 2025-02-06
- Publication Date
- 2025-12-11
AI Technical Summary
Existing intelligent question-answering systems suffer from inaccurate responses due to the uncertainty of user questions.
By determining the question-answering domain to which the target question belongs, the target vector and template vector are matched using a vector library and a text library. An accurate initial answer is generated by combining the language model, and the accuracy of the answer is further improved by using prompt text under the condition of similarity.
It improves the accuracy of answers and user experience in the question-and-answer system, ensures that answers are relevant to the question-and-answer domain, and reduces false answers caused by uncertainty.
Smart Images

Figure IB2025051262_11122025_PF_FP_ABST
Abstract
Description
[0001] The technical field of the present disclosure relates to the computer technology field, in particular to a question and answer method. One or more embodiments of the present disclosure also relate to a question and answer device, a computing device, a computer readable storage medium and a computer program product. In order to save artificial customer service resources, an intelligent question and answer "electronic customer service" can be set to answer various questions of users about products to help users better use the products. However, similar to the intelligent question and answer "electronic customer service", a commonly used technical solution is to use a search engine for retrieval, that is, to search for a matching answer from a knowledge base by using keywords contained in a question of a user. Since the syntax of the question of the user is variable, the answer of the question and answer system is often irrelevant and inaccurate, and therefore there is an urgent need for a question and answer method that can more accurately answer questions of users to solve the above technical problems. In view of this, the embodiments of the present disclosure provide a question and answer method. One or more embodiments of the present disclosure also relate to a question and answer method in the security field, a question and answer device, a computing device, a computer readable storage medium and a computer program product to solve the technical defects that the answer of the question and answer system is inaccurate due to the uncertainty of the question of the user in the prior art. According to a first aspect of an embodiment of the present disclosure, a question and answer method is provided, including: determining a target question, a question and answer field to which the target question belongs, a vector library corresponding to the question and answer field, and a text library corresponding to the vector library; determining a target vector corresponding to the target question, determining a template vector corresponding to the target vector from the vector library, and performing word segmentation on the target question, and determining a template text corresponding to the word segmentation result from the text library; determining an initial answer corresponding to the target vector according to the template vector, the template text, the target vector and the target question; in a case where a similarity result of the target vector and the initial answer meets a preset similarity condition, determining a first prompt text corresponding to the target vector according to the initial answer; and determining a target answer corresponding to the target question by using a language model and the first prompt text.According to a second aspect of the embodiments of the present disclosure, a method for generating a safe question and answer field question and answer is provided, which comprises: determining a safe question and answer field target question, a safe question and answer field vector library, and a safe question and answer field text library corresponding to the safe question and answer field vector library; determining a safe question and answer field target vector corresponding to the safe question and answer field target question, determining a safe question and answer field template vector corresponding to the safe question and answer field target vector from the safe question and answer field vector library, and performing word segmentation on the safe question and answer field target question, and determining a safe question and answer field template text corresponding to the word segmentation result from the safe question and answer field text library; determining a safe question and answer field initial answer corresponding to the safe question and answer field target vector according to the safe question and answer field template vector, the safe question and answer field template text, the safe question and answer field target vector, and the safe question and answer field target question; when a similarity result of the safe question and answer field target vector and the safe question and answer field initial answer meets a preset similarity condition, determining a safe question and answer field first prompt text corresponding to the safe question and answer field target vector according to the safe question and answer field initial answer; and determining a safe question and answer field target answer corresponding to the safe question and answer field target question by using a language model and the safe question and answer field first prompt text. According to a third aspect of the embodiments of the present disclosure, a question and answer device is provided, which comprises: a first determining module configured to determine a target question, a question and answer field to which the target question belongs, a vector library corresponding to the question and answer field, and a text library corresponding to the vector library; a second determining module configured to determine a target vector corresponding to the target question, determine a template vector corresponding to the target vector from the vector library, perform word segmentation on the target question, and determine a template text corresponding to the word segmentation result from the text library; a third determining module configured to determine an initial answer corresponding to the target vector according to the template vector, the template text, the target vector, and the target question; a fourth determining module configured to determine a first prompt text corresponding to the target vector according to the initial answer when a similarity result of the target vector and the initial answer meets a preset similarity condition; and a fifth determining module configured to determine a target answer corresponding to the target question by using a language model and the first prompt text. According to a fourth aspect of the embodiments of the present disclosure, a computing device is provided, which comprises: a storage and a processor; the storage is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, and the computer programs / instructions realize the steps of the above question and answer method when executed by the processor.According to a fifth aspect of an embodiment of the present disclosure, a computer readable storage medium is provided, which stores computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the steps of the above question answering method. According to a sixth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the steps of the above question answering method. According to an embodiment of the present disclosure, a question answering method is provided. The method includes determining a target vector corresponding to a target question, matching the target vector with template vectors in a vector library, obtaining a template vector similar in semantics to the target vector, obtaining a template text matching a word segmentation in the target question from a text library according to the word segmentation of the target question, and determining an initial answer corresponding to the target vector according to the template vector, the template text, the target vector, and the target question. The initial answer can take into account semantic information and keyword information of the target question, thereby improving the accuracy of the initial answer and the accuracy of a target answer determined based on the initial answer. When a similarity result of the target vector and the initial answer meets a preset similarity condition, the initial answer is considered to have high accuracy and high reference value. A first prompt text corresponding to the target vector is determined based on the initial answer, and the target question is answered by using a language model and the prompt text, thereby further improving the accuracy of the answer to the target question. The prompt text referenced by the target answer is more relevant to a question answering domain by analyzing the question answering domain to which the target question belongs and performing multi-path recall search in a vector library and a text library corresponding to the question answering domain, thereby improving the accuracy of the target answer to the target question in the question answering domain. BRIEF DESCRIPTION OF DRAWINGS FIG. 1 is a specific application scenario diagram of a question answering method according to an embodiment of the present disclosure; FIG. 2 is a flowchart of a question answering method according to an embodiment of the present disclosure; FIG. 3 is a processing process flowchart of a question answering method according to an embodiment of the present disclosure; FIG. 4 is a work order data processing flowchart of a question answering method according to an embodiment of the present disclosure; FIG. 5 is a safety term data processing flowchart of a question answering method according to an embodiment of the present disclosure; FIG. 6 is a document data processing flowchart of a question answering method according to an embodiment of the present disclosure; FIG. 7 is a document data chunk processing flowchart of a question answering method according to an embodiment of the present disclosure; FIG. 8 is a question searching processing process flowchart of a question answering method according to an embodiment of the present disclosure; FIG. 9 is a structural schematic diagram of a question answering apparatus according to an embodiment of the present disclosure; and FIG. 10 is a structural block diagram of a computing device according to an embodiment of the present disclosure.Many specific details are set forth in the following description in order to provide a thorough understanding of the present disclosure. However, the present disclosure can be practiced according to other embodiments that depart from the specific details disclosed herein, and the present disclosure is not limited to the embodiments described below. The terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the present disclosure. As used in the description herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be understood that the terms "and / or", "at least one of", and "one or more of" as used herein, refer to and encompass any one of the items in the list, any combination of two or more of the items in the list, and all possible combinations of the items in the list. It will be further understood that the terms "comprises" and / or "comprising", or "includes" and / or "including" when used in this specification, specify the presence of stated features, regions, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, regions, integers, steps, operations, elements, components, and / or groups thereof. It will be understood that when an element or layer is referred to as being "on" another element or layer, it can be directly on the other element or layer or intervening elements or layers can also be present. In contrast, when an element is referred to as being "directly on" another element or layer, there are no intervening elements or layers present. It will also be understood that, when a term is used in the singular, it can also be used in the plural, and vice versa, unless the context clearly dictates otherwise. The present disclosure will now be described with reference to various embodiments. The following examples are included to demonstrate a variety of embodiments of the present disclosure. However, one of ordinary skill in the art will recognize that the same or equivalent functions can be accomplished by other methods, structures, materials, and such changes and equivalents of the examples described herein are encompassed within the scope of the present disclosure.In practical applications, a large model can be applied to different tasks by fine-tuning a pre-trained model with a small amount of samples. The large model can be widely applied in natural language processing (NLP, Natural Language Processing) and computer vision fields. Specifically, the large model can be applied to computer vision field tasks such as visual question answering (VQA, Visual Question Answering), image captioning (IC, Image Caption), image generation, and natural language processing field tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the large model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, and the like. First, the technical terms appearing in one or more embodiments of the present disclosure are explained.
[0002] JavaScript Object Notation (JSON): a lightweight data interchange format, which uses a completely language-independent text format for storing and representing data. markdown: a plain text format, which is a lightweight markup language that allows users to write documents in a readable and writable plain text format, and converts the plain text format document into an HTML format or other formats. In the present disclosure, a question and answer method is provided, and the present disclosure simultaneously relates to a question and answer device, a computing device, a computer readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments. Referring to FIG. 1, FIG. 1 shows a specific application scenario diagram of a question and answer method according to an embodiment of the present disclosure. As shown in FIG. 1, FIG. 1 includes a client 102 and a question and answer server 104, wherein the client 102 includes but is not limited to a mobile phone, a tablet computer, a notebook computer, a desktop computer and the like, and the question and answer server 104 includes but is not limited to a physical server, a cloud server and the like. In a specific implementation, a user inputs a target question to be asked through the client 102, the client sends the target question input by the user to the question and answer server 104, the question and answer server 104 determines a target vector corresponding to the target question according to the target question and a question and answer domain to which the target question belongs, and determines a template vector satisfying a similarity condition according to a similarity between the target vector and a template vector in a vector library corresponding to the question and answer domain. Further, the target question is segmented, and a template text corresponding to the segmentation is determined from a text library corresponding to the vector library. Further, an initial answer corresponding to the target vector is determined according to the template vector and the template text. Further, in a case where a similarity between the target vector and the initial answer is greater than a similarity threshold, a prompt text corresponding to the target vector is determined according to the initial answer, and a target answer corresponding to the target question is determined by using a language model and the prompt text. Then, the question and answer server 104 returns the target answer to the client 102, and the client 102 displays the target answer to the user, so as to reply to the target question asked by the user. It should be noted that the language model in the present disclosure can be understood as a machine learning model capable of processing natural language, such as a large-scale language model, a multi-modal pre-training model and the like. The language model can be deployed in the question and answer server 104, or can be deployed in a third-party server and called through an interface. In a case where the running resources of the client can meet the deployment and running conditions of the language model, the language model can also be deployed in the client, and the embodiments of the present disclosure can be implemented in the client.One embodiment of the present disclosure provides a question and answer method. A question and answer server determines a target vector corresponding to a target question, matches the target vector with template vectors in a vector library, obtains template vectors similar in semantics to the target vector, and obtains template texts matching keywords of the target question from a text library according to segmentation of the target question, so as to determine an initial answer corresponding to the target vector according to the template vectors and the template texts, so that the initial answer can take into account semantic information and keyword information of the target question, and improve accuracy of the initial answer. Further, when similarity between the target vector and the initial answer is greater than a similarity threshold, that is, the initial answer has high reference value, a prompt text corresponding to the target vector is determined according to the initial answer, and the target question is answered by using a language model and the prompt text, so as to improve accuracy of an answer of the language model, thereby improving accuracy of a target answer corresponding to the target question. Further, by analyzing a question and answer field to which the target question belongs, a multi-path recall search is performed from a vector library and a text library corresponding to the question and answer field, so that the prompt text referenced by the target answer can be more relevant to the question and answer field, improving accuracy of the target answer to the target question in the question and answer field, and the accurate target answer is displayed to a user by a client, improving user experience. Referring to FIG. 2, FIG. 2 shows a flowchart of a question and answer method according to one embodiment of the present disclosure, specifically including the following steps. Step 202: determining a target question, a question and answer field to which the target question belongs, a vector library corresponding to the question and answer field, and a text library corresponding to the vector library. The target question can be understood as a question to be answered, for example, the target question can be understood as "What is the weather today?", "Please analyze the alarm situation in the next 7 days", "What are the virus types of the cloud security center virus defense", and the like. The question and answer field to which the target question belongs can be understood as a question and answer knowledge field to which the target question belongs, including but not limited to a cloud security field, an economic field, a common sense field, and the like. The vector library corresponding to the question and answer field can be understood as a database containing at least vectors associated with the question and answer field, and the text library corresponding to the vector library can be understood as a database containing texts corresponding to the vectors in the vector library.In one or more embodiments of the present disclosure, before the determining the target question, the question and answer domain to which the target question belongs, the vector library corresponding to the question and answer domain, and the text library corresponding to the vector library, the method further comprises: determining initial data associated with the question and answer domain, and performing vector processing on the initial data according to a vector generation model to obtain the template vector; determining a template text having a matching relationship with the template vector; constructing the vector library corresponding to the question and answer domain according to the template vector, and constructing the text library corresponding to the vector library according to the template text. The initial data associated with the question and answer domain can be understood as initial data related to the question and answer domain. The initial data includes, but is not limited to, data in an initial database related to the question and answer domain, data obtained by a server extracting web pages, documents and other information related to the question and answer domain, and user-uploaded data. The vector generation model can be understood as a model for converting data into vectors. For example, the vector generation model can be understood as an embedding model or a feature representation learning model. Specifically, determining the initial data associated with the question and answer domain and performing vector processing on the initial data according to the vector generation model to obtain the template vector can be understood as determining the initial data associated with the question and answer domain and performing vectorization processing on the initial data using the vector generation model to obtain vectors corresponding to each data in the initial data, i.e., the template vector. After obtaining the template vector, the template text having a matching relationship with the template vector is determined through the matching relationship between the vector and the text, so as to construct the vector library corresponding to the question and answer domain according to the template vector. The vector library stores the template vector. The text library corresponding to the question and answer domain is constructed according to the template text. The text library stores the template text. The question and answer method provided by one or more embodiments of the present disclosure can construct the vector library and the text library in advance by using the initial data associated with the question and answer domain, so that the answer to the target question is more targeted, and the accuracy of the subsequent target answer is improved.In one or more embodiments of the present disclosure, the determining the template text having the matching relationship with the template vector comprises: determining a target preset vector matching the template vector from a preset vector database, wherein the preset vector database stores preset vectors, preset texts, and an association relationship between the preset vectors and the preset texts associated with the question and answer field; determining a target preset text corresponding to the target preset vector according to the association relationship between the preset vectors and the preset texts, and determining the target preset text as the template text having the matching relationship with the template vector. Specifically, the determination of the template text having the matching relationship with the template vector can be implemented by the preset vector database. The preset vector database can be understood as a database containing preset vectors, preset texts, and an association relationship between the preset vectors and the preset texts. The association relationship between the preset vectors and the preset texts is determined and stored in the preset vector database in advance, which is not described herein. The target preset vector can be understood as the same preset vector as the preset vector, and the target preset text can be understood as the preset text having the matching relationship with the target preset vector. In actual applications, after the initial data is converted into the template vector, the initial data corresponding to the template vector can be determined according to the number of the initial data and the number of the corresponding template vector, and the template text corresponding to the template vector can be obtained by extracting the text information in the initial data corresponding to the template vector, such as picture text information in picture data, header information, table text information in table data, and character information in text data. The question and answer method provided in one embodiment of the present disclosure determines the template text corresponding to the template vector through the preset vector database, ensures the accuracy of the template text, improves the accuracy of the information referenced for obtaining the target answer, and thus improves the accuracy of the target answer corresponding to the target question obtained according to the template vector and the template text. In one or more embodiments of the present disclosure, the question and answer field is a security question and answer field, and the initial data is security question and answer field work order data, security question and answer field term data, security question and answer field document data, and / or security question and answer field intent data. The vector generation model is used to perform vector processing on the initial data to obtain the template vector, which comprises: performing vector conversion on the security question and answer field work order data, the security question and answer field term data, the security question and answer field document data, and / or the security question and answer field intent data according to the vector generation model to generate the template vector.The security question and answer field can be understood as the cloud security question and answer field described above. The security question and answer field work order data can be understood as work order type data associated with the security question and answer field, and includes but is not limited to historical work order data submitted by users associated with the security question and answer field, data for customer service to solve security question and answer field related work orders, and data for customer service and user communication to solve security question and answer field problems. The security question and answer field work order data can be obtained from the work order system through manual transcription or preset webpage data acquisition technology, or can be obtained through user upload, etc. The security question and answer field term data can be understood as data related to security professional terms in the security question and answer field, including but not limited to security professional terms, security professional term definitions, and security professional term explanations. The security question and answer field document data can be understood as document type data associated with the security question and answer field, including but not limited to safety instructions, technical manuals, and usage guides. The security question and answer field intent data can be understood as data associated with the security question and answer field and containing user intent, for example, in the case of chat intent in the security question and answer field intent data, i.e., the user wants to chat, the security question and answer field intent data can be understood as "good morning, how are you?", "hello", "did you hear the news?", "what is your favorite book?", "who are you?", etc. For another example, in the case of tool invocation intent in the security question and answer field intent data, i.e., the user wants to invoke the target tool, the security question and answer field intent data can be understood as "please analyze the alarm situation in the past 7 days", "query which high-risk alarms are detected on the host side", etc. to invoke the alarm history data viewing tool. For another example, in the case of question and answer intent in the security question and answer field intent data, i.e., the user wants to ask questions and get answers, the security question and answer field intent data can be understood as "virus types of cloud security center virus defense", "cloud security center service terms", etc.In specific implementation, the initial data can be understood as one or more of the following: security question and answer field work order data, security question and answer field term data, security question and answer field document data, and security question and answer field intent data. In specific implementation, the initial data can be set according to actual needs. In the case where the initial data is understood as one or more of the following: security question and answer field work order data, security question and answer field term data, security question and answer field document data, and security question and answer field intent data, the initial data can be processed into a vector according to a vector generation model. In this disclosure, any one of the following is taken as an example for illustrative description: the initial data can be processed into a vector according to a vector generation model, and the initial data can be any one of the following: security question and answer field work order data, security question and answer field term data, security question and answer field document data, and security question and answer field intent data. In the case of multiple combinations, refer to the combinations in the embodiments of this disclosure. In one embodiment of this disclosure, a question and answer method is provided. In the case where the question and answer field is a security question and answer field, the security question and answer field work order data, and / or the security question and answer field term data, and / or the security question and answer field document data, and / or the security question and answer field intent data are converted into a vector according to a vector generation model to generate a template vector. This improves the vertical correspondence between the template vector and the security question and answer field, and makes the reference information for answering the target question more targeted, further improving the accuracy of the subsequent target answer. In one or more embodiments of this disclosure, the initial data is security question and answer field work order data. Determining the initial data associated with the question and answer field includes: determining initial security question and answer field work order data associated with the security question and answer field; extracting sub-work order data corresponding to a preset work order information type from the initial security question and answer field work order data according to the preset work order information type; and determining the sub-work order data as the security question and answer field work order data. The initial security question and answer field work order data can be understood as initial work order data associated with the security question and answer field. Since the initial security question and answer field work order data contains data unrelated to the question and answer, such as a timestamp, a customer number, and a user number, the initial security question and answer field work order data can be filtered to reduce the interference of irrelevant data on the question and answer process and resource occupation.The preset work order information type can be understood as a preset information type used for work order data screening, including but not limited to a question type (type), a question (question), answer HTML format (HyperText Markup Language format) data (answer_html), answer md format (markdown format, i.e., pure text format) data (answer_md), version information (version), and the like. The sub-work order data can be understood as a data subset of initial security question and answer field work order data, and the information type of the data contained in the sub-work order data matches the preset work order information type. For example, the initial security question and answer field work order data is a work order data containing a timestamp, a customer number, a user number, a question type, a question, answer HTML format data, answer md format data, and version information. The sub-work order data can be understood as a data subset of the initial security question and answer field work order data, and the sub-work order data can be understood as a work order data containing a question type, a question, answer HTML format data, answer md format data, and version information. An embodiment of the present disclosure provides a question and answer method. By determining the sub-work order data corresponding to the preset work order information type in the initial security question and answer field work order data as the security question and answer field work order data, the data amount of the security question and answer field work order data is reduced while ensuring the utilization value of the security question and answer field work order data, thereby reducing the interference of subsequent data unrelated to question and answer on question and answer and resource occupation, and improving the accuracy of subsequent target question answering and the processing efficiency of question and answer. In one or more embodiments of the present disclosure, after determining the initial security question and answer field work order data associated with the security question and answer field, the method further includes: in a case where it is determined that the initial security question and answer field work order data contains work order data in a preset language format, performing format conversion on the work order data in the preset language format, and updating the initial security question and answer field work order data according to the format conversion result. The preset language format includes but is not limited to a table format, an HTML format, and the like.Specifically, in order to facilitate analysis, the obtained initial security field work order data can be stored as data in a target format to facilitate subsequent text information extraction. For example, the initial security field work order data obtained again from the work order system by a preset webpage data acquisition technique can be in an html format. Generally, data in an html format is not convenient for text information extraction. Therefore, the initial security field work order data in the html format can be stored in a markdown format. In actual application, format conversion can fail. For example, the initial security field work order data in the markdown format contains work order data in an html format, which leads to a large error in subsequent text information extraction. The work order data in the html format can be understood as the above-mentioned preset language format. Based on this, in a case where it is determined that the initial security question and answer field work order data contains work order data in the preset language format, the work order data in the preset language format can be format-converted, and format-converted work order data is obtained. The format-converted work order data is used to replace the work order data in the preset language format in the initial security question and answer field work order data, so as to update the initial security question and answer field work order data. In one or more embodiments of the present disclosure, by format-converting the work order data in the preset language format and updating the initial security question and answer field work order data according to the format conversion result, the interference of the work order data in the preset language format on subsequent text information extraction is reduced, and the convenience and accuracy of subsequent text information extraction of the initial security question and answer field work order data are improved. In one or more embodiments of the present disclosure, the initial data is security question and answer field term data; the determination of the initial data associated with the question and answer field includes: determining initial security question and answer field term data associated with the security question and answer field; performing a deduplication process on the initial security question and answer field term data to obtain deduplicated security question and answer field term data; extracting sub-term data corresponding to a preset term information type from the deduplicated security question and answer field term data according to the preset term information type; and determining the sub-term data as the security question and answer field term data. The initial security question and answer field term data can be understood as initial term data associated with the security question and answer field. The deduplication process can be understood as a processing operation of removing repeated content, such as removing repeated sentences, removing repeated words, removing repeated punctuation marks, etc. The deduplicated security question and answer field term data can be understood as security question and answer field term data after removing repeated term data from the initial security question and answer field term data.The preset term information type can be understood as a preset information type used for term data screening, including but not limited to an ID, a safety term, a term synonym, a term English, a term explanation, a version, and the like. The sub-term data can be understood as a data subset of initial safety question and answer field term data, and the information type of the term data contained in the sub-term data matches the preset term information type. For example, the initial safety question and answer field term data is term data containing a term editing time stamp, term pinyin, an ID, a safety term, a term synonym, a term English, a term explanation, and a version. The sub-term data can be understood as a data subset of the initial safety question and answer field term data, and the sub-term data can be understood as term data containing an ID, a safety term, a term synonym, a term English, a term explanation, and a version. An embodiment of the present disclosure provides a question and answer method, which determines the sub-term data corresponding to the preset term information type in the initial safety question and answer field term data as safety question and answer field term data, and performs deduplication processing on the safety question and answer field term data, thereby improving the accuracy of the safety question and answer field term data, reducing the data volume of the safety question and answer field work order data, reducing the interference of subsequent data irrelevant to question and answer and repeated data on question and answer and resource occupation, and improving the accuracy of subsequent target question answering and the processing efficiency of question and answer. In one or more embodiments of the present disclosure, the initial data is safety question and answer field document data; initial safety question and answer field document data associated with the safety question and answer field is determined; document data preprocessing is performed on the initial safety question and answer field document data to obtain preprocessed safety question and answer field document data; and the safety question and answer field document data is determined according to the preprocessed safety question and answer field document data. The initial safety question and answer field document data can be understood as initial document data associated with the safety question and answer field. The document data preprocessing can be understood as an operation of preprocessing the initial safety question and answer field document data, including but not limited to format conversion error data cleaning, table format error data restoration, link error data restoration, title format unification, and the like.In specific implementation, the initial security question and answer field document data is acquired through preset webpage data acquisition technology download and the like. In order to facilitate subsequent text information extraction, the initial security question and answer field document data can be stored in a pure text format. Further, since the initial security question and answer field document data acquired through preset webpage data acquisition technology download is in a hypertext markup language format, in order to store the initial security question and answer field document data in a pure text format, format conversion needs to be performed on the acquired initial security question and answer field document data. Format conversion may exist format conversion errors, including but not limited to format conversion errors, table format errors, link addresses being internal addresses, title identifier formats being non-uniform, and the like. Based on this, data preprocessing can be performed on the initial security question and answer field document data to obtain preprocessed initial security field document data, and the security question and answer field document data is determined according to the preprocessed initial security field document data. An embodiment of the present disclosure provides a question and answer method, which improves the accuracy of the initial security question and answer field document data by performing data preprocessing on the initial security question and answer field document data, thereby improving the accuracy of subsequent application of the security question and answer field document data to answer questions. In one or more embodiments of the present disclosure, the document data preprocessing on the initial security question and answer field document data to obtain preprocessed security question and answer field document data includes: deleting document data with format conversion errors in the initial security question and answer field document data to obtain preprocessed security question and answer field document data; and / or performing table format repair on document data with table format errors in the initial security question and answer field document data to obtain preprocessed security question and answer field document data; and / or performing link replacement on document data with link format errors in the initial security question and answer field document data to obtain preprocessed security question and answer field document data; and / or replacing title identifiers in the initial security question and answer field document data with preset identifiers to obtain preprocessed security question and answer field document data. The format conversion error can be understood as document data that has not been converted into a preset document format. For example, in the case of storage of the initial security question and answer field document data in an md format, the format conversion error can be understood as document data in an html format or other document data that is not in an md format in the initial security question and answer field document data.The table format error can be understood as the format of the table has an error sequence, an error text, an error layout, etc. The link format error can be understood as the address of the link is an error address, for example, the link format error can be understood as the address of the link is an internal address, a null address, etc. The title symbol can be understood as a symbol used to identify a title in the initial security question and answer field document data, for example, "#", "=", "==", etc. The preset symbol can be understood as a preset symbol, for example, the preset "#" is a preset symbol. In the specific implementation, in the case that the initial security question and answer field document data has document data with a format conversion error, document data with a table format error, document data with a link format error, and one or more cases of a format problem of a title symbol, the one or more cases of a format problem of the initial security question and answer field document data can be preprocessed according to the one or more cases of a format problem of the initial security question and answer field document data. For example, the initial security question and answer field document data with the document data with the format conversion error and the document data with the table format error is subjected to document data deletion of the document data with the format conversion error and table format repair of the document data with the table format error. The initial security question and answer field document data with the document data with the format conversion error, the document data with the table format error, and the document data with the link format error is subjected to document data deletion of the document data with the format conversion error, table format repair of the document data with the table format error, and link replacement of the document data with the link format error. The specific implementation of the preprocessing according to the one or more cases of a format problem of the initial security question and answer field document data in the case that the initial security question and answer field document data has the document data with the format conversion error, the document data with the table format error, the document data with the link format error, and one or more cases of a format problem of a title symbol can be referred to the preprocessing of a plurality of combinations according to the one or more cases of a format problem of the initial security question and answer field document data in the case that the initial security question and answer field document data has the document data with the format conversion error, the document data with the table format error, the document data with the link format error, and one or more cases of a format problem of a title symbol, which will not be enumerated here. The question and answer method provided in one embodiment of the present disclosure can reduce the probability of the format error data of the initial security question and answer field document data by pre-processing the document data with the format conversion error, the table format error, the link format error, and the format error of the title in the initial security question and answer field document data, thereby improving the accuracy of the subsequent obtained security question and answer field document data.In one or more embodiments of the present disclosure, determining the security question and answer field document data according to the preprocessed security question and answer field document data includes: determining a number of words in the preprocessed security question and answer field document data according to the preprocessed security question and answer field document data; in a case where the number of words is greater than a preset first number of words threshold, performing section segmentation processing on the preprocessed security question and answer field document data according to a section title included in the preprocessed security question and answer field document data to obtain section segmentation data; and determining the security question and answer field document data according to the section segmentation data. The preset first number of words threshold can be understood as a preset upper limit of the number of words in a document segment, and can also be understood as an upper limit of the number of words in a document segment that can be processed by a subsequent language model. For example, the preset first number of words threshold can be understood as 1000. The section title can be understood as a title of a section included in a document data. The section segmentation data can be understood as document segmentation data segmented according to sections. For example, one section corresponds to one document segmentation data, i.e., a section document data, or two sections correspond to one section segmentation data. The specific segmentation strategy can be set according to actual requirements. In specific implementation, after obtaining the preprocessed security question and answer field document data, the preprocessed security question and answer field document data can be segmented to determine the number of words in the preprocessed security question and answer field document data. Further, the number of words is compared with the first number of words threshold, and in a case where the number of words is greater than the first number of words threshold, the section title included in the preprocessed security question and answer field document data is determined, and the preprocessed security question and answer field document data is segmented according to the section title to obtain section segmentation data. After obtaining the section segmentation data, the section segmentation data can be determined as the security question and answer field document data. In a case where the section segmentation data is multiple, the security question and answer field document data includes the multiple section segmentation data. The question and answer method provided in one embodiment of the present disclosure reduces the number of words in a single security question and answer field document data by segmenting the security question and answer field document data according to sections in a case where the security question and answer field document data is large, i.e., the number of words exceeds the first number of words threshold, thereby ensuring the accuracy of subsequent text information extraction of the security question and answer field document data.In one or more embodiments of the present disclosure, the chapter segmentation data includes text data and / or table data; and the determining the safety question and answer domain document data according to the chapter segmentation data includes: determining text segmentation data according to the text data, and determining the safety question and answer domain document data according to the text segmentation data; or determining table segmentation data according to the table data, and determining the safety question and answer domain document data according to the table segmentation data; or determining text segmentation data according to the text data, and determining table segmentation data according to the table data, and determining the safety question and answer domain document data according to the text segmentation data and the table segmentation data. The text data can be understood as text format data, and the table data can be understood as table format data. Specifically, after the chapter segmentation data is obtained, if the number of segmented words in the chapter segmentation data is greater than a preset first threshold of segmented words, that is, the number of segmented words in the chapter segmentation data is still large. Since the chapter segmentation data includes table data and / or text data, the segmentation of the chapter segmentation data can consider segmenting the table data and the text data respectively to ensure the integrity and accuracy of the text information in the chapter segmentation data. In specific implementation, when the chapter segmentation data includes text data, the text data in the chapter segmentation data can be segmented to obtain text segmentation data, and the text segmentation data is determined as the safety question and answer domain document data; or when the chapter segmentation data includes table data, the table data in the chapter segmentation data can be segmented to obtain table segmentation data, and the table segmentation data is determined as the safety question and answer domain document data; or when the chapter segmentation data includes text data and table data, the text data can be segmented to obtain text segmentation data, the table data can be segmented to obtain table segmentation data, and the text segmentation data and the table segmentation data are determined as the safety question and answer domain document data. The question and answer method provided in one embodiment of the present disclosure ensures the semantic integrity of the obtained safety question and answer domain document data by respectively segmenting the text data and the table data in the chapter segmentation data, and improves the semantic accuracy of subsequent question answering based on the safety question and answer domain document data.In one or more embodiments of the present disclosure, the determining the text cut data according to the text data comprises: determining a number of tokens corresponding to the text data, and determining the text cut data according to the text data, the number of tokens corresponding to the text data, and the preset first token number threshold. The determining the table cut data according to the table data comprises: determining a number of tokens corresponding to the table data and a table structure of the table data, and determining the table cut data according to the table data, the number of tokens corresponding to the table data, the table structure of the table data, and the preset first token number threshold. The table structure can be understood as a table structure such as rows, columns, and cells contained in the table data. The table data can be divided by rows, and table header information can be combined into each table cut data obtained after the table data is cut, so as to ensure the integrity of the table information of the table data. Specifically, the text data and the table data can be cut when the number of tokens is greater than the first token number threshold. For details, refer to the above embodiments, which will not be repeated here. The method for question and answer provided in one embodiment of the present disclosure can cut the text data and the table data in the chapter cut data respectively according to the first token number threshold, cut the text data and the table data with a large number of tokens (the number of tokens is greater than the first token number threshold), and avoid cutting the text data and the table data with a small number of tokens (the number of tokens is less than or equal to the first token number threshold), so as to avoid excessive semantic information splitting caused by excessive cutting, thereby ensuring the integrity of the semantic information contained in the obtained text information of the security question and answer field document data. When cutting the table data, the table structure of the table data is considered to avoid incomplete table information caused by cutting the table data, thereby further ensuring the semantic integrity of the security question and answer field document data. In one or more embodiments of the present disclosure, the determining the security question and answer field document data according to the text cut data comprises: constructing a second prompt text according to the text cut data and a preset prompt text; obtaining text summary data of the text data according to the second prompt text by using the language model, wherein the text summary data is determined according to text data corresponding to a preset text information type in the text data; determining initial cut data according to the text cut data and the text summary data, and determining the security question and answer field document data according to the initial cut data. The preset prompt text can be understood as a preset prompt text for prompting the language model to summarize the semantic information of the text. The text summary data can be understood as data for summarizing the text, such as text central idea data, text content summary, etc.The preset text information type can be understood as a preset information type for text summarization. For example, summarizing a piece of text data describing a landscape, the preset text information type can be understood as a geographical location, natural scenery features, a season, weather, and the like. Or for example, summarizing a piece of text data describing a story, the preset text information type can be understood as a character role, a time background, a plot development, and the like. The language model can be understood as a machine learning model for natural language processing, for example, the language model can be understood as a LLM large model. After obtaining the text chunk data and the text summary data, the text chunk data and the text summary data can be determined as initial chunk data, and the safety question and answer field document data is determined according to the initial chunk data. An embodiment of the present disclosure provides a question and answer method, by summarizing text data, with less text summary data of a smaller number of word segmentation, the text data of a larger number of word segmentation is summarized, to extract important text information in the text data, so that the text information of the initial chunk data determined according to the text summary data and the text chunk data is more abundant, thereby improving the richness of the determined safety question and answer field document data, and further, improving the success rate of subsequent retrieval.In one or more embodiments of the present disclosure, the determining the safety question and answer field document data according to the text segmentation data and the table segmentation data comprises: constructing a second prompt text according to the text segmentation data and a preset prompt text, and obtaining text summary data of the text data by using the language model according to the second prompt text; determining document title data and document abstract data in the safety question and answer field document data according to the text segmentation data and the table segmentation data, and determining document information enhancement data of the safety question and answer field document data according to the document title data and the document abstract data; determining target text segmentation data associated with the table segmentation data from the text segmentation data according to the table segmentation data; constructing a third prompt text according to the table segmentation data, the document information enhancement data, the target text segmentation data, and a preset prompt text, and obtaining table summary data of the table segmentation data by using the language model according to the third prompt text, wherein the table summary data is determined according to target text segmentation data, the table segmentation data, and document information enhancement data corresponding to a preset table information type in the target text segmentation data, the table segmentation data, and the document information enhancement data; determining the initial segmentation data according to the text segmentation data, the table segmentation data, the document information enhancement data, the text summary data, and the table summary data, and determining the safety question and answer field document data according to the initial segmentation data.According to the table cut data, the document information enhancement data, the target text cut data, and the preset prompt text, the third prompt text is constructed, which can be understood as combining the table cut data, the document information enhancement data, the target text cut data, and the preset prompt text to construct the third prompt text, that is, the third prompt text contains the table cut data, the document information enhancement data, the target text cut data, and the preset prompt text. The question and answer method provided in one embodiment of the present disclosure increases the semantic information of the table data by using the text cut data corresponding to the table data, and further enhances the richness of the semantic information contained in the table data by using the third prompt text constructed by the table cut data, the document information enhancement data, the target text cut data, and the preset prompt text to obtain the table summary data, so that the subsequent retrieval of the table data is more accurate. In one or more embodiments of the present disclosure, the determining the security question and answer field document data according to the initial cut data includes: determining the number of words corresponding to the initial cut data according to the initial cut data; in the case where the number of words corresponding to the initial cut data is greater than a preset second word number threshold, performing cut processing on the initial cut data, and determining the security question and answer field document data according to the cut processing result; or in the case where the number of words corresponding to the initial cut data is less than or equal to the preset second word number threshold, determining the initial cut data as the security question and answer field document data. The second word number threshold can be understood as a preset upper limit of the number of words of secondary cut, or an upper limit of the number of words that can be processed by the embedding layer of the subsequent model, for example, the second word number threshold can be understood as 512. Specifically, for the specific implementation of the cut of the initial cut data, refer to the specific implementation of the cut of the chapter cut data in the above embodiment, which will not be repeated here. The question and answer method provided in one embodiment of the present disclosure further judges whether to continue cutting according to the number of words of the initial cut data by using the second word number threshold after obtaining the initial cut data, so as to reduce the number of words of the cut data contained in the security question and answer field document data, ensure the accuracy of the subsequent vector conversion, and reduce the dimension of the converted vector, thereby improving the efficiency of vector matching in the subsequent retrieval process. In one or more embodiments of the present disclosure, the initial data is security question and answer field intent data; the determining the initial data associated with the question and answer field includes: determining an intent question corresponding to the preset template intent; determining the security question and answer field intent data according to the template intent and the intent question.The preset template intention can be understood as a preset question and answer intention, including but not limited to chat, program calling, question and answer and the like. After determining the preset template intention, the intention question corresponding to the preset template intention can be obtained, and the template intention and the intention question are determined as the safety question and answer field intention data. An embodiment of the present disclosure provides a question and answer method, which determines the safety question and answer field intention data according to the template intention and the intention question corresponding to the template intention, so as to analyze the intention of the target question in the subsequent process, and processes the target question by using the corresponding question and answer processing method, thereby reducing the resource consumption of processing the target question of the non-question and answer intention, and improving the processing efficiency of the target question. In one or more embodiments of the present disclosure, the vector generation model is used to perform vector conversion on the safety question and answer field work order data, and / or the safety question and answer field term data, and / or the safety question and answer field document data, and / or the safety question and answer field intention data, to generate the template vector, including: performing vector conversion on the safety question and answer field work order data, the safety question and answer field term data, the safety question and answer field document data, and / or the safety question and answer field intention data according to the vector generation model, to generate a safety question and answer field work order vector, and / or a safety question and answer field term vector, and / or a safety question and answer field document vector, and / or a safety question and answer field intention vector; and determining the safety question and answer field work order vector, and / or the safety question and answer field term vector, and / or the safety question and answer field document vector, and / or the safety question and answer field intention vector as the template vector. The safety question and answer field work order vector can be understood as a vector generated by performing vector conversion on the safety question and answer field work order data; the safety question and answer field term vector can be understood as a vector generated by performing vector conversion on the safety question and answer field term data; the safety question and answer field document vector can be understood as a vector generated by performing vector conversion on the safety question and answer field document data; and the safety question and answer field intention vector can be understood as a vector generated by performing vector conversion on the safety question and answer field intention data.In specific implementation, in the case that the initial data can be understood as one or more of the security question and answer field work order data, the security question and answer field term data, the security question and answer field document data, and the security question and answer field intent data, correspondingly, one or more of the security question and answer field work order data, the security question and answer field term data, the security question and answer field document data, and the security question and answer field intent data contained in the initial data can be respectively processed by the vector generation model to obtain corresponding vectors, for example, the security question and answer field work order data and the security question and answer field term data are respectively processed by the vector generation model to obtain the security question and answer field work order vector and the security question and answer field term vector, or for example, the security question and answer field work order data, the security question and answer field document data, and the security question and answer field term data are respectively processed by the vector generation model to obtain the security question and answer field work order vector, the security question and answer field document vector, and the security question and answer field term vector, and the like. The present embodiment does not exhaustively list all the cases, and one or more of the security question and answer field work order vector, the security question and answer field term vector, the security question and answer field document vector, and the security question and answer field intent vector can be obtained by processing one or more of the security question and answer field work order data, the security question and answer field term data, the security question and answer field document data, and the security question and answer field intent data contained in the initial data by the vector generation model, which can be referred to the present embodiment. Further, after obtaining one or more of the security question and answer field work order vector, the security question and answer field term vector, the security question and answer field document vector, and the security question and answer field intent vector, one or more of the security question and answer field work order vector, the security question and answer field term vector, the security question and answer field document vector, and the security question and answer field intent vector obtained can be determined as the template vector. For example, the security question and answer field work order vector and the security question and answer field term vector are determined as the template vector after the security question and answer field work order data and the security question and answer field term data are respectively processed by the vector generation model to obtain the security question and answer field work order vector and the security question and answer field term vector, or for example, the security question and answer field work order vector, the security question and answer field document vector, and the security question and answer field term vector are determined as the template vector after the security question and answer field work order data, the security question and answer field document data, and the security question and answer field term data are respectively processed by the vector generation model to obtain the security question and answer field work order vector, the security question and answer field document vector, and the security question and answer field term vector, and the like.One embodiment of the present disclosure provides a question and answer method. The method includes: converting security question and answer field work order data, security question and answer field term data, security question and answer field document data, and security question and answer field intent data into vectors respectively to generate corresponding vectors, thereby ensuring the accuracy of the vector conversion and improving the accuracy of subsequent template vector matching. In one or more embodiments of the present disclosure, the method further includes: determining an initial question and historical dialogue data corresponding to the initial question; determining a fifth prompt text according to the historical dialogue data and the initial question; and determining the target question by using the language model according to the fifth prompt text. The initial question can be understood as the current question in the current question and answer session, and the historical dialogue data can be understood as the dialogue record data before the current question in the current question and answer session, including historical questions and historical answers returned by the question and answer system for the historical questions. The fifth prompt text can be determined according to the historical dialogue data and the initial question, that is, the fifth prompt text including historical dialogue information is constructed according to the historical dialogue data and the initial question. Further, after obtaining the fifth prompt text, the target question rewritten by the language model can be obtained according to the fifth prompt text. In one embodiment of the present disclosure, the question and answer method is used to rewrite the current question data according to the historical dialogue data in a multi-round dialogue scenario to obtain the rewritten target question, so that the question and answer system can consider the context of the dialogue when answering the current question, thereby improving the matching and accuracy of the target answer and the target question. Step 204: determining a target vector corresponding to the target question, determining a template vector corresponding to the target vector from the vector library, and performing word segmentation on the target question to determine a template text corresponding to the word segmentation result from the text library. The target vector corresponding to the target question can be understood as a vector obtained by converting the target question into a vector. The template vector corresponding to the target vector can be understood as a template vector having a similarity degree to the target vector reaching a preset similarity degree. The word segmentation on the target question can be understood as obtaining each word segmentation text contained in the target question according to the words, punctuation marks, etc. contained in the target question. According to the word segmentation text, the template text matched with the word segmentation text can be determined from the text library, for example, a template text containing the word segmentation text.In one or more embodiments of the present disclosure, the template vector includes a security Q&A domain intent vector; after determining the target vector corresponding to the target question, further comprising: determining a target security Q&A domain intent vector corresponding to the target vector from the vector library, and determining a target intent of the target vector according to the intent corresponding to the target security Q&A domain intent vector; in the case of determining that the target intent is a chat intent, processing the target question by using a language model to obtain a target answer corresponding to the target question; in the case of determining that the target intent is a program call, determining a program call instruction according to the target question, and determining a target answer corresponding to the target question according to an execution state of the program call instruction, wherein the program call instruction is used to call a to-be-called program contained in the target question; in the case of determining that the target intent is a Q&A, and the template vector further includes the security Q&A domain work order vector, and / or the security Q&A domain term vector, and / or the security Q&A domain document vector, performing the steps of determining a template vector corresponding to the target vector from the vector library, and performing word segmentation on the target question, and determining a template text corresponding to the word segmentation result from the text library. The program call instruction can be understood as an instruction for calling a certain program, and the execution state of the program call instruction can be understood as an execution state of successful instruction execution, an execution state of failed instruction execution, an execution state of instruction execution in progress, etc.; the to-be-called program can be understood as a program identifier contained in the text information of the target question, for example, the target question contains program information of a certain program, such as the target question "query which high-risk alarms are detected on the host side", and the calling instruction of the to-be-called program corresponding to "query high-risk alarms". In specific implementation, after determining the target vector, the target vector can be matched with the security Q&A domain intent vector in the vector library to determine the target intent corresponding to the target vector. Further, in the case of the target intent being a chat, a language model is directly used to give a target answer corresponding to the target question; in the case of the target intent being a program call, a program call instruction corresponding to the target question is determined, a corresponding to-be-called program is called, and a target answer containing an instruction execution state is determined according to the execution state of the program call instruction; in the case of the target intent being a Q&A, the steps of determining a template vector corresponding to the target vector from the vector library, and performing word segmentation on the target question, and determining a template text corresponding to the word segmentation result from the text library are performed, and specific implementation manners can be referred to the above description.The question and answer method provided by one embodiment of the present disclosure improves the accuracy of question and answer processing by determining the target intention corresponding to the target question as chatting, program calling, or question and answer, and determining different target question answering manners for different intentions. In one or more embodiments of the present disclosure, the intention corresponding to the target security question and answer field intention vector includes at least two intentions; the target intention of the target vector is determined according to the intention corresponding to the target security question and answer field intention vector, including: in the case where the intention corresponding to the target security question and answer field intention vector is the same intention, any one of the intentions corresponding to the target security question and answer field intention vector is determined as the target intention of the target vector; in the case where the intention corresponding to the target security question and answer field intention vector includes at least two different intentions, a fourth prompt text is determined according to the target intention question corresponding to the target security question and answer field intention vector, and the target intention of the target vector is determined according to the fourth prompt text by using the language model. Specifically, the fourth prompt text is determined according to the target intention question corresponding to the target security question and answer field intention vector, which can be understood as that the target intention question corresponding to the target security question and answer field intention vector is constructed to include the target intention question corresponding to the target security question and answer field intention vector and the target question, and is used to instruct the language model to give a prompt text of the target intention question corresponding to the target security question and answer field intention vector that is closer to the target question. The question and answer method provided by one embodiment of the present disclosure ensures the accuracy of the intention analysis of the target vector by using the language model to analyze the target intention in the case where the intention corresponding to the target security question and answer field intention vector is at least two intentions, thereby improving the accuracy of the answering processing manner used for answering the target question, and further improving the accuracy of the target answer obtained subsequently. In one or more embodiments of the present disclosure, after determining the target vector corresponding to the target question, determining the template vector corresponding to the target vector from the vector library, and performing word segmentation on the target question to determine the template text corresponding to the segmentation result from the text library, the method further includes: in the case where the template vector and the template text do not exist, determining the target answer corresponding to the target question by using the language model according to the target question.Wherein, the case that the template vector and the template text do not exist can be understood as that the template vector corresponding to the target vector is not determined from the vector library, and the template text corresponding to the target question is not determined from the text library, that is, the data is not retrieved, in this case, the language model can be used to directly answer the target question to obtain the target answer corresponding to the target question. The question and answer method provided in one embodiment of the present disclosure directly uses the language model to answer the target question in the case that the information related to the target question is not retrieved, ensures the normal output and relatively accurate answer of the target answer, and improves the user experience. Step 206: determining an initial answer corresponding to the target vector according to the template vector, the template text, the target vector and the target question. Wherein, the initial answer can be understood as a candidate answer, that is, the answer matched from the vector library, and there can be multiple initial answers. In one or more embodiments of the present disclosure, the determining of the initial answer corresponding to the target vector according to the template vector, the template text, the target vector and the target question comprises: determining a first initial answer from the text answer corresponding to the template vector according to the first similarity result of the determined template vector and the target vector and the association relationship with the preset first similarity condition; determining a second initial answer from the template text according to the second similarity result of the determined template text and the target question and the association relationship with the preset second similarity condition; and determining the first initial answer and the second initial answer as the initial answer corresponding to the target vector. Wherein, the first similarity result can be understood as the similarity degree of the template vector and the target vector, the first similarity condition can be understood as the similarity lower limit of the vector matching, the second similarity result can be understood as the similarity degree of the template text and the target question, and the second similarity condition can be understood as the similarity lower limit of the text matching, that is, the template vector and the target vector are considered to be dissimilar if the first similarity result is lower than the first similarity condition, and the template text and the target question are considered to be dissimilar if the second similarity result is lower than the second similarity condition. In specific implementation, the template vector corresponding to the first similarity result lower than the first similarity condition can be deleted from the above determined template vector, and the text answer corresponding to the remaining template vector is determined as the first initial answer; the template text corresponding to the second similarity result lower than the second similarity condition can be deleted from the above determined template text, and the remaining template text is determined as the second initial answer; and then, the first initial answer and the second initial answer are determined as the initial answer corresponding to the target vector. The question and answer method provided in one embodiment of the present disclosure removes the text answer and the template text corresponding to the template vector with lower similarity, so that the accuracy of the generated initial answer is higher, thereby improving the accuracy of the subsequent target answer.In one or more embodiments of this disclosure, after determining the initial answer corresponding to the target vector based on the template vector, the template text, the target vector, and the target question, the method further includes: if the similarity result between the target vector and the initial answer satisfies a preset fifth similarity condition, determining a target answer corresponding to the target question to represent that the answer does not exist; or if the similarity result between the target vector and the initial answer satisfies a preset sixth similarity condition, determining a target answer corresponding to the target question based on the initial answer. The preset fifth similarity condition can be understood as the similarity between the target vector and the initial answer being lower than a preset lower similarity threshold (e.g., labeled as A). oThe preset sixth similarity condition can be understood as that the similarity degree of the target vector and the initial answer is greater than or equal to a preset lower similarity threshold (namely, A described above) and less than a preset higher similarity threshold (for example, marked as B). In a specific implementation, the lower similarity threshold is set, and the lower similarity threshold can be greater than the similarity threshold corresponding to the first similarity condition. In a case where the determined similarity degree of the target vector and the initial answer is lower than the lower similarity threshold, it is considered that the similarity degree of the target vector and the initial answer is low, and then a target answer representing that the answer does not exist can be determined. Further, the higher similarity threshold is set, and the higher similarity threshold can be greater than the lower similarity threshold. In a case where the determined similarity degree of the target vector and the initial answer is between the lower similarity threshold and the higher similarity threshold, it is considered that the target vector and the initial answer have certain similarity but are not completely accurate, and a plurality of target answers corresponding to the target question can be determined according to the initial answer for reference of a user. The question and answer method provided in one embodiment of the present disclosure gives different reply manners according to the similarity result of the target vector and the initial answer, so as to ensure the rigor of the target answer reply and improve the accuracy of the target answer. In a case where it is determined that the similarity result of the target vector and the initial answer satisfies a preset similarity condition, a first prompt text corresponding to the target vector is determined according to the initial answer. The preset similarity condition can be understood as that the similarity result of the target vector and the initial answer is greater than the higher similarity threshold (namely, B described above). In this case, it is considered that the initial answer has high reference value. Based on this, the first prompt text corresponding to the target vector can be determined according to the initial answer, so as to be used for subsequent language model to answer the target question. In one or more embodiments of the present disclosure, the preset similarity condition includes a preset third similarity condition and a preset fourth similarity condition. In a case where it is determined that the similarity result of the target vector and the initial answer satisfies a preset similarity condition, a first prompt text corresponding to the target vector is determined according to the initial answer, including: determining a first reference answer from a first initial answer in the initial answer according to the first similarity result of the template vector and the target vector and an association relationship with the preset third similarity condition; determining a second reference answer from a second initial answer in the initial answer according to the second similarity result of the template text and the target question and an association relationship with the preset fourth similarity condition; and determining the first prompt text corresponding to the target vector according to the first reference answer and the second reference answer.Specifically, since the calculation manner of the similarity degree of the vector matching is the calculation manner of the vector similarity, for example, the calculation manner of the vector similarity calculation through the vector retrieval, and the calculation manner of the similarity degree of the text matching is the calculation manner of the text similarity, for example, the calculation manner of the keyword similarity calculation through the reverse arrangement, the dimensions of the similarity calculated by the two calculation manners are two dimensions, and therefore sorting needs to be performed on the two dimensions respectively to determine the more similar template vector and template text. In a specific implementation, the preset third similarity condition can be understood as the vector similarity being greater than a higher vector similarity threshold, that is, it can be considered that the template vector has a higher reference value, and the preset fourth similarity condition can be understood as the text similarity being greater than a higher text similarity threshold, that is, it can be considered that the template vector has a higher reference value. Based on this, the first reference answer and the second reference answer can be determined. The first reference answer can be understood as the template text corresponding to the template vector whose vector similarity with the target vector is greater than the higher vector similarity threshold, and the second reference answer can be understood as the template text whose text similarity with the target question is greater than the higher text similarity threshold. Further, the first prompt text of the target vector can be constructed according to the first reference answer and the second reference answer. The question and answer method provided in an embodiment of the present disclosure determines the more similar first reference answer from the template vector, determines the more similar second reference answer from the template text, and thereby constructs the first prompt text according to the first reference answer and the second reference answer, which improves the matching degree of the first prompt text and the target question, and thereby further improves the accuracy of the target answer determined according to the first prompt text subsequently. Step 210: determining a target answer corresponding to the target question by using a language model and the first prompt text. The language model can be understood as the language model described above. Determining the target answer corresponding to the target question by using the language model and the first prompt text can be understood as inputting the first prompt text into the language model to obtain the target answer corresponding to the target question output by the language model, or invoking the language model to answer the first prompt text to obtain the target answer corresponding to the target question returned by the language model. In one or more embodiments of the present disclosure, after the target answer corresponding to the target question is determined, the method further includes: determining a data address of the initial answer and completion data of the initial answer according to the initial answer, wherein the data address is used to access the initial data corresponding to the initial answer, and the completion data is data obtained by completing the initial answer according to the initial data corresponding to the initial answer; and adding the data address and the completion data to the target answer.Wherein, the data address of the initial answer can be understood as the storage address of the initial data corresponding to the initial answer. The complement data of the initial data can be understood as other data of the same initial data as the initial answer. For example, the initial answer corresponds to a document data in the initial data, and the complement data of the initial answer can be understood as other document data in the document data. Alternatively, the initial answer corresponds to one of the term explanations of one of the security terms in the initial data, and the complement data of the initial data can be understood as the complete security term data of the security term, and the like. Further, the data address and the complement data can be added to the target answer to update the target answer. In specific implementation, the reference information (i.e. the initial answer) obtained through the multi-path recall can contain information matching the target question, and in actual application, the user has the need to view the context of the reference information, i.e. the original file (for example, one or more complete documents in the initial security question and answer field document data, one or more complete term information in the initial security question and answer field term data, and the like) of the retrieval. These data cannot be directly retrieved, so the reference information associated with the initial answer can be added to the target answer to facilitate the user to view the more complete target answer. In specific implementation, other data of the same initial data as the initial answer and the storage address of the initial data are added to the target answer. Other data of the same initial data as the initial answer can facilitate the user to directly view the associated information, and the storage address of the initial data facilitates the user to directly access the source data of the initial data, so that the user can perform a larger range of retrieval subsequently. The question and answer method provided by one embodiment of the disclosure updates the data address associated with the initial data and the complement data of the initial data to the target answer, so that the answer information contained in the target answer is more abundant, and the user experience is improved. In one or more embodiments of the disclosure, before the initial question and the historical dialogue data corresponding to the initial question are determined, the method further comprises: receiving the initial question and the historical dialogue data corresponding to the initial question sent by the client, wherein the initial question and the historical dialogue data corresponding to the initial question are determined and sent by the client by collecting question and answer interaction information between the user and the user interaction interface of the client; after the target answer corresponding to the target question is determined, the method further comprises: returning the target answer to the client, so that the client displays the target answer to the user through the user interaction interface.The client can be understood as a client corresponding to the question and answer server applying the above question and answer method, that is, the user can input the target question through the client, determine the target answer of the target question through the question and answer server, and display the target answer to the user through the client. The question and answer method provided by one embodiment of the present disclosure interacts with the user through the client, so that the user can more intuitively obtain the reply to the target question, improves the user interaction, and thus improves the user experience. The question and answer method provided by one embodiment of the present disclosure determines the target vector corresponding to the target question, matches the target vector with the template vector in the vector library, obtains the template vector similar in semantics to the target vector, and obtains the template text matched with the key word of the target question from the text library according to the word segmentation of the target question, so as to determine the initial answer corresponding to the target vector according to the template vector, the template text, the target vector and the target question, so that the initial answer can take into account the semantic information and the key word information of the target question, improve the accuracy of the initial answer, and thus improve the accuracy of the target answer determined according to the initial answer. Further, in the case that the similarity result of the target vector and the initial answer meets the preset similarity condition, it is considered that the initial answer has high accuracy, and thus has high reference value. The first prompt text corresponding to the target vector is determined according to the initial answer, so as to answer the target question by using the language model and the prompt text, and further improve the accuracy of the answer to the target question. Moreover, by analyzing the question and answer field to which the target question belongs, performing multi-path recall retrieval from the vector library and the text library corresponding to the question and answer field, the prompt text referenced by the target answer can be more relevant to the question and answer field, and the accuracy of the target answer to the target question in the question and answer field is improved. The question and answer method provided by one embodiment of the present disclosure is applied to the safety vertical field as an example for further description in combination with FIG. 3. Referring to FIG. 3, FIG. 3 is a process flow diagram of a question and answer method according to one embodiment of the present disclosure, specifically including the following steps. Step 302: data collection and processing. Specifically, the data collection and processing can be understood as the collection and processing of work order type raw data, safety term type raw data, document type raw data and intent type raw data.
[0003] Step 402: Obtain the ticket type original data. Specifically, the ticket type original data can be obtained from the ticket system by manual extraction, or the ticket system can be obtained by a preset webpage data acquisition technique to obtain the ticket type original data. Step 404: Store in the format (xlsx) format. The xlsx format storage can be understood as storing the above-mentioned ticket type original data as a table file format (xlsx format) ticket type data. Specifically, after obtaining the above-mentioned ticket type original data, the above-mentioned ticket type original data is stored as a table file format (xlsx format) ticket type data. It should be noted that the embodiment of the present disclosure is not limited to storing the above-mentioned ticket type original data as a table file format ticket type data, but can also be stored as other format data, such as hypertext markup language format (html format) and the like. The specific implementation manner of storing in other formats can be referred to the embodiment of the present disclosure, and will not be described here. Step 406: Data preprocessing. The data preprocessing can be understood as data preprocessing of the table file format ticket type data. Specifically, after obtaining the table file format ticket type data, since the table file format ticket type data contains hypertext markup language format ticket type data, it is not convenient for subsequent text information extraction and matching. Therefore, the hypertext markup language format ticket type data in the table file format ticket type data is converted into pure text format (markdown format, markdown is abbreviated as md) format ticket type data, and the updated table file format ticket type data is obtained according to the pure text format ticket type data and the table file format ticket type data. Further, the question type data (type), question data (question), answer html format data (answer_html, that is, the above-mentioned html format ticket type data), answer md format data (answer_md, that is, the above-mentioned md format ticket type data), and version information data (version) in the updated xlsx format ticket type data are extracted. Step 408: Store in the format (json) format. The storage in the json format can be understood as storing the ticket type data as a json format ticket type data set. Specifically, after the above-mentioned extraction is completed, the json format ticket type data set is obtained according to the extraction result.
[0004] (II) Data collection and processing of safety term type raw data. Referring to FIG. 5, FIG. 5 is a safety term type data processing flowchart of a question and answer method according to an embodiment of the present disclosure, specifically comprising the following steps. Step 502: determining raw safety term information. Specifically, the raw safety term information can be obtained by obtaining the explanations and summaries of multiple safety experts for multiple safety terms. Step 504: correction. The correction can be understood as correcting the raw safety term information. Specifically, after obtaining the raw safety term information, the repeated information and the information with an explanation completeness lower than a preset completeness threshold in the raw safety term information are removed to obtain corrected safety term data. Step 506: storage in xlsx format. The xlsx format storage can be understood as storing the safety term data in a table file format (xlsx format). Specifically, after obtaining the corrected safety term data, the corrected safety term data is stored as safety term data in xlsx format (as described in the above embodiment, the xlsx format is not limited). Step 508: data preprocessing. The data preprocessing can be understood as data preprocessing of the safety term data in the table file format. Specifically, after obtaining the safety term data in xlsx format, the safety term data in xlsx format is subjected to data deduplication, and the serial number data (id), safety term data (safetyterm), synonym term data (synonym), English term data (english), term explanation data (explain), and version data (version) in the deduplicated safety term data are extracted. Step 510: storage in json format. The storage in json can be understood as storing the safety term data as a safety term type data set in json format. Specifically, after the above extraction is completed, the safety term type data set in json format is obtained according to the extraction result.
[0005] (Three) data collection and processing of intent type raw data. Specifically, the intent type includes three types of intents: chat, tool calling, and question and answer (qa). For each type of intent, a plurality of instance questions corresponding to the type of intent are obtained, i.e., intent type raw data corresponding to each type of intent, and an intent type data set is constructed according to each type of intent and the plurality of instance questions corresponding to each type of intent. For example, chat instance questions: "Good morning, how are you?", "Hello", "Have you heard the news?", "What is your favorite book?", "Who are you?", etc.; tool calling instance questions: "Please analyze the alarm situation in the past 7 days", "Query which high-risk alarms are detected on the host side", etc.; question and answer (qa) instance questions: "Received the trust supervision notice of *** that the cloud server has high-risk security vulnerabilities", "Virus type of security center virus defense", "Security center service terms", etc.
[0006] (Four) data collection and processing of document type raw data. Referring to FIG. 6, FIG. 6 is a document type data processing flowchart of a question and answer method according to one embodiment of the present disclosure, specifically including the following steps. Step 602: preset web data acquisition technology download. Specifically, the preset web data acquisition technology download can be understood as downloading document type raw data from a web page using a preset web data acquisition technology. Step 604: stored in markdown format. Wherein, markdown storage can be understood as storing the downloaded document type raw data as markdown format document type data. Step 606: data preprocessing. Wherein, data preprocessing can be understood as data preprocessing of the markdown format document type data. In the process of storing the downloaded document type raw data as markdown format document type data, there are format error conditions, including but not limited to table format error conditions, link path error conditions, etc., so the markdown format document type data needs to be preprocessed, including but not limited to cleaning, table restoration, link replacement, title identifier unification, etc. In specific implementation, first, the document type data with table format error conditions and the document type data with link path error conditions are obtained by cleaning from the markdown format document type data. Further, the document type data with table format error conditions is restored, for example, a table format error Further, the title identifiers in the markdown-formatted document data are unified to obtain a document data set, i.e., the title identifiers in the markdown-formatted document data are replaced with uniform identifiers, for example, "#" or other identifiers. Step 608: Store the document data. The storage of the document data can be understood as storing the markdown-formatted document data after the data preprocessing. Step 304: Document chunking. The document chunking can be understood as data segmentation of the document data. In actual applications, the document data is usually large, i.e., contains a large number of tokens. Since the language model needs to be used for processing subsequently, the large document data cannot be well processed by the language model. Therefore, the large document data (for example, document data containing more than 1000 tokens) can be segmented. Referring to FIG. 7, which is a document data chunking processing flowchart of a question and answer method according to an embodiment of the present disclosure, and specifically includes the following steps. Step 702: Split the text block based on the title. Specifically, for each document in the document data set, the text block is split based on the title, the text under each title is processed as a single text block, and a first split text block is obtained. Step 704: Table extraction. The table extraction, i.e., table extraction, can be understood as extracting a table from the first split text block. Specifically, the table information is extracted from the first split text block, and the text block is split into a text text portion text block and / or a table table portion text block. Further, the number of tokens corresponding to the text text portion text block and / or the table table portion text block can be calculated, and the text information before the table header can be extracted for information enhancement of the table. Step 706: Text information enhancement based on the title and the abstract. The document title and abstract information of each document (or the text is summarized using a large model) are extracted, and the document title and abstract information of each document are used for information enhancement of the text text portion text block and / or the table table portion text block corresponding to each document. Step 708: Determine whether the number of tokens is greater than a threshold value. Specifically, determining whether the number of tokens is greater than a threshold value can be understood as determining whether the number of tokens in the text text portion text block and / or the table table portion text block obtained is greater than a preset token number threshold. If yes, step 710 is performed, and if no, step 712 is performed. Step 710: Secondary block segmentation.Wherein, the secondary block segmentation can be understood as segmenting the table table part text block and / or the text text part text block. Specifically, for the table table part text block, based on the preset word segmentation quantity threshold, it is segmented into multiple small tables, and segmented by rows to ensure the correct table markdown structure, to obtain the updated table table part text block; for the text text part text block, based on the preset word segmentation quantity threshold, it is segmented according to punctuation symbols to obtain the updated text text part text block, and step 712o step 712: table / text summary is executed. Wherein, the table / text summary, i.e. table / text summary, can be understood as summarizing the above table table part text block, text text part text block. Specifically, for the text text part text block, the text prompt text is directly constructed according to the text text part text block, and the text summary data is obtained by using the language model to obtain the text prompt text of the text text part text block; for the table table part text block, the table prompt text is generated according to the information enhancement of the table table part text block according to the document title and abstract information of each document obtained in the above step 706, the text information in front of the table header obtained in the above step 704, and the table table part text block, and the table summary data is generated by using the table prompt text and the table table part text block. Step 714: storage as format (json) o wherein, storage as json can be understood as storing as json format document class data of each cut block corresponding to each document. Specifically, according to the text text part text block, the table table part text block, the updated table table part text block, the updated text text part text block, the text summary data, and the table summary data obtained above, the json format document class data of each cut block corresponding to each document is determined. Step 716: segmentation based on the number of word segmentation of the embedding model. Wherein, the segmentation based on the number of word segmentation of the embedding model can be understood as the number relationship between the number of word segmentation of the embedding model and the number of word segmentation of each cut block after the cut block of the json format constructed in step 714, to determine whether further cut block is needed to meet the embedding model window word segmentation quantity requirement. In the case that the number of word segmentation of the embedding model is greater than the number of word segmentation of each cut block after the cut block of the json format constructed in step 714, the json format document class data of each cut block corresponding to each document is determined.In the case that the number of tokens in the embedding model is less than the number of tokens in each segment after the segmentation of the text block in step 714, if the segment is a table text block, the table summary data is segmented, and steps 710-714 are performed; or if the segment is a text text block, the text text block is segmented according to the relationship between the number of tokens in the text text block and the number of tokens in the embedding model, and steps 710-714 are performed. Step 306: Vector library construction. Specifically, vector library construction can be understood as storing the processed work order data, security term data, and document data into the vector library using a pre-constructed table structure. For example, the pre-constructed table structure can be understood as "Column("id", TEXT, primary_key=True), Column("embedding", ARRAY(REAL)), Column("document", String, nullable=True), Column("type", String, nullable=True), Column("filename", String, nullable=True), Column("metadata", JSON, nullable=True), Column("tsvector", TSVECTOR, nullable=True),,, After that, the vector library can be configured according to the table structure to realize subsequent vector retrieval and inverted index retrieval. Step 308: Construction of vector retrieval enhancement model. After the vector library is constructed, the logic of question retrieval can be enhanced, as shown in FIG. 8, which is a question retrieval processing process flowchart of a question and answer method according to an embodiment of the present disclosure, specifically including the following steps. Step 802: Question input. The question input can be understood as determining the target question input by the user through the client and the conversation history with the user. Step 804: Determine whether to start a multi-round conversation. The determination of whether to start a multi-round conversation can be understood as determining whether the multi-round conversation function is configured to be started. If yes, step 806 is performed; if no, step 808 is performed. Step 806: Question rewriting. The question rewriting can be understood as rewriting the target question.Specifically, after obtaining the target question and the dialogue history, a rewriting prompt text is determined according to the target question and the dialogue history, and a language model is used to obtain a rewritten target question according to the rewriting prompt text. Step 808: Determine whether to start intent recognition. The determination of whether to start intent recognition can be understood as determining whether the intent recognition function is configured to be started. If yes, step 810 is executed; if no, step 822 is executed. Step 810: Intent recognition. The intent recognition can be understood as recognizing the intent of the target question. Specifically, a vectorization model is used to perform vectorization processing on the target question to obtain a target vector corresponding to the target question. The target vector is matched with a plurality of vectors corresponding to the intent class data set in the vector library to determine a plurality of similar vectors matched with the target vector. Then, it is determined whether the intents corresponding to the plurality of similar vectors are consistent. If yes, the intent of the target vector is determined. If no, an intent recognition prompt text is constructed according to the plurality of similar vectors, and a language model is used to obtain the intent of the target vector. Step 812: Determine the current intent. The determination of the current intent can be understood as determining the intent of the target vector. Specifically, according to the execution result of step 810, the intent of the target vector can be determined. If the intent is chat, step 814 is executed; if the intent is tool calling, step 820 is executed; if the intent is QA, step 822 is executed. Step 814: Construct a chat prompt text. Specifically, in the case where the intent of the target vector is determined to be chat, a chat prompt text is constructed according to the target vector. Step 816: Process using a large language model. The processing using a large language model, i.e., LLM, can be understood as, after the chat prompt text is determined, a language model is used to obtain a target answer corresponding to the target question according to the chat prompt text. Step 818: Return the result of the large language model to the client. The return of the result of the large language model, i.e., LLM, to the client can be understood as returning the target answer corresponding to the target question to the client, so that the client displays the target answer to the user. Step 820: Call the related tool. The calling of the related tool can be understood as calling the tool corresponding to the target vector. Specifically, in the case where the intent of the target vector is determined to be tool calling, a target tool to be called corresponding to the target vector is determined, and the target tool is called to execute the task corresponding to the target vector. Step 822: Question processing.Wherein, the problem processing can be understood as, after obtaining the target problem, using the vectorization model to vectorize the target problem, generating the target vector corresponding to the target problem, or in the case of obtaining the target vector, determining the target vector. Step 824: Vector retrieval. Wherein, the vector retrieval can be understood as using the target vector to perform vector similarity matching with each vector in the above vector library, and determining a plurality of matching vectors. Step 826: Inverted index retrieval. Wherein, the inverted index retrieval can be understood as using the word segmentation contained in the target problem to match the text data corresponding to each vector contained in the above vector library, and obtaining a plurality of matching texts. Step 828: Merge the retrieval results. Wherein, the retrieval result merging can be understood as merging the plurality of matching vectors obtained in the above step 824 and the plurality of matching texts obtained in the above step 826, for subsequent re-scoring and reordering. Step 830: Re-scoring and reordering of retrieval results. Wherein, the re-scoring and reordering of retrieval results can be understood as re-scoring or reordering the retrieval results. Specifically, the re-scoring and reordering of retrieval results includes two ways. Way one: using a reordering model to re-determine the scoring standard; according to the similarity of the plurality of matching vectors obtained in the above step 824 and the plurality of matching texts obtained in the above step 826 with the target vector, scoring the plurality of matching vectors and the plurality of matching texts, and reordering the plurality of matching vectors and the plurality of matching texts according to the score. Way two: respectively specifying a scoring system for vector retrieval and inverted index retrieval, respectively scoring the plurality of matching vectors and the plurality of matching texts, and respectively reordering the plurality of matching vectors and the plurality of matching texts contained in the ordering result according to the preset reordering threshold. Step 832: According to the ordering result, the matching reply strategy. Specifically, according to the above reordering result, the scores of the plurality of matching vectors and the plurality of matching texts can be determined, and according to the relationship between the scores and the first score threshold and the second score threshold, the reply strategy corresponding to the target problem can be determined. In the case where the scores of the plurality of matching vectors and the plurality of matching texts are greater than or equal to the first score threshold and less than or equal to the second score threshold, the first reply strategy is determined; in the case where the scores of the plurality of matching vectors and the plurality of matching texts are less than the first score threshold, the second reply strategy is determined; in the case where the above matching vectors and matching texts are not obtained, the third reply strategy is determined; in the case where the scores of the plurality of matching vectors and the plurality of matching texts are greater than the second score threshold, the fourth reply strategy is determined. Step 834: Execute the reply.Specifically, in the case of determining the first reply strategy, a plurality of reference information is generated according to the plurality of matching vectors and the plurality of matching texts, and a target answer corresponding to the target question is determined according to the plurality of reference information. In the case of determining the second reply strategy, a target answer that cannot be answered is determined. In the case of determining the third reply strategy, a direct answer prompt text is constructed according to the target question, and a target answer corresponding to the target question is obtained by using a language model according to the direct answer prompt text. In the case of determining the fourth reply strategy, a question and answer prompt text is determined, the question and answer prompt text is updated according to the plurality of matching vectors and the plurality of matching texts, and a target answer corresponding to the target question is determined by using a language model according to the updated question and answer prompt text. Optionally, after the target answer corresponding to the target question is determined by using the language model, a data source address associated with the target answer, such as a document source, can be obtained, so that the user can directly access the original data such as the document through the data source address. Further, after the target answer corresponding to the target question is determined by using the language model, complete data associated with the target answer can be obtained from the data source according to the data source such as the document source, the work order source and the table data source, so as to complete the target answer and improve the richness of the target answer. After the target answer is obtained, the target answer can be sent to the client, so that the client displays the target answer to the user. An embodiment of the present disclosure provides a question and answer method, which pre-constructs a vector library associated with a security vertical field by using work order type data, security term type data, document type data and intent recognition type data, improves the problem answering capability of the security vertical field, thereby improving the accuracy of answering the target question, and by using vector retrieval to realize semantic matching of the target question, solves the problems of low accuracy of search engine answers, inability to support semantic level analysis and inability to execute instructions, and by combining inverted index retrieval to realize keyword matching of the target question, reduces the probability of problems such as answer illusion, weak stability and low security caused by semantic answers, thereby significantly improving the accuracy of the target answer by combining vector retrieval and inverted index retrieval. Furthermore, by using targeted data storage methods for different data, the probability of format errors caused by data storage is reduced, the accuracy of the matching result obtained by subsequent matching through the vector library is improved, and the accuracy of the target answer is further improved.Corresponding to the above question and answer method embodiments, the present disclosure also provides a security question and answer field question and answer method embodiment, the specific implementation is as follows: determining a security question and answer field target question, a security question and answer field vector library, and a security question and answer field text library corresponding to the security question and answer field vector library; determining a security question and answer field target vector corresponding to the security question and answer field target question, determining a security question and answer field template vector corresponding to the security question and answer field target vector from the security question and answer field vector library, and performing word segmentation on the security question and answer field target question, determining a security question and answer field template text corresponding to the word segmentation result from the security question and answer field text library; determining a security question and answer field initial answer corresponding to the security question and answer field target vector according to the security question and answer field template vector, the security question and answer field template text, the security question and answer field target vector, and the security question and answer field target question; in the case that the similarity result of the security question and answer field target vector and the security question and answer field initial answer meets a preset similarity condition, determining a security question and answer field first prompt text corresponding to the security question and answer field target vector according to the security question and answer field initial answer; determining a security question and answer field target answer corresponding to the security question and answer field target question by using a language model and the security question and answer field first prompt text. Wherein, the security question and answer field target question can be understood as the above target question belonging to the security question and answer field, the security question and answer field vector library can be understood as the above vector library corresponding to the security question and answer field, and the security question and answer field text library can be understood as the above vector library corresponding to the security question and answer field and the corresponding security question and answer field text library. For specific implementation, please refer to the question and answer method specific implementation under the security question and answer field in the above specification embodiment. Optionally, before determining the security question and answer field target question, the security question and answer field vector library, and the security question and answer field text library corresponding to the security question and answer field vector library, it further includes: determining security question and answer field initial data, and performing vector processing on the security question and answer field initial data according to a vector generation model to obtain the security question and answer field template vector; determining a security question and answer field template text having a matching relationship with the security question and answer field template vector; constructing the security question and answer field vector library according to the security question and answer field template vector, and constructing the security question and answer field text library corresponding to the security question and answer field vector library according to the security question and answer field template text.An embodiment of the present disclosure provides a security question and answer field question and answer method. The method performs multi-channel recall search from a security question and answer field vector library and a security question and answer field text library, so that the security question and answer field prompt text referenced by a security question and answer field target answer is more relevant to the security question and answer field, and the accuracy of the reply to the target question in the security question and answer field is improved. The above is a schematic solution of the security question and answer field question and answer method. It should be noted that the technical solution of the security question and answer field question and answer method belongs to the same concept as the technical solution of the question and answer method described above, and the details of the technical solution of the security question and answer field question and answer method that are not described in detail can be referred to the description of the technical solution of the question and answer method. Corresponding to the above security question and answer field question and answer method embodiment, the present disclosure further provides a security question and answer field question and answer device embodiment. Specifically, the device comprises: a first security question and answer field determination module configured to determine a security question and answer field target question, a security question and answer field vector library, and a security question and answer field text library corresponding to the security question and answer field vector library; a second security question and answer field determination module configured to determine a security question and answer field target vector corresponding to the security question and answer field target question, determine a security question and answer field template vector corresponding to the security question and answer field target vector from the security question and answer field vector library, and perform word segmentation on the security question and answer field target question, and determine a security question and answer field template text corresponding to the word segmentation result from the security question and answer field text library; a third security question and answer field determination module configured to determine a security question and answer field initial answer corresponding to the security question and answer field target vector according to the security question and answer field template vector, the security question and answer field template text, the security question and answer field target vector, and the security question and answer field target question; a fourth security question and answer field determination module configured to determine a security question and answer field first prompt text corresponding to the security question and answer field target vector according to the security question and answer field initial answer when a similarity result of the security question and answer field target vector and the security question and answer field initial answer meets a preset similarity condition; and a fifth security question and answer field determination module configured to determine a security question and answer field target answer corresponding to the security question and answer field target question by using a language model and the security question and answer field first prompt text.Optionally, the apparatus further comprises a security Q&A domain library construction module configured to: determine security Q&A domain initial data, and perform vector processing on the security Q&A domain initial data according to a vector generation model to obtain a security Q&A domain template vector; determine security Q&A domain template text having a matching relationship with the security Q&A domain template vector; construct the security Q&A domain vector library according to the security Q&A domain template vector, and construct the security Q&A domain text library corresponding to the security Q&A domain vector library according to the security Q&A domain template text. One embodiment of the present disclosure provides a security Q&A domain question answering apparatus. The apparatus performs multi-path recall retrieval from the security Q&A domain vector library and the security Q&A domain text library, so that the security Q&A domain prompt text referenced by the target answer of the security Q&A domain is more relevant to the security Q&A domain, and the accuracy of the reply to the target question under the security Q&A domain is improved. The above is a schematic solution of a security Q&A domain question answering apparatus. It should be noted that the technical solution of the security Q&A domain question answering apparatus and the technical solution of the security Q&A domain question answering method described above belong to the same concept. The technical solution of the security Q&A domain question answering apparatus is not described in detail, and the description of the technical solution of the security Q&A domain question answering method can be referred to. Corresponding to the method embodiment described above, the present disclosure further provides a question answering apparatus embodiment. FIG. 9 shows a structural schematic diagram of a question answering apparatus according to an embodiment of the present disclosure. As shown in FIG. 9, the apparatus comprises: a first determination module 902 configured to determine a target question, a Q&A domain to which the target question belongs, a vector library corresponding to the Q&A domain, and a text library corresponding to the vector library; a second determination module 904 configured to determine a target vector corresponding to the target question, determine a template vector corresponding to the target vector from the vector library, and perform word segmentation on the target question to determine a template text corresponding to the word segmentation result from the text library; a third determination module 906 configured to determine an initial answer corresponding to the target vector according to the template vector, the template text, the target vector, and the target question; a fourth determination module 908 configured to determine a first prompt text corresponding to the target vector according to the initial answer in a case where a similarity result of the target vector and the initial answer satisfies a preset similarity condition; and a fifth determination module 910 configured to determine a target answer corresponding to the target question by using a language model and the first prompt text.Optionally, the apparatus further comprises a library construction module configured to: determine initial data associated with the question and answer field, and perform vector processing on the initial data according to a vector generation model to obtain the template vector; determine template text having a matching relationship with the template vector; construct the vector library corresponding to the question and answer field according to the template vector, and construct the text library corresponding to the vector library according to the template text. Optionally, the library construction module is further configured to: determine a target preset vector matching the template vector from a preset vector database, wherein the preset vector database stores preset vectors, preset texts, and an association relationship between the preset vectors and the preset texts associated with the question and answer field; determine a target preset text corresponding to the target preset vector according to the association relationship between the preset vectors and the preset texts, and determine the target preset text as the template text having the matching relationship with the template vector. Optionally, the question and answer field is a security question and answer field, and the initial data is security question and answer field work order data, security question and answer field term data, security question and answer field document data, and / or security question and answer field intent data. Optionally, the library construction module is further configured to: perform vector conversion on the security question and answer field work order data, the security question and answer field term data, the security question and answer field document data, and / or the security question and answer field intent data according to the vector generation model to generate the template vector. Optionally, the initial data is security question and answer field work order data. Optionally, the library construction module is further configured to: determine initial security question and answer field work order data associated with the security question and answer field; extract sub-work order data corresponding to a preset work order information type from the initial security question and answer field work order data according to the preset work order information type; and determine the sub-work order data as the security question and answer field work order data. Optionally, the apparatus further comprises a work order data updating module configured to: in a case where the initial security question and answer field work order data contains work order data in a preset language format, perform format conversion on the work order data in the preset language format, and update the initial security question and answer field work order data according to a format conversion result.Optionally, the initial data is security question and answer domain term data; the library construction module is further configured to: determine initial security question and answer domain term data associated with the security question and answer domain; perform deduplication processing on the initial security question and answer domain term data to obtain deduplicated security question and answer domain term data; extract, according to a preset term information type, sub-term data corresponding to the preset term information type from the deduplicated security question and answer domain term data; and determine the sub-term data as the security question and answer domain term data. Optionally, the initial data is security question and answer domain document data; optionally, the library construction module is further configured to: determine initial security question and answer domain document data associated with the security question and answer domain; perform document data preprocessing on the initial security question and answer domain document data to obtain preprocessed security question and answer domain document data; and determine the security question and answer domain document data according to the preprocessed security question and answer domain document data. Optionally, the library construction module is further configured to: delete document data with format conversion errors in the initial security question and answer domain document data to obtain the preprocessed security question and answer domain document data; and / or perform table format repair on document data with table format errors in the initial security question and answer domain document data to obtain the preprocessed security question and answer domain document data; and / or perform link replacement on document data with link format errors in the initial security question and answer domain document data to obtain the preprocessed security question and answer domain document data; and / or replace title indicators in the initial security question and answer domain document data by using a preset identifier to obtain the preprocessed security question and answer domain document data. Optionally, the library construction module is further configured to: determine, according to the preprocessed security question and answer domain document data, a number of segmented words contained in the preprocessed security question and answer domain document data; in a case where the number of segmented words is greater than a preset first segmented word number threshold, perform section segmentation processing on the preprocessed security question and answer domain document data according to a chapter title contained in the preprocessed security question and answer domain document data to obtain section segmentation data; and determine the security question and answer domain document data according to the section segmentation data.Optionally, the chapter segmentation data comprises text data and / or table data; optionally, the library construction module is further configured to: determine text segmentation data according to the text data, and determine the security question and answer domain document data according to the text segmentation data; or determine table segmentation data according to the table data, and determine the security question and answer domain document data according to the table segmentation data; or determine text segmentation data according to the text data, and determine table segmentation data according to the table data, and determine the security question and answer domain document data according to the text segmentation data and the table segmentation data. Optionally, the library construction module is further configured to: determine the number of word segmentation corresponding to the text data according to the text data, and determine the text segmentation data according to the text data, the number of word segmentation of the text data, and the preset first word quantity threshold. The determination of the table segmentation data according to the table data comprises: determining the number of word segmentation corresponding to the table data and the table structure of the table data according to the table data, and determining the table segmentation data according to the table data, the number of word segmentation corresponding to the table data, the table structure of the table data, and the preset first word quantity threshold. Optionally, the library construction module is further configured to: construct a second prompt text according to the text segmentation data and a preset prompt text; obtain text summary data of the text data according to the second prompt text by using the language model, wherein the text summary data is determined according to text data corresponding to a preset text information type in the text data; determine initial segmentation data according to the text segmentation data and the text summary data, and determine the security question and answer domain document data according to the initial segmentation data.Optionally, the library construction module is further configured to: construct a second prompt text according to the text chunk data and a preset prompt text, and obtain text summary data of the text data according to the second prompt text by using the language model; determine document title data and document abstract data in the safety question and answer field document data according to the text chunk data and the table chunk data, and determine document information enhancement data of the safety question and answer field document data according to the document title data and the document abstract data; determine target text chunk data associated with the table chunk data from the text chunk data according to the table chunk data; construct a third prompt text according to the table chunk data, the document information enhancement data, the target text chunk data, and a preset prompt text, and obtain table summary data of the table chunk data according to the third prompt text by using the language model, wherein the table summary data is determined according to target text chunk data, the table chunk data, and the document information enhancement data corresponding to a preset table information type in the target text chunk data, the table chunk data, and the document information enhancement data; determine the initial chunk data according to the text chunk data, the table chunk data, the document information enhancement data, the text summary data, and the table summary data, and determine the safety question and answer field document data according to the initial chunk data. Optionally, the library construction module is further configured to: determine a word segmentation quantity corresponding to the initial chunk data according to the initial chunk data; perform chunk processing on the initial chunk data in a case where the word segmentation quantity corresponding to the initial chunk data is greater than a preset second word segmentation quantity threshold, and determine the safety question and answer field document data according to a chunk processing result; or determine the initial chunk data as the safety question and answer field document data in a case where the word segmentation quantity corresponding to the initial chunk data is less than or equal to the preset second word segmentation quantity threshold. Optionally, the initial data is safety question and answer field intent data. Optionally, the library construction module is further configured to: determine an intent question corresponding to the preset template intent; and determine the safety question and answer field intent data according to the template intent and the intent question.Optionally, the library construction module is further configured to: perform vector conversion on the security question and answer field work order data, the security question and answer field term data, the security question and answer field document data, and / or the security question and answer field intent data according to the vector generation model to generate a security question and answer field work order vector, and / or a security question and answer field term vector, and / or a security question and answer field document vector, and / or a security question and answer field intent vector; and determine the security question and answer field work order vector, and / or the security question and answer field term vector, and / or the security question and answer field document vector, and / or the security question and answer field intent vector as the template vector. Optionally, the template vector includes a security question and answer field intent vector. The apparatus further includes an intent recognition module configured to: determine a target security question and answer field intent vector corresponding to the target vector from the vector library, and determine a target intent of the target vector according to an intent corresponding to the target security question and answer field intent vector; when it is determined that the target intent is a chat intent, process the target question by using a language model to obtain a target answer corresponding to the target question; when it is determined that the target intent is a program call, determine a program call instruction according to the target question, and determine a target answer corresponding to the target question according to an execution state of the program call instruction, wherein the program call instruction is used to call a to-be-called program included in the target question; and when it is determined that the target intent is a question and answer, and the template vector further includes the security question and answer field work order vector, and / or the security question and answer field term vector, and / or the security question and answer field document vector, perform the steps of determining the template vector from the vector library corresponding to the target vector, and performing word segmentation on the target question to determine a template text corresponding to the word segmentation result from the text library. Optionally, the intent corresponding to the target security question and answer field intent vector includes at least two. The intent recognition module is further configured to: when it is determined that the intents corresponding to the target security question and answer field intent vector are the same intent, determine any one of the intents corresponding to the target security question and answer field intent vector as the target intent of the target vector; and when it is determined that the intents corresponding to the target security question and answer field intent vector include at least two different intents, determine a fourth prompt text according to a target intent question corresponding to the target security question and answer field intent vector, and determine the target intent of the target vector by using the language model according to the fourth prompt text.Optionally, the first determining module 902 is further configured to: determine the initial question and historical dialogue data corresponding to the initial question; determine fifth prompt text according to the historical dialogue data and the initial question; and determine the target question according to the fifth prompt text and the language model. Optionally, the third determining module 906 is further configured to: determine a first initial answer from the text answer corresponding to the template vector according to the first similarity result of the template vector and the target vector and the association relationship with a preset first similarity condition; determine a second initial answer from the template text according to the second similarity result of the template text and the target question and the association relationship with a preset second similarity condition; and determine the first initial answer and the second initial answer as the initial answer corresponding to the target vector. Optionally, the preset similarity condition includes a preset third similarity condition and a preset fourth similarity condition. Optionally, the fifth determining module 910 is further configured to: determine a first reference answer from the first initial answer in the initial answer according to the first similarity result of the template vector and the target vector and the association relationship with a preset third similarity condition; determine a second reference answer from the second initial answer in the initial answer according to the second similarity result of the template text and the target question and the association relationship with a preset fourth similarity condition; and determine the first reference answer and the second reference answer as the first prompt text corresponding to the target vector. Optionally, the apparatus further includes a sixth determining module configured to: determine the target answer corresponding to the target question for representing that an answer does not exist in a case where it is determined that the similarity result of the target vector and the initial answer satisfies a preset fifth similarity condition; or determine the target answer corresponding to the target question according to the initial answer in a case where it is determined that the similarity result of the target vector and the initial answer satisfies a preset sixth similarity condition. Optionally, the apparatus further includes a seventh determining module configured to: determine the target answer corresponding to the target question according to the target question by using the language model in a case where it is determined that the template vector and the template text do not exist. Optionally, the apparatus further includes an answer updating module configured to: determine a data address of the initial answer and completion data of the initial answer, wherein the data address is used to access initial data corresponding to the initial answer, and the completion data is data obtained by completing the initial answer according to the initial data corresponding to the initial answer; and add the data address and the completion data to the target answer.Optionally, the apparatus further comprises a data receiving module configured to receive the initial question sent by the client and historical dialogue data corresponding to the initial question, wherein the initial question and the historical dialogue data corresponding to the initial question are determined and sent by the client through collecting question and answer interaction information between a user and a user interaction interface of the client; optionally, the apparatus further comprises an answer returning module configured to return the target answer to the client, so that the client displays the target answer to the user through the user interaction interface. The question and answer apparatus provided in the embodiment of the disclosure determines a target vector corresponding to a target question, matches the target vector with a template vector in a vector library, obtains a template vector similar in semantics to the target vector, and obtains a template text matching a keyword of the target question from a text library according to word segmentation of the target question, so as to determine an initial answer corresponding to the target vector according to the template vector, the template text, the target vector and the target question, so that the initial answer can take into account semantic information and keyword information of the target question, improve accuracy of the initial answer, and thus improve accuracy of a target answer determined according to the initial answer. Further, in a case where a similarity result of the target vector and the initial answer meets a preset similarity condition, it is considered that the initial answer has high accuracy, and thus has high reference value, a first prompt text corresponding to the target vector is determined according to the initial answer, so that the target question is answered by using a language model and the prompt text, and accuracy of answering the target question is further improved. Further, by analyzing a question and answer field of the target question, searching in a vector library and a text library corresponding to the question and answer field, a matching degree of the target answer and the target question is improved, and accuracy of the target answer is further improved. The above is a schematic scheme of the question and answer apparatus. It should be noted that the technical scheme of the question and answer apparatus belongs to the same concept as the technical scheme of the question and answer method, and details of the technical scheme of the question and answer apparatus that are not described in detail can be referred to the description of the technical scheme of the question and answer method. FIG. 10 shows a structural block diagram of a computing device 1000 according to an embodiment of the disclosure. Components of the computing device 1000 include but are not limited to a memory 1010 and a processor 1020. The processor 1020 is connected with the memory 1010 through a bus 1030. A database 1050 is used to save data. The computing device 1000 further comprises an access device 1040, which enables the computing device 1000 to communicate via one or more networks 1060.Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1040 can include one or more of any type of network interface (e.g., a network interface card (NIC)) such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, etc. In one embodiment of the disclosure, the above-mentioned components of the computing device 1000 and other components not shown in FIG. 10 can also be connected to each other, for example, through a bus. It should be understood that the computing device structure block diagram shown in FIG. 10 is merely for the purpose of example, and is not a limitation on the scope of the disclosure. Other components can be added or replaced by those skilled in the art as needed. The computing device 1000 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1000 can also be a mobile or stationary server. Among them, the memory 1010 is used to store computer programs / instructions, and the processor 1020 is used to execute the computer programs / instructions stored in the memory 1010, which when executed by the processor implement the steps of the above question and answer method.The various embodiments in the present disclosure are described in a progressive manner, and the same or similar parts among the various embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, the description of the computing device embodiment is relatively simple because it is basically similar to the question-answering method embodiment, and the relevant part can be referred to the description of the question-answering method embodiment. An embodiment of the present disclosure further provides a computer-readable storage medium storing computer programs / instructions, which are executed by a processor to implement the steps of the question-answering method described above. The various embodiments in the present disclosure are described in a progressive manner, and the same or similar parts among the various embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, the description of the computer-readable storage medium embodiment is relatively simple because it is basically similar to the question-answering method embodiment, and the relevant part can be referred to the description of the question-answering method embodiment. An embodiment of the present disclosure further provides a computer program product including computer programs / instructions, which are executed by a processor to implement the steps of the question-answering method described above. The above is a schematic scheme of a computer program product of an embodiment. It should be noted that the technical scheme of the computer program product belongs to the same concept as the technical scheme of the question-answering method described above, and the details of the technical scheme of the computer program product that are not described in detail can be referred to the description of the technical scheme of the question-answering method. The above describes a specific embodiment of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order and still accomplish desirable results. Additionally, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In certain implementations, multitasking and parallel processing can be advantageous. The computer instructions include computer program code, which can be in source code, object code, executable code, or some intermediate form. The computer-readable medium can include any entity or apparatus that can carry the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.It should be noted that the contents contained in the computer readable medium can be appropriately increased or decreased according to the requirements of patent practices, for example, according to the patent practices in some regions, the computer readable medium does not include the electric carrier signal and the telecommunication signal. It should be noted that, for the foregoing method embodiments, in order to facilitate the description, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the embodiments of the present disclosure are not limited to the action sequence described, because according to the embodiments of the present disclosure, some steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential for the embodiments of the present disclosure. In the above embodiments, the description of each embodiment is focused on, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments. The preferred embodiments of the present disclosure disclosed above are only used to help explain the present disclosure. The optional embodiments do not describe all the details, and the invention is not limited to the specific embodiments described. Obviously, according to the content of the embodiments of the present disclosure, many modifications and changes can be made. The present disclosure selects and describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present disclosure, so that those skilled in the art can well understand and utilize the present disclosure. The present disclosure is limited by the claims and their entire scope and equivalents. An answer method provided by an embodiment of the present disclosure, by determining a target vector corresponding to a target question, matching the target vector with a template vector in a vector library to obtain a template vector similar in semantics to the target vector, and obtaining a template text matching the word segmentation in the target question from a text library according to the word segmentation of the target question, determining an initial answer corresponding to the target vector according to the template vector, the template text, the target vector and the target question, so that the initial answer can take into account the semantic information and the keyword information of the target question, improving the accuracy of the initial answer, thereby improving the accuracy of the target answer determined according to the initial answer; further, in the case that the similarity result of the target vector and the initial answer meets a preset similarity condition, it is considered that the initial answer has high accuracy, and therefore has high reference value, a first prompt text corresponding to the target vector is determined according to the initial answer, so that the target question is answered by using a language model and the prompt text, further improving the accuracy of the answer to the target question; and by analyzing the question and answer domain to which the target question belongs, performing multi-path recall retrieval from the vector library and the text library corresponding to the question and answer domain, the prompt text referenced by the target answer can be more relevant to the question and answer domain, improving the accuracy of the target answer to the target question in the question and answer domain.
Claims
39 CLAIM 1. A method of question answering, comprising: determine a target question, a question and answer field to which the target question belongs, a vector library corresponding to the question and answer field, and a text library corresponding to the vector library; determine a target vector corresponding to the target question, determine a template vector corresponding to the target vector from the vector library, and perform word segmentation on the target question, determine a template text corresponding to the word segmentation result from the text library; determine an initial answer corresponding to the target vector according to the template vector, the template text, the target vector, and the target question; in a case where a similarity result of the target vector and the initial answer meets a preset similarity condition, determine a first prompt text corresponding to the target vector according to the initial answer; determine a target answer corresponding to the target question by using a language model and the first prompt text.
2. The question and answer method according to claim 1, wherein, Before the determining the target question, the question and answer field to which the target question belongs, the vector library corresponding to the question and answer field, and the text library corresponding to the vector library, the method further includes: determining initial data associated with the question and answer field, and performing vector processing on the initial data according to a vector generation model to obtain the template vector; determining a template text having a matching relationship with the template vector; constructing the vector library corresponding to the question and answer field according to the template vector, and constructing the text library corresponding to the vector library according to the template text.
3. The question and answer method according to claim 2, wherein, The question and answer field is a security question and answer field, and the initial data is security question and answer field work order data, security question and answer field term data, security question and answer field document data, and / or security question and answer field intent data. The vector processing on the initial data according to the vector generation model to obtain the template vector includes: performing vector conversion on the security question and answer field work order data, the security question and answer field term data, the security question and answer field document data, and / or the security question and answer field intent data according to the vector generation model to generate the template vector.
4. The question and answer method according to claim 3, wherein, The initial data is security question and answer field work order data, and the determining the initial data associated with the question and answer field includes: determining initial security question and answer field work order data associated with the security question and answer field; extracting sub-work order data corresponding to a preset work order information type from the initial security question and answer field work order data according to the preset work order information type; and determining the sub-work order data as the security question and answer field work order data.
5. The question and answer method according to claim 3, wherein, The initial data is security question and answer field term data; the initial data associated with the question and answer field is determined, including: determining initial security question and answer field term data associated with the security question and answer field; performing deduplication processing on the initial security question and answer field term data to obtain deduplicated security question and answer field term data; according to a preset term information type, extracting sub-term data corresponding to the preset term information type from the deduplicated security question and answer field term data; and determining the sub-term data as the security question and answer field term data. 40 6.The question and answer method of claim 3, wherein, The initial data is security question and answer field document data; The initial data associated with the question and answer field is determined, including: determining initial security question and answer field document data associated with the security question and answer field; performing document data preprocessing on the initial security question and answer field document data to obtain preprocessed security question and answer field document data; and determining the security question and answer field document data according to the preprocessed security question and answer field document data.
7. The question-answering method according to claim 6, wherein, The security question and answer field document data is determined according to the preprocessed security question and answer field document data, including: determining a number of segmented words in the preprocessed security question and answer field document data according to the preprocessed security question and answer field document data; in a case where the number of segmented words is greater than a preset first segmented word number threshold, performing section segmentation processing on the preprocessed security question and answer field document data according to a chapter title included in the preprocessed security question and answer field document data to obtain section segmentation data; and determining the security question and answer field document data according to the section segmentation data.
8. The question and answer method according to claim 7, wherein, The section segmentation data includes text data and / or table data; the security question and answer field document data is determined according to the section segmentation data, including: determining text segmentation data according to the text data, and determining the security question and answer field document data according to the text segmentation data; or determining table segmentation data according to the table data, and determining the security question and answer field document data according to the table segmentation data; or determining text segmentation data according to the text data, and determining table segmentation data according to the table data, and determining the security question and answer field document data according to the text segmentation data and the table segmentation data. The section segmentation data includes text data and / or table data; the security question and answer field document data is determined according to the section segmentation data, including: determining text segmentation data according to the text data, and determining the security question and answer field document data according to the text segmentation data; or determining table segmentation data according to the table data, and determining the security question and answer field document data according to the table segmentation data; or determining text segmentation data according to the text data, and determining table segmentation data according to the table data, and determining the security question and answer field document data according to the text segmentation data and the table segmentation data.
9. The question-answering method according to claim 8, wherein, The determining the text cut data according to the text data comprises: determining a number of word segmentation corresponding to the text data, and determining the text cut data according to the text data, the number of word segmentation of the text data, and the preset first word quantity threshold. 10.The question and answer method of claim 8, wherein, The determining the table cut data according to the table data comprises: determining a number of word segmentation corresponding to the table data and a table structure of the table data, and determining the table cut data according to the table data, the number of word segmentation corresponding to the table data, the table structure of the table data, and the preset first word quantity threshold. The determining the security question and answer field document data according to the text cut data and the table cut data comprises: constructing a second prompt text according to the text cut data and a preset prompt text, and obtaining text summary data of the text data by using the language model according to the second prompt text; determining document title data and document abstract data in the security question and answer field document data according to the text cut data and the table cut data, and determining document information enhancement data of the security question and answer field document data according to the document title data and the document abstract data; determining target text cut data associated with the table cut data from the text cut data according to the table cut data; constructing a third prompt text according to the table cut data, the document information enhancement data, the target text cut data, and a preset prompt text, and obtaining table summary data of the table cut data by using the language model according to the third prompt text, wherein the table summary data is determined according to target text cut data, the table cut data, and the document information enhancement data corresponding to a preset table information type; determining the initial cut data according to the text cut data, the table cut data, the document information enhancement data, the text summary data, and the table summary data, and determining the security question and answer field document data according to the initial cut data. 41 The determining the table cut data according to the table data comprises: determining a number of word segmentation corresponding to the table data and a table structure of the table data, and determining the table cut data according to the table data, the number of word segmentation corresponding to the table data, the table structure of the table data, and the preset first word quantity threshold. The determining the security question and answer field document data according to the text cut data and the table cut data comprises: constructing a second prompt text according to the text cut data and a preset prompt text, and obtaining text summary data of the text data by using the language model according to the second prompt text; determining document title data and document abstract data in the security question and answer field document data according to the text cut data and the table cut data, and determining document information enhancement data of the security question and answer field document data according to the document title data and the document abstract data; determining target text cut data associated with the table cut data from the text cut data according to the table cut data; constructing a third prompt text according to the table cut data, the document information enhancement data, the target text cut data, and a preset prompt text, and obtaining table summary data of the table cut data by using the language model according to the third prompt text, wherein the table summary data is determined according to target text cut data, the table cut data, and the document information enhancement data corresponding to a preset table information type; determining the initial cut data according to the text cut data, the table cut data, the document information enhancement data, the text summary data, and the table summary data, and determining the security question and answer field document data according to the initial cut data. 11.The question and answer method of claim 1, wherein, The template vector comprises a security question and answer field intention vector; after the target vector corresponding to the target question is determined, further comprising: determining a target security question and answer field intention vector corresponding to the target vector from the vector library, and determining a target intention of the target vector according to the intention corresponding to the target security question and answer field intention vector; in the case that the target intention is determined to be a chat intention, processing the target question by using a language model to obtain a target answer corresponding to the target question; in the case that the target intention is determined to be a program call, determining a program call instruction according to the target question, and determining a target answer corresponding to the target question according to an execution state of the program call instruction, wherein the program call instruction is used to call a to-be-called program contained in the target question; in the case that the target intention is determined to be a question and answer, and the template vector further comprises the security question and answer field work order vector, and / or the security question and answer field term vector, and / or the security question and answer field document vector, the steps of determining the template vector corresponding to the target vector from the vector library, and performing word segmentation on the target question, and determining a template text corresponding to the word segmentation result from the text library are performed.
12. The question and answer method according to claim 11, wherein, Before the initial question and the historical dialogue data corresponding to the initial question are determined, further comprising: receiving an initial question and historical dialogue data corresponding to the initial question sent by a client, wherein the initial question and the historical dialogue data corresponding to the initial question are determined and sent by the client by collecting question and answer interaction information between a user and a user interaction interface of the client; after the target answer corresponding to the target question is determined, further comprising: returning the target answer to the client, so that the client displays the target answer to the user through the user interaction interface.
13. The question and answer method according to claim 1 or 2, wherein, The target question is determined by: determining the initial question and the historical dialogue data corresponding to the initial question; determining a fifth prompt text according to the historical dialogue data and the initial question; and determining the target question by using the language model according to the fifth prompt text.
14. The question and answer method of claim 1 or 2, wherein, The target vector corresponding to the initial answer is determined according to the template vector, the template text, The target vector, the target question, comprising: determining a first initial answer from a text answer corresponding to the template vector according to an association relationship between the first similarity result of the determined template vector and the target vector and a preset first similarity condition; determining a second initial answer from the template text according to an association relationship between the second similarity result of the determined template text and the target question and a preset second similarity condition; and determining the first initial answer and the second initial answer as the initial answer corresponding to the target vector.
15. A method of fielded questioning in a security questioning domain, comprising: determine a security question and answer domain target question, a security question and answer domain vector library, and a security question and answer domain text library corresponding to the security question and answer domain vector library; determine a security question and answer domain target vector corresponding to the security question and answer domain target question, a security question and answer domain template vector corresponding to the security question and answer domain target vector from the security question and answer domain vector library, and perform word segmentation on the security question and answer domain target question, and determine a security question and answer domain template text corresponding to the word segmentation result from the security question and answer domain text library; determine a security question and answer domain initial answer corresponding to the security question and answer domain target vector according to the security question and answer domain template vector, the security question and answer domain template text, the security question and answer domain target vector, and the security question and answer domain target question, and determine a security question and answer domain first prompt text corresponding to the security question and answer domain target vector according to the security question and answer domain initial answer in a case where a similarity result of the security question and answer domain target vector and the security question and answer domain initial answer meets a preset similarity condition; determine a security question and answer domain target answer corresponding to the security question and answer domain target question by using a language model and the security question and answer domain first prompt text.
16. The question-answering method according to claim 15, wherein, Before the determination of the security question and answer domain target question, the security question and answer domain vector library, and the security question and answer domain text library corresponding to the security question and answer domain vector library, the method further includes: determining security question and answer domain initial data, and performing vector processing on the security question and answer domain initial data according to a vector generation model to obtain the security question and answer domain template vector; determining a security question and answer domain template text having a matching relationship with the security question and answer domain template vector; constructing the security question and answer domain vector library according to the security question and answer domain template vector, and constructing the security question and answer domain text library corresponding to the security question and answer domain vector library according to the security question and answer domain template text.
17. - A question answering apparatus comprising: A first determination module is configured to determine a target question, a question and answer domain to which the target question belongs, a vector library corresponding to the question and answer domain, and a text library corresponding to the vector library. A second determination module is configured to determine a target vector corresponding to the target question, determine a template vector corresponding to the target vector from the vector library, and perform word segmentation on the target question, and determine a template text corresponding to the word segmentation result from the text library. A third determination module is configured to determine an initial answer corresponding to the target vector according to the template vector, the template text, the target vector, and the target question. A fourth determination module is configured to determine a first prompt text corresponding to the target vector according to the initial answer in a case where a similarity result of the target vector and the initial answer meets a preset similarity condition. A fifth determination module is configured to determine a target answer corresponding to the target question by using a language model and the first prompt text. a memory and a processor 18. A computing device comprising: The memory is configured to store computer programs / instructions, and the processor is configured to execute the computer programs / instructions, and the computer programs / instructions, when executed by the processor, implement the steps of the method according to any one of claims 1 to 16. 19.A computer readable storage medium, storing computer programs / instructions, and the computer programs / instructions, when executed by a processor, implement the steps of the method according to any one of claims 1 to 16. 20.A computer program product, comprising computer programs / instructions, and the computer programs / instructions, when executed by a processor, implement the steps of the method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Chinese intelligent question and answer short text similarity calculation method oriented to medical field
CN111581364A
Question response method and device based on large language model
CN117235226A
Large model question and answer method and device based on domain knowledge
CN117609477A
Knowledge question-answering method and device, equipment and storage medium
CN117828057A
Cited By
Retrieval enhancement generation method and system based on multi-dimensional reordering
CN121681787A
Medical question and answer service method and system based on artificial intelligence
CN122087068A
A medical question and answer service method and system based on artificial intelligence
CN122087068B