Text processing method, system and equipment and medium

By using prompt information containing the attribute information of free question and answer tools in the language model, the general knowledge problem in human-computer dialogue is solved, and the problem of poor response effect in the existing technology is achieved, and more accurate response is achieved.

CN119739813APending Publication Date: 2025-04-01BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311262642.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2025-04-01

Smart Images

  • Figure CN119739813A_ABST
    Figure CN119739813A_ABST
Patent Text Reader

Abstract

The invention provides a text processing method, system and device and a medium. The method comprises the steps of obtaining a to-be-processed text; according to the to-be-processed text, first prompt information is determined, and the first prompt information comprises attribute information of a free question and answer tool; the first prompt information is sent to the language model, a processing result returned by the language model is received, and the processing result comprises a response text associated with the to-be-processed text. According to the method, the defect that the response effect of the general knowledge problem is poor under the condition that the prompt information is complex can be solved, and the response meeting the intention of the user is generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text processing method, system, electronic device, and computer-readable storage medium. Background Art

[0002] With the rapid development of artificial intelligence (AI) technology, human-computer dialogue based on AI technology is applied to a variety of scenarios. For example, in smart home scenarios, users can achieve human-computer dialogue through interactive devices such as smart home appliances. For another example, in daily life scenarios, users can achieve human-computer dialogue through mobile devices deployed with relevant software (such as chat robots). For another example, in office scenarios, users can achieve human-computer dialogue through dialogue services provided by business processing platforms.

[0003] In the various scenarios of human-computer dialogue mentioned above, how to generate accurate responses that meet user intentions has become an urgent problem that the industry needs to solve. Summary of the invention

[0004] The present application provides a text processing method. The method can improve the effect of answering general knowledge questions and generate answers that meet the user's intentions. The present application also provides a system, electronic device, computer-readable storage medium and computer program product corresponding to the above method.

[0005] In a first aspect, the present application provides a text processing method. The method comprises:

[0006] Get the text to be processed;

[0007] Determining first prompt information according to the text to be processed, wherein the first prompt information includes attribute information of the free question-and-answer tool;

[0008] The first prompt information is sent to a language model, and a processing result returned by the language model is received, wherein the processing result includes a response text associated with the text to be processed.

[0009] In some possible implementations, sending the first prompt information to a language model and receiving a processing result returned by the language model includes:

[0010] Sending the first prompt information to a language model, and receiving processing tool information returned by the language model;

[0011] Calling the target processing tool indicated by the processing tool information to process the text to be processed, and obtaining the output result of the target processing tool;

[0012] The output result of the target processing tool is sent to the language model, and the processing result returned by the language model is received.

[0013] In some possible implementations, the calling of the target processing tool indicated by the processing tool information to process the to-be-processed text to obtain an output result of the target processing tool includes:

[0014] In response to the target processing tool indicated by the processing tool information including the free question and answer tool, the free question and answer tool is called to process the text to be processed to obtain a response text output by the free question and answer tool.

[0015] In some possible implementations, calling the free question-and-answer tool to process the text to be processed includes:

[0016] The free question and answer tool is called to enable the free question and answer tool to determine second prompt information and output a response text according to the second prompt information, wherein the second prompt information includes information for indicating generation of a response text for the text to be processed.

[0017] In some possible implementations, determining the first prompt information according to the text to be processed includes:

[0018] Processing the text to be processed using a text response model to obtain an auxiliary response text of the text to be processed;

[0019] Based on the auxiliary response text, a first prompt message is generated.

[0020] In some possible implementations, the first prompt information is generated based on a first prompt template, and the processing of the to-be-processed text using a text response model to obtain an auxiliary response text of the to-be-processed text includes:

[0021] According to the content of the auxiliary response text generated in the first prompt template, the text response model is called to make the text response model process the text to be processed and obtain the auxiliary response text of the text to be processed.

[0022] In some possible implementations, the first prompt information includes an auxiliary response text of the text to be processed, the target processing tool does not include the free question-and-answer tool, and sending the output result of the target processing tool to the language model and receiving the processing result returned by the language model includes:

[0023] Sending the output result of the target processing tool to the language model so that the language model performs reasoning according to the output result of the target processing tool, and in response to the output result of the target processing tool not satisfying the processing result of the text to be processed, processing the text to be processed according to the auxiliary response text;

[0024] Receive the processing result returned by the language model.

[0025] In a second aspect, the present application provides a text processing system, the system comprising:

[0026] An acquisition module is used to obtain the text to be processed;

[0027] A determination module, configured to determine first prompt information according to the text to be processed, wherein the first prompt information includes attribute information of the free question-and-answer tool;

[0028] The communication module is used to send the first prompt information to the language model and receive the processing result returned by the language model, wherein the processing result includes a response text associated with the text to be processed.

[0029] In some possible implementations, the communication module is specifically used to:

[0030] Sending the first prompt information to a language model, and receiving processing tool information returned by the language model;

[0031] Calling the target processing tool indicated by the processing tool information to process the text to be processed, and obtaining the output result of the target processing tool;

[0032] The output result of the target processing tool is sent to the language model, and the processing result returned by the language model is received.

[0033] In some possible implementations, the communication module is specifically used to:

[0034] In response to the target processing tool indicated by the processing tool information including the free question and answer tool, the free question and answer tool is called to process the text to be processed to obtain a response text output by the free question and answer tool.

[0035] In some possible implementations, the communication module is specifically used to:

[0036] The free question and answer tool is called to enable the free question and answer tool to determine second prompt information and output a response text according to the second prompt information, wherein the second prompt information includes information for indicating generation of a response text for the text to be processed.

[0037] In some possible implementations, the determining module is specifically configured to:

[0038] Processing the text to be processed using a text response model to obtain an auxiliary response text of the text to be processed;

[0039] Based on the auxiliary response text, a first prompt message is generated.

[0040] In some possible implementations, the first prompt information is generated based on a first prompt template, and the determining module is specifically configured to:

[0041] According to the content of the auxiliary response text generated in the first prompt template, the text response model is called to make the text response model process the text to be processed and obtain the auxiliary response text of the text to be processed.

[0042] In some possible implementations, the first prompt information includes an auxiliary response text of the text to be processed, the target processing tool does not include the free question-and-answer tool, and the communication module is specifically configured to:

[0043] Sending the output result of the target processing tool to the language model so that the language model performs reasoning according to the output result of the target processing tool, and in response to the output result of the target processing tool not satisfying the processing result of the text to be processed, processing the text to be processed according to the auxiliary response text;

[0044] Receive the processing result returned by the language model.

[0045] In a third aspect, the present application provides an electronic device, the electronic device comprising a processor and a memory. The processor and the memory communicate with each other. The processor is used to execute instructions stored in the memory, so that the electronic device performs the text processing method in the first aspect or any implementation of the first aspect.

[0046] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, wherein the instructions instruct an electronic device to execute the text processing method described in the first aspect or any one of the implementations of the first aspect.

[0047] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the text processing method described in the first aspect or any one of the implementations of the first aspect.

[0048] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations.

[0049] It can be seen from the above technical solutions that this application has the following advantages:

[0050] The present application provides a text processing method. The method first obtains a text to be processed, then determines first prompt information based on the text to be processed, the first prompt information including attribute information of a free question-and-answer tool, sends the first prompt information to a language model, and receives a processing result returned by the language model, wherein the processing result includes a response text associated with the text to be processed.

[0051] In the text processing based on prompt learning, this method adds the attribute information of the free question-answering tool to the prompt information, so that the language model can learn the relevant functions of the free question-answering tool by analyzing the prompt information. In this way, the server can receive the answer text returned by the language model, which is generated by the free question-answering tool after processing the text to be processed (for example, the question text related to general knowledge). In this way, the defect of poor answer effect for general knowledge questions in the case of complex prompt information can be solved, and answers that meet the user's intention can be generated. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.

[0053] Figure 1 A schematic diagram of the architecture of a text processing system provided in an embodiment of the present application;

[0054] Figure 2 A flowchart of a text processing method provided in an embodiment of the present application;

[0055] Figure 3 A structural diagram of a text processing system provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] The terms "first" and "second" in the embodiments of the present application are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.

[0058] First, some technical terms involved in the embodiments of the present application are introduced.

[0059] Natural language processing (NLP) is a machine learning technology that enables computing devices to interpret, process and understand human language. Computing devices can complete a variety of tasks based on natural language processing, including but not limited to part-of-speech tagging, word sense disambiguation, speech recognition, machine translation, sentiment analysis, etc.

[0060] With the continuous development of natural language processing technology, four different natural language processing paradigms have emerged in the industry, namely, the machine learning model paradigm, the neural network model paradigm, the "pre-training + fine-tuning" paradigm, and the "pre-training + prompt + prediction" paradigm.

[0061] Below, we will introduce four natural language processing paradigms respectively. The machine learning model paradigm uses machine learning models based on fully supervised learning to process natural language, such as sentiment analysis and text classification through machine learning models such as decision trees and support vector machines.

[0062] The neural network model paradigm performs natural language processing through a neural network model based on fully supervised learning. Compared with the machine learning model paradigm, the neural network model paradigm does not require manual feature selection, but can extract features through the neural network model.

[0063] The "pre-training + fine-tuning" paradigm performs natural language processing through a pre-trained language model based on large-scale raw corpus, and pre-trains the pre-trained language model through a variety of pre-training tasks, so that the pre-trained language model has a certain understanding and generation ability for the text. When the pre-trained language model is applied to downstream tasks, the objective function is set according to the downstream tasks to achieve fine-tuning of the parameters in the pre-trained language model.

[0064] The "pre-training + prompt + prediction" paradigm performs natural language processing through a pre-trained language model based on prompt learning. Unlike the "pre-training + fine-tuning" paradigm, the "pre-training + prompt + prediction" paradigm does not need to apply the pre-trained language model to downstream tasks for parameter fine-tuning, that is, it does not change the parameters of the pre-trained language model, but instead transforms the downstream tasks by designing prompt information (prompt), so that the pre-trained language model can better understand the downstream tasks.

[0065] For example, when the downstream task is to perform sentiment analysis on a text, the input text of the pre-trained language model is "the plot is smooth, the actors' acting is good, and the special effects are also good", and the pre-trained language model needs to output the sentiment of the text (i.e., positive or negative). At this time, the prompt information can be "the user's evaluation of this movie is [xxx]". By inputting the text and the prompt information into the pre-trained language model, the downstream task of sentiment analysis can be transformed into a form that is closer to the pre-trained language model, and a more accurate output result can be obtained.

[0066] Human-computer dialogue refers to the process of allowing computing devices to understand and use natural language to simulate dialogue or chat with humans. Human-computer dialogue is usually implemented based on natural language processing technology. Users input text into computing devices (such as smart home appliances, mobile devices, business platforms, etc.), and the computing devices analyze and process the text through pre-trained language models, generate responses to the text, and return the responses to the users, thereby realizing human-computer dialogue.

[0067] However, when the prompt information is designed to be more complex, it is difficult for the pre-trained language model to take into account different types of tasks and cannot output response text that meets the user's intention for different types of tasks (especially general knowledge tasks).

[0068] In view of this, the present application provides a text processing method. The method first obtains a text to be processed, then determines first prompt information according to the text to be processed, the first prompt information including attribute information of a free question-and-answer tool, sends the first prompt information to a language model, and receives a processing result returned by the language model, wherein the processing result includes a response text associated with the text to be processed.

[0069] In the text processing based on prompt learning, this method adds the attribute information of the free question-answering tool to the prompt information, so that the language model can learn the relevant functions of the free question-answering tool by analyzing the prompt information. In this way, the server can receive the answer text returned by the language model, which is generated by the free question-answering tool after processing the text to be processed (for example, the question text related to general knowledge). In this way, the defect of poor answer effect for general knowledge questions in the case of complex prompt information can be solved, and answers that meet the user's intention can be generated.

[0070] In order to make the technical solution of the present application clearer and easier to understand, the architecture of the text processing system of the present application is introduced below with reference to the accompanying drawings.

[0071] See also Figure 1 The schematic diagram of the architecture of the text processing system shown in the figure includes a server 10 and a language model 20. The server 10 is used to obtain the text to be processed and determine the first prompt information based on the text to be processed, and the first prompt information includes the attribute information of the free question-and-answer tool. In some embodiments, the server 10 can be an independent software system that can provide human-computer dialogue functions, such as an independent chat robot. In other embodiments, the server 10 can also be deployed in other systems to provide human-computer dialogue functions as a functional module of other systems, for example, it is deployed in a business platform so that the business platform can provide human-computer dialogue services to users.

[0072] Furthermore, the server 10 sends the first prompt information to the language model 20. The language model 20 has the capability of natural language processing, and the language model 20 analyzes the first prompt information and returns a processing result to the server 10, wherein the processing result includes a response text associated with the text to be processed.

[0073] In some possible implementations, the server 10 is deployed in the business platform. At this time, the language model 20 can first return the processing tool information to the server 10. The server 10 calls the target processing tool (such as a free question-and-answer tool, a calendar tool, a conference tool, etc.) indicated by the processing tool information to process the task indicated by the text to be processed, obtains the output result of the target processing tool, and sends the output result of the target processing tool to the language model 20. The language model 20 generates a processing result based on the output result of the target processing tool and returns the processing result to the server 10. In this way, the text to be processed is analyzed and understood by the language model 20, and then the existing processing tools in the business platform are used to achieve the response.

[0074] In the above embodiment, when the text to be processed includes general knowledge questions, the target processing tool indicated by the processing tool information returned by the language model 20 to the server 10 may include a free question-and-answer tool, and the server 10 may generate a response text for the text to be processed by calling the free question-and-answer tool. Since the free question-and-answer tool can answer general knowledge questions (for example, the free question-and-answer tool can generate a response text for general knowledge questions by calling a general knowledge answer model), the above method of calling the free question-and-answer tool can effectively improve the ability of the server 10 to process general knowledge questions and improve the accuracy of the server 10's response.

[0075] To facilitate understanding of the technical solution provided by the embodiments of the present application, it will be described below with reference to the accompanying drawings.

[0076] See also Figure 2 The present invention provides a flowchart of a text processing method, which specifically includes:

[0077] S201: Obtain the text to be processed.

[0078] The text to be processed may be, for example, text input by a user when interacting with the chatbot.

[0079] In some embodiments, the text to be processed may only include natural language with a certain intention, which is the task indicated by the text to be processed. For example, the text to be processed may be "Will it rain today?", "Set an alarm for me at 7 o'clock tomorrow morning" or "What is the recipe for scrambled eggs with tomatoes?".

[0080] In other embodiments, the text to be processed may include descriptive information and natural language with a certain intention, wherein the descriptive information may be information related to the task indicated by the text to be processed, which helps understand the task indicated by the text to be processed and generate a response. For example, the text to be processed may be "During the Tang Dynasty (618-907), the capital was successively located in Chang'an and Luoyang, and there were 21 emperors in total, including Li Yuan, Li Shimin, Li Zhi, Li Longji, etc., the three-province and six-department system was implemented, and woodblock printing, gunpowder, curved plow, etc. were invented. Please write a history of the development of the Tang Dynasty." In this case, "During the Tang Dynasty (618-907), the capital was successively located in Chang'an and Luoyang, and there were 21 emperors in total, including Li Yuan, Li Shimin, Li Zhi, Li Longji, etc., the three-province and six-department system was implemented, and woodblock printing, gunpowder, curved plow, etc. were invented" is the descriptive information, and "Please write a history of the development of the Tang Dynasty" is the natural language with a certain intention. The descriptive information and the natural language with a certain intention together constitute the text to be processed.

[0081] In different application scenarios, users can provide text to be processed in different ways. In some embodiments, users can input text by text input, for example, users can input text in a dialog window in a dialog page, and the text input by the user can be used as the text to be processed. In other embodiments, when the device used by the user supports voice input, the user can also input voice by voice input, and the recognized text can be used as the text to be processed by performing voice recognition and voice conversion on the voice input by the user.

[0082] S202: Determine first prompt information according to the text to be processed.

[0083] In the embodiment of the present application, the text processing is realized by using the prompt learning method, so as to determine the response text of the text to be processed. Therefore, after obtaining the text to be processed, the first prompt information can be determined, so as to facilitate the subsequent use of the first prompt information to guide the language model to analyze and semantically understand the text to be recognized.

[0084] In a specific implementation, the first prompt information can be generated by a first prompt template. Among them, the first prompt template can be a chain of thought (COT). COT is a discrete prompt learning. COT can refer to the thinking process of humans in solving problems, that is, a series of natural language reasoning starting from receiving the question until the final output of the answer to the question. Compared with the prompt template that only includes prompt words, COT can guide the language model to simulate the human reasoning process, thereby improving the accuracy of the language model when performing complex reasoning.

[0085] In the embodiment of the present application, the first prompt template may include attribute information of multiple processing tools. Among them, the multiple processing tools include a free question-and-answer tool, and the attribute information may be natural language information describing the processing tool from multiple aspects, for example, the attribute information of the processing tool may include function description information of the processing tool, input parameter information of the processing tool, output parameter information of the processing tool, etc.

[0086] Taking the processing tool as a search tool as an example, the functional description information of the search tool can be "the search tool is used for searching, such as contact search, message search, document search, and meeting search", the input parameter information of the search tool can be "the input parameter of the search tool is the search information entered by the user, such as user name, message content, document name, and meeting name", and the output parameter information of the search tool can be "the output parameter of the search tool is the storage address of the search results in the database."

[0087] S203: Send the first prompt information to the language model, and receive the processing result returned by the language model.

[0088] In a specific implementation, the first prompt information is sent to the language model, the processing tool information returned by the language model is received, the target processing tool indicated by the processing tool information is called to process the text to be processed, the output result of the target processing tool is obtained, the output result of the target processing tool is sent to the language model, and the processing result returned by the language model is received. The processing tool information refers to information used to describe the target processing tool, such as the name of the target processing tool, and the processing result includes the response text associated with the text to be processed.

[0089] The language model may be a model with natural language processing capabilities, such as a deep learning model trained with text data. Since the first prompt template includes attribute information of multiple processing tools, the first prompt information generated by the first prompt template may instruct the language model to select a tool, such as instructing the language model to analyze the text to be processed, and select a target processing tool that can process the current tool to be processed from the multiple processing tools according to the attribute information of the multiple processing tools.

[0090] After the language model returns the processing tool information, the text to be processed can be processed by calling the target processing tool. Considering that there may be a situation where multiple target processing tools need to be called to process the text to be processed, the output result of the target processing tool can be sent to the language model. The language model continues to return other target processing tools based on the output result of the processing tool, and then continues to process the text to be processed by calling other target processing tools until the text to be processed can be solved and the language model returns the processing result.

[0091] When calling the target processing tool, you can first obtain the identification information of the target processing tool, which can specifically include the class name and / or function name. According to the identification information of the target processing tool, parse the class and / or function corresponding to the target processing tool, so as to enable the target processing tool to process the text to be processed.

[0092] In an embodiment of the present application, the processing tool is encapsulated as a class name or function name that can be called, so that the target processing tool can be called according to the identification information of the target processing tool. For example, the instance method can be called using "function name.method name", or the class can be called using "class name.method name", or the instance method can be called through reflection call to realize the calling of the target processing tool.

[0093] Since the first prompt information includes the attribute information of the free question-answering tool, the language model can return the processing tool information indicating the free question-answering tool. In other words, the attribute information of the free question-answering tool included in the first prompt information can prompt the language model the relevant functions of the free question-answering tool, for example, the free question-answering tool has the ability to answer general knowledge questions. In this way, when the language model performs semantic analysis on the text to be processed and believes that the text to be processed is related to general knowledge questions, it can return the processing tool information indicating the free question-answering tool.

[0094] At this time, the target processing tool indicated by the processing tool information includes a free question-and-answer tool, and the free question-and-answer tool is called to process the text to be processed to obtain the answer text output by the free question-and-answer tool. In an embodiment of the present application, a free question-and-answer tool for answering general knowledge questions is provided, and the attribute information of the free question-and-answer tool is added to the first prompt information, so that the language model is combined with the attribute information of the text to be processed and the free question-and-answer tool for analysis. When it is determined that the text to be processed can be processed by the free question-and-answer tool, the answer text is generated by calling the free question-and-answer tool to achieve the answer to the general knowledge question.

[0095] The following is an introduction to the free question-and-answer tool, which refers to a tool that can provide answers to general knowledge questions. In other words, the free question-and-answer tool has the ability to conduct free question-and-answer on the text to be processed.

[0096] The free question-and-answer tool can generate a response text based on the prompt learning. In specific implementation, the free question-and-answer tool can determine a second prompt information, and the second prompt information includes information for indicating the generation of a response text for the text to be processed. In this way, the free question-and-answer tool can generate a response text for the text to be processed based on the second prompt information.

[0097] Taking the example that the second prompt information is generated by the prompt word, the second prompt information may include multiple roles, such as the user role and the assistant role. The user role is used to indicate the text to be processed, and the assistant role is used to indicate that the free question-and-answer tool generates the answer text. For example, the prompt word corresponding to the user role may be "user:", and the prompt word corresponding to the assistant role may be "assistant:".

[0098] By analyzing the text to be processed, the free question-and-answer tool can place the text to be processed after "user:", and then combine it with the prompt word "assistant:" to determine the second prompt information, so that the free question-and-answer tool analyzes and processes the text to be processed and generates a response text.

[0099] In some embodiments, the language model may have a processing tool selection error, that is, the target processing tool indicated by the returned processing tool information is wrong. For example, the text to be processed is related to general knowledge questions, and the language model should return a free question and answer tool so that the free question and answer tool can be used to process the text to be processed. However, because the logic of the text to be processed is not clear enough, the number of processing tools is large, or the attribute information obtained by the multiple processing tools in the first prompt information is not accurate enough, the target processing tool indicated by the processing tool information returned by the language model does not include the free question and answer tool. At this time, due to the incorrect selection of the processing tool, if the target processing tool indicated by the processing tool information returned by the language model is called to process the text to be processed, it is difficult to obtain a response text that meets the user's intention.

[0100] Considering the above situation, the first prompt information may also include auxiliary response text of the text to be processed. In specific implementation, the text to be processed may be processed using a text response model to obtain the auxiliary response text of the text to be processed, and the first prompt information may be generated based on the auxiliary response text.

[0101] In some possible implementations, the first prompt information is generated by a first prompt template, and the auxiliary response text is generated according to the content indicated in the first prompt template. The text response model is called to enable the text response model to process the text to be processed to obtain the auxiliary response text of the text to be processed.

[0102] For example, the first prompt template may include "For the text to be processed, the response text output by the external text response model is: ". Since the first prompt template includes content instructing to obtain the response text output by the text response model, the text response model can be called to obtain the response text output by the text response model, and the response text output by the text response model can be filled into the first prompt template to generate the first prompt information.

[0103] Among them, the text response model can be an external model with a text response function. By adding auxiliary response text to the first prompt information, the auxiliary response text can be used to help the language model better understand the text to be processed and clarify the direction of the response text. In this way, in the case where the language model selects the wrong processing tool, the language model can also use the auxiliary response text in the first prompt information to determine the response text that meets the user's intention, so as to avoid the generated response text deviating too much from the user's intention.

[0104] In specific implementation, when the target processing tool indicated by the processing tool information returned by the language model does not include a free question-and-answer tool, the target processing tool is called to obtain the output result of the target processing tool, and the output result of the target processing tool is sent to the language model, so that the language model performs reasoning based on the output result of the target processing tool. In response to the output result of the target processing tool not satisfying the processing result of the text to be processed, the text to be processed is processed based on the auxiliary answer text, thereby generating a processing result.

[0105] It can be understood that since the first prompt information can also include information for indicating the reasoning process of the language model, such as "what is the processing tool that needs to be called currently", "can calling this processing tool solve the text to be processed", "is calling this processing tool correct", etc., therefore, by analyzing the reasoning log of the language model, it is possible to understand the reasoning process of the language model for the text to be processed under the instruction of the first prompt information.

[0106] In other words, after calling the target processing tool to process the text to be processed, the language model can analyze the output result of the target processing tool based on the reasoning process indicated by the first prompt information, and determine whether the output result of the target processing tool can be used as the response text of the text to be processed, that is, whether the processing of the text to be processed has been completed. If the output result of the target processing tool does not meet the processing result of the text to be processed, that is, there is an error in the selection of the target processing tool, since the first prompt information includes auxiliary response text, the language model can refer to the auxiliary response text generated by the external text response model to determine the response text of the text to be processed, so as to use the auxiliary response text to generate answers to general knowledge questions when the processing tool is called incorrectly.

[0107] Based on the above description, an embodiment of the present application provides a text processing method. The method first obtains the text to be processed, then determines the first prompt information according to the text to be processed, the first prompt information includes the attribute information of the free question-and-answer tool, sends the first prompt information to the language model, and receives the processing result returned by the language model, wherein the processing result includes the answer text associated with the text to be processed.

[0108] In the text processing based on prompt learning, this method adds the attribute information of the free question-answering tool to the prompt information, so that the language model can learn the relevant functions of the free question-answering tool by analyzing the prompt information. In this way, the server can receive the answer text returned by the language model, which is generated by the free question-answering tool after processing the text to be processed (for example, the question text related to general knowledge). In this way, the defect of poor answer effect for general knowledge questions in the case of complex prompt information can be solved, and answers that meet the user's intention can be generated.

[0109] Combination of the above Figure 2 The text processing method provided in the embodiment of the present application is introduced in detail. The system and device provided in the embodiment of the present application will be introduced in conjunction with the accompanying drawings.

[0110] See also Figure 3 The structural diagram of the text processing system shown in FIG. 30 includes:

[0111] An acquisition module 301 is used to acquire the text to be processed;

[0112] A determination module 302 is used to determine first prompt information according to the text to be processed, wherein the first prompt information includes attribute information of the free question-and-answer tool;

[0113] The communication module 303 is used to send the first prompt information to the language model, and receive the processing result returned by the language model, where the processing result includes the response text associated with the text to be processed.

[0114] In some possible implementations, the communication module 303 is specifically used to:

[0115] Sending the first prompt information to a language model, and receiving processing tool information returned by the language model;

[0116] Calling the target processing tool indicated by the processing tool information to process the text to be processed, and obtaining the output result of the target processing tool;

[0117] The output result of the target processing tool is sent to the language model, and the processing result returned by the language model is received.

[0118] In some possible implementations, the communication module 303 is specifically used to:

[0119] In response to the target processing tool indicated by the processing tool information including the free question and answer tool, the free question and answer tool is called to process the text to be processed to obtain a response text output by the free question and answer tool.

[0120] In some possible implementations, the communication module 303 is specifically used to:

[0121] The free question and answer tool is called to enable the free question and answer tool to determine second prompt information and output a response text according to the second prompt information, wherein the second prompt information includes information for indicating generation of a response text for the text to be processed.

[0122] In some possible implementations, the determining module 302 is specifically configured to:

[0123] Processing the text to be processed using a text response model to obtain an auxiliary response text of the text to be processed;

[0124] Based on the auxiliary response text, a first prompt message is generated.

[0125] In some possible implementations, the first prompt information is generated based on a first prompt template, and the determining module 302 is specifically configured to:

[0126] According to the content of the auxiliary response text generated in the first prompt template, the text response model is called to make the text response model process the text to be processed and obtain the auxiliary response text of the text to be processed.

[0127] In some possible implementations, the first prompt information includes an auxiliary response text of the text to be processed, the target processing tool does not include the free question-and-answer tool, and the communication module 303 is specifically configured to:

[0128] Sending the output result of the target processing tool to the language model so that the language model performs reasoning according to the output result of the target processing tool, and in response to the output result of the target processing tool not satisfying the processing result of the text to be processed, processing the text to be processed according to the auxiliary response text;

[0129] Receive the processing result returned by the language model.

[0130] The text processing system 30 according to the embodiment of the present application may correspond to executing the method described in the embodiment of the present application, and the above and other operations and / or functions of each module / unit of the text processing system 30 are respectively to implement Figure 2 For the sake of brevity, the corresponding processes of each method in the illustrated embodiment are not described in detail here.

[0131] The present application also provides an electronic device. The electronic device is specifically used to implement Figure 3 Functionality of the text processing system 30 in the illustrated embodiment.

[0132] Figure 4A schematic diagram of the structure of an electronic device 400 is provided. Figure 4 As shown, the electronic device 400 includes a bus 401, a processor 402, a communication interface 403 and a memory 404. The processor 402, the memory 404 and the communication interface 403 communicate with each other via the bus 401.

[0133] The bus 401 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0134] The processor 402 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0135] The communication interface 403 is used for communicating with the outside. For example, the communication interface 403 can be used for communicating with a terminal.

[0136] The memory 404 may include a volatile memory, such as a random access memory (RAM). The memory 404 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0137] The memory 404 stores executable codes, and the processor 402 executes the executable codes to perform the aforementioned text processing method.

[0138] Specifically, in implementing Figure 3 In the case of the embodiment shown, and Figure 3 When each module or unit of the text processing system 30 described in the embodiment is implemented by software, the execution Figure 3The software or program code required for the functions of each module / unit in the text processing method may be partially or completely stored in the memory 404. The processor 402 executes the program code corresponding to each unit stored in the memory 404 to perform the above-mentioned text processing method.

[0139] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the above-mentioned text processing method applied to the text processing system 30.

[0140] The embodiment of the present application further provides a computer program product, which includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in the embodiment of the present application is generated in whole or in part.

[0141] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer or data center to another website, computer or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0142] When the computer program product is executed by a computer, the computer executes any of the aforementioned text processing methods. The computer program product may be a software installation package, and when any of the aforementioned information recognition methods is required, the computer program product may be downloaded and executed on a computer.

[0143] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to each embodiment of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0144] The units involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the unit / module does not, in some cases, constitute a limitation on the unit itself.

[0145] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0146] In the context of the present application embodiment, machine-readable medium can be a tangible medium that can contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable medium can include but is not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0147] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0148] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0149] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0150] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0151] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A text processing method, characterized in that: The method comprises: Get the text to be processed; Determining first prompt information according to the text to be processed, wherein the first prompt information includes attribute information of the free question-and-answer tool; The first prompt information is sent to a language model, and a processing result returned by the language model is received, wherein the processing result includes a response text associated with the text to be processed.

2. The method according to claim 1, characterized in that The sending the first prompt information to the language model and receiving the processing result returned by the language model includes: Sending the first prompt information to a language model, and receiving processing tool information returned by the language model; Calling the target processing tool indicated by the processing tool information to process the text to be processed, and obtaining the output result of the target processing tool; The output result of the target processing tool is sent to the language model, and the processing result returned by the language model is received.

3. The method according to claim 2, characterized in that The calling of the target processing tool indicated by the processing tool information to process the to-be-processed text to obtain the output result of the target processing tool includes: In response to the target processing tool indicated by the processing tool information including the free question and answer tool, the free question and answer tool is called to process the text to be processed to obtain a response text output by the free question and answer tool.

4. The method according to claim 3, characterized in that The calling of the free question-and-answer tool to process the text to be processed includes: The free question and answer tool is called to enable the free question and answer tool to determine second prompt information and output a response text according to the second prompt information, wherein the second prompt information includes information for indicating generation of a response text for the text to be processed.

5. The method according to claim 1, characterized in that The step of determining the first prompt information according to the text to be processed includes: Processing the text to be processed using a text response model to obtain an auxiliary response text of the text to be processed; Based on the auxiliary response text, a first prompt message is generated.

6. The method according to claim 5, characterized in that The first prompt information is generated based on the first prompt template, and the processing of the to-be-processed text by using the text response model to obtain the auxiliary response text of the to-be-processed text includes: According to the content of the auxiliary response text generated in the first prompt template, the text response model is called to make the text response model process the text to be processed and obtain the auxiliary response text of the text to be processed.

7. The method according to claim 2, characterized in that The first prompt information includes an auxiliary answer text of the text to be processed, the target processing tool does not include the free question and answer tool, and the sending the output result of the target processing tool to the language model and receiving the processing result returned by the language model include: Sending the output result of the target processing tool to the language model so that the language model performs reasoning according to the output result of the target processing tool, and in response to the output result of the target processing tool not satisfying the processing result of the text to be processed, processing the text to be processed according to the auxiliary response text; Receive the processing result returned by the language model.

8. A text processing system, characterized in that: The system comprises: An acquisition module is used to obtain the text to be processed; A determination module, configured to determine first prompt information according to the text to be processed, wherein the first prompt information includes attribute information of the free question-and-answer tool; The communication module is used to send the first prompt information to the language model and receive the processing result returned by the language model, wherein the processing result includes a response text associated with the text to be processed.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the electronic device performs the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The method comprises instructions, wherein the instructions instruct an electronic device to execute the method as claimed in any one of claims 1 to 7.