Text processing method and device, electronic equipment and storage medium

Information extraction and optimization of text through language processing model, combined with context and additional information, solve the problem of failure to make full use of text information in the prior art, and achieve more efficient text optimization effects.

CN120373307APending Publication Date: 2025-07-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410103220.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-24
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

Existing text optimization schemes fail to make full use of the various information contained in text, resulting in lower optimization results.

Method used

Through the trained language processing model, the text to be processed is extracted based on the preset information and extracted information to be processed, the context information is obtained, and the text optimization is optimized in combination with the context information and the preset optimization prompt text until the optimization end condition is met.

Benefits of technology

It improves the accuracy of text optimization, can be corrected in combination with context information and additional information in the initial text, customizes the optimization level, and enhances the flexibility and accuracy of text optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373307A_ABST
    Figure CN120373307A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a text processing method and device, electronic equipment and a storage medium, and relates to the technical field of artificial intelligence. Obtaining an initial text to be optimized; performing at least one optimization processing on the initial text to obtain an optimized text corresponding to each optimization processing until an optimization ending condition is met, and taking the optimized text obtained by the last optimization processing as a target text; wherein the optimization processing comprises the steps of performing information extraction on a to-be-processed text based on a preset information extraction prompt text through a trained language processing model to obtain context information of the to-be-processed text; the to-be-processed text corresponding to the first optimization processing is an initial text; performing text optimization on the to-be-processed text based on the context information and a preset optimization prompt text through a language processing model to obtain an optimized text corresponding to current optimization processing; and taking the optimized text as a to-be-processed text corresponding to the next optimization processing. And the text optimization accuracy is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence. Specifically, this application relates to a text processing method, apparatus, electronic device, and storage medium. Background Art

[0002] With the continuous development of artificial intelligence technology, artificial intelligence technology has been studied and applied in multiple fields. Natural Language Processing (NLP) is an important direction in artificial intelligence technology and is often applied to text processing, such as text optimization and machine reading comprehension.

[0003] In traditional text optimization solutions, the text is usually split into sentences, and each sentence is optimized separately. During the process of optimizing the sentence, each word in the sentence is scored to correct and update the sentence. The current text optimization solution does not fully utilize various information contained in the text, resulting in a low optimization effect. Summary of the Invention

[0004] The purpose of the embodiments of this application is to provide a text processing method, apparatus, and electronic device. The technical solutions provided by the embodiments of this application are as follows:

[0005] On the one hand, the embodiments of this application provide a text processing method, which includes:

[0006] Obtain an initial text to be optimized;

[0007] Perform at least one optimization process on the initial text to obtain an optimized text corresponding to each optimization process until the optimization end condition is met, and use the optimized text obtained from the last optimization process as the target text;

[0008] Among them, the optimization process includes:

[0009] Through a trained language processing model, based on a preset information extraction prompt text, extract information from the text to be processed to obtain the context information of the text to be processed; the text to be processed corresponding to the first optimization process is the initial text;

[0010] Through the language processing model, based on the context information and a preset optimization prompt text, optimize the text to be processed to obtain the optimized text corresponding to the current optimization process; use the optimized text as the text to be processed corresponding to the next optimization process.

[0011] In some possible implementation manners, through the language processing model, based on the context information and a preset optimization prompt text, optimize the text to be processed to obtain the optimized text obtained from the current optimization process, including:

[0012] Obtain additional information input by the object; the additional information includes at least one of language style information, expression way information, scenario information, popular vocabulary, and tone information;

[0013] Through a language processing model, based on the additional information, context information, and a preset optimization prompt text, perform text optimization on the text to be processed to obtain the optimized text obtained from the current optimization process.

[0014] In some possible implementation manners, through a trained language processing model, based on a preset information extraction prompt text, perform information extraction on the text to be processed to obtain the context information of the text to be processed, including:

[0015] Add the text to be processed to an information extraction template to obtain a first input information; the information extraction template includes an information extraction prompt text;

[0016] Input the first input information into the language processing model to obtain the context information of the text to be processed.

[0017] In some possible implementation manners, through a language processing model, based on the additional information, context information, and a preset optimization prompt text, perform text optimization on the text to be processed to obtain the optimized text corresponding to the current optimization process, including:

[0018] Add the text to be processed, context information, and additional information to a text optimization template to obtain a second input information; the text optimization template includes an optimization prompt text;

[0019] Input the second input information into the language processing model to obtain the optimized text corresponding to the current optimization process.

[0020] In some possible implementation manners, obtain the initial text to be optimized, including:

[0021] Obtain the text to be processed voice, perform text conversion on the text to be processed voice to obtain the initial text;

[0022] Determine the scenario information of the text to be processed voice;

[0023] The information extraction prompt text and the optimization prompt text are generated based on the following method:

[0024] Update the initial extraction prompt text based on the scenario information to obtain the information extraction prompt text;

[0025] Update the initial optimization prompt text based on the scenario information to obtain the optimization prompt text.

[0026] In some possible implementation manners, the language processing model is trained based on the following method:

[0027] Obtain multiple sample texts; each sample text has corresponding standard context information and optimized standard text respectively;

[0028] Perform at least one training operation on the initial language processing model through multiple sample texts until the training end condition is met, and obtain a speech processing model;

[0029] Among them, the training operation includes:

[0030] For each sample text, through the initial language processing model, extract information from the sample text based on a preset information extraction prompt text to obtain the sample context of the sample text;

[0031] Through the initial language processing model, optimize the sample text based on the sample context and a preset optimization prompt text to obtain a sample optimized text;

[0032] Determine the first loss of the sample text based on the sample context and the standard context of the sample text, determine the second loss of the sample text based on the sample optimized text and the standard text, adjust the parameters of the initial language processing model based on the first loss and the second loss corresponding to each sample text respectively, and use the initial language processing model with adjusted parameters as the initial language processing model corresponding to the next training operation.

[0033] In some possible implementation manners, performing at least one optimization process on the initial text includes:

[0034] Determine the text information amount of the initial text;

[0035] If the text information amount is greater than or equal to a preset threshold, perform at least one optimization process on the initial text.

[0036] In some possible implementation manners, the optimization end condition includes any one of the following:

[0037] The number of optimization processes meets a preset number;

[0038] It is detected that the optimization rate of the current optimization process meets a preset ratio; where the optimization rate is determined based on the text to be optimized corresponding to the current optimization process and the obtained optimized text.

[0039] On the other hand, an embodiment of the present application provides a text processing device, including:

[0040] An acquisition module, configured to acquire an initial text to be optimized;

[0041] An optimization module, configured to perform at least one optimization process on the initial text to obtain an optimized text corresponding to each optimization process until the optimization end condition is met, and use the optimized text obtained from the last optimization process as the target text;

[0042] Among them, when the optimization module performs optimization processing, it is specifically used for:

[0043] Through the trained language processing model, based on the preset information extraction prompt text, extract information from the text to be processed to obtain the context information of the text to be processed; the text to be processed corresponding to the first optimization processing is the initial text;

[0044] Through the language processing model, based on the context information and the preset optimization prompt text, optimize the text to be processed to obtain the optimized text corresponding to the current optimization processing; use the optimized text as the text to be processed corresponding to the next optimization processing.

[0045] In some possible implementation manners, when the optimization module optimizes the text to be processed through the language processing model, based on the context information and the preset optimization prompt text, to obtain the optimized text obtained by the current optimization processing, it is specifically used for:

[0046] Obtain additional information input by the object; the additional information includes at least one of language style information, expression information, scenario information, popular vocabulary, and tone information;

[0047] Through the language processing model, based on the additional information, context information, and preset optimization prompt text, optimize the text to be processed to obtain the optimized text obtained by the current optimization processing.

[0048] In some possible implementation manners, when the optimization module extracts information from the text to be processed through the trained language processing model, based on the preset information extraction prompt text, to obtain the context information of the text to be processed, it is specifically used for:

[0049] Add the text to be processed to the information extraction template to obtain the first input information; the information extraction template includes the information extraction prompt text;

[0050] Input the first input information into the language processing model to obtain the context information of the text to be processed.

[0051] In some possible implementation manners, when the optimization module optimizes the text to be processed through the language processing model, based on the additional information, context information, and preset optimization prompt text, to obtain the optimized text corresponding to the current optimization processing, it is specifically used for:

[0052] Add the text to be processed, context information, and additional information to the text optimization template to obtain the second input information; the text optimization template includes the optimization prompt text;

[0053] Input the second input information into the language processing model to obtain the optimized text corresponding to the current optimization process.

[0054] In some possible implementation manners, when the obtaining module obtains the initial text to be optimized, it is specifically configured to:

[0055] Obtain the speech to be processed, perform text conversion on the speech to be processed to obtain the initial text;

[0056] Determine the scenario information of the speech to be processed;

[0057] The information extraction prompt text and the optimization prompt text are generated based on the following method:

[0058] Update the initial extraction prompt text based on the scenario information to obtain the information extraction prompt text;

[0059] Update the initial optimization prompt text based on the scenario information to obtain the optimization prompt text.

[0060] In some possible implementation manners, it further includes a training module, which is used for:

[0061] Obtain a plurality of sample texts; each sample text has corresponding standard context information and optimized standard text respectively;

[0062] Perform at least one training operation on the initial language processing model through the plurality of sample texts until the training end condition is met to obtain the speech processing model;

[0063] Wherein, when the training module executes the training operation, it is specifically configured to:

[0064] For each sample text, through the initial language processing model, extract information from the sample text based on the preset information extraction prompt text to obtain the sample context of the sample text;

[0065] Through the initial language processing model, optimize the sample text based on the sample context and the preset optimization prompt text to obtain the sample optimized text;

[0066] Determine the first loss of the sample text based on the sample context and the standard context of the sample text, determine the second loss of the sample text based on the sample optimized text and the standard text, adjust the parameters of the initial language processing model based on the first loss and the second loss respectively corresponding to each sample text, and use the initial language processing model with the adjusted parameters as the initial language processing model corresponding to the next training operation.

[0067] In some possible implementation manners, when the optimization module performs at least one optimization process on the initial text, it is specifically configured to:

[0068] Determine the text information volume of the initial text;

[0069] If the text information volume is greater than or equal to a preset threshold, perform at least one optimization process on the initial text.

[0070] In some possible implementation manners, the optimization end condition includes any one of the following:

[0071] The number of optimization processes conforms to a preset number;

[0072] It is detected that the optimization rate of the current optimization process conforms to a preset ratio; wherein, the optimization rate is determined based on the text to be optimized corresponding to the current optimization process and the obtained optimized text.

[0073] On the other hand, an embodiment of the present application further provides an electronic device, which includes a memory and a processor. A computer program is stored in the memory, and the processor executes the computer program to implement the method provided in any optional embodiment of the present application.

[0074] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method provided in any optional embodiment of the present application is implemented.

[0075] On the other hand, an embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method provided in any optional embodiment of the present application is implemented.

[0076] The beneficial effects brought by the technical solution provided by the embodiment of the present application are as follows:

[0077] In the process of performing each optimization process on the initial text, first extract information from the text to be processed based on a preset information extraction prompt text to obtain the context information of the text to be processed, and then optimize the text to be processed based on the context information and a preset optimization prompt text to obtain the optimized text corresponding to the current optimization process, which can effectively correct the initial text by combining the context information in the initial text and improve the accuracy of optimizing the initial text.

[0078] In addition, by performing at least one optimization process on the initial text to obtain the optimized text corresponding to each optimization process, and using the optimized text obtained from the last optimization process as the target text, the degree of optimization can be customized, and the degree of optimization can be improved by increasing the number of optimization times. The text to be processed is optimized not only based on context information, that is, domain information, keywords, key sentences, tag information, summary information, and to-do items associated with the text to be processed, etc., but also can be combined with additional information input by the object, that is, at least one of language style information, expression information, scenario information, popular vocabulary, and tone information to optimize the text to be processed, thereby further improving the accuracy of text optimization. By determining the scenario information of the speech to be processed, and then updating the initial extraction prompt text based on the scenario information to obtain the information extraction prompt text, the text to be processed can be more accurately extracted in combination with the scenario information of the speech to be processed; by updating the initial optimization prompt text in combination with the scenario information to obtain the optimization prompt text, the text to be processed can be more accurately optimized in combination with the scenario information of the speech to be processed, effectively improving the accuracy of text optimization. Brief Description of the Drawings

[0079] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments of the present application.

[0080] Figure 1 Schematic diagram of the application environment of the text processing method provided in one example;

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

[0082] Figure 3 Schematic diagram of a text processing solution provided in an embodiment of the present application;

[0083] Figure 4 Schematic diagram of a text processing solution provided in an embodiment of the present application; Schematic diagram of a text processing solution provided in an embodiment of the present application;

[0084] Figure 5 Schematic diagram of the text processing solution provided in one example of the present application;

[0085] Figure 6 Schematic diagram of the structure of a text processing device provided in an embodiment of the present application;

[0086] Figure 7 Schematic diagram of the structure of an electronic device applicable to an embodiment of the present application. Detailed Description of the Embodiments

[0087] The embodiments of the present application will be described below with reference to the accompanying drawings in the present application. It should be understood that the embodiments described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not limit the technical solutions of the embodiments of the present application.

[0088] Those skilled in the art of the present technology can understand that unless specifically stated, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation of other features, information, data, steps, operations, elements, components and / or their combinations supported by the art of the present technology. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein can include a wireless connection or a wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or implemented as "B", or implemented as "A and B". When describing multiple (two or more) items, if the relationship between the multiple items is not clearly defined, the multiple items can refer to one, multiple or all of the multiple items. For example, for the description of "parameter A includes A1, A2, A3", it can be implemented that parameter A includes A1 or A2 or A3, and it can also be implemented that parameter A includes at least two of the three items of parameter A1, A2, A3.

[0089] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.

[0090] In oral dialogue scenarios such as meetings, phone calls, chats, etc., the text generated by an ASR (Automatic Speech Recognition) system for transcribing speech usually has the following problems:

[0091] 1) Sentence segmentation error: In spoken language, a complete sentence may be expressed intermittently with pauses in between, causing the VAD (Voice Activity Detection) system to misjudge and split the sentence into multiple sentences.

[0092] 2) Punctuation error: Each sentence output by ASR is in pure text form and requires punctuation to be added through a punctuation system. The sentence segmentation error further leads to incorrect punctuation. Moreover, the punctuation system only considers the current sentence in isolation from the context, making it prone to errors such as incorrect marking, over-marking, or under-marking.

[0093] 3) Severe colloquialism: Common colloquial phenomena in spoken language include some pause words (such as "um", "uh", etc.), meaningless filler words (such as "this this this" in "I thought everyone should often reflect on this this this"), stuttering words (such as the redundant "go" in "I want to go go go go go go traveling"), corrections (such as the correction of "yesterday" to "the day before yesterday" in "Yesterday oh the day before yesterday he just came").

[0094] 4) Norm error: It includes English case (such as "NbA" should be "NBA"), numerical expression (such as "forty percent" should be "40%", "thirteen forty-five" is preferably "13:45"), etc.

[0095] 5) Recognition error: Some words are misrecognized as homophonic or near-homophonic words; some parts of the document are recognized correctly while others are misrecognized; some popular words are professional terms that cannot be recognized by general ASR systems.

[0096] 6) Grammar error: It does not conform to the grammar rules of the corresponding language and is a faulty sentence, such as "The per capita income exceeds more than a thousand yuan".

[0097] Current ASR text error correction schemes usually involve: 1. Given the optimal ASR recognition result for a single sentence, combined with the scores assigned by ASR to each word, masking the words with lower scores (usually the misrecognized parts), and training an error correction model to regenerate the words at the masked positions to achieve the effect of error correction.

[0098] In some ASR scenarios (such as meetings), the output of ASR is often at the discourse level, that is, the text output contains multiple sentences, and the sentences are related to each other. The semantic relevance between sentences can be used for subsequent error correction. For example, if a word is misrecognized in one sentence but correctly recognized in another sentence, the latter can be used as a reference for correcting the former; or if a professional term is recognized as a homophone, the domain information implied by the text information of the entire discourse can facilitate subsequent error correction.

[0099] This application makes full use of the capabilities of the LLM (Large Language Model) to improve the ability to regularize and correct ASR results at the semantic level. The key points are as follows:

[0100] 1) At the discourse level, most of the normalization problems (such as capitalization, time, numbers, etc.), recognition errors, and grammar errors in the ASR recognition results in the spoken language scenario are corrected from the semantic understanding level.

[0101] 2) By flexibly setting rich background information such as theme, scenario, keywords, language style, tone, expression method, audience, etc., the correction ability of the LLM is further improved, making the corrected text more in line with the scenario requirements.

[0102] 3) The iterative loop mode is adopted to optimize the correction results bit by bit, enhancing controllability, flexibility, and the intensity that can be selected by the user.

[0103] The text processing method of this application can be implemented based on machine learning (ML) in artificial intelligence (AI).

[0104] Artificial intelligence is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science. It attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines, enabling the machines to have the functions of perception, reasoning, and decision-making.

[0105] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level technologies and software-level technologies. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, large text processing technology, operation / interaction systems, and mechatronics. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, text processing technology, natural language processing technology, and machine learning / deep learning.

[0106] The key technologies of speech technology include automatic speech recognition technology (ASR), text-to-speech technology (TTS), and voiceprint recognition technology. Enabling computers to listen, see, speak, and feel is the future development direction of human-computer interaction, and among them, speech has become one of the most promising human-computer interaction methods. The large model technology has brought about a revolution in the development of speech technology. Pretrained models such as WavLM and UniSpeech that follow the Transformer architecture have strong generalization and versatility and can excellently complete text processing tasks in various directions.

[0107] Machine learning (ML) is an interdisciplinary field that involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent, and its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and rote learning. Pretrained models are the latest development results of deep learning and integrate the above technologies.

[0108] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in multiple fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless, autonomous driving, drones, digital twins, virtual humans, robots, artificial intelligence-generated content (AIGC), conversational interaction, intelligent healthcare, intelligent customer service, game AI, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0109] The solution provided in the embodiments of this application relates to technologies such as text processing of artificial intelligence, and will be specifically described through the following embodiments.

[0110] The technical solution provided in this application and the technical effects produced by the technical solution of this application will be described below through the description of several optional embodiments. It should be noted that the following implementation manners can be referred to, learned from, or combined with each other. For the same terms, similar features, and similar implementation steps in different implementation manners, they will not be described repeatedly.

[0111] In the specific embodiments of the present application, any data related to an object, such as additional information of the object input, voice information, etc., when the embodiments of the present application are applied to specific products or technologies, object permission or consent needs to be obtained, and the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions. That is to say, if any of the above data related to the object is involved in the embodiments of the present application, these data need to be obtained under the condition of being authorized and consented by the object and conforming to the relevant laws, regulations, and standards of the country and region.

[0112] The text processing method provided by the embodiments of the present application can be executed by any computer device. Optionally, it can be executed by a server. Among them, the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0113] Figure 1 It is a schematic diagram of the application environment of the text processing method provided by the embodiments of the present application. Among them, the application environment may include a voice acquisition device 101 and a server 102. The voice acquisition device 101 acquires the voice to be processed and sends the voice to be processed to the server 102; the server 102 converts the voice to be processed into an initial text; the server 102 performs at least one optimization process on the initial text to obtain an optimized text corresponding to each optimization process until the optimization end condition is met, and uses the optimized text obtained from the last optimization process as the target text.

[0114] In the above application scenario, it is the voice acquisition device that acquires the voice and sends it to the server. The server obtains the initial text to be optimized based on the voice and optimizes the initial text. In other application scenarios, the voice acquisition device can be integrated into the terminal. The terminal acquires the voice and converts it into the initial text, and directly optimizes the initial text by the terminal.

[0115] Those skilled in the art of the present technology can understand that the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal can be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a laptop computer, a digital broadcast receiver, a MID (Mobile Internet Devices), a PDA (Personal Digital Assistant), a desktop computer, a smart home appliance, a vehicle terminal (such as a vehicle navigation terminal, a vehicle computer, etc.), a smart speaker, a smart watch, etc. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, but it is not limited thereto. The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, intelligent transportation, assisted driving, etc. Specifically, it can also be determined based on the actual application scenario requirements and is not limited herein.

[0116] The terminal (which can also be referred to as a user terminal or user device) can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart voice interaction device (such as a smart speaker), a wearable electronic device (such as a smart watch), a vehicle terminal, a smart home appliance (such as a smart TV), an AR / VR device, an aircraft, etc., but it is not limited thereto. The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, intelligent transportation, assisted driving, etc.

[0117] In some possible implementation manners, a text processing method is provided, which can be executed by an electronic device.

[0118] Figure 2 The flowchart of a text processing method provided by an embodiment of the present application is shown. Taking the execution entity as the server as an example, the text processing method provided by the present application may include the following steps:

[0119] Step S201, obtain the initial text to be optimized.

[0120] Step S202, perform at least one optimization process on the initial text to obtain the optimized text corresponding to each optimization process until the optimization end condition is met, and use the optimized text obtained in the last optimization process as the target text.

[0121] Among them, the initial text can be directly searched and obtained by the server, or can be obtained by converting the voice information input by the object, or can be obtained by the object input.

[0122] Among them, the optimization process may include:

[0123] (1) Through the trained language processing model, based on the preset information extraction prompt text, extract information from the text to be processed to obtain the context information of the text to be processed; the text to be processed corresponding to the first optimization process is the initial text;

[0124] (2) Through the language processing model, based on the context information and the preset optimization prompt text, optimize the text to be processed to obtain the optimized text corresponding to the current optimization process; use the optimized text as the text to be processed corresponding to the next optimization process.

[0125] Among them, the language processing model may include large language models. Currently, most practical large language models are basically based on the Transformer structure and adopt an autoregressive form, that is, based on the input token (text unit) sequence, predict the next token, and then based on the original input and the predicted token, continue to predict the next token, and so on. Here, the token refers to the basic unit of the text, which can be a Chinese character corresponding to Chinese.

[0126] For example, the language processing model may include chatGPT, chatGLM, MOSS, etc.; among them, chatGPT (Chat Generative Pre-trained Transformer) is a chatbot program; chatGLM is a 100-billion Chinese-English language model with initial question-answering and dialogue functions; MOSS is a conversational language model.

[0127] Among them, the information extraction prompt text can be used to instruct the language processing model to extract information from the text to be processed.

[0128] Among them, the context information may include the domain information, keywords, key sentences, label information, summary information, and to-do items associated with the text to be processed of the text to be processed.

[0129] For example, the information extraction prompt text may include: Please extract the domain, keywords, label information, key sentences, summary information, and to-do items involved in the text.

[0130] Similarly, the optimization prompt text can be used to instruct the language processing model to optimize the text to be processed.

[0131] For example, the optimization prompt text may include: Please combine the given multiple pieces of information to regularize and correct the original text so that the text is more fluent, smooth, and conforms to the grammar rules.

[0132] In the specific implementation process, such asFigure 3 As shown, in each optimization process, first, the context information in the text to be processed is extracted through a language processing model, and then, combined with the context information, the text to be processed is optimized to obtain the optimized text obtained from each optimization process.

[0133] Specifically, in the first optimization process, first, the context information of the initial text is extracted through a language processing model, and then, combined with the context information corresponding to the first optimization process, the initial text is optimized to obtain the optimized text obtained from the first optimization process; then, continue to extract the context information and optimize the text of the optimized text, and repeat the loop until the optimization end condition is met.

[0134] In the above embodiments, in the process of each optimization process for the initial text, first, information extraction is performed on the text to be processed based on a preset information extraction prompt text to obtain the context information of the text to be processed, and then, based on the context information and the preset optimization prompt text, the text to be processed is optimized to obtain the optimized text corresponding to the current optimization process, which can effectively combine the context information in the initial text to correct the initial text and improve the accuracy of the initial text optimization.

[0135] In addition, by performing at least one optimization process on the initial text to obtain the optimized text corresponding to each optimization process, and using the optimized text obtained from the last optimization process as the target text, the optimization degree can be customized, and the optimization degree can be improved by increasing the number of optimization times.

[0136] In the specific implementation process, the optimization end condition may include any one of the following:

[0137] The number of optimization processes meets the preset number;

[0138] It is detected that the optimization rate of the current optimization process meets the preset ratio; where the optimization rate is determined based on the text to be optimized corresponding to the current optimization process and the obtained optimized text.

[0139] Specifically, the preset number can be set by the object according to the degree of optimization required. The higher the degree of optimization required, the more the preset number can be set in advance. Conversely, the lower the degree of optimization required, the smaller the preset number can be set in advance.

[0140] In the specific implementation process, for each optimization process, the text to be processed corresponding to the current optimization process and the obtained optimized text can be compared to determine the text optimized in the current optimization process, that is, the corrected text, and based on the ratio of the data volume between the corrected text and the text to be processed, the optimization rate of the current optimization process is determined.

[0141] In some possible embodiments, through a language processing model, based on context information and a preset optimization prompt text, text optimization is performed on the text to be processed, and the optimized text obtained from the current optimization process may include:

[0142] (1) Obtain additional information input by the object;

[0143] (2) Through the language processing model, based on the additional information, context information, and preset optimization prompt text, perform text optimization on the text to be processed to obtain the optimized text obtained from the current optimization process.

[0144] Among them, the additional information includes at least one of language style information, expression way information, scenario information, popular vocabulary, and tone information.

[0145] Among them, the language style information can represent the style of the optimized text expected to be obtained after optimization. For example, the style of daily spoken language, the style of applied writing, the style of artistic writing, and the personal language style, etc.; the expression way information can be used to represent the expression way of the optimized text, such as lyric, narration, description, argumentation, explanation, etc.; the scenario information can represent the scenario of the text to be processed, such as a meeting scenario, a conversation scenario, etc., and can also represent the specific content scenario of the text to be processed, such as which type of content the meeting is about, etc.; the popular vocabulary can include the popular vocabulary within the current time period; the tone information can include the tone types contained in each sentence of the initial text.

[0146] As Figure 4 shown, in each optimization process, first, the context information in the text to be processed, that is, domain information, keywords, key sentences, tag information, summary information, and to-do items associated with the text to be processed, etc., is extracted through the language processing model, and then, in combination with the additional information input by the object, that is, at least one of language style information, expression way information, scenario information, popular vocabulary, and tone information, text optimization is performed on the text to be processed to obtain the optimized text obtained from each optimization process.

[0147] The following will elaborate on the specific process of extracting context information in combination with embodiments.

[0148] In some possible embodiments, through a trained language processing model, based on a preset information extraction prompt text, information extraction is performed on the text to be processed to obtain the context information of the text to be processed, including:

[0149] (1) Add the text to be processed to the information extraction template to obtain the first input information; the information extraction template includes the information extraction prompt text;

[0150] (2) Input the first input information into the language processing model to obtain the context information of the text to be processed.

[0151] Among them, the information extraction template can be used to instruct the language processing model to perform information extraction. Adding the text to be processed to the information extraction template means instructing the language processing model to perform information extraction on the text to be processed.

[0152] For example, the information extraction template may include:

[0153] Please extract the domain information, keywords, topics, key sentences, summary information, and to-do items involved in the text.

[0154] Text content: []

[0155] Adding the text to be processed to the information extraction template, we can get:

[0156] Please extract the domain information, keywords, topics, key sentences, summary information, and to-do items involved in the text.

[0157] Text content: [Text content of the text to be processed]

[0158] In the specific implementation process, the information to be extracted can be edited. For example, only extract the domain information, or only extract the summary information, etc.

[0159] In some possible implementation manners, through the language processing model, based on the additional information, context information, and preset optimization prompt text, the text to be processed is optimized to obtain the optimized text corresponding to the current optimization process, which may include:

[0160] (1) Add the text to be processed, context information, and additional information to the text optimization template to obtain the second input information; the text optimization template includes the optimization prompt text;

[0161] (2) Input the second input information into the language processing model to obtain the optimized text corresponding to the current optimization process.

[0162] Among them, the text optimization template can be used to instruct the language processing model to perform text optimization. Adding the text to be processed to the text optimization template means instructing the language processing model to perform text optimization on the text to be processed.

[0163] For example, the text optimization template may include:

[0164] Please combine the given multiple types of information to regularize and correct the original text so that the text is more fluent, smooth, and conforms to the grammar norms.

[0165] Original text content: []

[0166] Context information: []

[0167] Additional information: []

[0168] Adding the text to be processed, context information, and additional information to the text optimization template, we can obtain:

[0169] Please combine the given multiple pieces of information to regularize and correct the original text so that the text is more fluent, smooth, and conforms to grammar rules.

[0170] Original text content: [Text content of the text to be processed]

[0171] Context information: [Specific content of the context information of the text to be processed extracted]

[0172] Additional information: [Content of the additional information input by the object]

[0173] Similarly, the additional information can be edited. For example, the additional information only includes language style information, or the additional information only includes expression style information, etc.

[0174] In the above embodiments, not only is the text to be processed optimized based on context information, that is, domain information, keywords, key sentences, tag information, summary information, and to-do items associated with the text to be processed, etc., but also the additional information input by the object, that is, at least one of language style information, expression style information, scenario information, popular words, and tone information, can be combined to optimize the text to be processed, thereby further improving the accuracy of text optimization.

[0175] In some possible implementation manners, step S201 of obtaining the initial text to be optimized includes:

[0176] (1) Obtain the speech to be processed, convert the speech to be processed into text to obtain the initial text;

[0177] (2) Determine the scenario information of the speech to be processed.

[0178] Specifically, the speech to be processed can be converted into text, for example, by performing speech recognition, to obtain the initial text.

[0179] Among them, the scenario information of the speech to be processed can be the source information of the text to be processed. For example, it comes from a meeting, etc.

[0180] In some possible implementation manners, the information extraction prompt text and the optimization prompt text can be generated based on the following method:

[0181] Update the initial extraction prompt text based on the scenario information to obtain the information extraction prompt text;

[0182] Update the initial optimization prompt text based on the scenario information to obtain the optimization prompt text.

[0183] Specifically, the scenario information can be added to the initial extraction prompt text to obtain the information extraction prompt text.

[0184] For example, the initial extraction prompt text is:

[0185] Please extract the domain information, keywords, topics, key sentences, summary information, and to-do items involved in the text.

[0186] Text content: [Text content of the text to be processed]

[0187] Taking the meeting scenario as an example of the scenario information, adding the scenario information to the initial extraction prompt text to obtain the information extraction prompt text may include:

[0188] The following text is from the meeting scenario. Please extract the domain information, keywords, topics, key sentences, summary information, and to-do items involved in the text.

[0189] Text content: [Text content of the text to be processed]

[0190] Similarly, the scenario information can be added to the initial optimization prompt text to obtain the optimization prompt text.

[0191] For example, the initial optimization prompt text includes:

[0192] Please combine the given multiple pieces of information to regularize and correct the original text so that the text is more fluent, smooth, and conforms to the grammar rules.

[0193] Original text content: [Text content of the text to be processed]

[0194] Context information: [Specific content of the context information of the text to be processed extracted]

[0195] Additional information: [Content of the additional information input by the object]

[0196] Taking the meeting scenario as an example of the scenario information, adding the scenario information to the initial optimization prompt text to obtain the optimization prompt text may include:

[0197] The original text is from the meeting scenario. Please combine the given multiple pieces of information to regularize and correct the original text so that the text is more fluent, smooth, and conforms to the grammar rules.

[0198] Original text content: [Text content of the text to be processed]

[0199] Context information: [Specific content of the context information of the text to be processed extracted]

[0200] Additional information: [Content of additional information input by the object]

[0201] In the above embodiments, by determining the scene information of the speech to be processed, and then updating the initial extraction prompt text based on the scene information to obtain the information extraction prompt text, the text extraction of the text to be processed can be more accurate in combination with the scene information of the speech to be processed; by updating the initial optimization prompt text in combination with the scene information to obtain the optimization prompt text, the text to be processed can be more accurately optimized in combination with the scene information of the speech to be processed, effectively improving the accuracy of text optimization.

[0202] The following will further elaborate on the specific training process for the language processing model in combination with embodiments.

[0203] In some possible implementation manners, the language processing model is trained based on the following method:

[0204] Obtain a plurality of sample texts; each sample text has a corresponding standard context information and an optimized standard text respectively;

[0205] Perform at least one training operation on the initial language processing model through the plurality of sample texts until the training end condition is met to obtain the speech processing model;

[0206] Among them, the training operation includes:

[0207] For each sample text, through the initial language processing model, information extraction is performed on the sample text based on the preset information extraction prompt text to obtain the sample context of the sample text;

[0208] Through the initial language processing model, text optimization is performed on the sample text based on the sample context and the preset optimization prompt text to obtain the sample optimized text;

[0209] Determine the first loss of the sample text based on the sample context and the standard context of the sample text, determine the second loss of the sample text based on the sample optimized text and the standard text, adjust the parameters of the initial language processing model based on the first loss and the second loss respectively corresponding to each sample text, and use the initial language processing model with the adjusted parameters as the initial language processing model corresponding to the next training operation.

[0210] In the specific implementation process, the initial language processing model can be directly used as the trained language processing model. For example, if the LLM base model itself has strong capabilities, it can be directly used; otherwise, a small number of samples can be used to fine-tune it to enhance its performance in the information extraction task and text optimization task in the present invention. Information extraction and text optimization can be fine-tuned with a set of models respectively, or a common model can be used.

[0211] Specifically, during the training process, due to the large number of parameters in the LLM itself, only a small number of parameters are added during fine-tuning to improve the training efficiency. The LoRA (Low-Rank Adaptation) algorithm is often used, that is, the weights of the pre-trained model are frozen, and the trainable rank decomposition matrix is injected into each layer of the transformer architecture, thereby greatly reducing the number of trainable parameters for downstream tasks. Specifically, when using LoRA to train downstream task data, only the newly added part of the parameters are trained to adapt to the downstream tasks. After the new parameters are trained, the new parameters are merged with the old parameters in the way of reparameterization, so that the fine-tuning effect can be achieved on the new tasks without increasing the time consumption during model inference.

[0212] In some possible implementation manners, at least one optimization process is performed on the initial text, including:

[0213] Determine the text information amount of the initial text;

[0214] If the text information amount is greater than or equal to a preset threshold, at least one optimization process is performed on the initial text.

[0215] Specifically, for the initial text with a large text information amount, a process of first extracting context information and then optimizing the text in combination with the context information can be performed.

[0216] To more clearly illustrate the text processing method of this application, the following will be further described with examples.

[0217] As Figure 5 shown, in an example, the text processing method of this application may include the following steps:

[0218] Obtain the speech to be processed, perform text conversion on the speech to be processed to obtain the initial text; that is, the passage-level text output by ASR shown in the figure;

[0219] Use the initial text as the text to be processed corresponding to the first optimization process, that is, the text to be optimized shown in the figure;

[0220] Through the trained language processing model, that is, the LLM shown in the figure, based on the preset information extraction prompt text, that is, the information extraction prompt (prompt information) shown in the figure, extract the context information of the text to be processed; that is, the fields, keywords, topics, key sentences, summaries, to-do items, etc. shown in the figure;

[0221] Obtain the additional information input by the object; that is, the hot words, language style, tone, expression method, scene, audience, etc. shown in the figure;

[0222] Through a language processing model, based on context information, additional information, and a preset optimized prompt text, i.e., the text optimization prompt shown in the figure, the text to be processed is optimized to obtain the optimized text corresponding to the current optimization process;

[0223] Then, the optimized text obtained from the current optimization process is used as the text to be processed corresponding to the next optimization process, and cyclic optimization processing is performed.

[0224] In the above text processing method, during each optimization process of the initial text, information extraction is first performed on the text to be processed based on a preset information extraction prompt text to obtain the context information of the text to be processed, and then the text to be processed is optimized based on the context information and the preset optimized prompt text to obtain the optimized text corresponding to the current optimization process, which can effectively combine the context information in the initial text to correct the initial text and improve the accuracy of initial text optimization.

[0225] In addition, by performing at least one optimization process on the initial text to obtain the optimized text corresponding to each optimization process, and using the optimized text obtained from the last optimization process as the target text, the optimization degree can be customized, and the optimization degree can be improved by increasing the number of optimization times.

[0226] Furthermore, not only is the text to be processed optimized based on context information, i.e., domain information, keywords, key sentences, tag information, summary information, and to-do items associated with the text to be processed, etc., but also the additional information input by the object, i.e., at least one of language style information, expression information, scenario information, popular vocabulary, and tone information, can be combined to optimize the text to be processed, thereby further improving the accuracy of text optimization.

[0227] Furthermore, by determining the scenario information of the speech to be processed, and then updating the initial extraction prompt text based on the scenario information to obtain the information extraction prompt text, the text to be processed can be more accurately extracted in combination with the scenario information of the speech to be processed; by updating the initial optimization prompt text in combination with the scenario information to obtain the optimization prompt text, the text to be processed can be more accurately optimized in combination with the scenario information of the speech to be processed, effectively improving the accuracy of text optimization.

[0228] As Figure 6 shown, in some possible implementation manners, a text processing device is provided, including:

[0229] An acquisition module 601, configured to acquire an initial text to be optimized;

[0230] An optimization module 602 is configured to perform at least one optimization process on the initial text to obtain an optimized text corresponding to each optimization process until the optimization end condition is met, and use the optimized text obtained from the last optimization process as the target text;

[0231] Wherein, when performing the optimization process, the optimization module 602 is specifically configured to:

[0232] Extract information from the text to be processed based on a preset information extraction prompt text through a trained language processing model to obtain the context information of the text to be processed; the text to be processed corresponding to the first optimization process is the initial text;

[0233] Optimize the text to be processed based on the context information and a preset optimization prompt text through the language processing model to obtain the optimized text corresponding to the current optimization process; use the optimized text as the text to be processed corresponding to the next optimization process.

[0234] In some possible implementation manners, when the optimization module 602 optimizes the text to be processed based on the context information and a preset optimization prompt text through the language processing model to obtain the optimized text obtained from the current optimization process, it is specifically configured to:

[0235] Obtain additional information input by the object; the additional information includes at least one of language style information, expression way information, scenario information, popular vocabulary, and tone information;

[0236] Optimize the text to be processed based on the additional information, context information, and a preset optimization prompt text through the language processing model to obtain the optimized text obtained from the current optimization process.

[0237] In some possible implementation manners, when the optimization module 602 extracts information from the text to be processed based on a preset information extraction prompt text through a trained language processing model to obtain the context information of the text to be processed, it is specifically configured to:

[0238] Add the text to be processed to an information extraction template to obtain a first input information; the information extraction template includes an information extraction prompt text;

[0239] Input the first input information into the language processing model to obtain the context information of the text to be processed.

[0240] In some possible implementation manners, when the optimization module 602 optimizes the text to be processed based on the additional information, context information, and a preset optimization prompt text through the language processing model to obtain the optimized text corresponding to the current optimization process, it is specifically configured to:

[0241] Add the text to be processed, context information, and additional information to a text optimization template to obtain second input information; the text optimization template includes optimization prompt text;

[0242] Input the second input information into a language processing model to obtain an optimized text corresponding to the current optimization process.

[0243] In some possible implementation manners, when the obtaining module 601 obtains the initial text to be optimized, it is specifically configured to:

[0244] Obtain the speech to be processed, perform text conversion on the speech to be processed to obtain the initial text;

[0245] Determine the scene information of the speech to be processed;

[0246] The information extraction prompt text and the optimization prompt text are generated based on the following method:

[0247] Update the initial extraction prompt text based on the scene information to obtain the information extraction prompt text;

[0248] Update the initial optimization prompt text based on the scene information to obtain the optimization prompt text.

[0249] In some possible implementation manners, it further includes a training module, which is used to:

[0250] Obtain multiple sample texts; each sample text has corresponding standard context information and optimized standard text;

[0251] Perform at least one training operation on the initial language processing model through multiple sample texts until the training end condition is met to obtain a speech processing model;

[0252] Among them, when the training module performs the training operation, it is specifically configured to:

[0253] For each sample text, through the initial language processing model, extract information from the sample text based on the preset information extraction prompt text to obtain the sample context of the sample text;

[0254] Through the initial language processing model, optimize the sample text based on the sample context and the preset optimization prompt text to obtain the sample optimized text;

[0255] Determine the first loss of the sample text based on the sample context and the standard context of the sample text, determine the second loss of the sample text based on the sample optimized text and the standard text, adjust the parameters of the initial language processing model based on the first loss and the second loss corresponding to each sample text respectively, and use the initial language processing model with the adjusted parameters as the initial language processing model corresponding to the next training operation.

[0256] In some possible implementation manners, when the optimization module 602 performs at least one optimization process on the initial text, it is specifically configured to:

[0257] Determine the text information amount of the initial text;

[0258] If the text information amount is greater than or equal to a preset threshold, perform at least one optimization process on the initial text.

[0259] In some possible implementation manners, the optimization end condition includes any one of the following:

[0260] The number of optimization processes conforms to a preset number;

[0261] It is detected that the optimization rate of the current optimization process conforms to a preset ratio; wherein, the optimization rate is determined based on the text to be optimized corresponding to the current optimization process and the obtained optimized text.

[0262] In the above text processing device, during each optimization process of the initial text, first, information extraction is performed on the text to be processed based on a preset information extraction prompt text to obtain the context information of the text to be processed, and then text optimization is performed on the text to be processed based on the context information and a preset optimization prompt text to obtain the optimized text corresponding to the current optimization process, which can effectively combine the context information in the initial text to correct the initial text and improve the accuracy of initial text optimization.

[0263] In addition, by performing at least one optimization process on the initial text to obtain the optimized text corresponding to each optimization process, and using the optimized text obtained from the last optimization process as the target text, the optimization degree can be customized, and the optimization degree can be improved by increasing the number of optimization processes.

[0264] Furthermore, not only is the text to be processed optimized based on the context information, that is, domain information, keywords, key sentences, tag information, summary information, and to-do items associated with the text to be processed, etc., but also additional information input by the object, that is, at least one of language style information, expression mode information, scene information, popular vocabulary, and tone information, can be combined to optimize the text to be processed, thereby further improving the accuracy of text optimization.

[0265] Furthermore, by determining the scene information of the text to be processed, and then updating the initial extraction prompt text based on the scene information to obtain the information extraction prompt text, the text extraction of the text to be processed can be more accurately performed in combination with the scene information of the text to be processed; by updating the initial optimization prompt text in combination with the scene information to obtain the optimization prompt text, the text to be processed can be more accurately optimized in combination with the scene information of the text to be processed, effectively improving the accuracy of text optimization.

[0266] The device in the embodiment of the present application can execute the method provided in the embodiment of the present application, and their implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed function description of each module of the device, reference can be specifically made to the description in the corresponding method shown above, and details are not repeated here.

[0267] An electronic device is provided in an embodiment of the present application, including a memory, a processor, and a computer program stored on the memory. When the processor executes the computer program stored in the memory, the method in any optional embodiment of the present application can be implemented.

[0268] Figure 7 A schematic structural diagram of an electronic device applicable to the embodiment of the present invention is shown, as Figure 7 shown. The electronic device can be a server or a user terminal, and the electronic device can be used to implement the method provided in any embodiment of the present invention.

[0269] As Figure 7 shown, the electronic device 700 mainly includes at least one processor 701 ( Figure 7 one is shown), a memory 702, a communication module 703, and an input / output interface 704, etc. Optionally, the components can be connected and communicate through a bus 705. It should be noted that Figure 7 the structure of the electronic device 700 shown is only schematic and does not constitute a limitation on the electronic device applicable to the method provided in the embodiment of the present application.

[0270] Among them, the memory 702 can be used to store the operating system, application programs, etc. The application programs can include computer programs that implement the methods shown in the embodiments of the present invention when called by the processor 701, and can also include programs for implementing other functions or services. The memory 702 can be a ROM (Read Only Memory), or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory), or other types of dynamic storage devices that can store information and computer programs. It can also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.

[0271] The processor 701 is connected to the memory 702 through the bus 705 and realizes corresponding functions by calling the application programs stored in the memory 702. Among them, the processor 701 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logic blocks, modules, and circuits described in connection with the disclosure of the present invention. The processor 701 can also be a combination that realizes computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0272] The electronic device 700 can be connected to the network through the communication module 703 (which can include, but is not limited to, components such as a network interface) to communicate with other devices (such as user terminals or servers, etc.) through the network to achieve data interaction, such as sending data to other devices or receiving data from other devices. Among them, the communication module 703 can include a wired network interface and / or a wireless network interface, etc., that is, the communication module can include at least one of a wired communication module or a wireless communication module.

[0273] The electronic device 700 can be connected to the required input / output devices, such as a keyboard, a display device, etc., through the input / output interface 704. The electronic device 70 itself can have a display device and can also externally connect other display devices through the interface 704. Optionally, a storage device, such as a hard disk, etc., can also be connected through the interface 704, so as to store the data in the electronic device 700 into the storage device, or read the data in the storage device, and can also store the data in the storage device into the memory 702. It can be understood that the input / output interface 704 can be a wired interface or a wireless interface. According to different actual application scenarios, the devices connected to the input / output interface 704 can be components of the electronic device 700 or external devices connected to the electronic device 700 when needed.

[0274] The bus 705 for connecting each component can include a path to transmit information between the above components. The bus 705 can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. According to different functions, the bus 705 can be divided into an address bus, a data bus, a control bus, etc.

[0275] Optionally, for the solution provided in the embodiments of the present invention, the memory 702 can be used to store the computer program for executing the solution of the present invention, and is run by the processor 701. When the processor 701 runs the computer program, the actions of the method or device provided in the embodiments of the present invention are implemented.

[0276] Based on the same principle as the method provided in the embodiments of the present application, the embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the corresponding content of the foregoing method embodiments can be implemented.

[0277] The embodiments of the present application also provide a computer program product, which includes a computer program. When the computer program is executed by a processor, the corresponding content of the foregoing method embodiments can be implemented.

[0278] It should be noted that the terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification, claims and the above drawings of the present application are used to distinguish similar objects and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order other than the illustrated or textually described order.

[0279] It should be understood that although the flowchart of the embodiments of the present application indicates each operation step by an arrow, the execution order of these steps is not limited to the order indicated by the arrow. Unless otherwise clearly stated herein, in some implementation scenarios of the embodiments of the present application, the implementation steps in each flowchart can be executed in other orders according to requirements. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage among these sub-steps or stages can also be executed at different times respectively. In the scenario where the execution times are different, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and the embodiments of the present application do not limit this.

[0280] The above are only optional implementation manners of some implementation scenarios of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the technical concept of the solution of the present application, adopting other similar implementation means based on the technical idea of the present application also belongs to the protection scope of the embodiments of the present application.

Claims

1. A text processing method, characterized in that, The method includes: Obtaining an initial text to be optimized; Performing at least one optimization process on the initial text to obtain an optimized text corresponding to each optimization process until the optimization end condition is met, and taking the optimized text obtained from the last optimization process as the target text; Wherein, the optimization process includes: Using a trained language processing model to extract information from the text to be processed based on a preset information extraction prompt text to obtain the context information of the text to be processed; the text to be processed corresponding to the first optimization process is the initial text; Using the language processing model to optimize the text to be processed based on the context information and a preset optimization prompt text to obtain the optimized text corresponding to the current optimization process; taking the optimized text as the text to be processed corresponding to the next optimization process.

2. The method according to claim 1, characterized in that, The step of using the language processing model to optimize the text to be processed based on the context information and a preset optimization prompt text to obtain the optimized text corresponding to the current optimization process includes: Obtaining additional information input by the object; the additional information includes at least one of language style information, expression mode information, scenario information, popular vocabulary, and tone information; Using the language processing model to optimize the text to be processed based on the additional information, the context information, and a preset optimization prompt text to obtain the optimized text corresponding to the current optimization process.

3. The method according to claim 1, characterized in that, The step of using a trained language processing model to extract information from the text to be processed based on a preset information extraction prompt text to obtain the context information of the text to be processed includes: Adding the text to be processed to an information extraction template to obtain first input information; the information extraction template includes the information extraction prompt text; Inputting the first input information into the language processing model to obtain the context information of the text to be processed.

4. The method according to claim 2, characterized in that, The step of using the language processing model to optimize the text to be processed based on the additional information, the context information, and a preset optimization prompt text to obtain the optimized text corresponding to the current optimization process includes: Adding the text to be processed, the context information, and the additional information to a text optimization template to obtain second input information; the text optimization template includes the optimization prompt text; Inputting the second input information into the language processing model to obtain the optimized text corresponding to the current optimization process.

5. The method according to claim 1, characterized in that, The step of obtaining the initial text to be optimized includes: Obtaining the text to be processed speech, converting the text to be processed speech into text to obtain the initial text; Determining the scenario information of the text to be processed speech; The information extraction prompt text and the optimization prompt text are generated in the following manner: Updating an initial extraction prompt text based on the scenario information to obtain the information extraction prompt text; Updating an initial optimization prompt text based on the scenario information to obtain the optimization prompt text.

6. The method according to claim 1, characterized in that The language processing model is trained in the following manner: Obtain multiple sample texts; each of the sample texts has corresponding standard context information and optimized standard texts respectively; Perform at least one training operation on the initial language processing model with the multiple sample texts until the training end condition is met, to obtain the speech processing model; Among them, the training operation includes: For each sample text, through the initial language processing model, perform information extraction on the sample text based on a preset information extraction prompt text to obtain the sample context of the sample text; Through the initial language processing model, perform text optimization on the sample text based on the sample context and a preset optimization prompt text to obtain a sample optimized text; Determine the first loss of the sample text based on the sample context and the standard context of the sample text, determine the second loss of the sample text based on the sample optimized text and the standard text, adjust the parameters of the initial language processing model based on the first loss and the second loss corresponding to each sample text respectively, and use the initial language processing model with adjusted parameters as the initial language processing model corresponding to the next training operation.

7. The method according to claim 1, wherein The at least one optimization process on the initial text includes: Determine the text information amount of the initial text; If the text information amount is greater than or equal to a preset threshold, perform at least one optimization process on the initial text.

8. The method according to claim 1, characterized in that The optimization end condition includes any one of the following: The number of optimization processes meets a preset number; It is detected that the optimization rate of the current optimization process meets a preset ratio; wherein, the optimization rate is determined based on the text to be optimized and the obtained optimized text corresponding to the current optimization process.

9. A text processing device, characterized in that, The device includes: An acquisition module, configured to acquire an initial text to be optimized; An optimization module, configured to perform at least one optimization process on the initial text to obtain an optimized text corresponding to each optimization process until the optimization end condition is met, and use the optimized text obtained from the last optimization process as the target text; Among them, the optimization process includes: Through the trained language processing model, perform information extraction on the text to be processed based on a preset information extraction prompt text to obtain the context information of the text to be processed; the text to be processed corresponding to the first optimization process is the initial text; Through the language processing model, perform text optimization on the text to be processed based on the context information and a preset optimization prompt text to obtain the optimized text corresponding to the current optimization process; use the optimized text as the text to be processed corresponding to the next optimization process.

10. An electronic device, characterized in that, The electronic device includes a memory and a processor, and a computer program is stored in the memory, and the processor executes the computer program to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, A computer program is stored in the storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, characterized in that, The computer product includes a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.