Text processing method and device, electronic device and storage medium

By automatically identifying text application scenarios and optimizing them, the problem of low text editing efficiency is solved, the efficiency and communication effect of text editing are improved, and the user's editing process is simplified.

CN116861860BActive Publication Date: 2024-08-30BAIDU (CHINA) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310827542.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2024-08-30
Estimated Expiration
2043-07-06

AI Technical Summary

Technical Problem

In the existing technology, the text editing efficiency is low, and users need to spend a long time to repeatedly deliberate and modify the text, resulting in low editing efficiency.

Method used

By obtaining the user's text in the input interface, the application scenario of the text is automatically identified based on the attribute information of the input interface, and the corresponding optimization model is used to optimize the text, generate optimized text, and display it to the user for selection to assist the user in editing.

Benefits of technology

It improves text editing efficiency, reduces the time users spend editing text, provides higher emotional intelligence expression and content generation efficiency, and simplifies the text editing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116861860B
    Figure CN116861860B
Patent Text Reader

Abstract

The present disclosure provides a text processing method and device, an electronic device and a storage medium, which relate to the field of artificial intelligence technology, especially to the technical fields of natural language processing, deep learning, etc. The implementation scheme is: obtaining a first text input by a user in an input interface; determining an application scenario of the first text based on the attribute information of the input interface; optimizing the first text based on the application scenario to obtain a second text; and displaying the second text in the input interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to technical fields such as natural language processing and deep learning, and specifically to a text processing method and device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] Artificial Intelligence (AI) is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. AI hardware technologies generally include technologies such as sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing; AI software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, and knowledge graph technology.

[0003] Text editing is a common function of applications. For example, users can edit and publish articles through applications with content publishing functions, edit messages and send them to others through applications with instant messaging functions, and so on.

[0004] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention

[0005] The present disclosure provides a text processing method and device, an electronic device, a computer-readable storage medium, and a computer program product.

[0006] According to one aspect of the present disclosure, a text processing method is provided, including: obtaining a first text input by a user in an input interface; determining an application scenario of the first text based on attribute information of the input interface; optimizing the first text based on the application scenario to obtain a second text; and displaying the second text in the input interface.

[0007] According to one aspect of the present disclosure, a text processing device is provided, including: an acquisition module, configured to acquire a first text input by a user in an input interface; a determination module, configured to determine an application scenario of the first text based on attribute information of the input interface; an optimization module, configured to optimize the first text based on the application scenario to obtain a second text; and a display module, configured to display the second text in the input interface.

[0008] According to one aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the above method.

[0009] According to one aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute the above method.

[0010] According to one aspect of the present disclosure, a computer program product is provided, comprising computer program instructions, which implement the above method when executed by a processor.

[0011] According to one or more embodiments of the present disclosure, text editing efficiency can be improved.

[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0014] Figure 1 A schematic diagram showing an exemplary system in which various methods described herein may be implemented according to an embodiment of the present disclosure;

[0015] Figure 2 A flowchart of a text processing method according to an embodiment of the present disclosure is shown;

[0016] Figures 3A-3G A schematic diagram of an input interface according to an embodiment of the present disclosure is shown;

[0017] Figure 4 A schematic diagram showing a text processing process according to an embodiment of the present disclosure is shown;

[0018] Figure 5 A structural block diagram of a text processing device according to an embodiment of the present disclosure is shown; and

[0019] Figure 6 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0021] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0022] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations. "Multiple" refers to two or more.

[0023] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0024] In order to accurately express their own views, bring readers a good reading experience, and avoid misunderstandings, users usually repeatedly consider and modify the expression of the text, which is time-consuming and has low efficiency in text editing.

[0025] In view of the above problems, the embodiments of the present disclosure provide a text processing method, which can automatically optimize the first text input by the user, thereby assisting the user in editing the text, reducing the time for the user to edit the text, and improving the text editing efficiency. The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0026] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.

[0027] In an embodiment of the present disclosure, the client devices 101 , 102 , 103 , 104 , 105 , and 106 and the server 120 may run one or more services or software applications that enable execution of the text processing method.

[0028] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.

[0029] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0030] Client devices 101, 102, 103, 104, 105, and / or 106 may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.

[0031] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, vehicle-mounted devices, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems; or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.

[0032] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, Wi-Fi), and / or any combination of these and / or other networks.

[0033] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0034] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0035] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and / or 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and / or 106.

[0036] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0037] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.

[0038] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0039] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.

[0040] For the purpose of the embodiments of this disclosure, Figure 1 In the example of , the client devices 101-106 may include applications with text editing functions (i.e., text editing applications), such as shopping applications that can edit and publish product reviews, instant messaging applications that can edit and send messages, office applications that can edit documents, and so on. The client devices 101-106 may also include input method applications. When the user edits text in the text editing application, the input method application is called. The user inputs text into the text editing application by operating the input method application to implement text editing.

[0041] Corresponding to the input method application in the client device, the server 120 may be a server corresponding to the input method application. The server 120 may include a service program that can provide text input services to users based on the data stored in the database 130 (including vocabulary, emoticons, symbols, etc.).

[0042] Figure 2 200 according to an embodiment of the present disclosure. The execution subject of each step of the method 200 is usually a client device, such as Figure 1 In some embodiments, the execution subject of method 200 may also be a server, for example Figure 1 The server 120 shown in .

[0043] like Figure 2 As shown, method 200 includes steps S210 - S240 .

[0044] In step S210, a first text input by a user in an input interface is obtained.

[0045] In step S220, an application scenario of the first text is determined based on the attribute information of the input interface.

[0046] In step S230, the first text is optimized based on the application scenario to obtain a second text.

[0047] In step S240, the second text is displayed in the input interface.

[0048] According to the embodiments of the present disclosure, based on the attribute information of the input interface, the application scenario of the first text is automatically identified, and then the first text is optimized based on the application scenario to obtain the optimized second text, and the second text is displayed to the user for the user to select. This can assist the user in editing the text, reduce the time for the user to edit the text, and improve the efficiency of text editing.

[0049] The following is a detailed description of each step of method 200.

[0050] In an embodiment of the present disclosure, the input interface refers to a text editing application interface including an input method application interface and a text input box. For example, a user uses an input method application to edit text in a text editing application, and the current interface in the text editing application is the input interface. The text editing application can be any application with a text editing function, such as an instant messaging application, a shopping application, an office application, and the like. In the input interface, the user enters the corresponding first text into the text input box by operating in the input method application interface. In some embodiments, the first text can be input by copying and pasting or by voice.

[0051] Figure 3A Schematic diagram of an input interface according to an embodiment of the present disclosure is shown. Figure 3A As shown, the user currently editing the text is user A, and the input interface is a chat interface with user B in an instant messaging application. The input interface includes a text input box 302, an input method application interface 304, and a history dialog box 306. The input method application interface 304 includes a plurality of keyboard buttons. User A inputs the corresponding first text into the text input box 302 by operating in the input method application interface 304. By clicking the "Send" button, the first text in the text input box 302 can be sent to user B. After successful sending, the first text will be displayed in the history dialog box 306.

[0052] In step S220, an application scenario of the first text is determined based on the attribute information of the input interface.

[0053] Since users have different text editing needs in different application scenarios, in an embodiment of the present disclosure, the application scenario of the first text is identified in step S220, and then the first text is optimized in a targeted manner based on the application scenario in step S230, thereby improving the text optimization effect, thereby better assisting users in editing text and improving text editing efficiency.

[0054] According to some embodiments, the application scenario of the first text may include a chat scenario and a content publishing scenario. In the chat scenario, the first text may be a chat content to be sent by a user to others. In the content publishing scenario, the first text may be an article to be published, a product review, etc.

[0055] In a chat scenario, the same semantics may be expressed in many different ways. Different expressions often convey different emotions and give readers different feelings. For example, user A wants to reject a dinner invitation from user B. Expression 1 "I can't go, I have to work overtime!" and expression 2 "Sorry, I can't go, I have to work overtime tonight T_T" will give user B different feelings. The tone of expression 1 is relatively blunt, and user B may feel unwelcome or offended. The tone of expression 2 is more peaceful, and the symbol emoticon T_T is used to express regret and apology, and user B can feel sincerity and friendliness. Compared with expression 1, expression 2 is a high-EQ expression and is more conducive to communicating with others.

[0056] Therefore, in a chat scenario, users usually have a demand for high EQ expression, that is, users hope to optimize the expression of the first text while keeping the semantics of the first text unchanged, so that the first text can express their views in a tactful and friendly manner, thereby facilitating communication with others.

[0057] In a content publishing scenario, users usually want to expand or rewrite the first text to improve the efficiency of content generation and publishing.

[0058] According to some embodiments, step S220 may include steps S221 and S222.

[0059] In step S221, it is determined whether the semantics of the first text is complete.

[0060] In step S222, in response to the semantic completion of the first text, an application scenario of the first text is determined based on the attribute information of the input interface.

[0061] According to the above embodiment, the application scenario of the first text is identified only when the first text is semantically complete, which can improve computing efficiency and avoid wasting computing resources caused by optimizing the semantically incomplete first text to obtain a second text that does not meet expectations.

[0062] According to some embodiments, in step S221, the first text is input into a trained semantic judgment model to obtain a judgment result output by the semantic judgment model. The semantic judgment model is trained using sample texts annotated with semantic integrity labels, the sample texts are historical input texts of sample users, and the semantic integrity labels indicate whether the sample texts have been sent or published.

[0063] According to the above embodiment, the semantic integrity of the first text is determined by using the trained semantic judgment model, which can improve the efficiency and generalization of semantic judgment.

[0064] The semantic judgment model may be, for example, a binary classification model, which takes a text question as input and outputs a semantic integrity label of the text. For example, if the text is semantically complete, its semantic integrity label may be 1; if the text is semantically incomplete, its semantic integrity label may be 0. The semantic judgment model may be implemented as a neural network, for example.

[0065] In the embodiment of the present disclosure, the semantic judgment model is trained using sample texts annotated with semantic integrity labels, the sample texts are historical input texts of sample users, and the semantic integrity labels indicate whether the sample texts have been sent or published. For example, if the sample user enters the sample text in the text input box and then sends or publishes the sample text, the semantics of the sample text is considered to be complete, and its semantic integrity label is marked as 1. If the sample user enters the sample text in the text input box and then deletes it without sending or publishing it, the semantics of the sample text is considered to be incomplete, and its semantic integrity label is marked as 0.

[0066] According to some embodiments, step S220 may include steps S223 and S224.

[0067] In step S223, application information of the target application to which the input interface belongs and prompt information in the input interface are obtained. The prompt information is used to guide the user to input the first text.

[0068] In step S224, an application scenario of the first text is determined based on the application information and prompt information of the target application.

[0069] According to the above embodiment, the application scenario of the first text is identified by combining the application information of the target application to which the input interface belongs and the prompt information in the input interface, so that the accuracy of application scenario identification can be improved.

[0070] According to some embodiments, the application information may be, for example, the name of the application or the name of an Android application package (APK).

[0071] The prompt information may be located in the text input box where the first text is located or near the text input box (e.g., above, to the left, etc.). The prompt information may be, for example, "Enter title here", "Enter text here", "Tell me what you think about the product", "Say something", etc. The prompt information may indicate the content type of the first text. The content type includes, for example, title, text, product review, mood status, etc.

[0072] According to some embodiments, step S224 may include: in response to the application information indicating that the application is a first application with a chat function and the prompt information is empty, determining that the application scenario is a chat scenario.

[0073] According to some embodiments, a chat application information set may be preset. The chat application information set includes application information of each of a plurality of first applications having a chat function. By determining whether the application information of the target application belongs to the preset chat application information set, it is possible to quickly identify whether the target application has a chat function.

[0074] The text input box in the chat interface is usually blank and does not contain prompt information. According to the above embodiment, the chat scene can be quickly and accurately identified by combining the application information and the prompt information.

[0075] According to some embodiments, step S224 may include steps S2241 and S2242.

[0076] In step S2241, in response to the prompt information being non-empty, the content type of the first text is determined based on the prompt information.

[0077] In step S2242, in response to the application information indicating that the target application is a second application having a content publishing function and the content type is a target content type, it is determined that the application scenario is a content publishing scenario.

[0078] According to the above embodiment, the content publishing scenario can be identified quickly and accurately by combining application information and content type.

[0079] According to some embodiments, a set of published application information may be preset. The set of published application information includes application information of each of a plurality of second applications having a content publishing function. By determining whether the application information of the target application belongs to the preset set of published application information, it is possible to quickly identify whether the target application has a content publishing function.

[0080] According to some embodiments, a content type set may be preset. The content type set includes a plurality of target content types that can be published, such as title, text, product review, mood status, etc. By matching the content type of the first text with each target content type in the content type set, it is possible to quickly determine whether the content type of the first text is the target content type.

[0081] According to some embodiments, the first text may be input into a trained content classification model to obtain a content type of the first text output by the content classification model. Further, it is determined whether the content type belongs to a preset content type set, thereby determining whether the content type is a target content type.

[0082] According to some embodiments, the similarity between the content type of the first text and each target content type in the content type set may be calculated respectively. In response to the similarity of the target content type with the greatest similarity being greater than a similarity threshold, the content type of the first text is determined to be the target content type.

[0083] The similarity between the content type of the first text and the target content type can be the literal similarity between the two, such as the edit distance, the maximum number of consecutive matching characters, etc.; it can also be the cosine distance of the embedding vectors of the two. The embedding vectors of the content type of the first text and the target content type can be obtained, for example, through a trained text representation model. That is, the content type of the first text or the target content type is input into the text representation model, and the embedding vector of the content type of the first text or the target content type output by the text representation model can be obtained.

[0084] According to some embodiments, step S220 may further include steps S225 - S227 .

[0085] In step S225, it is determined whether the semantics of the first text is complete.

[0086] In step S226, in response to the semantics of the first text being complete, application information of the target application to which the input interface belongs and prompt information in the input interface are obtained. The prompt information is used to guide the user to input the first text.

[0087] In step S227, based on the application information and prompt information of the target application, an application scenario of the first text is determined.

[0088] The specific implementations of steps S225, S226 and S227 may refer to the above steps S221, S223 and S224 respectively, and will not be repeated here.

[0089] After the application scenario of the first text is determined in step S220, in step S230, the first text is optimized based on the application scenario of the first text to obtain an optimized second text.

[0090] According to some embodiments, a text optimization model corresponding to an application scenario of the first text may be obtained. The first text is optimized using the text optimization model corresponding to the application scenario to obtain a second text. It can be understood that the text optimization model is a trained model.

[0091] According to the above embodiment, the first text is optimized using a text optimization model, which can improve the efficiency and generalization of text optimization.

[0092] According to some embodiments, the correspondence between application scenarios and text optimization models can be preset. For example, a chat scenario corresponds to a dialogue model, and a content publishing scenario corresponds to a content generation model. Furthermore, different content generation models can be set for different content types in content publishing scenarios. For example, a title publishing scenario corresponds to a title generation model, a product review publishing scenario corresponds to a product review generation model, a mood status publishing scenario corresponds to a mood status generation model, and so on. Based on the preset correspondence between application scenarios and text optimization models, the text optimization model corresponding to the application scenario of the first text can be obtained.

[0093] According to some embodiments, the application scenario includes a chat scenario, and the text optimization model corresponding to the chat scenario includes a trained dialogue model. Accordingly, step S230 may include steps S231-S232.

[0094] In step S231, based on the user's behavior information in the input interface, it is determined whether the user has a target intention to optimize the expression of the first text.

[0095] In step S232, in response to determining that the user has a target intention, the expression of the first text is optimized using the dialogue model to obtain a second text, wherein the content of the second text is different from the content of the first text, and the semantics of the second text is the same as the semantics of the first text.

[0096] According to the above embodiment, based on the user's behavioral information in the input interface, the user's need for polishing the first text (i.e., target intention) is automatically identified, and then the first text is automatically polished, and the polished second text is displayed to the user for selection, which can assist the user in editing the chat content, improve text editing efficiency, and thus improve communication efficiency.

[0097] It should be noted that the optimization of step S232 refers to the optimization of text content with unchanged semantics. That is, the content of the second text is different from the content of the first text, but the semantics of the second text is the same as the semantics of the first text. In the embodiment of the present disclosure, the semantics of two texts are the same, which means that the two texts belong to the same semantic type.

[0098] According to some embodiments, the dialogue model is a large language model trained on large-scale natural corpus, which can understand what the user says and generate reasonable answers based on the context. The dialogue model can be, for example, Wenxinyiyan, GPT (Generative Pre-trained Transformer), ChatGPT, etc.

[0099] According to some embodiments, the user's behavior information in the input interface includes the length of time the user stays in the input interface after inputting the first text. Accordingly, in step S231, it can be determined whether the user has the target intention of optimizing the expression of the first text based at least on the length of time the user stays in the input interface after inputting the first text.

[0100] According to the above embodiment, it is possible to determine whether the user has the intention to polish the text according to the length of time the user stays after inputting the first text, thereby improving the efficiency of intention recognition.

[0101] According to some embodiments, in response to the dwell time being greater than a first threshold (eg, 3 seconds), it is determined that the user has a target intention to optimize the expression of the first text.

[0102] The length of time the user stays after entering the first text can reflect the time difference from when the user completes text editing to when the user sends (or publishes) the text. According to the above embodiment, the user's intention to polish the text can be quickly identified. If the dwell time is long (i.e., the dwell time is greater than the first threshold), it means that the user has not sent (or published) the first text after entering it. During the dwell time, the user may be pondering the first text and thinking about how to modify the first text, so it can be determined that the user has the target intention to polish the first text. On the contrary, if the dwell time is short (i.e., the dwell time is less than or equal to the first threshold), it means that the user sends (or publishes) the first text soon after entering it, and the user is confident and sure about the way of expressing the first text, so it can be determined that the user does not have the target intention to polish the first text.

[0103] According to some embodiments, the user's behavior information in the input interface also includes information about the first text input by the user, such as the length of the first text. Accordingly, in response to the dwell time being greater than the first threshold and the length of the first text being greater than the second threshold (e.g., 10), it can be determined that the user has a target intention to optimize the expression of the first text. It is understood that the length of the first text refers to the number of characters included in the first text.

[0104] According to the above embodiment, the user's intention to polish the text can be quickly and accurately identified. If the user stays for a long time after entering the first text and the length of the entered first text is long (that is, the length is greater than the second threshold), the user may be thinking about how to modify the first text and the first text has expressed complete semantics, so it can be determined that the user has the target intention to polish the first text. Conversely, if the stay time is short or the length of the first text is short (that is, the length is less than or equal to the second threshold), the user may be more confident in the expression of the first text, or the first text is not convenient to polish because it does not express complete semantics, so it can be determined that the user does not have the target intention to polish the first text.

[0105] According to some embodiments, whether the user has a target intention may be determined according to the following steps S2311 and S2312.

[0106] In step S2311, the semantic type of the first text is identified.

[0107] In step S2312, in response to satisfying any one of the following conditions, it is determined that the user has a target intention:

[0108] The semantic type belongs to a preset first semantic type set, wherein the first semantic type set includes a plurality of semantic types having a target intent; or

[0109] The semantic type does not belong to the first semantic type set, the dwell time is greater than the first threshold, and the length of the first text is greater than the second threshold.

[0110] According to the above embodiment, the accuracy of intention recognition can be improved by combining the semantics of the first text and the behavior information of the user in the input interface to identify the user's text polishing intention.

[0111] There are many ways to identify the semantic type of the first text. According to some embodiments, the first text can be input into a trained semantic recognition model to obtain the semantic type of the first text output by the semantic recognition model. It can be understood that the semantic recognition model is a classification model for implementing text semantic classification, which classifies the first text into one or more semantic types in a preset second semantic type set. It should be noted that the first semantic type set is a subset of the second semantic type set. The number of semantic types with target intent included in the first semantic type set is less than or equal to the number of semantic types included in the second semantic type set. The semantic recognition model can be implemented as a neural network, for example.

[0112] According to some embodiments, the similarity between the first text and each semantic type in the first semantic type set may be calculated respectively. In response to the similarity of the semantic type with the greatest similarity being greater than a similarity threshold, it is determined that the first text belongs to the semantic type and the user has a target intention to polish the first text.

[0113] According to some embodiments, the similarity between the first text and each semantic type in the second semantic type set may be calculated respectively, and the semantic type with the greatest similarity may be determined as the semantic type of the first text. If the semantic type also belongs to the first semantic type set, it is determined that the user has the target intention to polish the first text.

[0114] The similarity between the first text and the semantic type can be the literal similarity between the two, such as the edit distance, the maximum number of consecutive matching characters, etc.; it can also be the cosine distance of the embedding vectors of the two. The embedding vectors of the first text and the semantic type can be obtained, for example, through a trained text representation model. That is, the first text or the semantic type is input into the text representation model, and the embedding vector of the first text or the semantic type output by the text representation model can be obtained.

[0115] According to some embodiments, step S232 may include step S2321.

[0116] In step S2321, the first text and its semantic type are input into the trained dialogue model to obtain the second text output by the dialogue model. According to this embodiment, by directly inputting the first text and its semantic type into the dialogue model to obtain the second text, the text polishing efficiency can be improved. Moreover, by optimizing the expression of the first text based on the semantic type, the semantics of the text before and after the optimization can be ensured to remain unchanged, avoiding distortion of the user's meaning.

[0117] For example, Figure 3A The first text "I can't go, I have to work overtime tomorrow!" and its semantic type "reject others" are concatenated, and the concatenated result "reject others: I can't go, I have to work overtime tomorrow!" is input into the dialogue model to obtain the second text "I'm sorry, I can't go because I have to work overtime" output by the dialogue model.

[0118] According to some embodiments, step S232 may include steps S2322-S2324.

[0119] In step S2322, a query template corresponding to the semantic type of the first text is obtained, wherein the query template includes slots to be filled, and the query template is used to guide the dialogue model to optimize the expression of the text belonging to the semantic type.

[0120] In step S2323, at least the first text is filled into the slot to obtain the query text.

[0121] In step S2324, the inquiry text is input into the dialogue model to obtain a second text output by the dialogue model.

[0122] The query template corresponding to the semantic type is used to guide the dialogue model to optimize the first text, so as to improve the polishing effect of the first text.

[0123] The query template corresponding to the semantic type is preset. There can be one or more query templates. When there are multiple query templates, at least one of them can be selected to generate the query text.

[0124] For example, in Figure 3AIn the illustrated embodiment, the semantic type of the first text "I can't go, I have to work overtime tomorrow!" is "reject others". The inquiry template corresponding to this semantic type can be, for example, "How to reject others tactfully, optimize the expression of "__"?", "How to modify "__" to reject others with high emotional intelligence?", "Please express the rejection of "__" more tactfully", etc. The underline in the above inquiry template indicates the slot to be filled.

[0125] Select the first inquiry template, fill the first text into the slot of the template, and generate the inquiry text "How to politely reject others and optimize the expression of "I can't go, I have to work overtime tomorrow!"?"

[0126] The inquiry text "How to politely refuse others and optimize the expression "I can't go, I have to work overtime tomorrow!"?" is input into the dialogue model, and the dialogue model's response text "Thank you very much for your invitation, but I have to work overtime tomorrow and can't go. I'm really sorry." is obtained. The response text is used as the second text.

[0127] According to some embodiments, the first text may be input by the user in response to the historical chat content of the target contact. Accordingly, in step S2323, the first text and the historical chat content to which the first text responds may be filled into the slot to obtain the inquiry text. According to this embodiment, the historical chat content can enhance the semantics of the first text, so that the inquiry text includes more sufficient semantic information, thereby improving the polishing effect of the first text.

[0128] For example, in Figure 3A In the illustrated embodiment, the first text "I can't go, I have to work overtime tomorrow!" is input by user A in response to the historical chat content "Dear, let's go to scenic spot A together tomorrow~" of user B. The inquiry template can be, for example, "How to politely refuse (1) and optimize the expression of (2)?". Among them, (1) is the first slot, which is used to fill the historical chat content; (2) is the second slot, which is used to fill the first text. The first text and the historical chat content of its response are filled into the corresponding slot to obtain the inquiry text "How to politely refuse "Dear, let's go to scenic spot A together tomorrow~" and optimize the expression of "I can't go, I have to work overtime tomorrow!". The inquiry text is input into the dialogue model to obtain the second text output by the dialogue model "Thank you very much for inviting me to scenic spot A, but I have been busy with work recently and need to work overtime, so I can't participate in this event. I am really sorry, I really want to go with you, but the current situation does not allow it. I hope you have a good time!".

[0129] According to some embodiments, only the historical chat content responded by the first text may be filled into the slot to obtain the inquiry text. For example, the inquiry template may be "How to politely reject "__"?", and the slot in the template is used to fill the historical chat content. The historical chat content "Dear, let's go to scenic spot A together tomorrow~" is filled into the slot to obtain the inquiry text "How to politely reject "Dear, let's go to scenic spot A together tomorrow~"?".

[0130] It can be understood that the above steps S2321 and S2322-S2324 provide two ways of generating the second text. According to some embodiments, at least one of the above two ways can be selected to generate the second text. In the case of selecting multiple ways to generate the second text, in the subsequent step S240, the second text generated by each way can be summarized and displayed to the user through the input interface.

[0131] According to some embodiments, the application scenario includes a content publishing scenario, and the text optimization model corresponding to the content publishing scenario includes a trained content generation model. Accordingly, step S230 may include step S233.

[0132] In step S233, the first text is input into the content generation model to obtain a second text output by the content generation model. According to this embodiment, the content generation model is used to automatically generate the content to be published, which can improve the efficiency of content publishing.

[0133] According to some embodiments, in a content publishing scenario, the second text may be an expanded version of the first text. The length of the second text is usually greater than the length of the first text. The semantics of the second text may be the same as that of the first text, or may be different from that of the first text.

[0134] After the second text is generated in step S230 , in step S240 , the second text is displayed in the input interface.

[0135] The user can select the second text displayed in the input interface. In response to the user's selection operation on the second text, the first text in the current text input box will be replaced with the second text selected by the user. Furthermore, the user can edit the second text in the current text input box through the input method application to obtain the target text for sending or publishing.

[0136] According to some embodiments, in step S240, the second text may be directly displayed in the input interface without requiring the user to perform additional operations.

[0137] According to some other embodiments, in step S240, a prompt that the second text has been generated may be sent to the user. When a target interaction operation of the user in the input interface is monitored, the second text is displayed.

[0138] According to some embodiments, for a chat scenario, step S240 may include steps S241 - S243 .

[0139] In step S241, based on the semantic type of the first text, a prompt is generated to guide the user to obtain the second text. According to some embodiments, the prompt may include the semantic type of the first text.

[0140] In step S242, a prompt component including the above prompt words is displayed in the input interface.

[0141] In step S243, in response to the user's interactive operation on the prompt component, the second text is displayed.

[0142] According to the above embodiment, the prompt component is used to prompt the user that the second text has been generated. When the user operates the prompt component, the second text is displayed, which can ensure that the second text is displayed only when the user needs it, avoiding adverse effects on the user's text editing efficiency due to invalid display of the second text.

[0143] For example, the expression of the first text "I can't go, I have to work overtime tomorrow" as shown in 3A is optimized to obtain two second texts:

[0144] 1. I'm sorry, I can't go because I have to work overtime.

[0145] 2. Thank you very much for inviting me to Attraction A, but I have been busy with work recently and need to work overtime, so I can't attend this event. I'm really sorry, I really want to go with you, but the situation does not allow it now. I hope you have a good time!

[0146] The semantic type of the first text is "reject others", and a prompt "how to reject others with high emotional intelligence" is generated according to the semantic type to guide the user to obtain the second text, and a prompt component 312 containing the prompt is displayed in the input interface, such as Figure 3B As shown. Figure 3B After clicking the prompt component 312 in the input interface shown in FIG. 1 , a dialog function panel 313 will pop up in the input method application, such as Figure 3C As shown. Area 314 in the dialog function panel 313 displays two optimized second texts. The user can select a second text by clicking, double-clicking, long pressing, etc. In response to the user's selection operation of the second text, the first text in the text input box 302 will be replaced by the second text selected by the user, such as Figure 3D shown.

[0147] According to some embodiments, method 200 further includes steps S250 - S270 .

[0148] In step S250, the requirement text input by the user in the input interface is obtained. The requirement text indicates the user's optimization direction for the second text.

[0149] In step S260, the second text is optimized based on the required text to obtain a third text.

[0150] In step S270, the third text is displayed in the input interface.

[0151] According to the above embodiment, the user can express the directional optimization demand for the second text by communicating with the input method application, and then obtain the optimized third text, thereby further improving the text editing efficiency.

[0152] According to some embodiments, the requirement text may be user-defined or selected by the user from a preset set of requirement texts. The requirement text may indicate the user's optimization requirements for the second text. According to some embodiments, the requirement text may indicate the expression style that the user expects the second text to have, such as "passionate", "cute", "formal", etc. According to other embodiments, the requirement text may also indicate the user's requirements for the length, content, etc. of the second text, such as "simplify", "add symbols and emoticons", etc. According to some embodiments, the requirement text may be input in the form of text or voice.

[0153] According to some embodiments, the second text and the required text may be input into a trained dialogue model to obtain a third text output by the dialogue model. According to this embodiment, by directly inputting the second text and the required text into the dialogue model to obtain the third text, text editing efficiency can be improved.

[0154] It should be noted that the user can have multiple rounds of dialogue with the input method application in the dialogue function panel of the input method application to express multiple optimization requirements, that is, input multiple requirement texts. Accordingly, the second text can be optimized multiple times according to the multiple requirement texts.

[0155] For example, Figure 3C , 3D As shown, the dialogue function panel 313 displays a dialog box 316, a voice input component 318, and a plurality of preset requirement texts 320. The preset requirement texts 320 indicate the expression style of the text, including "regular", "passionate", and "cute". The user can select one from the requirement texts 320 as the target expression style of the second text, or input a custom requirement text into the dialog box 316 by text or voice.

[0156] like Figure 3EAs shown, the user selected the "enthusiasm" style from the preset multiple demand texts 320. Accordingly, the input method application can optimize the current second text "Thank you very much for inviting me to scenic spot A, but I have been very busy at work recently and need to work overtime, so I cannot attend this event. I am really sorry, I really want to go with you, but the situation does not allow it now. I hope you have a good time!" by calling the dialogue model, and obtain the optimized third text 322 "Thank you for inviting me to scenic spot A with you, I am really happy! But my work has been very busy recently and I need to work overtime, so I can't attend this event, I am really sorry. I hope you can have a super happy time!", as shown in FIG. Figure 3F shown.

[0157] Then, the user enters the requirement text "be more concise" in the dialog box 316. The input method application calls the dialogue model and takes the third text 322 as the second text to be optimized. Based on the current requirement text "be more concise", the second text "Thank you for inviting me to go to attraction A with you. I am really happy! But I am very busy at work recently and need to work overtime, so I can't participate in this event. I am really sorry. I hope you can have a super happy time!" is optimized to obtain the optimized third text 324 "I am sorry that I can't participate in the attraction A event. I am very busy at work recently and need to work overtime. I hope you have a good time!", such as Figure 3G shown.

[0158] Figure 4 FIG. 4 is a schematic diagram showing a text processing process 400 according to an embodiment of the present disclosure. Figure 4 As shown, process 400 includes steps S401-S407.

[0159] In step S401, a first text input by a user is obtained.

[0160] In step S402, it is determined whether the semantics of the first text is complete. If so, step S403 is executed to further identify the application scenario of the first text; if not, the text processing process is terminated.

[0161] If the application scenario identified in step S403 is a chat scenario, step S404 is executed to further determine whether the user has the target intention to optimize the expression of the first text. If the application scenario is a content publishing scenario, step S406 is executed to call the content publishing model to generate a second text.

[0162] If step S404 determines that the user has the target intention to optimize the expression of the first text, step S405 is executed to call the dialogue model to generate the second text; if not, the text processing process is terminated.

[0163] In step S407, the second text is displayed for the user to select.

[0164] According to an embodiment of the present disclosure, a text processing device is also provided. Figure 5 FIG. 5 shows a structural block diagram of a text processing device 500 according to an embodiment of the present disclosure. Figure 5 As shown, the device 500 includes an acquisition module 510 , a determination module 520 , an optimization module 530 and a display module 540 .

[0165] The acquisition module 510 is configured to acquire the first text input by the user in the input interface.

[0166] The determination module 520 is configured to determine an application scenario of the first text based on the attribute information of the input interface.

[0167] The optimization module 530 is configured to optimize the first text based on the application scenario to obtain a second text.

[0168] The display module 540 is configured to display the second text in the input interface.

[0169] According to the embodiments of the present disclosure, based on the attribute information of the input interface, the application scenario of the first text is automatically identified, and then the first text is optimized based on the application scenario to obtain the optimized second text, and the second text is displayed to the user for the user to select. This can assist the user in editing the text, reduce the time for the user to edit the text, and improve the efficiency of text editing.

[0170] According to some embodiments, the determination module 520 includes: a first judgment unit, configured to judge whether the semantics of the first text are complete; and a first determination unit, configured to determine the application scenario based on the attribute information of the input interface in response to the semantic completeness of the first text.

[0171] According to some embodiments, the first judgment unit is further configured to: input the first text into a trained semantic judgment model to obtain a judgment result output by the semantic judgment model, wherein the semantic judgment model is trained using sample texts annotated with semantic integrity labels, the sample texts are historical input texts of sample users, and the semantic integrity labels indicate whether the sample texts are sent or published.

[0172] According to some embodiments, the determination module 520 includes: an acquisition unit, configured to acquire application information of a target application to which the input interface belongs and prompt information in the input interface, wherein the prompt information is used to guide the user to input the first text; and a second determination unit, configured to determine an application scenario of the first text based on the application information and the prompt information.

[0173] According to some embodiments, the second determination unit includes: a first determination subunit configured to determine that the application scenario is a chat scenario in response to the application information indicating that the target application is a first application with a chat function and the prompt information is empty.

[0174] According to some embodiments, the second determination unit includes: a second determination subunit, configured to determine the content type of the first text based on the prompt information in response to the prompt information being non-empty; and a third determination subunit, configured to determine that the application scenario is a content publishing scenario in response to the application information indicating that the target application is a second application with a content publishing function and the content type is a target content type.

[0175] According to some embodiments, the optimization module 530 is further configured to: optimize the first text using a text optimization model corresponding to the application scenario to obtain the second text.

[0176] According to some embodiments, the application scenario includes a chat scenario, the text optimization model corresponding to the chat scenario includes a trained dialogue model, and the optimization module 530 includes: a second judgment unit, configured to judge whether the user has a target intention to optimize the expression of the first text based on the user's behavior information in the input interface; and an optimization unit, configured to optimize the expression of the first text using the dialogue model in response to determining that the user has the target intention to obtain the second text, wherein the content of the second text is different from the content of the first text, and the semantics of the second text is the same as the semantics of the first text.

[0177] According to some embodiments, the second judgment unit is further configured to: judge whether the user has the target intention based on at least the length of time the user stays after inputting the first text.

[0178] According to some embodiments, the second judgment unit is further configured to: in response to the length of the stay time being greater than a first threshold and the length of the first text being greater than a second threshold, determine that the user has the target intention.

[0179] According to some embodiments, the second judgment unit includes: an identification subunit, configured to identify the semantic type of the first text; and a fourth determination subunit, configured to determine that the user has the target intent in response to satisfying any one of the following conditions: the semantic type belongs to a preset first semantic type set, wherein the first semantic type set includes multiple semantic types with target intent; or the semantic type does not belong to the first semantic type set, the dwell time is greater than a first threshold and the length of the first text is greater than a second threshold.

[0180] According to some embodiments, the optimization unit includes: an acquisition subunit, configured to acquire a query template corresponding to the semantic type of the first text, wherein the query template includes slots to be filled, and the query template is used to guide the dialogue model to optimize the expression of the text belonging to the semantic type; a filling subunit, configured to at least fill the first text into the slot to obtain a query text; and an input subunit, configured to input the query text into the dialogue model to obtain the second text output by the dialogue model.

[0181] According to some embodiments, the application scenario includes a content publishing scenario, the text optimization model corresponding to the content publishing scenario includes a trained content generation model, and the optimization module 530 includes: an input unit, configured to input the first text into the content generation model to obtain the second text output by the content generation model.

[0182] It should be understood that Figure 5 The modules and units of the apparatus 500 shown in FIG. 5 can be compared with those of the reference Figure 2 The steps in the method 200 described above correspond to each other. Therefore, the operations, features and advantages described above for the method 200 are also applicable to the device 500 and the modules and units included therein. For the sake of brevity, some operations, features and advantages are not repeated here.

[0183] Although specific functionality is discussed above with reference to specific modules, it should be noted that the functionality of the various modules discussed herein may be separated into multiple modules, and / or at least some functionality of multiple modules may be combined into a single module.

[0184] It should also be understood that various techniques may be described herein in the general context of software hardware elements or program modules. Figure 5The various units described can be implemented in hardware or in hardware in combination with software and / or firmware. For example, these units can be implemented as computer program codes / instructions, which are configured to be executed in one or more processors and stored in a computer-readable storage medium. Alternatively, these units can be implemented as hardware logic / circuits. For example, in some embodiments, one or more of modules 510-540 can be implemented together in a system on chip (System on Chip, SoC). SoC can include an integrated circuit chip (which includes a processor (e.g., a central processing unit (CPU), a microcontroller, a microprocessor, a digital signal processor (DSP), etc.), a memory, one or more communication interfaces, and / or one or more components in other circuits), and can optionally execute the received program code and / or include embedded firmware to perform functions.

[0185] According to an embodiment of the present disclosure, there is also provided an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the text processing method of the embodiment of the present disclosure.

[0186] According to an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is also provided. The computer instructions are used to enable a computer to execute the text processing method of the embodiment of the present disclosure.

[0187] According to an embodiment of the present disclosure, a computer program product is also provided, including computer program instructions, which implement the text processing method of the embodiment of the present disclosure when executed by a processor.

[0188] refer to Figure 6 , a block diagram of an electronic device 600 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0189] like Figure 6 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0190] Multiple components in the electronic device 600 are connected to the I / O interface 605, including: an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. The input unit 606 can be any type of device that can input information to the electronic device 600. The input unit 606 can receive input digital or character information and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 607 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 608 can include but is not limited to a disk, an optical disk. The communication unit 609 allows the electronic device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, an 802.11 device, a Wi-Fi device, a WiMAX device, a cellular communication device, and / or the like.

[0191] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as method 200. For example, in some embodiments, the method 200 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the method 200 described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the method 200 in any other appropriate manner (e.g., by means of firmware).

[0192] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0193] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0194] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0195] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0196] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0197] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0198] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0199] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present disclosure is not limited by these embodiments or examples, but is only limited by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples may be omitted or replaced by their equivalent elements. In addition, each step may be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples may be combined in various ways. It is important that with the evolution of technology, many of the elements described herein may be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A text processing method, comprising: Acquire a first text currently input by a user in an input interface, wherein the input interface is a text editing application interface including an input method application interface and a text input box, and the first text is text input by the user into the text input box by operating in the input method application interface; Determining whether the semantics of the first text is complete; In response to the semantics of the first text being complete, acquiring application information of a target application to which the input interface belongs and prompt information in the input interface, wherein the prompt information is used to guide the user to input the first text; Determine, based on the application information and the prompt information, an application scenario of the first text, where the application scenario indicates a purpose of the first text, and the application scenario includes a chat scenario or a content publishing scenario. In the chat scenario, the first text is used to chat with others, and in the content publishing scenario, the first text is used to publish; Optimizing the first text using a text optimization model corresponding to the application scenario to obtain a second text; as well as The second text is displayed in the input interface.

2. The method according to claim 1, wherein: The determining whether the semantics of the first text is complete includes: The first text is input into a trained semantic judgment model to obtain a judgment result output by the semantic judgment model, wherein the semantic judgment model is trained using sample texts annotated with semantic integrity labels, the sample texts are historical input texts of sample users, and the semantic integrity labels indicate whether the sample texts have been sent or published.

3. The method according to claim 1, wherein: The determining, based on the application information and the prompt information, an application scenario of the first text includes: In response to the application information indicating that the target application is a first application with a chat function and the prompt information is empty, it is determined that the application scenario is a chat scenario.

4. The method according to claim 1, wherein: The determining, based on the application information and the prompt information, an application scenario of the first text includes: In response to the prompt information being non-empty, determining a content type of the first text based on the prompt information; and In response to the application information indicating that the target application is a second application having a content publishing function and the content type is a target content type, it is determined that the application scenario is a content publishing scenario.

5. The method according to claim 1, wherein: The application scenario includes a chat scenario, the text optimization model corresponding to the chat scenario includes a trained dialogue model, and the optimizing the first text by using the text optimization model corresponding to the application scenario to obtain the second text includes: Based on the behavior information of the user in the input interface, determining whether the user has a target intention to optimize the expression of the first text; and In response to determining that the user has the target intent, the expression of the first text is optimized using the dialogue model to obtain the second text, wherein the content of the second text is different from the content of the first text, and the semantics of the second text is the same as the semantics of the first text.

6. The method according to claim 5, wherein: The determining, based on the behavior information of the user in the input interface, whether the user has a target intention to optimize the expression of the first text includes: Whether the user has the target intention is determined based at least on the length of time the user stays after inputting the first text.

7. The method according to claim 6, wherein: The determining whether the user has the target intention based at least on the length of time after the user inputs the first text includes: In response to the dwell time being greater than a first threshold and the length of the first text being greater than a second threshold, it is determined that the user has the target intention.

8. The method according to claim 6, wherein: The determining whether the user has the target intention based at least on the length of time after the user inputs the first text includes: identifying a semantic type of the first text; and In response to satisfying any one of the following conditions, it is determined that the user has the target intention: The semantic type belongs to a preset first semantic type set, wherein the first semantic type set includes a plurality of semantic types having a target intent; or The semantic type does not belong to the first semantic type set, the dwell time is greater than a first threshold, and the length of the first text is greater than a second threshold.

9. The method according to any one of claims 5 to 8, wherein: The step of optimizing the expression of the first text by using the dialogue model to obtain the second text includes: Obtaining a query template corresponding to the semantic type of the first text, wherein the query template includes slots to be filled, and the query template is used to guide the dialogue model to optimize the expression of the text belonging to the semantic type; Filling at least the first text into the slot to obtain a query text; and The inquiry text is input into the dialogue model to obtain the second text output by the dialogue model.

10. The method according to claim 1, wherein: The application scenario includes a content publishing scenario, the text optimization model corresponding to the content publishing scenario includes a trained content generation model, and the optimizing the first text using the text optimization model corresponding to the application scenario to obtain the second text includes: The first text is input into the content generation model to obtain the second text output by the content generation model.

11. A text processing device, comprising: an acquisition module, configured to acquire a first text currently input by a user in an input interface, wherein the input interface is a text editing application interface including an input method application interface and a text input box, and the first text is text input by the user into the text input box by operating in the input method application interface; Identify modules, including: A first judging unit is configured to judge whether the semantics of the first text is complete; an acquisition unit, configured to acquire, in response to the semantic completeness of the first text, application information of a target application to which the input interface belongs and prompt information in the input interface, wherein the prompt information is used to guide the user to input the first text; and A second determining unit is configured to determine an application scenario of the first text based on the application information and the prompt information, where the application scenario indicates a purpose of the first text, and the application scenario includes a chat scenario or a content publishing scenario. In the chat scenario, the first text is used to chat with others, and in the content publishing scenario, the first text is used to publish; an optimization module, configured to optimize the first text using a text optimization model corresponding to the application scenario to obtain a second text; and A display module is configured to display the second text in the input interface.

12. The device according to claim 11, wherein The first determination unit is further configured to: The first text is input into a trained semantic judgment model to obtain a judgment result output by the semantic judgment model, wherein the semantic judgment model is trained using sample texts annotated with semantic integrity labels, the sample texts are historical input texts of sample users, and the semantic integrity labels indicate whether the sample texts have been sent or published.

13. The device according to claim 11, wherein: The second determining unit includes: The first determining subunit is configured to determine that the application scenario is a chat scenario in response to the application information indicating that the target application is a first application with a chat function and the prompt information is empty.

14. The device according to claim 11, wherein: The second determining unit includes: A second determining subunit is configured to, in response to the prompt information being non-empty, determine a content type of the first text based on the prompt information; and The third determining subunit is configured to determine that the application scenario is a content publishing scenario in response to the application information indicating that the target application is a second application with a content publishing function and the content type is a target content type.

15. The device according to claim 11, wherein The application scenario includes a chat scenario, the text optimization model corresponding to the chat scenario includes a trained dialogue model, and the optimization module includes: A second judgment unit is configured to judge whether the user has a target intention to optimize the expression of the first text based on the behavior information of the user in the input interface; and An optimization unit is configured to optimize the expression of the first text using the dialogue model in response to determining that the user has the target intention to obtain the second text, wherein the content of the second text is different from the content of the first text, and the semantics of the second text is the same as the semantics of the first text.

16. The device according to claim 15, wherein: The second determination unit is further configured to: Whether the user has the target intention is determined based at least on the length of time the user stays after inputting the first text.

17. The device according to claim 16, wherein: The second determination unit is further configured to: In response to the dwell time being greater than a first threshold and the length of the first text being greater than a second threshold, it is determined that the user has the target intention.

18. The device according to claim 16, wherein: The second judging unit comprises: an identification subunit configured to identify the semantic type of the first text; and The fourth determining subunit is configured to determine that the user has the target intention in response to satisfying any one of the following conditions: The semantic type belongs to a preset first semantic type set, wherein the first semantic type set includes a plurality of semantic types having a target intent; or The semantic type does not belong to the first semantic type set, the dwell time is greater than a first threshold, and the length of the first text is greater than a second threshold.

19. The device according to any one of claims 15 to 18, wherein: The optimization unit comprises: an acquisition subunit, configured to acquire a query template corresponding to the semantic type of the first text, wherein the query template includes slots to be filled, and the query template is used to guide the dialogue model to optimize the expression of the text belonging to the semantic type; a filling subunit, configured to fill at least the first text into the slot to obtain a query text; and The input subunit is configured to input the inquiry text into the dialogue model to obtain the second text output by the dialogue model.

20. The device according to claim 11, wherein The application scenario includes a content publishing scenario, the text optimization model corresponding to the content publishing scenario includes a trained content generation model, and the optimization module includes: The input unit is configured to input the first text into the content generation model to obtain the second text output by the content generation model.

21. An electronic device, comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.

22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-10.

23. A computer program product comprising computer program instructions, wherein: The computer program instructions implement the method of any one of claims 1-10 when executed by a processor.

Citation Information

Patent Citations

  • Dialogue generation method and device

    CN110188177A

  • Reply message generation method and device, electronic equipment and storage medium

    CN113037932A

  • Input text processing method and device, electronic equipment and storage medium

    CN113360001A

  • Text data processing method and device, model training method and device and medium

    CN115879469A