Interactive text question and answer processing method and device
By performing structured parsing and question generation on interactive text and using a large language model to predict query results, the problem of low efficiency and accuracy of interactive response in existing technologies is solved, achieving more efficient and accurate interactive text question answering processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies in social networks and online storage services rely on manually designed strategies and template rewriting, which cannot effectively handle non-factual or open-ended questions, resulting in low efficiency and accuracy of interactive responses and high resource consumption.
By acquiring interactive text and query text, we perform structured parsing to generate contextual information. When the relevance does not meet the conditions, we generate and rewrite questions, use a large language model to predict query results, activate knowledge, and recommend related questions.
It improves the efficiency and accuracy of interactive text question-and-answer processing, reduces processing costs, and enhances the efficiency and accuracy of user response to interactive text.
Smart Images

Figure CN121787550A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, specifically relating to an interactive text question-and-answer processing method and apparatus. Background Technology
[0002] Social networks are internet applications that provide communication and interaction services to users who are connected online through various forms, based on certain social relationships or shared interests. With the rapid development of the internet, social networks have attracted a massive influx of users, and as the number of users joins, the amount of files uploaded by users also increases. Furthermore, online storage services (such as cloud storage) also store a large amount of user-uploaded files.
[0003] Related technologies typically employ manually designed strategies and templates to rewrite user-submitted questions (e.g., converting declarative sentences into interrogative sentences). The rewritten questions are then used to infer and match relevant content within the document to provide a corresponding response. However, questions rewritten using manually designed strategies and templates are usually factual, with answers typically consisting of named entities or short fragments. In reality, non-factual or open-ended questions constitute a large proportion, with answers often consisting of multiple sentences or fragments. Therefore, existing rewriting methods not only consume significant system resources but also fail to correlate the rewritten questions with the document content, thus reducing the efficiency and accuracy of user interaction with text content on social networks or online storage services. Summary of the Invention
[0004] To address the aforementioned technical problems, this application provides an interactive text question-and-answer processing method and apparatus.
[0005] On the one hand, this application proposes an interactive text question-answering processing method, the method comprising:
[0006] Get the interactive text and query text;
[0007] The interactive text is processed by structured parsing to obtain text fragments. Target text fragments that have a similarity to the query text that meets a first preset condition are obtained from the text fragments. Context information of the query text is generated based on the target text fragments.
[0008] If the correlation between the query text and the interactive text does not meet the second preset condition, the text fragment is processed to generate a question, thereby obtaining the candidate recommended query text corresponding to the text fragment.
[0009] Obtain the target recommended query text from the candidate recommended query texts that has a similarity to the query text that meets the third preset condition;
[0010] The context information and the target recommended query text are input into a large language model for query result prediction processing to obtain the query result of the query text; wherein, the large language model is obtained by fine-tuning an initial large language model based on preset context information of a preset domain, a first preset query text for the preset context information, and a preset query result corresponding to the first preset query text.
[0011] On the other hand, this application proposes an interactive text question-and-answer processing apparatus, the apparatus comprising:
[0012] The text acquisition module is used to acquire interactive text and query text;
[0013] The context information generation module is used to perform structured parsing processing on the interactive text to obtain text fragments, obtain target text fragments from the text fragments that have a similarity to the query text that meets a first preset condition, and generate context information of the query text based on the target text fragments;
[0014] The question generation module is used to generate questions for the text fragment when it is determined that the correlation between the query text and the interactive text does not meet the second preset condition, so as to obtain the candidate recommended query text corresponding to the text fragment;
[0015] The target recommendation query text generation module is used to obtain target recommendation query texts from the candidate recommendation query texts that have a similarity to the query text that meets a third preset condition;
[0016] The query result generation module is used to input the context information and the target recommended query text into a large language model for query result prediction processing to obtain the query result of the query text; wherein, the large language model is obtained by fine-tuning an initial large language model based on preset context information of a preset domain, a first preset query text for the preset context information, and preset query results corresponding to the first preset query text.
[0017] On the other hand, this application proposes an electronic device for interactive text question-and-answer processing, the electronic device including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the interactive text question-and-answer processing method as described above.
[0018] On the other hand, this application proposes a computer-readable storage medium storing at least one instruction or at least one program, which is loaded and executed by a processor to implement the interactive text question-and-answer processing method as described above.
[0019] On the other hand, this application proposes a computer program product, including a computer program that, when executed by a processor, implements the interactive text question-and-answer processing method as described above.
[0020] The interactive text question-answering processing method and apparatus proposed in this application include: acquiring interactive text and query text; performing structured parsing processing on the interactive text to obtain text fragments; acquiring target text fragments from the text fragments that satisfy a first preset condition of similarity to the query text; generating context information of the query text based on the target text fragments; if it is determined that the degree of association between the query text and the interactive text does not satisfy a second preset condition, performing question generation processing on the text fragments to obtain candidate recommended query texts corresponding to the text fragments; acquiring target recommended query texts from the candidate recommended query texts that satisfy a third preset condition of similarity to the query text; and inputting the context information and the target recommended query texts into a large-scale language model for query result prediction processing to obtain the query result of the query text. This allows for the analysis and judgment of query text. If the correlation between the query text and the interactive text does not meet the second preset condition, a question is generated for the interactive text. Based on the generated question, the query text is rewritten and recommended. This allows the rewritten target recommended query text to better activate the knowledge contained in the large language model and to have a deep connection with the interactive text itself. This extends the query text proposed by the terminal object, reduces the difficulty of the terminal object's question, and improves the efficiency of interactive text question-and-answer processing, the efficiency of user-interactive text interaction response, and the accuracy of interaction response, while reducing the processing cost of interactive text. Attached Figure Description
[0021] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram illustrating the implementation environment of an interactive text question-and-answer processing method according to an exemplary embodiment.
[0023] Figure 2 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 1 .
[0024] Figure 3 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 2 .
[0025] Figure 4 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 3 .
[0026] Figure 5 This is a flowchart illustrating the training process of a text semantic similarity model according to an exemplary embodiment.
[0027] Figure 6 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 4 .
[0028] Figure 7 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 5 .
[0029] Figure 8 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 6 .
[0030] Figure 9 This is a schematic diagram of an interactive text question-and-answer processing system according to an exemplary embodiment.
[0031] Figure 10 This is a block diagram illustrating an interactive text question-and-answer processing apparatus according to an exemplary embodiment.
[0032] Figure 11 This is a hardware structure block diagram of a server provided according to an exemplary embodiment. Detailed Implementation
[0033] Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities. AI software technology mainly includes several major areas such as computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0034] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, pre-trained model technology, operating / interactive systems, and mechatronics. Among these, pre-trained models, also known as large-scale models or foundational models, can be widely applied to downstream tasks across various AI fields after fine-tuning. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0035] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP deals with natural language—the language people use in daily life—and is closely related to linguistics; it also involves computer science and mathematics. Pre-trained models, a crucial technique for model training in artificial intelligence, evolved from large language models in NLP. After fine-tuning, large language models can be widely applied to downstream tasks. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0036] Specifically, the process of obtaining query text and getting query results from the query text in this application involves robot question answering in NLP.
[0037] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and pre-trained learning. Pre-trained models are the latest development in deep learning, integrating all of these techniques.
[0038] Specifically, the training process of the large-scale language model, text association classification model, and text semantic similarity model in the embodiments of this application involves deep learning technology in machine learning.
[0039] With the rapid development of the Internet, social networks have attracted a massive influx of users. As the number of users joining social networks increases, the amount of files uploaded by users on social networks also increases. In addition, a large amount of file content uploaded by users is also stored in online storage services based on the Internet (e.g., cloud storage). Based on the user's targeted questions, reasoning and matching are performed to finally give the relevant answers to the questions in the document. If there are relevant answers in the document, the answer is returned; otherwise, the user is prompted that the document does not involve relevant content. This reduces the threshold for using and processing file content. Such a technical solution can effectively improve the efficiency of file understanding, but it still has the following shortcomings: (1) The whole process depends on the user's own questions about the file content. If the user does not know much about the document, it is difficult to ask targeted and high-quality questions. In this way, it is difficult for large language models to fully capture the user's true intentions. If there are relevant answers in the document, the answer is returned directly; otherwise, the user is prompted that the document does not involve relevant content. This can easily lead to situations where the true content and information of the document cannot be obtained due to poorly worded questions; (2) Related technologies usually rely on manually designed strategies and templates to rewrite the questions raised by users. However, this approach relies on manually designed strategies and templates to convert declarative sentences into interrogative sentences. This method also requires a lot of manpower and relies on deep grammatical knowledge. Its generalization performance and scalability are poor, and it is difficult to process each document individually; (3) Large language models are usually interactive dialogue processes. As the dialogue deepens, the understanding will become deeper, and the questions will also change as the interaction deepens. Moreover, the same semantic question, when asked in different ways, will express different meanings in the results processed and produced by the large language model. Currently, the main questions designed manually are factual questions, and the answers to the questions are usually named entities or short fragments. However, in actual understanding, non-factual questions or open-ended questions account for a large proportion. The answers to such questions are multiple sentences or fragments. Therefore, the generation of questions needs to better grasp the overall meaning of the answers and the article. Based on this, embodiments of this application provide an interactive text question-answering processing method and apparatus, which realizes question understanding, question generation, question rewriting, and recommendation based on a large language model. It recommends and rewrites questions that terminal users might ask, thereby reducing input operations for terminal users, better understanding the true questioning intent of terminal users, and improving efficiency and user experience. Furthermore, the rewritten target recommended query text can better activate the knowledge contained in the large language model and has a deep connection with the interactive text itself, thus extending the query text proposed by the terminal user, reducing the difficulty of the terminal user's question, and thereby improving the efficiency of interactive text question-answering processing, the efficiency of user-interactive text interaction response, and the accuracy of interaction response, while reducing the processing cost of interactive text.
[0040] First, the technical terms involved in the embodiments of this application will be explained:
[0041] Faiss is an open-source library for clustering and similarity search. It provides efficient similarity search and clustering for dense vectors, supports searching on the order of billions of vectors, and is currently the most mature approximate nearest neighbor search library.
[0042] Elasticsearch is a distributed, highly scalable, and real-time search and data analytics engine. It easily enables the searching, analysis, and exploration of large amounts of data. Leveraging Elasticsearch's horizontal scalability can make data more valuable in production environments.
[0043] Large Language Models (LLMs) are computer models capable of processing and generating natural language; they represent a significant advancement in the field of artificial intelligence and hold the promise of transforming the field through learned knowledge. LLMs can predict the next word or sentence by learning statistical patterns and semantic information from language data. As the input dataset and parameter space expand, the capabilities of LLMs also increase. LLMs are used in various application areas, such as robotics, machine learning, machine translation, speech recognition, and image processing, hence the name Multimodal Large Language Models (MLLMs).
[0044] Question generation is an important subtask in text generation. It usually refers to generating natural and fluent questions that are relevant to the input data (text, knowledge base, image, etc., this article focuses only on text).
[0045] Instruction Tuning refers to generating individual instructions for each task, fine-tuning them on several full-shot tasks, and then evaluating the generalization ability on a specific task (zero shot). Full-shot means that all parameters in the pre-trained model are fine-tuned.
[0046] Prompt tuning, a type of learning method in machine learning, significantly improves the performance of a pre-trained language model by adding "cues" to the input without significantly changing the model's structure and parameters. It can be a task instruction or a reuse of the pre-trained objective. Essentially, it enhances parameter effectiveness training by generating separate prompt templates and then performing full-shot fine-tuning and evaluation on each task.
[0047] RLHF (Reinforcement Learning with Human Feedback) is an extension of reinforcement learning (RL) that incorporates human feedback into the training process, providing machines with a natural, human-like, interactive learning experience. In addition to reward signals, RLHF agents receive feedback from humans, learning with a broader perspective and greater efficiency, similar to how humans learn from another person's expertise. By bridging the gap between the agent and the human, RLHF allows humans to directly guide the machine and enables the machine to grasp decision-making elements clearly embedded in human experience. As an effective alignment technique, RLHF can help mitigate harmful content generated by large language models (LLMs) and improve information integrity to some extent.
[0048] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0049] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the present application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0050] It should be noted that, in the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0051] Figure 1This is a schematic diagram illustrating the implementation environment of an interactive text question-answering processing method according to an exemplary embodiment. For example... Figure 1 As shown, the implementation environment may include at least terminal 01 and server 02. The terminal 01 and server 02 may be directly or indirectly connected through wired or wireless communication. This embodiment of the application does not impose any limitations on this.
[0052] Specifically, server 02 can be used to obtain interactive text and query text, and retrieve query results corresponding to the query text from the interactive text. Optionally, server 02 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0053] Specifically, the terminal 01 can be used to display query results. The terminal 01 may include, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc.
[0054] The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0055] It should be noted that, Figure 1 This is just one example. Other implementation environments may also be included in other scenarios.
[0056] It should be noted that in the specific implementation of this application, user information, such as interactive text, query text and other related data, is involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards.
[0057] Figure 2 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 1 This method can be used for Figure 1In the implementation environment described in this specification, the method operation steps are as illustrated in the embodiments or flowcharts. However, based on conventional or non-inventive labor, more or fewer operation steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or server product execution, the method can be executed sequentially according to the embodiments or drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment). Specifically, as shown in the embodiments or drawings... Figure 2 As shown, the method may include:
[0058] S101. Obtain interactive text and query text.
[0059] Optionally, the interactive text can be from various fields and of various types, without any specific limitations.
[0060] As an example, the interactive text could be a text file uploaded by a user on a social network. Social networks contain various instant messaging groups. To facilitate convenient communication, many users join instant messaging groups. The types of instant messaging groups and the topics discussed are very diverse. As the types of instant messaging groups increase and the number of users participating in communication within these groups grows, the amount of user-uploaded files accumulated in these groups also increases. This results in a large amount of digital resources stored in instant messaging groups, such as PDFs, Word documents, TXT files, and web files, as well as a wealth of materials, such as various e-books. In addition to the text files accumulated in instant messaging groups, the interactive file could also be a text file or a link to a webpage transmitted during peer-to-peer chat.
[0061] As another example, the interactive text can also be a text file saved in an online storage service (such as cloud storage). Examples include PDF, Word, Web, TXT files, and various ebooks.
[0062] Optionally, the query text is a question posed to the text content of the interactive text.
[0063] S103. Perform structured parsing on the interactive text to obtain text fragments, extract target text fragments from the text fragments that have a similarity to the query text that meets the first preset condition, and generate context information of the query text based on the target text fragments.
[0064] In this embodiment, the interactive text can essentially be a tree structure. Since some interactive text passages may be quite long and cannot be directly input into the model, the server can perform structured parsing on the interactive text to segment it into smaller text fragments. It can then search for target text fragments from these fragments that satisfy a first preset condition regarding similarity to the query text, and simultaneously generate contextual information for the query text based on these target text fragments.
[0065] For example, the similarity satisfying the first preset condition can refer to the condition that the similarity is greater than a preset similarity threshold. Furthermore, the similarity satisfying the first preset condition can be reflected by distance, that is, text fragments whose distance from the query text is less than a preset distance threshold are used as target text fragments.
[0066] For example, the server can process the retrieved target text fragments as needed, as contextual information for the query text. For example, this processing of the retrieved target text fragments as needed may include, but is not limited to, at least one of: copying, editing, summarizing, sorting, filtering, translating, compressing, filtering, and re-encoding.
[0067] S105. If the degree of correlation between the query text and the interactive text does not meet the second preset condition, perform question generation processing on the text fragment to obtain the candidate recommended query text corresponding to the text fragment.
[0068] In this embodiment, the server can first analyze and judge the intent of the terminal object. Optionally, analyzing and judging the intent of the terminal object mainly involves analyzing whether the query text input by the terminal object is explicit and whether the query text is related to the text content of the interactive text (i.e., whether the query text is proposed around the text content of the interactive text), etc., to obtain the degree of correlation between the query text and the interactive text, so as to determine whether the query question needs to be rewritten and recommended based on the degree of correlation.
[0069] Optionally, if the result of analyzing and judging the intent of the terminal object indicates that the degree of correlation between the content of the query text and the text content of the interactive text does not meet the second preset condition, it indicates that the query text needs to be rewritten and recommended. In this case, the server can first perform question generation processing on the text fragment to obtain a question that is related to the text fragment and flows naturally, that is, obtain the candidate recommended query text corresponding to this fragment.
[0070] For example, the fact that the degree of association does not meet the second preset condition can refer to the condition that the degree of association is less than the preset association threshold, such as the lowest degree of association.
[0071] When the query text is a question posed to the text content of the interactive text, the degree of relevance can refer to the degree of relevance between the "question" and the interactive text, that is, whether the question is posed around the text content of the interactive text. For example, if the query text is "What kinds of plants are there?", and the interactive text is an article about animals, then the degree of relevance between the query text and the interactive text is considered not to meet the second presupposition condition. However, if the interactive text is an article about plants, then the degree of relevance between the query text and the interactive text is considered to meet the second presupposition condition.
[0072] Optionally, after obtaining the candidate recommendation query text, it can be stored in a preset database. This activates the core capabilities of a large language model, fully utilizing its powerful natural language processing capabilities to understand contextual information and semantic relationships, thereby generating a more accurate, comprehensive, and readable content question base, which is the preset database. This preset database can be used for subsequent question rewriting and recommendation processes, improving the convenience and efficiency of question rewriting, thus enhancing the efficiency of interactive text question-and-answer processing, the efficiency of user-interactive text interaction response, and the accuracy of interaction response.
[0073] S107. Obtain the target recommended query text from the candidate recommended query texts that has a similarity to the query text that meets the third preset condition.
[0074] Optionally, the number of candidate recommended query texts is at least two. The server can find the target recommended query text from the at least two candidate recommended query texts that has a similarity to the query text that meets a third preset condition. It should be noted that the similarity here refers to the similarity between the text content of the candidate recommended query text and the text content of the query text. The target recommended query text can be obtained from the candidate recommended query texts, and its similarity to the content of the query text meets the third preset condition. When the query text is a question posed based on the text content of the interactive text, it is equivalent to obtaining questions from the candidate recommended questions generated based on the interactive text whose content has a similarity to the currently asked question that meets the third preset condition. That is, the similarity here can refer to the similarity between the content of two questions.
[0075] Since the obtained target recommended query text is not the query text itself, but the text whose similarity to the query text meets the third preset condition, it is equivalent to rewriting and recommending the query text. Furthermore, since the candidate recommended query text is generated by generating questions from text fragments of the interactive text, the target recommended query text is closely related to the text content of the interactive text. That is, the rewritten questions are also closely related to the text content of the interactive text, thereby fully realizing the full understanding of the text content of the interactive text and improving the accuracy of question answering of the interactive text.
[0076] For example, the similarity meeting the third preset condition can refer to the condition that the similarity is greater than a preset similarity threshold. For example, the highest similarity.
[0077] In some implementations, since the candidate recommended query text can be pre-stored in a preset database, the server can obtain the target recommended query text that meets the third preset condition of similarity to the query text from the candidate recommended query text in the preset database. Because the target recommended query text can be directly obtained from the candidate recommended query text generated for the interactive text stored in the preset database, the convenience and efficiency of question rewriting are improved, thereby enhancing the efficiency of interactive text question-and-answer processing, the efficiency of user-interactive text interaction response, and the accuracy of interaction response.
[0078] S109. Input the context information and the target recommended query text into a large language model to perform query result prediction processing and obtain the query result of the query text; wherein, the large language model is obtained by fine-tuning the initial large language model based on the preset context information of the preset domain, the first preset query text for the preset context information and the preset query result corresponding to the first preset query text.
[0079] Optionally, the server uses the context information and the rewritten target recommendation query text as input to a large language model, ultimately enabling fine-tuning of a portion of the large language model and a very small number of parameters. This allows for the effective reuse of the large model's capabilities, and finally, the query results are generated through the large language model.
[0080] This allows for the analysis and judgment of query text. If the correlation between the query text and the interactive text does not meet the second preset condition, a question is generated for the interactive text. Based on the generated question, the query text is rewritten and recommended. This allows the rewritten target recommended query text to better activate the knowledge contained in the large language model and to have a deep connection with the interactive text itself. This extends the query text proposed by the terminal object, reduces the difficulty of the terminal object's question, and improves the efficiency of interactive text question-and-answer processing, the efficiency of user-interactive text interaction response, and the accuracy of interaction response, while reducing the processing cost of interactive text.
[0081] Figure 3 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 2 ,like Figure 3 As shown, in an optional embodiment, step S103 above may include:
[0082] S1031. Perform structured parsing on the interactive text to obtain text fragments; the text fragments include at least one of chapter fragments, paragraph fragments, and sentence fragments.
[0083] Optionally, the server can perform structured parsing of the interactive text to segment it into smaller text fragments, obtaining at least one of the following: chapter fragments, paragraph fragments, and sentence fragments. That is, it can determine which parts of the interactive text are chapters, paragraphs, and sentences. At least one of these chapter fragments, paragraph fragments, and sentence fragments can form a hierarchical tree structure.
[0084] It's important to note that the granularity of the text fragments depends on the type of interactive text. If the interactive text is an ebook, it typically contains chapters, and parsing it will yield chapter fragments, paragraph fragments, and sentence fragments. If the interactive text is an article, it usually doesn't include chapters, and parsing it will yield paragraph fragments and sentence fragments. If the interactive text is a paragraph, it will yield sentence fragments.
[0085] As can be seen, the embodiments of this application can parse interactive text at up to three levels of granularity: sentence-level granularity, paragraph-level granularity, and document-level granularity. This allows for the subsequent retrieval of text fragments at different granularities based on these three levels of granularity, thereby achieving a deep understanding and processing of the interactive text.
[0086] It should be noted that step S1031 above can be implemented in various ways, and no specific limitation is made. In one implementation, the server can use publicly available third-party plugin capabilities, such as the Docparsing module, to parse the interactive text based on its format, in order to identify chapters, paragraphs, sentences, etc., within the text document. Docparsing refers to an end-to-end document structure analysis solution that can extract the structure of documents (scanned versions, image versions, etc.), including entity recognition (entities refer to all elements to be detected, including text, rows, columns, cells, etc.) and relationship classification. In another implementation, without third-party plugins, the server can use Optical Character Recognition (OCR) technology to recognize the document, identifying chapters, paragraphs, sentences, etc. Specifically, it can utilize the organizational segmentation information of chapters, paragraphs, and sentences, such as paragraph title font size, whitespace, and sentence end marker samples, to train an OCR model. This allows the OCR model to understand the typical results for each area, thereby enabling the trained OCR model to recognize the interactive text, identifying at least one of the chapters, paragraphs, and sentences.
[0087] S1033. Establish index information corresponding to text fragments; the index information is used to represent the position information of text fragments in interactive text, and the index information includes at least one of the following: chapter fragment index information corresponding to chapter fragments, paragraph fragment index information corresponding to paragraph fragments, and sentence fragment index information corresponding to sentence fragments.
[0088] In this embodiment of the application, the server can establish corresponding index information for each text fragment. The index information represents the position information of the text fragment in the interactive text. That is, the index information is the position guide of the text fragment in the interactive text. Through the index information, the corresponding text fragment can be quickly located and accessed, so that the relevant text fragment can be recalled according to the query text input by the user.
[0089] Since the index information includes at least one of the following: the index information of chapter fragments, the index information of paragraph fragments, and the index information of sentence fragments, it can achieve recall at least one of sentence-level granularity, fragment-level granularity, and chapter-level granularity, thereby enabling deep understanding and processing of interactive text and improving the positioning accuracy of query results corresponding to query text.
[0090] S1035. Obtain target index information whose similarity to the query text meets the first preset condition from at least one of the chapter fragment index information, paragraph fragment index information, and sentence fragment index information.
[0091] In this embodiment of the application, vector semantic similarity search, such as Faiss or Elasticsearch, can be used to find target index information that meets the preset conditions for similarity with the query text from at least one of the article fragment index information, paragraph fragment index information, and sentence fragment index information.
[0092] For example, the similarity satisfying the first preset condition can refer to the condition that the similarity is greater than a preset similarity threshold. Furthermore, the similarity satisfying the first preset condition can be reflected by distance, that is, index information whose distance from the query text is less than a preset distance threshold is the target index information.
[0093] S1037. Obtain the target text fragment corresponding to the target index information from the text fragment.
[0094] In this embodiment of the application, vector semantic similarity search, such as Faiss or Elasticsearch, returns the target index information and the similarity with the query text. Furthermore, it returns the target index information and the distance between it and the query text. The server can use the target index information to obtain the original data corresponding to the target index information from the already segmented text fragments, and obtain the target text fragment.
[0095] Therefore, it is possible to deeply understand, parse, and recall interactive text at three granularities: chapter, paragraph, and sentence. Combined with a large-scale language model, it can achieve a deep understanding of interactive documents, enabling the generation of more accurate, comprehensive, and readable thematic summaries and information extraction of interactive documents based on user questions and answers. It can also provide targeted answers to user questions about the documents, improving the efficiency of interactive text question-and-answer processing, the efficiency of user-interactive text interaction response, and the accuracy of interaction response, while reducing the processing cost of interactive text.
[0096] It should be noted that step S1031 above can be implemented in various ways, and no specific limitation is made. In one implementation, the server can use publicly available third-party plugin capabilities, such as the Docparsing module, to parse the interactive text based on its format, in order to identify chapters, paragraphs, sentences, etc., within the text document. Docparsing refers to an end-to-end document structure analysis solution that can extract the structure of documents (scanned versions, image versions, etc.), including entity recognition (entities refer to all elements to be detected, including text, rows, columns, cells, etc.) and relationship classification. In another implementation, without third-party plugins, the server can use Optical Character Recognition (OCR) technology to recognize the document, identifying chapters, paragraphs, sentences, etc. Specifically, it can utilize the organizational segmentation information of chapters, paragraphs, and sentences, such as paragraph title font size, whitespace, and sentence end marker samples, to train an OCR model. This allows the OCR model to understand the typical results for each area, thereby enabling the trained OCR model to recognize the interactive text, identifying at least one of the chapters, paragraphs, and sentences.
[0097] In an optional embodiment, after step S1031, the method may further include:
[0098] The text fragments are vectorized to obtain the corresponding text fragment vectors; the text fragment vectors include at least one of the following: the text fragment vector corresponding to the chapter fragment, the paragraph fragment vector corresponding to the paragraph fragment, and the sentence fragment vector corresponding to the sentence fragment.
[0099] In this embodiment, after the server divides the interactive text into at least one of chapter fragments, paragraph fragments, and sentence fragments, it can vectorize at least one of the chapter fragments, paragraph fragments, and sentence fragments to obtain at least one of the chapter fragment vectors corresponding to the chapter fragments, the paragraph fragment vectors corresponding to the paragraph fragments, and the sentence fragment vectors corresponding to the sentence fragments.
[0100] Accordingly, in step S1033 above, the establishment of index information corresponding to the text fragment includes: establishing index information corresponding to at least one of the chapter fragment vector, paragraph fragment vector, and sentence fragment vector to obtain the index information corresponding to the text fragment.
[0101] In this embodiment, when the text fragment vector corresponding to a text fragment includes document fragment vectors, paragraph fragment vectors, and sentence fragment vectors, index information corresponding to each of the document fragment vectors, paragraph fragment vectors, and sentence fragment vectors can be established to obtain the document fragment index information corresponding to the document fragment, the paragraph fragment index information corresponding to the paragraph fragment, and the sentence fragment index information corresponding to the sentence fragment. When the text fragment vector corresponding to a text fragment includes paragraph fragment vectors and sentence fragment vectors, index information corresponding to each of the paragraph fragment vectors and sentence fragment vectors can be established to obtain the paragraph fragment index information corresponding to the paragraph fragment, and the sentence fragment index information corresponding to the sentence fragment. When the text fragment vector corresponding to a text fragment includes sentence fragment vectors, index information corresponding to the sentence fragment vector can be established to obtain the sentence fragment index information corresponding to the sentence fragment.
[0102] It should be noted that there are multiple ways to establish vector index information, and no specific limitations are made here. In some implementations, the aforementioned vector can be an embedding vector, which the server can store in the Faiss distributed index library to obtain the corresponding index information. Furthermore, the parsed interactive text and its corresponding index information can reside in Cloud Object Storage (COS). COS has advantages such as no format restrictions, no storage capacity limit, and high stability; storing the parsed interactive text and its corresponding index information in COS can improve the processing efficiency of interactive text.
[0103] It's worth noting that explicit and structural indexes can also be created for text files. An explicit index can be understood as an index of different levels within a complex book or collection of books. A structural index is a structured representation of a book, such as its chapters, the specific page of each chapter, and so on, refining the structure layer by layer. Both explicit and structural indexes can be used to locate the position of query results.
[0104] Accordingly, step S1035 may include: retrieving a target vector whose similarity to the semantic vector of the query text meets a preset condition from at least one of document fragment vectors, paragraph fragment vectors, and sentence fragment vectors; and determining the target index information corresponding to the target vector from at least one of document fragment index information, paragraph fragment index information, and sentence fragment index information. In this embodiment, the server can find the top k vectors that are closest to the semantic vector of the query text from at least one of document fragment vectors, paragraph fragment vectors, and sentence fragment vectors to obtain the target vector. For example, in Faiss's distributed vector retrieval, a distributed high-dimensional nearest neighbor retrieval platform can be implemented using the Faiss framework. A large-scale vector retrieval K-nearest neighbor algorithm (e.g., HNSW algorithm) can efficiently recall the top k vectors whose distance to the semantic vector (considering both truncation threshold and similarity score) is less than a preset distance threshold from tens of millions of vectors, i.e., the top k vectors similar to the semantic vector, thereby achieving accurate positioning and retrieval of the query text. Because an index is pre-established for each vector, after obtaining the target vector, the server can search for the index information of the text segment corresponding to the target vector from at least one of the article segment index information, paragraph segment index information, and sentence segment index information, thus obtaining the target index information. Since the target index information is obtained from at least one of the article segment index information, paragraph segment index information, and sentence segment index information, different granularities of recall can be achieved, improving the depth of understanding of the interactive file, thereby improving the accuracy of query result generation and, consequently, the accuracy of the interactive response between the user and the interactive text. Furthermore, by vectorizing text segments, establishing vector indexes, and performing vector semantic similarity search, the server can efficiently recall the top k vectors whose distance to the semantic vector is less than a preset distance threshold from tens of millions of vectors within tens of milliseconds, thereby achieving accurate and rapid location and retrieval of query results.
[0105] Furthermore, continue as Figure 3 As shown, step S1035 above may include:
[0106] S10351. Obtain the target text fragment vector from the text fragment vector whose similarity to the second semantic vector corresponding to the query text meets the first preset condition; obtain the target paragraph fragment vector from the paragraph fragment vector corresponding to the target text fragment vector whose similarity to the second semantic vector meets the first preset condition; obtain the target sentence fragment vector from the sentence fragment vector corresponding to the target paragraph fragment vector whose similarity to the second semantic vector meets the first preset condition; determine the target sentence fragment vector as the target vector.
[0107] S10353. Determine the target index information corresponding to the target vector from the text fragment index information, paragraph fragment index information, and sentence fragment index information.
[0108] In this embodiment, when the text fragments include passage fragments, paragraph fragments, and sentence fragments, and the text fragment vectors include passage fragment vectors, paragraph fragment vectors, and sentence fragment vectors, the server can first obtain the target passage fragment vectors from the passage fragment vectors whose similarity to the second semantic vector meets a preset condition. For example, the Faiss framework or Elasticsearch can be used to obtain the top k target passage fragment vectors from the passage fragment vectors whose similarity to the second semantic vector meets the preset condition.
[0109] After determining the target text fragment vector, the server can retrieve target paragraph fragment vectors from the corresponding paragraph fragment vectors that satisfy a preset similarity condition with the second semantic vector. The interactive text can correspond to multiple paragraph fragments, which may originate from different texts. The paragraph fragment vector corresponding to the target text fragment vector can refer to the paragraph fragment vectors included within the text fragment corresponding to the target text fragment vector. For example, the Faiss framework or Elasticsearch can be used to retrieve the top k target paragraph fragment vectors from the corresponding paragraph fragment vectors that satisfy the second preset similarity condition with the second semantic vector.
[0110] After determining the target paragraph fragment vector, the server can extract target sentence fragment vectors from the sentence fragment vectors corresponding to the target paragraph fragment vector, ensuring that their similarity to the second semantic vector meets a preset condition. The server uses this target sentence fragment vector as the target vector that meets the preset condition. Here, the interactive text corresponds to multiple sentence fragments, which can originate from different paragraphs and chapters. The sentence fragment vector corresponding to the target paragraph fragment vector can refer to the sentence fragment vectors included in the paragraph fragment corresponding to the target paragraph fragment vector. For example, the Faiss framework or Elasticsearch can be used to extract the top k target sentence fragment vectors from the sentence fragment vectors corresponding to the target paragraph fragment vector that meet the third preset condition in terms of similarity to the semantic vector.
[0111] This application embodiment recalls target vectors whose similarity to the second semantic vector of the query text meets preset conditions at three granularities: chapter, paragraph, and sentence. That is, it can recall the optimal sentence at three granularities: chapter, paragraph, and sentence, thereby realizing a deep understanding and parsing of interactive text and achieving accurate matching and positioning of query results.
[0112] In other embodiments, the corresponding vectors can be recalled in parallel at three granularities: chapter, paragraph, and sentence.
[0113] In an optional embodiment, in step S10351 above, obtaining the target text fragment vector from the text fragment vector whose similarity to the second semantic vector corresponding to the query text satisfies the first preset condition may include:
[0114] Input the text fragment vector and the second semantic vector into the text semantic similarity model for similarity matching processing, so as to obtain the target text fragment vector whose similarity with the second semantic vector meets the first preset condition from the text fragment vector;
[0115] The text semantic similarity model is obtained by training the first pre-trained model based on the anchor sample text data corresponding to the sample query text, positive sample text fragments and negative sample text fragments in the sample text fragment set. The title content of the positive sample text fragments matches the content of the anchor sample text data, while the title content of the negative sample text fragments does not match the content of the anchor sample text data.
[0116] In this embodiment, a first pre-trained model can be trained using anchor sample chapter data corresponding to the sample query text, positive sample chapter fragments whose content matches the anchor sample chapter data, and negative sample chapter fragments whose content does not match the anchor sample chapter data. This yields a chapter semantic similarity model. The chapter fragment vector and the second semantic vector are then input into the chapter semantic similarity model for similarity matching to obtain the top k target chapter fragment vectors. Since the chapter semantic similarity model is trained on the first pre-trained model based on anchor sample chapter data, positive sample chapter fragments, and negative sample chapter fragments in the sample chapter fragment set, the trained chapter semantic similarity model has the function of narrowing the distance between data of the same category and widening the distance between data of different categories. Thus, the pre-trained model can recall more accurate, comprehensive, and readable document chapter topic summaries and chapter information extraction based on chapter granularity, achieving a deep understanding of the chapters in the interactive text and improving the positioning and matching accuracy of the chapters where the query results are located.
[0117] In one specific embodiment, the training method for the text semantic similarity model includes:
[0118] Obtain a set of sample passage fragments and sample query text. Generate anchored sample passage data based on the sample query text. Identify positive and negative sample passage fragments from the sample passage fragment set. Input the anchored sample passage data, positive sample passage fragments, and negative sample passage fragments into a first pre-trained model for feature extraction, obtaining anchored sample passage data vectors, positive sample passage data vectors, and negative sample passage data vectors. Calculate the first difference between the anchored and negative sample passage data vectors, and the second difference between the anchored and positive sample passage data vectors. Calculate the first loss data based on the first and second differences. Adjust the network parameters of the first pre-trained model based on the first loss data until a preset training termination condition is met, obtaining the passage semantic similarity model.
[0119] In this embodiment, for the document-level semantic similarity model, the first pre-trained model can employ a pre-trained language model (PTM) with shared parameters, such as a pre-trained text model. More specifically, LICHEES can be used to model the text. LICHEES is a pre-trained BERT model based on a large-scale information flow text corpus, which is better able to extract semantic features from the information flow text corpus. The data for the document-level semantic similarity model mainly consists of document titles and multi-level headings. The model's loss function can be triplet loss, a loss function in deep learning primarily used for training samples with low variance.
[0120] Specifically, the server can obtain a set of sample passage fragments and sample query text for the set of sample passage fragments. The server uses the sample query text as anchor sample passage data, or preprocesses the sample query text to obtain anchor sample passage data. Based on the title and multi-level heading content of the sample passage fragments in the sample passage fragment set, the server determines positive sample passage fragments whose title content matches the content of the anchor sample passage data, and negative sample passage fragments whose title content does not match the content of the anchor sample passage data. In other implementations, to reduce the distance between Anchors and Negatives, improve the training accuracy of the passage semantic similarity model, and enhance the understanding depth of the trained passage semantic similarity model of the passages in the interactive text, negative sample passage fragments can also be determined in the following way: the negative sample passage fragments can be difficult negative sample passage fragments or random negative sample passage fragments. For example, passages unrelated to the sample query text in OpenQA data can be used as negative sample passage fragments.
[0121] The server inputs a triplet (Anchor, Positive, and Negative) to the first pre-trained model for feature extraction, obtaining anchor sample text data vectors corresponding to anchor sample text data, positive sample text data vectors corresponding to positive sample text fragments, and negative sample text data vectors corresponding to negative sample text fragments. The distance between the anchor sample text data vector and the negative sample text data vector is calculated to obtain the first difference, and the distance between the anchor sample text data vector and the positive sample text data vector is calculated to obtain the second difference. Based on the first and second differences, the first loss data is calculated. The core idea of this first loss data calculation is to achieve similarity calculation between samples by making the distance between the Anchor and the Positive less than the distance between the Anchor and the Negative. The optimization goal is to shorten the distance between the Anchor and the Positive and widen the distance between the Anchor and the Negative.
[0122] After receiving the loss data, the server determines whether the loss data meets the preset training termination condition, or whether the number of times the model has been trained meets the preset training termination condition. If either of these conditions is met, the model training ends, and the trained model is used as the document semantic similarity model. If neither of these conditions is met, the model training process is repeated until the loss data meets the preset training termination condition, or the number of times the model has been trained meets the preset training termination condition.
[0123] The input to the training process of the document semantic similarity model in this application embodiment is a triplet consisting of anchor sample document data, positive sample document fragments, and negative sample document fragments. Triplet loss is used to calculate the loss data. Triplet loss achieves similarity calculation between samples by making the distance between the Anchor and the Positive less than the distance between the Anchor and the Negative. Therefore, using Triplet loss to calculate the loss data improves the accuracy of the loss data determination, thereby improving the training accuracy of the document semantic similarity model. This enables the trained document semantic similarity model to recall target document fragment vectors at the document granularity level, achieving a deep understanding of the documents in interactive text.
[0124] In a specific embodiment, in step S10351 above, obtaining the target paragraph segment vector whose similarity to the second semantic vector satisfies the first preset condition from the paragraph segment vector corresponding to the target text segment vector may include:
[0125] The target passage fragment vector and the second semantic vector are input into the paragraph semantic similarity model for similarity matching processing. This is to obtain the target paragraph fragment vector that has a similarity to the second semantic vector that meets the first preset condition from the paragraph fragment vector corresponding to the target passage fragment vector. The paragraph semantic similarity model is obtained by training a second pre-trained model based on the anchor sample paragraph data corresponding to the sample query text, positive sample paragraph fragments and negative sample paragraph fragments in the sample paragraph fragment set. The content of the positive sample paragraph fragment matches the content of the anchor sample paragraph data, while the content of the negative sample paragraph fragment does not match the content of the anchor sample paragraph data.
[0126] In this embodiment, a second pre-trained model can be trained using anchor sample paragraph data corresponding to the sample query text, positive sample paragraph segments whose content matches the anchor sample paragraph data, and negative sample paragraph segments whose content does not match the anchor sample paragraph data. This yields a paragraph semantic similarity model. The target passage segment vector and the second semantic vector are then compared with the passage semantic similarity model to obtain the top k target paragraph segment vectors. Since the paragraph semantic similarity model is trained based on anchor sample paragraph data, positive sample paragraph segments, and content matching with negative sample paragraph segments, the trained paragraph semantic similarity model has the function of narrowing the distance between data of the same category and widening the distance between data of different categories. This allows for the retrieval of more accurate, comprehensive, and readable document paragraph summaries and paragraph information extraction at the paragraph granular level using the pre-trained model, achieving a deep understanding of the paragraphs in the interactive text and improving the positioning and matching accuracy of the paragraphs in the query results.
[0127] It should be noted that the structure of the passage semantic similarity model and the paragraph semantic similarity model are similar, only the data samples differ. The training samples for the paragraph semantic similarity model are the set of sample paragraph fragments corresponding to the sample passage fragments, i.e., paragraphs are the primary focus. This second pre-trained model can also use a pre-trained language model with shared parameters, such as a pre-trained text model. More specifically, LICH EES can be used to model the text. For the training method of the paragraph semantic similarity model, please refer to the training method of the passage semantic similarity model, which will not be repeated here.
[0128] In an optional embodiment, obtaining the target sentence fragment vector whose similarity to the second semantic vector meets a preset condition from the sentence fragment vector corresponding to the target paragraph fragment vector may include:
[0129] The sentence combination result is obtained by combining each sentence fragment vector corresponding to the target paragraph fragment vector with the second semantic vector. Each sentence combination result is then input into a sentence semantic similarity model for similarity matching processing. This process aims to obtain the target sentence fragment vector whose similarity to the second semantic vector satisfies a first preset condition from at least two sentence fragment vectors corresponding to the target paragraph fragment vector. The sentence semantic similarity model is trained on a third pre-trained model based on sample paragraph fragments and sample query text labeled with sample query result tags.
[0130] In this embodiment, the server can pre-train a third pre-trained model to obtain a semantic similarity model using sample paragraph fragments and sample query text labeled with sample query result tags. This enables the trained semantic similarity model to find sentence fragment vectors from existing sentence fragment vectors that have a similarity to the semantic vector of a query sample that meets a first preset condition. It should be noted that the third pre-trained model can be any type of pre-trained language model.
[0131] After obtaining the target paragraph fragment vector, the server can retrieve the sentence fragment vectors of the sentence fragments included in the target paragraph fragment vector. There can be at least two sentence fragment vectors. The server can combine each sentence fragment vector corresponding to the target paragraph fragment vector with the second semantic vector to obtain the sentence combination result for each sentence fragment vector corresponding to the target paragraph fragment vector. For example, combining can refer to concatenating the sentence fragment vectors before or after the second semantic vector to obtain the sentence combination result for each sentence fragment vector.
[0132] The server can input the combined result of each sentence into the sentence semantic similarity model for similarity matching processing, so as to obtain the target sentence segment vector that meets the preset condition of similarity with the second semantic vector from at least two sentence segment vectors corresponding to the target paragraph segment vector.
[0133] Since the sentence fragment vectors corresponding to the already recalled target paragraph fragment vectors are searched for with a similarity to the second semantic vector that meets the preset conditions, the recall accuracy of sentence fragment vectors can be improved. In addition, since the target sentence fragment vectors are recalled through the sentence semantic similarity model, which is trained on the third pre-trained model based on sample paragraph fragments and sample query text labeled with sample query result tags, the trained sentence semantic similarity model can find target sentence fragment vectors that are similar to the semantic vectors of the query text from the input sentence vectors. This not only improves the recall accuracy of sentence fragment vectors, but also improves the recall efficiency of sentence fragment vectors.
[0134] In an optional embodiment, the training method for the above sentence semantic similarity model includes:
[0135] Obtain sample paragraph fragments and a third sample query text. Segment the sample paragraph fragments to obtain at least two sample sentence fragments. Combine the sample sentence fragment vector of each sample sentence fragment with the sample semantic vector of the sample query text to obtain the sample sentence combination result corresponding to each sample sentence fragment vector. Input each sample sentence combination result into the third pre-trained model for query prediction processing to obtain the predicted matching result that matches each sample sentence combination result with the sample query result label. Adjust the network parameters of the third pre-trained model based on the difference between the predicted matching result and the actual matching result until the difference between the predicted matching result and the actual matching result meets the preset conditions to obtain the sentence semantic similarity model; the actual matching result is the actual similarity matching result between each sample sentence combination result and the sample query result label.
[0136] In this embodiment, the server can obtain sample paragraph fragments and a third sample query text for those fragments, the third sample query text carrying sample query result tags. The sample paragraph fragments can be from various fields and are not specifically limited thereto. The server can segment the sample paragraph fragments according to a preset method to obtain at least two sample sentence fragments. This preset method can be punctuation marks, the number of characters in the sentence, the number of lines in the sentence, etc. If the preset method is punctuation marks, the punctuation mark can be a period. The server can combine the sample sentence fragment vector of each sample sentence fragment with the sample semantic vector of the sample query text to obtain a sample sentence combination result corresponding to each sample sentence fragment vector. For example, combination can refer to concatenating the sample sentence fragment vector before or after the sample semantic vector to obtain a sample sentence combination result corresponding to each sample sentence fragment vector. The server can input each sample sentence combination result into a third pre-trained model for query prediction processing to obtain a predicted matching result where each sample sentence combination result matches the sample query result tag. For example, the predicted matching result can be a "yes" or "no" matching result, or it can be a predicted matching probability.
[0137] Since the sample query result labels are known, the actual matching result between each sample sentence combination and the sample query result label can be predetermined based on these known labels. This actual matching result can be a "yes" or "no" match, or a predicted matching probability. The server adjusts the network parameters of the third pre-trained model based on the difference between the predicted and actual matching results until the difference satisfies a fourth preset condition, thus obtaining the sentence semantic similarity model.
[0138] For example, the sample paragraph segments can be segmented to obtain three sample sentence segments (sample sentence segment 1, sample sentence segment 2, and sample sentence segment 3). The sample sentence segment vector of sample sentence segment 1 is combined with the sample semantic vector of the sample query text to obtain sample sentence combination result 1 corresponding to sample sentence segment 1; the sample sentence segment vector of sample sentence segment 2 is combined with the sample semantic vector of the sample query text to obtain sample sentence combination result 2 corresponding to sample sentence segment 2; and the sample sentence segment vector of sample sentence segment 3 is combined with the sample semantic vector of the sample query text to obtain sample sentence combination result 3 corresponding to sample sentence segment 3. Sample sentence combination results 1, 2, and 3 are then input into a third pre-trained model for query prediction processing to obtain predicted matching probabilities 1, 2, and 3, respectively, that match the sample query result tags.
[0139] Since the sample query result labels are known, based on these known sample query result labels, the actual matching probabilities 1, 2, and 3 of sample sentence combination result 1, sample sentence combination result 2, and sample sentence combination result 3 with the sample query result labels can be determined in advance.
[0140] The server adjusts the network parameters of the third pre-trained model based on the differences between predicted matching probability 1 and actual matching probability 1, predicted matching probability 2 and actual matching probability 2, and predicted matching probability 3 and actual matching probability 3, until predicted matching probability 1 matches actual matching probability 1, predicted matching probability 2 matches actual matching probability 2, and predicted matching probability 3 matches actual matching probability 3, thus obtaining the sentence semantic similarity model.
[0141] This allows for sentence segmentation of paragraphs to obtain sentence fragments, which are then used to train a sentence semantic similarity model. This improves the training efficiency and accuracy of the semantic similarity model, enabling the trained semantic similarity model to find sentence fragment vectors that meet preset conditions for similarity with the second semantic vector from the sentence fragment vectors corresponding to the already recalled target paragraph fragment vectors. This, in turn, improves the recall accuracy and efficiency of sentence fragment vectors.
[0142] Figure 4 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 3 ,like Figure 4As shown, prior to step S105, the method may further include: S104. Analyzing and judging the intent of the terminal object to obtain the degree of correlation between the query text and the interactive text. In an optional embodiment, step S104 may include:
[0143] S1041. Obtain the text association classification model; the text association classification model is obtained by training the preset text association classification model on the preset interactive text, the second preset query text targeting the preset interactive text, and the association degree label; the association degree label represents the degree of association between the preset interactive text and the second preset query text.
[0144] S1043. Input the query text and interaction text into the text association classification model for association prediction processing to obtain the degree of association between the query text and the interaction text.
[0145] In this embodiment, a text association classification model can be pre-trained. This model has the function of predicting the degree of association between interactive text and query text targeting the interactive text. For example, the training process of this text association classification model may include:
[0146] Obtain a preset interactive text and a second preset query text targeting the preset interactive text, the second preset query text carrying a relevance label. Input the preset interactive text and the second preset query text targeting the preset interactive text into a preset text association classification model for association classification training. Obtain the predicted relevance between the preset interactive text and the second preset query text output by the preset text association classification model. Calculate loss data based on the predicted relevance and the relevance label. If the loss data does not meet the model convergence condition, adjust the network parameters of the preset text association classification model using the loss data until the loss data meets the preset model convergence condition, thus obtaining the trained text association classification model.
[0147] The server inputs the query text and interaction text into a text association classification model. This model then predicts the degree of association between the two, yielding the correlation between the query text and the interaction text. This allows for the prediction of the correlation between query text and interaction text using a pre-trained text association classification model capable of predicting the correlation between interaction text and query text targeting that interaction text. This improves the efficiency and accuracy of correlation prediction, thereby enhancing the precision of determining whether to generate questions for text fragments and whether to perform question rewriting and recommendation. Furthermore, because the correlation is predicted by the text association classification model before question generation and rewriting, question generation and rewriting only occur if the correlation does not meet a second preset condition. This avoids the significant system resource consumption caused by generating and rewriting questions for all query texts, reducing the processing cost of interaction text.
[0148] In other embodiments, step S104 may include: sequentially traversing each chapter, each paragraph, and each sentence in the interactive text according to different dimensions such as chapters, paragraphs, and sentences, and matching the degree of correlation between the query text and the interactive text during the traversal process.
[0149] It should be noted that step S105 above can be implemented in various ways, and no specific limitation is made. In one embodiment, the process continues as follows: Figure 4 As shown, in step S105 above, the above-mentioned question generation process is performed on the text fragment to obtain the candidate recommended query text corresponding to the text fragment, including:
[0150] S1051. Obtain the large language model generated by the question; the large language model generated by the question is obtained by fine-tuning the large language model generated by the preset question based on the preset text fragment and the question label corresponding to the preset text fragment.
[0151] S1053. Input the text fragment into a large language model for question generation to obtain candidate recommended query text corresponding to the text fragment.
[0152] In this embodiment, a large-scale language model for question generation can be pre-trained. This large-scale language model for question generation has the function of generating natural and fluent questions related to the input text fragments. For example, the training process of this large-scale language model for question generation may include:
[0153] Obtain a preset text fragment and its corresponding question label. Input the preset text fragment into a large-scale language model for question generation and train it to generate questions. Obtain the predicted question output by the large-scale language model for question generation. Calculate the loss data based on the predicted question and question label. If the loss data does not meet the preset model convergence condition, fine-tune the network parameters of the large-scale language model for question generation using the loss data until the loss data meets the preset model convergence condition, thus obtaining the trained large-scale language model for question generation.
[0154] The server inputs the text fragment into a large-scale language model for question generation. This model then generates a natural and fluent question corresponding to the text fragment, thus producing candidate recommended query text. In this way, a pre-trained large-scale language model capable of generating natural and fluent questions related to the input text fragment can be used to generate questions specific to the text fragment, improving the efficiency and accuracy of question generation, thereby enhancing the efficiency and accuracy of query result generation.
[0155] In other embodiments, step S104 may include: obtaining historical interaction text from the historical question-and-answer process, obtaining historical text fragments similar to the text fragments from the historical text fragments of the historical interaction text, obtaining historical questions generated from the historical text fragments similar to the text fragments at historical time, and using the historical questions as candidate recommended query texts corresponding to the text fragments.
[0156] In a specific embodiment, when the text fragment includes at least one of a passage fragment, a paragraph fragment, and a sentence fragment, in step S1053 above, the input of the text fragment into a large-scale language model for question generation processing to obtain the candidate recommended query text corresponding to the text fragment may include:
[0157] Input at least one of the following types of text fragments: passage fragments, paragraph fragments, and sentence fragments, into a large-scale language model for question generation to generate candidate recommended query texts corresponding to the text fragments.
[0158] In this embodiment, when the text fragment includes at least one of passage fragments, paragraph fragments, and sentence fragments, a pre-trained large-scale language model for question generation can scan and traverse at least one of the parsed passage fragments, paragraph fragments, and sentence fragments to obtain candidate recommended query texts corresponding to the text fragments. Thus, questions for the interactive text can be generated based on at least one dimension of passage fragments, paragraph fragments, and sentence fragments. By activating the core capabilities of the large-scale language model and fully utilizing its powerful natural language processing capabilities, it can understand contextual information and semantic relationships, generating more accurate, comprehensive, and readable questions. This improves the comprehensiveness and accuracy of question generation for interactive text, thereby enhancing the accuracy of subsequent question rewriting and recommendation. This ensures that the rewritten and recommended questions are closely related to the text content of the interactive text, thereby improving the efficiency of interactive text question-and-answer processing, the efficiency of user-interactive response, and the accuracy of interactive response, while reducing the processing cost of interactive text.
[0159] It should be noted that step S107 above can be implemented in a variety of ways, and no specific limitation is made.
[0160] In one implementation, continue as follows Figure 4 As shown, in step S107 above, obtaining the target recommended query text from the candidate recommended query text that satisfies the third preset condition of similarity with the query text may include:
[0161] S1071. Vectorize the candidate recommendation query text and the query text respectively to obtain the first semantic vector corresponding to the candidate recommendation query text and the second semantic vector corresponding to the query text.
[0162] S1073. Input the first semantic vector and the second semantic vector into the text semantic similarity model for similarity matching processing, so as to obtain the target semantic vector from the first semantic vector that has a similarity to the second semantic vector that meets the third preset condition; determine the candidate recommended query text corresponding to the target semantic vector as the target recommended query text.
[0163] The text semantic similarity model is obtained by training a preset model on the anchor sample recommended text corresponding to the first sample query text, the positive sample recommended query text and the negative sample recommended query text in the sample recommended query text set. The content of the positive sample recommended query text matches the content of the anchor sample recommended text, while the content of the negative sample recommended query text does not match the content of the anchor sample recommended text.
[0164] In this embodiment, a preset model can be trained using the anchor sample recommended text corresponding to the first sample query text, the positive sample recommended query text whose content matches the anchor sample recommended text, and the negative sample recommended query text whose content does not match the anchor sample recommended text, to obtain a text semantic similarity model. The first semantic vector and the second semantic vector are then input into the text semantic similarity model for similarity matching processing to obtain the topk target semantic vector. Since the text semantic similarity model is trained on a pre-defined model based on anchor sample recommended text, positive sample recommended query text, and negative sample recommended query text in the sample recommended query text set, the trained text semantic similarity model has the function of narrowing the distance between data of the same category and widening the distance between data of different categories. Thus, it can recall target semantic vectors whose similarity with the second semantic vector meets the third pre-defined condition through the pre-trained text semantic similarity model, and achieve accurate rewriting of query text. This allows the rewritten target recommended query text to better activate the knowledge contained in the large language model, and at the same time, it can have a deep connection with the interactive text itself, thereby improving the efficiency of interactive text question answering, the efficiency of user interaction response, and the accuracy of interaction response, and reducing the processing cost of interactive text.
[0165] Figure 5 This is a flowchart illustrating the training process of a text semantic similarity model according to an exemplary embodiment, such as... Figure 5 As shown, in an optional embodiment, the training process of the above-mentioned text semantic similarity model may include:
[0166] S201. Obtain the sample recommended query text set and the first sample query text.
[0167] S203. Generate anchor sample recommendation text based on the first sample query text.
[0168] S205. Identify the positive and negative sample recommendation query texts from the sample recommendation query text set.
[0169] S207. Input the anchor sample recommendation text, positive sample recommendation query text, and negative sample recommendation query text into the preset model for feature extraction to obtain the anchor sample text vector corresponding to the anchor sample recommendation text, the positive sample text vector corresponding to the positive sample recommendation query text, and the negative sample text vector corresponding to the negative sample recommendation query text.
[0170] S209. Calculate the negative sample difference between the anchor sample text vector and the negative sample text vector, and the positive sample difference between the anchor sample text vector and the positive sample text vector.
[0171] S2011. Calculate the loss data based on the negative sample difference and the positive sample difference.
[0172] S2013. Adjust the network parameters of the preset model based on the loss data until the preset training termination condition is met to obtain the text semantic similarity model.
[0173] In this embodiment, the preset model can employ a pre-trained language model (PTM) with shared parameters, such as a pre-trained text model. More specifically, LICHEES can be used to model the text. LICHEES is a pre-trained BERT model based on a large-scale information flow text corpus, which is better able to extract semantic features from the information flow text corpus. The model's loss function can be triplet loss, a loss function in deep learning primarily used for training samples with low variance.
[0174] Specifically, the server can obtain a set of sample recommended query texts and a first sample query text. The server uses the first sample query text as the anchor recommended text, or preprocesses the first sample query text to obtain the anchor recommended text. The server determines positive sample recommended query texts whose content matches the content of the anchor recommended text, and negative sample recommended query texts whose content does not match the content of the anchor recommended text. In other embodiments, in order to widen the distance between the anchor and the negative, and improve the training accuracy of the text semantic similarity model and the accuracy of the trained text semantic similarity model in rewriting the query text, the negative sample recommended query text can also be determined in the following way: the negative sample recommended query text can be a difficult negative sample recommended query text or a random negative sample recommended query text. For example, texts unrelated to the first sample query text in open-domain question answering (OpenQA) data can be used as negative sample recommended query texts.
[0175] The server inputs a triplet (Anchor, Positive, and Negative) to a pre-defined model for feature extraction. This extracts the anchor text vector corresponding to the recommended text, the positive text vector corresponding to the recommended query text, and the negative text vector corresponding to the recommended query text. The distance between the anchor text vector and the negative text vector is calculated to obtain the negative sample difference, and the distance between the anchor text vector and the positive text vector is calculated to obtain the positive sample difference. Based on these negative and positive sample differences, the loss data is calculated. The core idea of this loss data calculation is to achieve similarity calculation between samples by making the distance between the Anchor and the Positive smaller than the distance between the Anchor and the Negative. The optimization goal is to shorten the distance between the Anchor and the Positive, and widen the distance between the Anchor and the Negative. The formula for calculating the first loss data can be as follows:
[0176] L=max(d(a,p)-d(a,n)+margin,0);
[0177] Where 'a' refers to Anchor, 'p' to Positive, and 'n' to Negative, distance L represents the loss data, d(a,p) refers to the positive sample difference between the anchor text vector and the positive sample text vector, d(a,n) refers to the negative sample difference between the anchor text vector and the negative sample text vector, and margin refers to the margin parameter, which represents whether the first distance between the anchor text vector and the positive sample text vector, and the second distance between the anchor text vector and the negative sample text vector, satisfy a preset condition. For example, the preset condition can be the minimum margin between the first distance and the second distance. From the above formula, it can be seen that the loss data can be the maximum value between (d(a,p)-d(a,n)+margin) and 0.
[0178] After receiving the loss data, the server determines whether the loss data meets the preset training termination condition, or whether the number of training iterations meets the preset training termination condition. If either of these conditions is met, the model training ends, and the trained model is used as the text semantic similarity model. If neither of these conditions is met, the model training process is repeated until the loss data meets the preset training termination condition, or the number of training iterations meets the preset training termination condition.
[0179] The input to the text semantic similarity model training process in this application embodiment is a triplet consisting of anchor sample recommended text, positive sample recommended query text, and negative sample recommended query text. Triplet loss is used to calculate the loss data. Triplet loss achieves similarity calculation between samples by making the distance between the Anchor and the Positive less than the distance between the Anchor and the Negative. Therefore, using Triplet loss to calculate the loss data improves the accuracy of loss data determination, thereby improving the training accuracy of the text semantic similarity model. This allows the trained text semantic similarity model to accurately rewrite the query text, enabling the rewritten target recommended query text to better activate the knowledge contained in the large language model and to have a deep connection with the interactive text itself. This improves the efficiency of interactive text question answering, the efficiency of user-interactive text interaction response, and the accuracy of interaction response, while reducing the processing cost of interactive text.
[0180] In an optional embodiment, in step S109 above, the input of contextual information and target recommended query text into a large language model for query result prediction processing to obtain query results for the query text may include:
[0181] Based on contextual information and target recommendation text, suggestive messages are generated.
[0182] The prompt information is input into a large language model for query result prediction processing, resulting in the query results of the query text.
[0183] Optionally, the server can generate a prompt based on context information and the target recommended query text. In one implementation, the server obtains a pre-configured prompt template, which includes information slots. The server then fills these slots with the context information and the target recommended query text to obtain the prompt. In another implementation, the server can directly concatenate the context information and the target recommended query text to obtain the prompt, or concatenate and encrypt the text to obtain the prompt.
[0184] Optionally, after generating the prompt information, the server can input the prompt information into a large language model for prompt learning to predict query results and obtain the query results of the query text. This allows for a deep understanding of the interactive text by generating questions from the interactive text and rewriting questions from the query text, in conjunction with a large language model. This ensures that the rewritten questions are deeply related to the interactive text itself, thereby improving the efficiency of interactive text question-and-answer processing, the efficiency and accuracy of user-interactive responses, and reducing the processing cost of interactive text. Furthermore, a prompt is essentially an instruction for downstream tasks, serving as information augmentation to tell the model what task to perform and what content to output. In essence, prompt learning can reuse the objectives and parameters used in the pre-training stage of the pre-trained language model. For the basic large model, freezing some parameters and layers is beneficial due to limited hardware computing resources and storage. Therefore, freezing some model parameters based on the already trained model allows for practical application in real-world business scenarios, reducing modeling costs and improving modeling efficiency.
[0185] The following is an introduction to large-scale language models:
[0186] Large-scale language models utilize the Transform architecture, which employs an attention mechanism for sequence modeling and has achieved state-of-the-art results in machine translation tasks. This breaks the traditional pattern where encoder-decoder models must combine with recurrent neural networks (RNNs), significantly improving model parallelism without sacrificing or even enhancing performance. Key components of the Transform architecture's network structure include:
[0187] Multi-head self-attention: Applying self-attention to a sequence allows for the simultaneous mining of the relationships between each item and all other items in the sequence. Multi-head attention can be used to mine information from different vector subspaces.
[0188] Position-wise Feed-Forward Network: This adds a feed-forward layer after the attention layer, giving the model non-linear expressive capabilities and enabling it to explore the interaction relationships between different dimensions.
[0189] Transformer Layer: A Transformer layer consists of a multi-head self-attention layer and a position feedforward network. Both the Attention Layer and the FFN use residual networks in the output part and perform layer normalization.
[0190] Stacking Transformer Layers: By stacking multiple Transformer layers together, more complex and higher-order interaction information can be learned.
[0191] In an optional embodiment, the above method may further include:
[0192] If the degree of correlation between the query text and the interactive text meets the second preset condition, the context information and the query text are input into a large language model for query result prediction processing to obtain the query result of the query text.
[0193] In this embodiment, if the server determines that the correlation between the query text and the interaction text meets the second preset condition, it indicates that the query text and the interaction text are related. Therefore, without generating or rewriting questions, the context information and query text can be directly input into a large language model for query result prediction, yielding the query result. This avoids the significant system resource consumption caused by generating and rewriting questions for each query text, reducing the processing cost of interaction text.
[0194] The embodiments of this application can also process the questions of the terminal object in multiple rounds through interactive dialogue, thereby enabling a progressive and in-depth exploration of the true intentions of the terminal object, fully realizing a deep understanding of the document content, and thus improving the efficiency of interactive text question-and-answer processing and reducing information overload. Figure 6 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 4 ,like Figure 6 As shown, the above interactive text question-and-answer processing method includes at least two rounds of queries. The query text mentioned above is the first round of query text. After obtaining the query results of the query text, the above method may further include:
[0195] S301. Obtain the text of non-first-round queries.
[0196] S303. Obtain text fragments from the text fragments that have a similarity to the non-first-round query text that meets a first preset condition, and generate context information of the non-first-round query text based on the text fragments that have a similarity to the non-first-round query text.
[0197] S305. If the correlation between the non-first-round query text and the interaction text does not meet the second preset condition, obtain the recommended query text whose similarity to the non-first-round query text meets the third preset condition from the candidate recommended query text in the preset database.
[0198] S307. Input the contextual information of the non-first-round query text and the recommended query text whose similarity meets the third preset condition into a large language model to perform query result prediction processing, and obtain the query results of the non-first-round query text.
[0199] In this embodiment, for a multi-round query process, in subsequent non-first-round query processes, the server can obtain the non-first-round query text proposed by the terminal object in response to the interactive text, and extract text fragments from the text fragments that satisfy a first preset condition of similarity with the non-first-round query text, and generate context information of the non-first-round query text based on the text fragments that satisfy the first preset condition of similarity. It should be noted that the process of generating text fragments that satisfy the first preset condition of similarity with the non-first-round query text, and the context information of the non-first-round query text, is the same as that of the first-round text. For details, please refer to steps S103, S1031-S1037 above, which will not be repeated here.
[0200] Similar to the initial query text, for non-initial query texts, the server still needs to analyze and judge them beforehand to determine whether the relevance between the non-initial query text and the interaction text meets the second preset condition. If so, the non-initial query text and its corresponding context information are directly input into a large language model for question-answering prediction. If not, it indicates that the non-initial query text is not related to the content of the interaction text and needs to be rewritten and recommended. Since the initial processing stores candidate recommended query texts obtained by generating questions from text fragments in a preset database, for the non-initial query process, the server can directly obtain text fragments whose similarity to the non-initial query text meets the first preset condition from the preset database. That is, without needing to generate questions for the interaction text again, the server can directly rewrite and recommend the non-initial query text based on the content stored in the preset database, obtaining the rewritten questions for the non-initial query text. This avoids the drawback of high system resource consumption caused by generating questions for the interaction text in each query, reducing the cost of interaction text question-answering processing. Then, the context information of the non-initial query text is generated based on the text fragments whose similarity meets the first preset condition.
[0201] After obtaining the contextual information of the recommended query text and the non-first-round query text that meet the third preset similarity condition, prompt information can be generated based on the two. The prompt information is then input into a large language model for query result prediction processing to obtain the query results of the non-first-round query text.
[0202] The following explains the process of generating and rewriting questions during multi-round queries:
[0203] First-round query text (Q): From which aspects does the article discuss?
[0204] After receiving the first-round query text, the server determines whether the correlation between the first-round query text and the interaction text meets the second preset condition. If so, it directly inputs the corresponding context information and the first-round query text into the large language model for query result prediction processing to obtain the query result of the first-round query text.
[0205] For example, the query result (A) of the first round of text query is: The article discusses the topic from two dimensions: animals and plants.
[0206] Non-first-round query text (Q): Let's elaborate on the second aspect?
[0207] After receiving the first-round query text, the server determines whether the correlation between the first-round query text and the interaction text meets the second preset condition. If so, it directly inputs the corresponding context information and the non-first-round query text into the large language model for query result prediction processing to obtain the query result of the non-first-round query text.
[0208] If not, then generate and rewrite the question in the manner described above. The rewritten non-first-round query text (Q) can be: Please describe the plants in the article in detail.
[0209] The query result (A) for the non-first-round query text (Q) is: The article mentions that plants can be divided into seed plants, bryophytes, ferns, etc.
[0210] It is evident that the rewritten questions are relevant to the text content, effectively improving the accuracy of question-and-answer processing.
[0211] In some embodiments, in order to ensure that the actual output of the large language model can be aligned with the expectations of the terminal object, RLHF can be introduced. Before the large language model is officially launched, the output of the large language model is scored to ensure that the actual output of the large language model can be aligned with the expectations of the terminal object.
[0212] The following is a general explanation of the interactive text question-and-answer processing method described above:
[0213] The application scenarios of this application embodiment can be as follows: for text files uploaded by users in instant messaging groups in social networks, text files or links to file web pages transmitted in peer-to-peer chat, or text files saved in online storage services (e.g., cloud storage), the text files can be effectively understood and processed. Through interactive methods, the terminal object can be guided to supplement sufficient information for the question, and some questions that the terminal object may ask can be recommended and rewritten, reducing the input of the terminal object. At the same time, the true questioning intention of the terminal object can be well understood, so that the rewritten questions can be closely related to the content of the interactive text, thereby improving the efficiency of question and answer processing and improving the user experience.
[0214] Figure 7 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 5 ,like Figure 7 As shown, this interactive text question-and-answer processing method may include:
[0215] 1) Obtain the interactive text and the query text proposed in response to the interactive text; the interactive text can be a file in formats such as PDF, Word, Web, txt, or various e-books, etc.
[0216] 2) Perform structured parsing on the interactive text to obtain text fragments; text fragments include at least one of chapter fragments, paragraph fragments, and sentence fragments. Vectorize the text fragments to obtain at least one of the following: chapter fragment vector, paragraph fragment vector corresponding to a paragraph fragment, and sentence fragment vector corresponding to a sentence fragment.
[0217] In one implementation, where the preset service is an instant messaging service within a social network, the process of the server acquiring interactive text, query text, and parsing the text may include:
[0218] Figure 8 This is a flowchart illustrating an interactive text question-and-answer processing method according to an exemplary embodiment. Figure 6 ,like Figure 8 As shown, the terminal object opens the instant messaging service, enters an instant messaging group, or enters a page for point-to-point chat with other objects. The terminal object finds the file control in the group application of the instant messaging group or in the point-to-point chat page, and clicks the file control, thereby displaying all the text uploaded by the terminal object and other objects before the current time on the text display page.
[0219] When a terminal object wants to parse certain files, it can perform operations on those files (including but not limited to: clicking, long-pressing, dragging, etc.) to trigger a selection operation for those files. The server responds to this selection operation by determining the selected files as the final interactive text to be parsed. It should be noted that these "certain files" can be a single file or a group of files; there is no specific limitation.
[0220] When a terminal object performs operations on certain files, the client can also display interactive text and pop up a file assistant tool in the instant messaging service. The terminal object interacts with (e.g., clicks) this file assistant tool to display its corresponding function page, which shows various functions for file operations, such as file parsing and file compilation. Clicking the file parsing function triggers a text parsing operation. The server responds to this operation by passing the interactive text to the file assistant tool for structured parsing to obtain a text fragment. The server then sends this text fragment to the terminal, which displays it on the target page in the instant messaging service.
[0221] The terminal can also display a query text editing area on the target page. This query text editing area can be displayed anywhere on the target page, such as below or above a text fragment, without specific limitations. The terminal object edits this query text editing area to trigger an editing operation. The server responds to the editing operation by using the text corresponding to the edited text as the query text.
[0222] In another implementation, where the default service is an online storage service, the process of the server acquiring interactive text, query text, and parsing the text may include:
[0223] The terminal object opens the online storage service. The text display page in the online storage service shows all the text uploaded by the terminal object before the current time. When the terminal object wants to parse certain files, it can perform operations on those files (including but not limited to: clicking, long-pressing, dragging, etc.) to trigger a selection operation for those files. The server responds to this selection operation and determines the selected files by the terminal object as the final interactive text to be parsed.
[0224] When a terminal object performs operations on certain files, the client can also pop up a file assistant tool. Clicking this file assistant tool displays its corresponding function page, which shows various file operation functions, such as file parsing and file compilation. Clicking the file parsing function triggers a text parsing operation. The server responds by passing the interactive text to the file assistant tool for structured parsing to obtain a text fragment. The server then sends this text fragment to the terminal, which displays it on the target page in the online storage service.
[0225] The terminal can also display a query text editing area on the target page. This query text editing area can be displayed anywhere on the target page, such as below or above a text fragment, without specific limitations. The terminal object edits this query text editing area to trigger an edit operation. The server responds to the edit operation by using the text corresponding to the edit operation as the query text.
[0226] 3) Establish index information corresponding to text fragments. This index information includes at least one of the following: text fragment index information corresponding to text fragment vectors, paragraph fragment index information corresponding to paragraph fragment vectors, sentence fragment index information corresponding to sentence fragment vectors, display index information, and structure index information.
[0227] 4) Encode the query text to obtain the second semantic vector of the query text.
[0228] 5) Input the text fragment vector and the second semantic vector into the text semantic similarity model for similarity matching processing, so as to obtain the target text fragment vector from the text fragment vector that satisfies the first preset condition of similarity with the semantic vector.
[0229] 6) Input the target passage fragment vector and the second semantic vector into the paragraph semantic similarity model for similarity matching processing, so as to obtain the target paragraph fragment vector whose similarity with the second semantic vector meets the first preset condition from the paragraph fragment vector corresponding to the target passage fragment vector.
[0230] 7) Combine each sentence segment vector corresponding to the target paragraph segment vector with the first semantic vector to obtain the sentence combination result of each sentence segment vector corresponding to the target paragraph segment vector; input each sentence combination result into the sentence semantic similarity model for similarity matching processing, so as to obtain the target sentence segment vector whose similarity with the first semantic vector meets the first preset condition from at least two sentence segment vectors corresponding to the target paragraph segment vector. Determine the target sentence segment vector as the target vector.
[0231] 8) Determine the target index information corresponding to the target vector from at least one of the following: text fragment index information, paragraph fragment index information, and sentence fragment index information. Obtain the target text fragment corresponding to the target index information from the text fragment.
[0232] 9) Generate contextual information for the query text based on the target text fragment.
[0233] 10) Obtain the text association classification model. Input the query text and interaction text into the text association classification model for association prediction processing to obtain the degree of association between the query text and the interaction text.
[0234] 11) If the degree of correlation between the query text and the interactive text meets the second preset condition, generate prompt information based on the query text and the interactive text, input the prompt information into the large language model for query result prediction processing, and obtain the query result of the query text.
[0235] If the correlation between the query text and the interaction text does not meet the second preset condition, question generation and question rewriting processes are performed, followed by subsequent steps. The question generation process may include: generating questions from the text fragment to obtain candidate recommended query texts corresponding to the text fragment, and storing the candidate recommended query texts in a preset database. The question rewriting process may include: retrieving the target recommended query text from the candidate recommended query texts in the preset database, where the similarity to the query text meets the third preset condition.
[0236] Continue as Figure 8 As shown, after obtaining the target recommended query text from the candidate recommended query text that satisfies the third preset condition of similarity with the query text, the method further includes:
[0237] Send the target recommended query text to the terminal so that the terminal displays the target recommended query text in the query text editing area.
[0238] After rewriting the question, in order to clearly display the rewritten question to the end user and improve the end user experience, the server can send the target recommended query text to the end user, so that the end user can display the target recommended query text in the query text editing area.
[0239] 12) Generate prompts based on contextual information and target recommended query text.
[0240] 13) Input the prompt information into a large language model to perform query result prediction processing and obtain the query results of the query text.
[0241] It should be noted that the process from "creating the index information corresponding to the text fragment" to "obtaining the query results of the query text" can all be achieved through a file assistant tool.
[0242] Continue as Figure 8 As shown, after obtaining the query results for the query text, the above method also includes:
[0243] Send the query results to the terminal so that the terminal can display the text snippet, the target recommended query text, and the query results on the target page.
[0244] After obtaining the query results from the query text, in order to clearly display the query results to the terminal and further improve the user experience, the server can send the query results to the terminal. The terminal then displays the text fragment, the target recommended query text, and the query results on the target page.
[0245] 14) In response to an editing operation triggered by a terminal object based on the target recommended query text in the query text editing area, the text corresponding to the editing operation is determined to be a non-first-round query text.
[0246] 15) Obtain text fragments from the text fragments that have a similarity to the non-first round query text that meets the first preset condition, and generate context information of the non-first round query text based on the text fragments that have a similarity to the first preset condition.
[0247] 16) If the correlation between the non-first-round query text and the interaction text does not meet the second preset condition, obtain the recommended query text from the candidate recommended query text in the preset database that meets the third preset condition in terms of similarity with the non-first-round query text.
[0248] 17) Input the context information of the non-first-round query text and the recommended query text whose similarity meets the third preset condition into the large language model to perform query result prediction processing, and obtain the query results of the non-first-round query text.
[0249] 18) Send the query results of the non-first-round query text to the terminal so that the terminal displays the text fragment, the recommended query text whose similarity with the non-first-round query text meets the third preset condition, and the query results of the non-first-round query text on the target page.
[0250] Continue as Figure 8 As shown, the terminal can display text fragments, recommended query texts whose similarity to non-first-round query texts meets the third preset condition, and query results of non-first-round query texts in a preset format on the target page.
[0251] 19) In response to an editing operation triggered by the terminal object based on the query text editing area, determine the text corresponding to the editing operation as the query text for the next round, and repeat steps 15)-18) until the multi-round query process ends.
[0252] Figure 9 This is a schematic diagram of an interactive text question-and-answer processing system according to an exemplary embodiment, such as... Figure 9 As shown, the interactive text question-and-answer processing system may include:
[0253] I. Accessing the server
[0254] (1) Connect the message content with the message database storage and indexing system through the message queue system to complete the core business logic of message processing;
[0255] (2) Communicate with the group service server to provide a complete set of group functions, including adding and deleting groups, and serving as an intermediary bridge for uploading and downloading group files;
[0256] II. Message Content Database
[0257] (1) Temporarily save user conversation messages to enable message roaming and multi-terminal message synchronization;
[0258] (2) As the core module of the messaging system, it optimizes message storage and indexing with high efficiency;
[0259] (3) Information sources for multi-device message synchronization;
[0260] III. Messaging System
[0261] (1) Responsible for the entire flow, dispatch, and distribution of messages, including synchronization and communication;
[0262] (2) Responsible for communicating with the message content database, completing message distribution and processing, including various group message content;
[0263] IV. File Database and Index Information
[0264] (1) Communication with access service period, including document display index, document structure index, chapter index, paragraph index and sentence-level granular index. The index information is mainly used to quickly locate the actual text content, and at the same time save the content block entity text information of various granularities after file parsing.
[0265] (2) Simultaneously preserve various publicly available and manually annotated datasets related to reading comprehension and question-and-answer;
[0266] (3) Provide raw supervised sample data services for fine-tuning large language models and building multi-granularity text similarity models, such as semantic similarity base models at the document, paragraph, and sentence levels.
[0267] V. Document Comprehension Problem Generation Model
[0268] (1) Construct the understanding and question answering model according to the method of constructing the large language model prompt and the context location method described above. On this model, the final service of document understanding and question answering generation is obtained by service-oriented approach.
[0269] (2) Communicate with the client to understand and answer questions in the text file specified by the user and return the results for display on the message client;
[0270] VI. Document Comprehension Question Generation Service
[0271] (1) Improve the group file understanding and question answering service and a series of dependent foundations, such as the basic model at the level of chapter, paragraph and sentence, to complete the location of the answer to the user's question;
[0272] (2) Based on the location, construct the Prompt based on a large language model to generate the final question and answer results;
[0273] (3) Communicate with the client to understand and answer questions about the files selected by the user and return the results for the client to display;
[0274] VII. Large-scale language models
[0275] This embodiment is not limited to a fixed large language model; any model that uses the generated Transform architecture can be classified as a large language model.
[0276] 8. Group Business System
[0277] (1) Complete the synchronization and processing of various group messages;
[0278] (2) Simultaneously complete the indexing, saving and sharing of various group files uploaded and published by group members, and communicate with the file database and indexing system to provide the original file data source that requires in-depth file understanding and question-and-answer processing.
[0279] Figure 10 This is a block diagram illustrating an interactive text question-and-answer processing apparatus according to an exemplary embodiment, such as... Figure 10 As shown, the interactive text question-and-answer processing device includes:
[0280] The text acquisition module 401 is used to acquire interactive text and query text.
[0281] The context information generation module 403 is used to perform structured parsing processing on the interactive text to obtain text fragments, obtain target text fragments from the text fragments that have a similarity to the query text that meets a first preset condition, and generate context information of the query text based on the target text fragments.
[0282] The question generation module 405 is used to perform question generation processing on the text fragment when it is determined that the degree of correlation between the query text and the interactive text does not meet the second preset condition, so as to obtain the candidate recommended query text corresponding to the text fragment.
[0283] The target recommendation query text generation module 407 is used to obtain target recommendation query texts from the candidate recommendation query texts that have a similarity to the query text that meets a third preset condition.
[0284] The query result generation module 409 is used to input the context information and the target recommended query text into a large language model for query result prediction processing to obtain the query result of the query text; wherein, the large language model is obtained by fine-tuning an initial large language model based on preset context information of a preset domain, a first preset query text for the preset context information, and a preset query result corresponding to the first preset query text.
[0285] In an optional embodiment, the apparatus further includes:
[0286] The text association classification model acquisition module is used to acquire a text association classification model; the text association classification model is obtained by training the preset text association classification model on a preset interactive text, a second preset query text for the preset interactive text, and an association degree label; the association degree label represents the degree of association between the preset interactive text and the second preset query text.
[0287] The correlation degree generation module is used to input the query text and the interaction text into the text association classification model for association prediction processing, and obtain the correlation degree between the query text and the interaction text.
[0288] In an optional embodiment, the question generation module includes:
[0289] A large language model acquisition unit is used to acquire a large language model generated by a question; the large language model generated by the question is obtained by fine-tuning the large language model generated by a preset question based on a preset text fragment and the question tag corresponding to the preset text fragment.
[0290] The candidate recommendation query text generation unit is used to input the text fragment into the large language model that generates the question for question generation processing, and obtain the candidate recommendation query text corresponding to the text fragment.
[0291] In an optional embodiment, the text fragment includes at least one of a chapter fragment, a paragraph fragment, and a sentence fragment. The candidate recommendation query text generation unit is further configured to input at least one of the chapter fragment, paragraph fragment, and sentence fragment into the large-scale language model for question generation to perform question generation processing, thereby obtaining the candidate recommendation query text corresponding to the text fragment.
[0292] In an optional embodiment, the transpose further includes:
[0293] The storage module is used to store the candidate recommended query text corresponding to the text fragment into a preset database.
[0294] Accordingly, the target recommendation query text generation module is further configured to obtain the target recommendation query text from the candidate recommendation query texts in the preset database, wherein the similarity to the query text satisfies the third preset condition.
[0295] In an optional embodiment, the interactive text question-and-answer processing method includes at least two rounds of queries, wherein the query text is the first round of query text, and the apparatus further includes:
[0296] The non-first-round query text acquisition module is used to acquire non-first-round query text.
[0297] The non-first-round query text context generation module is used to obtain text segments from the text segments that have a similarity to the non-first-round query text that meets the first preset condition, and to generate context information of the non-first-round query text based on the text segments that have a similarity that meets the first preset condition.
[0298] The similarity matching module is used to, when it is determined that the degree of association between the non-first-round query text and the interaction text does not meet the second preset condition, obtain recommended query texts from the candidate recommended query texts in the preset database that have a similarity to the non-first-round query text that meets the third preset condition.
[0299] The non-first-round query text query result generation module is used to input the context information of the non-first-round query text and the recommended query text whose similarity meets the third preset condition into the large language model for query result prediction processing, so as to obtain the query result of the non-first-round query text.
[0300] In an optional embodiment, the target recommendation query text generation module includes:
[0301] The second semantic vector generation unit is used to vectorize the candidate recommendation query text and the query text respectively to obtain the first semantic vector corresponding to the candidate recommendation query text and the second semantic vector corresponding to the query text.
[0302] The vectorization processing unit is used to input the first semantic vector and the second semantic vector into a text semantic similarity model for similarity matching processing, so as to obtain a target semantic vector from the first semantic vector whose similarity to the second semantic vector meets the third preset condition; and determine the candidate recommended query text corresponding to the target semantic vector as the target recommended query text.
[0303] The text semantic similarity model is obtained by training a preset model based on the anchor sample recommended text corresponding to the first sample query text, the positive sample recommended query text and the negative sample recommended query text in the sample recommended query text set. The content of the positive sample recommended query text matches the content of the anchor sample recommended text, while the content of the negative sample recommended query text does not match the content of the anchor sample recommended text.
[0304] In an optional embodiment, the apparatus further includes:
[0305] The sample text acquisition module is used to acquire the sample recommended query text set and the first sample query text.
[0306] An anchor sample recommendation text generation module is used to generate the anchor sample recommendation text based on the first sample query text.
[0307] The positive and negative sample generation module is used to determine the positive sample recommendation query text and the negative sample recommendation query text from the sample recommendation query text set.
[0308] The positive and negative vector generation module is used to input the anchor sample recommended text, the positive sample recommended query text, and the negative sample recommended query text into the preset model for feature extraction, so as to obtain the anchor sample text vector corresponding to the anchor sample recommended text, the positive sample text vector corresponding to the positive sample recommended query text, and the negative sample text vector corresponding to the negative sample recommended query text.
[0309] The sample difference determination module is used to calculate the negative sample difference between the anchored sample text vector and the negative sample text vector, and the positive sample difference between the anchored sample text vector and the positive sample text vector.
[0310] The loss data generation module is used to calculate loss data based on the negative sample difference and the positive sample difference.
[0311] The parameter adjustment module is used to adjust the network parameters of the preset model according to the loss data until the preset training termination condition is met to obtain the text semantic similarity model.
[0312] In an optional embodiment, the context information generation module includes:
[0313] The parsing unit is used to perform structured parsing processing on the interactive text to obtain the text fragments; the text fragments include at least one of chapter fragments, paragraph fragments, and sentence fragments.
[0314] An index building unit is used to build index information corresponding to the text fragment; the index information is used to characterize the position information of the text fragment in the interactive text, and the index information includes at least one of the following: the chapter fragment index information corresponding to the chapter fragment, the paragraph fragment index information corresponding to the paragraph fragment, and the sentence fragment index information corresponding to the sentence fragment.
[0315] The target index information generation unit is used to obtain target index information that satisfies the first preset condition in terms of similarity to the query text from at least one of the chapter fragment index information, paragraph fragment index information, and sentence fragment index information.
[0316] A target text fragment generation unit is used to obtain the target text fragment corresponding to the target index information from the text fragment.
[0317] In an optional embodiment, the text fragments include passage fragments, paragraph fragments, and sentence fragments, and the device further includes:
[0318] The text fragment vector generation module is used to vectorize the text fragments to obtain the text fragment vectors corresponding to the text fragments; the text fragment vectors include the text fragment vectors corresponding to the chapter fragments, the paragraph fragment vectors corresponding to the paragraph fragments, and the sentence fragment vectors corresponding to the sentence fragments.
[0319] Accordingly, the index building unit is also used to build index information corresponding to the text fragment vector, paragraph fragment vector and sentence fragment vector respectively, so as to obtain the index information corresponding to the text fragment.
[0320] Accordingly, the target index information generation unit includes:
[0321] The target vector generation subunit is used to obtain a target text segment vector from the text segment vector whose similarity to the second semantic vector corresponding to the query text meets a first preset condition; obtain a target paragraph segment vector from the paragraph segment vector corresponding to the target text segment vector whose similarity to the second semantic vector meets the first preset condition; obtain a target sentence segment vector from the sentence segment vector corresponding to the target paragraph segment vector whose similarity to the second semantic vector meets the first preset condition; and determine the target sentence segment vector as the target vector.
[0322] The index determination subunit is used to determine the target index information corresponding to the target vector from the text fragment index information, paragraph fragment index information and sentence fragment index information.
[0323] In an optional embodiment, the apparatus further includes:
[0324] The second query result prediction module is used to input the context information and the query text into the large language model to perform query result prediction processing, and obtain the query result of the query text, when it is determined that the degree of correlation between the query text and the interactive text meets the second preset condition.
[0325] In an optional embodiment, the query result generation module includes:
[0326] The prompt information generation unit is used to generate prompt information based on the context information and the target recommended query text.
[0327] The first query result prediction module is used to input the prompt information into the large language model for query result prediction processing to obtain the query result of the query text.
[0328] In an optional embodiment, the text acquisition module includes:
[0329] The first response module is used to respond to a text selection operation triggered by a terminal object on a text display page in a preset service, and to determine the text corresponding to the text selection operation as the interactive text; the preset service is an online storage service or an instant messaging service in a social network.
[0330] Accordingly, the context information generation module includes:
[0331] The parsing operation response unit is used to respond to the text parsing operation triggered by the terminal object based on the file assistant tool, and to pass the interactive text to the file assistant tool for structured parsing processing to obtain the text fragment.
[0332] A text fragment sending unit is used to send the text fragment to a terminal so that the terminal displays the text fragment on a target page in the preset service; wherein, the text file assistant tool is displayed on the terminal when the terminal object triggers the text selection operation.
[0333] In an optional embodiment, the target page displays a query text editing area, and the device further includes:
[0334] The second response module is used to respond to the editing operation triggered by the terminal object based on the query text editing area, and to determine the text corresponding to the editing operation as the query text.
[0335] Accordingly, the device further includes:
[0336] The target recommendation query text sending module is used to send the target recommendation query text to the terminal, so that the terminal displays the target recommendation query text in the query text editing area.
[0337] Accordingly, the device further includes:
[0338] The query result sending module is used to send the query result to the terminal so that the terminal displays the text fragment, the target recommended query text, and the query result on the target page.
[0339] The third response module is used to respond to an editing operation triggered by the terminal object based on the target recommended query text in the query text editing area, determine the text corresponding to the editing operation as non-first-round query text, generate query results corresponding to the non-first-round query text, and send the query results corresponding to the non-first-round query text to the terminal, so that the terminal displays the text fragment, the recommended query text whose similarity to the non-first-round query text meets the third preset condition, and the query results corresponding to the non-first-round query text on the target page.
[0340] It should be noted that the device embodiments provided in this application are based on the same inventive concept as the method embodiments described above.
[0341] This application also provides an electronic device for interactive text question-and-answer processing. The electronic device includes a processor and a memory. The memory stores at least one instruction or at least one program. The processor loads and executes the at least one instruction or at least one program to implement the interactive text question-and-answer processing method provided in any of the above embodiments.
[0342] This application also provides an electronic device for interactive text question-and-answer processing. The electronic device includes a processor and a memory. The memory stores at least one instruction or at least one program. The processor loads and executes the at least one instruction or at least one program to implement the interactive text question-and-answer processing method provided in any of the above embodiments.
[0343] Embodiments of this application also provide a computer-readable storage medium that can be disposed in a terminal to store at least one instruction or at least one program for implementing an interactive text question-and-answer processing method as described in the method embodiments. The at least one instruction or at least one program is loaded and executed by a processor to implement the interactive text question-and-answer processing method as described in the above method embodiments.
[0344] Optionally, in the embodiments of this specification, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0345] The memory described in this specification can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for functions, etc.; the data storage area may store data created based on the use of the device, etc. Furthermore, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.
[0346] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the interactive text question-and-answer processing method provided in the above-described method embodiments.
[0347] The embodiments of the interactive text question-and-answer processing method provided in this application can be executed on a terminal, computer terminal, server, or similar computing device. Taking running on a server as an example, Figure 11This is a hardware structure block diagram of a server according to an exemplary embodiment. For example... Figure 11 As shown, the server 500 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 510 (CPUs 510 may include, but are not limited to, microprocessors (MCUs) or programmable logic devices (FPGAs), a memory 530 for storing data, and one or more storage media 520 (e.g., one or more mass storage devices) for storing application programs 523 or data 522. The memory 530 and storage media 520 may be temporary or persistent storage. The program stored in the storage media 520 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 410 may be configured to communicate with the storage media 520 and execute the series of instruction operations stored in the storage media 520 on the server 500. Server 500 may also include one or more power supplies 560, one or more wired or wireless network interfaces 550, one or more input / output interfaces 540, and / or one or more operating systems 521, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0348] The input / output interface 540 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 500. In one example, the input / output interface 540 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 540 may be a radio frequency (RF) module for wireless communication with the Internet.
[0349] Those skilled in the art will understand that Figure 11 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 500 may also include... Figure 11 The more or fewer components shown, or having the same Figure 11 The different configurations shown.
[0350] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, specific embodiments have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0351] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and server embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0352] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0353] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An interactive text question-and-answer processing method, characterized in that, The method includes: Get the interactive text and query text; The interactive text is processed by structured parsing to obtain text fragments. Target text fragments that have a similarity to the query text that meets a first preset condition are obtained from the text fragments. Context information of the query text is generated based on the target text fragments. If the correlation between the query text and the interactive text does not meet the second preset condition, the text fragment is processed to generate a question, thereby obtaining the candidate recommended query text corresponding to the text fragment. Obtain the target recommended query text from the candidate recommended query texts that has a similarity to the query text that meets the third preset condition; The context information and the target recommended query text are input into a large language model for query result prediction processing to obtain the query result of the query text; wherein, the large language model is obtained by fine-tuning an initial large language model based on preset context information of a preset domain, a first preset query text for the preset context information, and a preset query result corresponding to the first preset query text.
2. The interactive text question-and-answer processing method according to claim 1, characterized in that, Before performing question generation processing on the text fragment to obtain candidate recommended query text corresponding to the text fragment, when it is determined that the correlation between the query text and the interactive text does not meet the second preset condition, the method further includes: A text association classification model is obtained; the text association classification model is obtained by training the preset text association classification model on a preset interactive text, a second preset query text for the preset interactive text, and an association degree label; the association degree label represents the degree of association between the preset interactive text and the second preset query text. The query text and the interaction text are input into the text association classification model for association prediction processing to obtain the degree of association between the query text and the interaction text.
3. The interactive text question-and-answer processing method according to claim 1, characterized in that, The step of performing question generation processing on the text fragment to obtain the candidate recommended query text corresponding to the text fragment includes: A large language model generated from a question is obtained; the large language model generated from the question is obtained by fine-tuning the large language model generated from a preset question based on a preset text fragment and the question label corresponding to the preset text fragment; The text fragment is input into a large language model for question generation to generate the candidate recommended query text corresponding to the text fragment.
4. The interactive text question-and-answer processing method according to claim 3, characterized in that, The text fragment includes at least one of chapter fragments, paragraph fragments, and sentence fragments. The step of inputting the text fragment into a large-scale language model for question generation processing to obtain candidate recommended query text corresponding to the text fragment includes: Input at least one of the text fragments, paragraph fragments, and sentence fragments into the large-scale language model for question generation to generate the candidate recommended query text corresponding to the text fragment.
5. The interactive text question-and-answer processing method according to any one of claims 1 to 4, characterized in that, After obtaining the candidate recommended query text corresponding to the text fragment, the method further includes: Store the candidate recommended query text corresponding to the text fragment in a preset database; Accordingly, obtaining the target recommended query text from the candidate recommended query text that satisfies the third preset condition in terms of similarity to the query text includes: From the candidate recommended query texts in the preset database, obtain the target recommended query text whose similarity to the query text meets the third preset condition.
6. The interactive text question-and-answer processing method according to claim 5, characterized in that, The interactive text question-and-answer processing method includes at least two rounds of queries, where the query text is the first round of query text. After obtaining the query results of the query text, the method further includes: Retrieve text from non-first-round queries; Obtain text segments from the text segments that have a similarity to the non-first-round query text that meets the first preset condition, and generate context information of the non-first-round query text based on the text segments that have a similarity to the first preset condition; If the correlation between the non-first-round query text and the interaction text does not meet the second preset condition, then from the candidate recommended query texts in the preset database, a recommended query text whose similarity to the non-first-round query text meets the third preset condition is obtained. The context information of the non-first-round query text and the recommended query text whose similarity meets the third preset condition are input into the large language model for query result prediction processing to obtain the query result of the non-first-round query text.
7. The interactive text question-and-answer processing method according to any one of claims 1 to 4, characterized in that, The step of obtaining the target recommended query text from the candidate recommended query text that satisfies the third preset condition in similarity to the query text includes: The candidate recommendation query text and the query text are vectorized respectively to obtain the first semantic vector corresponding to the candidate recommendation query text and the second semantic vector corresponding to the query text; The first semantic vector and the second semantic vector are input into a text semantic similarity model for similarity matching processing, so as to obtain a target semantic vector from the first semantic vector whose similarity to the second semantic vector meets the third preset condition; and determine the candidate recommended query text corresponding to the target semantic vector as the target recommended query text. The text semantic similarity model is obtained by training a preset model based on the anchor sample recommended text corresponding to the first sample query text, the positive sample recommended query text and the negative sample recommended query text in the sample recommended query text set. The content of the positive sample recommended query text matches the content of the anchor sample recommended text, while the content of the negative sample recommended query text does not match the content of the anchor sample recommended text.
8. The interactive text question-and-answer processing method according to claim 7, characterized in that, The training process of the text semantic similarity model includes: Obtain the sample recommended query text set and the first sample query text; The anchor sample recommendation text is generated based on the first sample query text; The positive sample recommendation query text and the negative sample recommendation query text are determined from the sample recommendation query text set; The anchor sample recommendation text, the positive sample recommendation query text, and the negative sample recommendation query text are input into the preset model for feature extraction to obtain the anchor sample text vector corresponding to the anchor sample recommendation text, the positive sample text vector corresponding to the positive sample recommendation query text, and the negative sample text vector corresponding to the negative sample recommendation query text. Calculate the negative sample difference between the anchored sample text vector and the negative sample text vector, and the positive sample difference between the anchored sample text vector and the positive sample text vector; Calculate the loss data based on the negative sample difference and the positive sample difference; The network parameters of the preset model are adjusted based on the loss data until the preset training termination condition is met to obtain the text semantic similarity model.
9. The interactive text question-and-answer processing method according to any one of claims 1 to 4, characterized in that, The step of performing structured parsing processing on the interactive text to obtain text fragments, and then extracting target text fragments from the text fragments that satisfy a first preset condition for similarity with the query text, includes: The interactive text is subjected to structured parsing to obtain the text fragments; the text fragments include at least one of chapter fragments, paragraph fragments, and sentence fragments; Establish index information corresponding to the text fragment; the index information is used to characterize the position information of the text fragment in the interactive text, and the index information includes at least one of the following: the chapter fragment index information corresponding to the chapter fragment, the paragraph fragment index information corresponding to the paragraph fragment, and the sentence fragment index information corresponding to the sentence fragment; From at least one of the chapter fragment index information, paragraph fragment index information, and sentence fragment index information, obtain target index information whose similarity to the query text meets the first preset condition; Obtain the target text fragment corresponding to the target index information from the text fragment.
10. The interactive text question-and-answer processing method according to claim 9, characterized in that, The text fragments include passage fragments, paragraph fragments, and sentence fragments. After the interactive text is structured and parsed to obtain the text fragments, the method further includes: The text fragments are vectorized to obtain text fragment vectors corresponding to the text fragments; the text fragment vectors include the text fragment vectors corresponding to the chapter fragments, the paragraph fragment vectors corresponding to the paragraph fragments, and the sentence fragment vectors corresponding to the sentence fragments. Accordingly, establishing the index information corresponding to the text fragment includes: Establish the index information corresponding to the text segment vector, paragraph segment vector and sentence segment vector respectively, and obtain the index information corresponding to the text segment; Accordingly, obtaining target index information from at least one of the text fragment index information, paragraph fragment index information, and sentence fragment index information, wherein the similarity to the query text satisfies the first preset condition, includes: From the document fragment vector, obtain a target document fragment vector whose similarity to the second semantic vector corresponding to the query text satisfies a first preset condition; from the paragraph fragment vector corresponding to the target document fragment vector, obtain a target paragraph fragment vector whose similarity to the second semantic vector satisfies a first preset condition; from the sentence fragment vector corresponding to the target paragraph fragment vector, obtain a target sentence fragment vector whose similarity to the second semantic vector satisfies a first preset condition; determine the target sentence fragment vector as the target vector; The target index information corresponding to the target vector is determined from the article fragment index information, paragraph fragment index information, and sentence fragment index information.
11. The interactive text question-and-answer processing method according to any one of claims 1 to 4, characterized in that, The method further includes: If the correlation between the query text and the interactive text meets the second preset condition, the context information and the query text are input into the large language model for query result prediction processing to obtain the query result of the query text.
12. The interactive text question-and-answer processing method according to any one of claims 1 to 4, characterized in that, The step of inputting the context information and the target recommended query text into a large language model for query result prediction processing to obtain the query result of the query text includes: Based on the context information and the target recommended query text, generate prompt information; The prompt information is input into the large language model for query result prediction processing to obtain the query result of the query text.
13. The interactive text question-and-answer processing method according to any one of claims 1 to 4, characterized in that, The acquisition of interactive text includes: In response to a text selection operation triggered by a terminal object on a text display page in a preset service, the text corresponding to the text selection operation is determined as the interactive text; the preset service is an online storage service or an instant messaging service in a social network. Accordingly, the step of performing structured parsing processing on the interactive text to obtain text fragments includes: In response to the text parsing operation triggered by the terminal object based on the file assistant tool, the interactive text is passed to the file assistant tool for structured parsing processing to obtain the text fragment; The text fragment is sent to the terminal so that the terminal displays the text fragment on the target page of the preset service; wherein the text file assistant tool is displayed on the terminal when the terminal object triggers the text selection operation.
14. The interactive text question-and-answer processing method according to claim 13, characterized in that, The target page displays a query text editing area. After sending the text fragment to the terminal so that the terminal displays the text fragment on the target page of the preset service, the method further includes: In response to an editing operation triggered by the terminal object based on the query text editing area, the text corresponding to the editing operation is determined as the query text; Accordingly, after obtaining the target recommended query text from the candidate recommended query text that satisfies the third preset condition of similarity with the query text, the method further includes: The target recommendation query text is sent to the terminal, so that the terminal displays the target recommendation query text in the query text editing area; Accordingly, after obtaining the query results of the query text, the method further includes: The query results are sent to the terminal so that the terminal displays the text fragment, the target recommended query text, and the query results on the target page. In response to an editing operation triggered by the terminal object based on the target recommended query text in the query text editing area, the text corresponding to the editing operation is determined as non-first-round query text, and a query result corresponding to the non-first-round query text is generated; the query result corresponding to the non-first-round query text is sent to the terminal, so that the terminal displays the text fragment, the recommended query text whose similarity to the non-first-round query text meets the third preset condition, and the query result corresponding to the non-first-round query text on the target page.
15. An interactive text question-and-answer processing device, characterized in that, The device includes: The text acquisition module is used to acquire interactive text and query text; The context information generation module is used to perform structured parsing processing on the interactive text to obtain text fragments, obtain target text fragments from the text fragments that have a similarity to the query text that meets a first preset condition, and generate context information of the query text based on the target text fragments; The question generation module is used to generate questions for the text fragment when it is determined that the correlation between the query text and the interactive text does not meet the second preset condition, so as to obtain the candidate recommended query text corresponding to the text fragment; The target recommendation query text generation module is used to obtain target recommendation query texts from the candidate recommendation query texts that have a similarity to the query text that meets a third preset condition; The query result generation module is used to input the context information and the target recommended query text into a large language model for query result prediction processing to obtain the query result of the query text; wherein, the large language model is obtained by fine-tuning an initial large language model based on preset context information of a preset domain, a first preset query text for the preset context information, and preset query results corresponding to the first preset query text.