Text processing method and device, electronic device and storage medium

By analyzing user behavior information and using natural language processing technology, it automatically identifies text polishing needs and optimizes text expression, solving the problem of low text editing efficiency and achieving assisted editing and efficient expression.

CN116861861BActive Publication Date: 2024-09-03BAIDU (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310828752.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2024-09-03
Estimated Expiration
2043-07-06

AI Technical Summary

Technical Problem

During the text editing process, it is difficult for users to quickly find suitable expressions, resulting in low editing efficiency, and existing technology cannot automatically identify users' polishing needs and provide optimization solutions.

Method used

By obtaining the user's behavioral information in the input interface, it is determined whether the user has the goal intention of optimizing the expression, and the trained semantic recognition model and dialogue model are used to polish the text input by the user and generate text with the same semantics but different expressions. Optimize text.

Benefits of technology

It improves text editing efficiency, reduces user editing time, and provides auxiliary editing functions to help users achieve good expressions faster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116861861B
    Figure CN116861861B
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, and in particular 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; judging 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; in response to determining that the user has the target intention, optimizing the expression of the first text 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; judging whether the user has a target intention of optimizing the expression of the first text based on the behavior information of the user in the input interface; in response to determining that the user has the target intention, optimizing the expression of the first text 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 are the same as the semantics of the first 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: a first acquisition module, configured to acquire a first text input by a user in an input interface; a judgment module, 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; an optimization module, configured to optimize the expression of the first text in response to determining that the user has the target intention 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 are the same as the semantics of the first text; and a first 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-3H 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] When users edit text, 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.

[0025] 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.

[0026] In view of the above problems, the embodiments of the present disclosure provide a text processing method, which can automatically identify the text polishing needs of the user and polish the 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.

[0027] 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.

[0028] 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.

[0029] 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.

[0030] 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.

[0031] 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.

[0032] 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.

[0033] 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.

[0034] 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.

[0035] 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.

[0036] 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.

[0037] 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.

[0038] 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.

[0039] 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.

[0040] 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.

[0041] 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.

[0042] 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.).

[0043] 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 .

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

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

[0046] In step S220, 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.

[0047] In step S230, in response to determining that the user has a target intention, the expression of the first text is optimized to obtain a second text. 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.

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

[0049] According to the embodiments of the present disclosure, based on the user's behavior 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 the user to select. This can assist the user in editing the text, reduce the time the user spends editing the text, and improve the efficiency of text editing.

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

[0051] 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.

[0052] Figure 3A Schematic diagram of an input interface according to an embodiment of the present disclosure is shown. Figure 3AAs 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 chat window 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 chat window 306.

[0053] In some cases, the expression of the first text input by the user may not be good enough, so there is a target intention to optimize the expression of the first text, that is, there is a need to polish the first text. In step S220, it can be determined whether the user has the target intention to optimize the expression of the first text based on the user's behavior information in the input interface.

[0054] 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 S220, 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.

[0055] 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.

[0056] 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 of optimizing the expression of the first text.

[0057] 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.

[0058] 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.

[0059] 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.

[0060] According to some embodiments, a first semantic type set with a target intent may be preset. The first semantic type set may, for example, include multiple semantic types with high emotional intelligence expression requirements, such as rejecting others, thanking others, and rejecting overtime. The semantic type of the first text is determined by performing semantic recognition on the first text. In response to the semantic type of the first text belonging to the preset first semantic type set, it is determined that the user has a target intent to polish the first text.

[0061] 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.

[0062] 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.

[0063] 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.

[0064] 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.

[0065] According to some embodiments, the above embodiment of identifying the target intent based on the dwell time after inputting the first text and the above embodiment of identifying the target intent using a preset first semantic type set can be combined. For example, the semantic type of the first text can be identified. The specific method of identifying the semantic type of the first text can refer to the above description and will not be repeated here. In response to satisfying any of the following conditions, it is determined that the user has the target intent to polish the first text:

[0066] Condition 1: The semantic type of the first text belongs to a preset first semantic type set. As described above, the first semantic type set is preset and includes a plurality of semantic types having a target intent.

[0067] Condition 2: the semantic type of the first text does not belong to the first semantic type set, the dwell time after the user inputs the first text is greater than the first threshold, and the length of the first text is greater than the second threshold.

[0068] 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.

[0069] According to some embodiments, it can be determined that the user has a target intention to polish the first text in response to the user's interactive operation on the target component in the input interface. According to this embodiment, the user can actively trigger text polishing through the interactive operation on the target component, thereby improving text editing efficiency.

[0070] For example, Figure 3A As shown, the input interface includes a target component 308. When the user clicks the target component 308, a tab 310 will pop up in the input interface, such as Figure 3BIf the user selects "High EQ" in tab 310, it is considered that the user has actively expressed the need to polish the first text, and it is determined that the user has the target intention to polish the first text. Subsequently, a dialogue function panel ( Figure 3B (not shown in the figure). The user can have a conversation with the input method application in the conversation function panel and input his / her own expression requirements, for example, "how to politely reject a friend who cannot go to Disneyland due to overtime work". The expression requirement can be used as the first text. In step S230, the input method application obtains the response text corresponding to the expression requirement by calling the trained conversation model as the optimized second text.

[0071] In step S230, in response to determining that the user has a target intention to polish the first text, the expression of the first text is optimized to obtain a second text. It should be noted that the optimization of step S230 refers to the optimization of text content while maintaining the semantics unchanged. 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.

[0072] It can be understood that in response to determining that the user does not have the target intention to polish the first text, there is no need to optimize the expression of the first text.

[0073] According to some embodiments, step S230 may include steps S232 and S234.

[0074] In step S232 , the semantic type of the first text is identified.

[0075] In step S234, based on the semantic type obtained in step S232, the expression of the first text is optimized to obtain a second text.

[0076] According to the above embodiment, the expression of the first text is optimized based on the semantic type, which can ensure that the semantics of the text before and after the optimization remain unchanged, thereby avoiding distortion of the user's meaning.

[0077] According to some embodiments, step S234 may include step S2341.

[0078] In step S2341, the first text and its semantic type are input into the trained dialogue model to obtain a second text output by the dialogue model.

[0079] A dialogue model is a large language model trained on large-scale natural corpus, which can understand what the user says and generate reasonable responses based on the context. Examples of dialogue models include Wenxinyiyan, GPT (Generative Pre-trained Transformer), ChatGPT, etc.

[0080] 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.

[0081] According to the above embodiment, the efficiency of text polishing can be improved by directly inputting the first text and its semantic type into the dialogue model to obtain the second text.

[0082] According to some embodiments, step S234 may include steps S2342 - S2344 .

[0083] In step S2342, a first query template corresponding to the semantic type of the first text is obtained. The first query template includes a first slot to be filled. The first query template is used to guide the trained dialogue model to optimize the expression of the text belonging to the semantic type.

[0084] In step S2343, at least the first text is filled into the first slot to obtain a first inquiry text.

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

[0086] According to the above embodiment, the first query template corresponding to the semantic type is used to guide the dialogue model to optimize the first text, so that the polishing effect of the first text can be improved.

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

[0088] For example, in Figure 3A In the illustrated embodiment, the semantic type of the first text "I can't go, I have to work overtime tomorrow!" is "reject others". The first 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 first inquiry template indicates the first slot to be filled.

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

[0090] The first 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.

[0091] 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 S2343, the first text and the historical chat content to which the first text responds may be filled into the first slot to obtain the first inquiry text. According to this embodiment, the historical chat content can enhance the semantics of the first text, so that the first inquiry text includes more sufficient semantic information, thereby improving the polishing effect of the first text.

[0092] 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 Disneyland tomorrow~" of user B. The first inquiry template can be, for example, "How to politely refuse (1) and optimize the expression of (2)?". Among them, (1) is the first first slot, which is used to fill the historical chat content; (2) is the second first 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 first slot to obtain the first inquiry text "How to politely refuse "Dear, let's go to Disneyland tomorrow~" and optimize the expression of "I can't go, I have to work overtime tomorrow!"?". The first 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 Disneyland, 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 current situation does not allow it. I hope you have a good time!".

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

[0094] According to some embodiments, step S234 may include steps S2345-S2347.

[0095] In step S2345, a plurality of expression texts corresponding to the semantic type of the first text are obtained.

[0096] In step S2346, the similarity between the first text and any expression text in the plurality of expression texts is calculated respectively.

[0097] In step S2347, at least one expression text having the highest similarity to the first text is determined as the second text.

[0098] According to the above embodiment, by determining the second text from a plurality of preset expression texts, the controllability and acquisition efficiency of the second text can be improved, and the quality of the second text can be guaranteed.

[0099] According to some embodiments, the multiple expression texts corresponding to the semantic type are high EQ texts belonging to the semantic type and capable of bringing a good reading experience to the reader. It can be understood that the multiple expression texts corresponding to the semantic type are preset.

[0100] According to some embodiments, in step S2346, the similarity between the first text and the expression text may be the literal similarity of the two, such as the edit distance, the maximum number of consecutive matching characters, etc.; or the cosine distance of the embedding vectors of the two. The embedding vectors of the first text and the expression text may be obtained, for example, by a trained text representation model. That is, by inputting the first text or the expression text into the text representation model, the embedding vector of the first text or the expression text output by the text representation model may be obtained.

[0101] It can be understood that there may be one or more second texts determined in step S2347.

[0102] The above steps S2341, S2342-S2344, S2345-S2347 provide three ways to generate the second text. According to some embodiments, one or more of the above three ways can be selected to generate the second text. In the case of selecting multiple ways to generate the second text, in step S240, the second text generated by each way can be summarized and displayed to the user through the input interface.

[0103] 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.

[0104] 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.

[0105] 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.

[0106] According to some embodiments, step S240 may include steps S241 - S243 .

[0107] 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.

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

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

[0110] 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.

[0111] 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:

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

[0113] 2. Thank you very much for inviting me to Disneyland, 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!

[0114] 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 3C As shown. Figure 3C 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 3DAs 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 3E shown.

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

[0116] 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.

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

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

[0119] 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.

[0120] 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.

[0121] 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.

[0122] According to some embodiments, step S260 may include steps S262 - S266 .

[0123] In step S262, a second query template is obtained, wherein the second query template includes a second slot for filling the second text and the requirement text, and the second query template is used to guide the trained dialogue model to optimize the second text along the optimization direction indicated by the requirement text.

[0124] For example, the second query template may be "change (1) to (2) style", "change (1) to (2)", etc., wherein (1) is the first second slot, which is used to fill in the second text; (2) is the second second slot, which is used to fill in the requirement text.

[0125] In step S264, the second text and the requirement text are filled into the second slot to obtain a second inquiry text.

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

[0127] According to the above embodiment, the optimization effect of the second text can be improved by using the second inquiry template to guide the dialogue model to optimize the second text.

[0128] 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.

[0129] For example, Figure 3D , 3E 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.

[0130] like Figure 3F As 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 Disney, but I have been very busy at 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 doesn't 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 Disney with you, I'm really happy! But I'm very busy at work recently and need to work overtime, so I can't attend this event, I'm really sorry. I hope you can have a super happy time!", as shown in the figure. Figure 3G shown.

[0131] Then, the user enters the requirement text "simplify" 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 "simplify", the second text "Thank you for inviting me to go to Disney with you. I am really happy! But I am very busy at work recently and need to work overtime, so I can't attend 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 attend the Disney event. I am very busy at work recently and need to work overtime. I hope you have a good time!", such as Figure 3H shown.

[0132] According to some embodiments, the user can initiate a dialogue with the input method application by interacting with the target component before inputting the first text. The input method application interface at this time is the dialogue function panel between the user and the input method application. The user can enter his or her own expression needs in the dialogue function panel, for example, "how to politely refuse a friend who cannot go to Disneyland due to overtime work". The expression need can be used as the first text. The input method application obtains the response text corresponding to the expression need as the optimized second text by calling the trained dialogue model.

[0133] Furthermore, the user can further input his / her optimization requirements for the second text, namely, the requirement text, in the dialogue function panel. The input method application obtains the response text corresponding to the requirement text as the optimized third text by calling the dialogue model.

[0134] Figure 4 FIG. 4 is a schematic diagram showing a text processing process 400 according to an embodiment of the present disclosure. Figure 4 In the illustrated embodiment, the user can enter the dialogue function panel in the input method application by passive or active access. Subsequently, the user can perform text optimization by having a dialogue with the dialogue model of the input method application in the dialogue function panel.

[0135] like Figure 4 As shown, the process of users passively accessing the conversation function panel is as follows:

[0136] In step S401, the user edits or copies text to obtain a first text.

[0137] In step S402, the first text is subjected to intention recognition to determine whether the user has a target intention of optimizing the expression of the first text.

[0138] In step S403, in response to the user having a target intention, a prompt component (eg, Figure 3CThe prompt component 312 in FIG. 1 includes a prompt word, and the prompt word is generated based on the semantic type of the first text.

[0139] In step S404, in response to the user's interactive operation on the prompt component (eg, click, long press, etc.), the dialog function panel is opened.

[0140] The process of a user actively reaching the conversation function panel is as follows:

[0141] In step S405, the user clicks on a target component (eg, Figures 3A-3C The user can interact with the input method application in the dialog box (for example, by clicking or long pressing the target component 308) to enter the dialog function panel. The user can have a dialog with the input method application in the dialog box, actively input his / her own query as the first text, and obtain the response text output by the dialog model as the second text.

[0142] In step S406, the generated one or more second texts (for example, Figure 3D shown).

[0143] In step S407, the user can select a second text by clicking, and the selection result is displayed in the text input box of the text editing application (for example, Figure 3E shown).

[0144] For the second text displayed in the dialog function panel, steps S408-S412 may be further performed.

[0145] In step S408, in response to the user's interactive operation on the stop component in the dialog function panel, the text generation process is stopped, that is, the calling of the dialog model is stopped.

[0146] In step S409, in response to the question text input by the user, the second text is modified based on the question text by calling the dialogue model to generate a third text.

[0147] In step S410, in response to the user's selection of a preset style (eg, enthusiastic, cute, formal, etc.) in the dialogue function panel, the second text is modified based on the preset style to generate a third text.

[0148] In step S411, in response to a custom style (eg, simplified, with emoticons, etc.) input by the user in the dialogue function panel, the second text is modified based on the custom style to generate a third text.

[0149] In step S412, in response to the user's interactive operation on the refresh component in the dialogue function panel, a new second text is generated by re-calling the dialogue model.

[0150] 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 a first acquisition module 510 , a judgment module 520 , a first optimization module 530 and a first display module 540 .

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

[0152] The determination module 520 is configured to determine 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.

[0153] The first optimization module 530 is configured to optimize the expression of the first text in response to determining that the user has a target intention 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.

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

[0155] According to the embodiments of the present disclosure, based on the user's behavior 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 the user to select. This can assist the user in editing the text, reduce the time the user spends editing the text, and improve the efficiency of text editing.

[0156] According to some embodiments, the judgment module 520 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.

[0157] According to some embodiments, the judgment module 520 is further configured to: in response to the stay duration being greater than a first threshold, determine that the user has the target intention.

[0158] According to some embodiments, the judgment module 520 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, determine that the user has the target intention.

[0159] According to some embodiments, the judgment module 520 includes: an identification unit, configured to identify the semantic type of the first text; and a determination unit, 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.

[0160] According to some embodiments, the determination module 520 is further configured to: determine whether the user has the target intention in response to the user's interactive operation on the target component in the input interface.

[0161] According to some embodiments, the first optimization module 530 includes: a first acquisition unit configured to acquire the semantic type of the first text; and an optimization unit configured to optimize the expression of the first text based on the semantic type to obtain the second text.

[0162] According to some embodiments, the optimization unit is further configured to: input the first text and the semantic type into a trained dialogue model to obtain the second text output by the dialogue model.

[0163] According to some embodiments, the optimization unit includes: a first acquisition subunit, configured to acquire a first query template corresponding to the semantic type, wherein the first query template includes a first slot to be filled, and the first query template is used to guide the trained 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 first slot to obtain a first query text; and an input subunit, configured to input the first query text into the dialogue model to obtain the second text output by the dialogue model.

[0164] According to some embodiments, the first text is input by the user in response to the historical chat content of the target contact, and wherein the filling subunit is further configured to: fill the first text and the historical chat content of the first text response into the first slot to obtain the first inquiry text.

[0165] According to some embodiments, the optimization unit includes: a second acquisition subunit, configured to acquire multiple expression texts corresponding to the semantic type; a calculation subunit, configured to respectively calculate the similarity between the first text and any expression text among the multiple expression texts; and a determination subunit, configured to determine at least one expression text with the highest similarity to the first text as the second text.

[0166] According to some embodiments, the first display module 540 includes: a generation unit, configured to generate a prompt for guiding the user to obtain the second text based on the semantic type of the first text; a first display unit, configured to display a prompt component including the prompt in the input interface; and a second display unit, configured to display the second text in response to the user's interactive operation on the prompt component.

[0167] According to some embodiments, the device 500 also includes: a second acquisition module, configured to acquire the requirement text input by the user in the input interface, wherein the requirement text indicates the optimization direction of the second text by the user; a second optimization module, configured to optimize the second text based on the requirement text to obtain a third text; and a second display module, configured to display the third text in the input interface.

[0168] According to some embodiments, the second optimization module is further configured to: input the second text and the requirement text into a trained dialogue model to obtain the third text output by the dialogue model.

[0169] According to some embodiments, the second optimization module includes: a second acquisition unit, configured to acquire a second inquiry template, wherein the second inquiry template includes a second slot for filling the second text and the requirement text, and the second inquiry template is used to guide the trained dialogue model to optimize the second text along the optimization direction indicated by the requirement text; a filling unit, configured to fill the second text and the requirement text into the second slot to obtain a second inquiry text; and an input unit, configured to input the second inquiry text into the dialogue model to obtain the third text output by the dialogue model.

[0170] 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.

[0171] 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.

[0172] It should also be understood that various techniques may be described herein in the general context of software hardware elements or program modules. Figure 5 The 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.

[0173] 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.

[0174] 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.

[0175] 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.

[0176] 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.

[0177] 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.

[0178] 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.

[0179] 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).

[0180] 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.

[0181] 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.

[0182] 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.

[0183] 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).

[0184] 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.

[0185] 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.

[0186] 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.

[0187] 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 input by a user in an input interface, wherein the input interface is a chat interface between the user and a target contact, and the first text is a reply to a historical chat content of the target contact; Judging 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 includes: At least based on the length of stay after the user inputs the first text, judging whether the user has the target intention, wherein the target intention is the user's intention to reply to the target contact with high emotional intelligence, and judging whether the user has the target intention at least based on the length of stay after the user inputs the first text includes: in response to the length of stay being greater than a first threshold and the length of the first text being greater than a second threshold, determining that the user has the target intention, the length of stay reflecting the time difference from the user completing text editing to sending the text, and the length of the first text reflecting the semantic integrity of the first text; In response to determining that the user has the target intent, optimizing the expression of the first text 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; and The second text is displayed in the input interface.

2. The method according to claim 1, 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 further 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.

3. The method according to claim 1 or 2, wherein: The optimizing the expression of the first text to obtain the second text includes: Obtaining the semantic type of the first text; and Based on the semantic type, the expression of the first text is optimized to obtain the second text.

4. The method according to claim 3, wherein: The optimizing the expression of the first text based on the semantic type to obtain the second text includes: The first text and the semantic type are input into a trained dialogue model to obtain the second text output by the dialogue model.

5. The method according to claim 3, wherein: The optimizing the expression of the first text based on the semantic type to obtain the second text includes: Obtaining a first query template corresponding to the semantic type, wherein the first query template includes a first slot to be filled, and the first query template is used to guide the trained dialogue model to optimize the expression of the text belonging to the semantic type; Filling at least the first text into the first slot to obtain a first inquiry text; and The first inquiry text is input into the dialogue model to obtain the second text output by the dialogue model.

6. The method according to claim 5, wherein: The first text is input by the user in response to historical chat content of the target contact, and wherein at least filling the first text into the first slot to obtain the first inquiry text includes: The first text and the historical chat content of the first text response are filled into the first slot to obtain the first inquiry text.

7. The method according to claim 3, wherein: The optimizing the expression of the first text based on the semantic type to obtain the second text includes: Acquire multiple expression texts corresponding to the semantic type; respectively calculating the similarity between the first text and any expression text of the plurality of expression texts; and At least one expression text having the highest similarity to the first text is determined as the second text.

8. The method according to claim 1, wherein: Displaying the second text in the input interface includes: Based on the semantic type of the first text, generating a prompt for guiding the user to obtain the second text; Displaying a prompt component including the prompt in the input interface; and In response to the user's interactive operation on the prompt component, the second text is displayed.

9. The method according to claim 1, further comprising: Acquire a demand text input by the user in the input interface, wherein the demand text indicates an optimization direction of the second text by the user; Based on the demand text, optimizing the second text to obtain a third text; and The third text is displayed in the input interface.

10. The method according to claim 9, wherein: The optimizing the second text based on the requirement text to obtain a third text includes: The second text and the requirement text are input into a trained dialogue model to obtain the third text output by the dialogue model.

11. The method according to claim 9, wherein: The optimizing the second text based on the requirement text to obtain a third text includes: Acquire a second inquiry template, wherein the second inquiry template includes a second slot for filling the second text and the requirement text, and the second inquiry template is used to guide the trained dialogue model to optimize the second text along the optimization direction indicated by the requirement text; Filling the second text and the requirement text into the second slot to obtain a second inquiry text; and The second inquiry text is input into the dialogue model to obtain the third text output by the dialogue model.

12. A text processing device, comprising: A first acquisition module is configured to acquire a first text input by a user in an input interface, wherein the input interface is a chat interface between the user and a target contact, and the first text is a reply to a historical chat content of the target contact; A judgment module 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, including: At least based on the length of stay after the user inputs the first text, judging whether the user has the target intention, wherein the target intention is the user's intention to reply to the target contact with high emotional intelligence, and judging whether the user has the target intention at least based on the length of stay after the user inputs the first text includes: in response to the length of stay being greater than a first threshold and the length of the first text being greater than a second threshold, determining that the user has the target intention, the length of stay reflecting the time difference from the user completing text editing to sending the text, and the length of the first text reflecting the semantic integrity of the first text; a first optimization module configured to, in response to determining that the user has the target intent, optimize the expression of the first text 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; and The first display module is configured to display the second text in the input interface.

13. The device according to claim 12, wherein: The judging module comprises: a recognition unit configured to recognize a semantic type of the first text; and A determining unit 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.

14. The device according to claim 12 or 13, wherein: The first optimization module comprises: A first acquiring unit is configured to acquire a semantic type of the first text; and The optimization unit is configured to optimize the expression of the first text based on the semantic type to obtain the second text.

15. The device according to claim 14, wherein: The optimization unit is further configured to: The first text and the semantic type are input into a trained dialogue model to obtain the second text output by the dialogue model.

16. The device according to claim 15, wherein: The optimization unit comprises: a first acquisition subunit, configured to acquire a first query template corresponding to the semantic type, wherein the first query template includes a first slot to be filled, and the first query template is used to guide the trained 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 first slot to obtain a first inquiry text; and The input subunit is configured to input the first inquiry text into the dialogue model to obtain the second text output by the dialogue model.

17. The device according to claim 16, wherein: The first text is input by the user in response to historical chat content of the target contact, and wherein the filling subunit is further configured to: The first text and the historical chat content of the first text response are filled into the first slot to obtain the first inquiry text.

18. The device according to claim 14, wherein: The optimization unit comprises: A second acquisition subunit is configured to acquire a plurality of expression texts corresponding to the semantic type; a calculation subunit, configured to respectively calculate the similarity between the first text and any expression text of the plurality of expression texts; and The determination subunit is configured to determine at least one expression text having the highest similarity to the first text as the second text.

19. The device according to claim 12, wherein: The first display module includes: a generating unit, configured to generate a prompt for guiding the user to obtain the second text based on the semantic type of the first text; A first display unit is configured to display a prompt component including the prompt in the input interface; and The second display unit is configured to display the second text in response to the user's interactive operation on the prompt component.

20. The apparatus according to claim 12, further comprising: A second acquisition module is configured to acquire a demand text input by the user in the input interface, wherein the demand text indicates an optimization direction of the second text by the user; a second optimization module configured to optimize the second text based on the demand text to obtain a third text; and The second display module is configured to display the third text in the input interface.

21. The device according to claim 20, wherein: The second optimization module is further configured to: The second text and the requirement text are input into a trained dialogue model to obtain the third text output by the dialogue model.

22. The device according to claim 20, wherein: The second optimization module comprises: a second acquisition unit configured to acquire a second inquiry template, wherein the second inquiry template includes a second slot for filling the second text and the requirement text, and the second inquiry template is used to guide the trained dialogue model to optimize the second text along the optimization direction indicated by the requirement text; a filling unit configured to fill the second text and the requirement text into the second slot to obtain a second inquiry text; and The input unit is configured to input the second inquiry text into the dialogue model to obtain the third text output by the dialogue model.

23. 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 11.

24. 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-11.

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