Input method, device, equipment and storage medium
By using pre-trained dialogue models and translation results, it provides users with diverse reply corpus, solves the problem of frequently editing the same content during chat, and improves the user experience.
Patent Information
- Application Number
- CN201910907038.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-24
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2040-07-10
AI Technical Summary
During the chat process, users need to frequently edit the same or similar content to reply, resulting in the inability to achieve quick reply and waste of time.
By obtaining the information of the target dialogue above and using the pre -trained dialogue model, determine multiple responses corresponding to the information corresponding to the information above, and provide translation results for these recovery corpus as a candidate.
It automatically provides users with diversified reply corpus and translation results, improves the user experience and reduces the time of repeated editing.
Smart Images

Figure CN112631435B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to an input method, device, equipment and storage medium. Background Art
[0002] With the popularization of terminal devices and various chat tools, users can chat with other users by means of the chat tools running on the terminal devices. For example, when a first user chats with a second user, the terminal device of the first user receives and displays the conversation information sent by the second user, so that the first user can reply to the conversation information sent by the second user by means of the terminal device.
[0003] In the prior art, users usually edit the content to reply. However, in actual applications, for some similar or identical questions, users usually reply with the same content, so when receiving multiple similar or identical questions, users need to repeatedly edit the same content through the input method client to reply, which cannot achieve quick reply and also wastes user time. Summary of the invention
[0004] The embodiments of the present application provide an input method, apparatus, device and storage medium, which can automatically provide users with a variety of reply corpora to enhance the user experience.
[0005] In view of this, the first aspect of the present application provides an input method, the method comprising:
[0006] Get the target conversation context information;
[0007] Determine, by means of a pre-trained dialogue model, N response corpora corresponding to the target dialogue context information according to the target dialogue context information, where N is a positive integer; the dialogue model is trained according to the historical context information and the historical response corpora corresponding to the historical context information;
[0008] Determine a translation result corresponding to at least one of the N response corpora;
[0009] The translation results corresponding to the N reply corpora and the at least one reply corpus are displayed as candidate items.
[0010] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0011] Arrange the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N;
[0012] Determine a translation result corresponding to each of the M reply corpora.
[0013] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0014] Selecting M reply corpora frequently used by the current logged-in user from the N reply corpora, where M is less than N;
[0015] Determine a translation result corresponding to each of the M reply corpora.
[0016] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0017] Determine a translation result corresponding to any one of the N reply corpora.
[0018] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0019] According to the commonly used foreign language type of the currently logged-in user, a translation result of the commonly used foreign language type corresponding to each of any M reply corpora among the N reply corpora is determined.
[0020] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0021] Determine the target foreign language type of the currently logged-in user according to the current interaction information of the currently logged-in user;
[0022] According to the target foreign language type of the currently logged-in user, a translation result of the target foreign language type corresponding to at least one reply corpus among the N reply corpora is determined.
[0023] Optionally, displaying the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items includes:
[0024] Sorting the N reply corpora in descending order according to the score corresponding to each reply corpus in the N reply corpora to obtain a first sorting result;
[0025] According to the first sorting result, each of the N reply corpora is sequentially displayed as a first-category candidate item, and the translation result corresponding to at least one reply corpus in the N reply corpora is displayed as a second-category candidate item at an adjacent position to the corresponding first-category candidate item.
[0026] Optionally, displaying the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items includes:
[0027] According to the usage frequency of the N reply corpora and the translation results corresponding to at least one of the N reply corpora by the current logged-in user, the N reply corpora and the translation results corresponding to at least one of the N reply corpora are sorted in descending order to obtain a second sorting result;
[0028] According to the second sorting result, the N reply corpora and the translation results corresponding to at least one of the N reply corpora are displayed in sequence as candidate items.
[0029] A second aspect of the present application provides an input device, the device comprising:
[0030] The acquisition module is used to obtain the target conversation context information;
[0031] A reply corpus determination module is used to determine N reply corpora corresponding to the target conversation context information according to the target conversation context information through a pre-trained dialogue model, where N is a positive integer; the dialogue model is trained based on historical context information and historical replies corresponding to the historical context information;
[0032] A translation result determination module, used to determine a translation result corresponding to at least one of the N reply corpora;
[0033] The candidate item display module is used to display the translation results corresponding to the N reply corpora and the at least one reply corpus as candidate items.
[0034] Optionally, the translation result determination module includes:
[0035] A first selection submodule is used to sort the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N;
[0036] The first determination submodule is used to determine the translation result corresponding to each reply corpus in the M reply corpora.
[0037] Optionally, the translation result determination module includes:
[0038] A second selection submodule is used to select M reply corpora commonly used by the current logged-in user from the N reply corpora, where M is less than N;
[0039] The second determination submodule is used to determine the translation result corresponding to each reply corpus in the M reply corpora.
[0040] Optionally, the translation result determination module is specifically configured to determine the translation results corresponding to any M reply corpora among the N reply corpora.
[0041] Optionally, the translation result determination module is specifically configured to determine, according to a commonly used foreign language type of a currently logged-in user, a translation result of the commonly used foreign language type corresponding to at least one reply corpus among the N reply corpora.
[0042] Optionally, the translation result determination module is specifically used to determine the target foreign language type of the currently logged-in user based on the current interaction information of the currently logged-in user, and determine the translation result of the target foreign language type corresponding to at least one of the N reply corpora based on the target foreign language type of the currently logged-in user.
[0043] Optionally, the candidate item display module includes:
[0044] A first sorting submodule, configured to sort the N reply corpora in descending order according to the score corresponding to each reply corpus in the N reply corpora to obtain a first sorting result;
[0045] The candidate item display submodule is used to sequentially display each of the N response corpora as a first-category candidate item according to the first sorting result, and to display the translation result corresponding to at least one response corpus among the N response corpora as a second-category candidate item at an adjacent position to the corresponding first-category candidate item.
[0046] Optionally, the candidate item display module includes:
[0047] A second sorting submodule is used to sort the N reply corpora and the translation results corresponding to at least one of the N reply corpora in descending order to obtain a second sorting result according to the usage frequency of the N reply corpora and the translation results corresponding to at least one of the N reply corpora by the current logged-in user;
[0048] The candidate item display submodule is used to sequentially display the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items according to the second sorting result.
[0049] In a third aspect, an embodiment of the present application provides an input device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations:
[0050] Get the target conversation context information;
[0051] Determining, by means of a pre-trained dialogue model, N response corpora corresponding to the target dialogue context information according to the target dialogue context information, where N is a positive integer; the dialogue model is trained according to the historical context information and the historical responses corresponding to the historical context information;
[0052] Determine a translation result corresponding to at least one of the N response corpora;
[0053] The translation results corresponding to the N reply corpora and the at least one reply corpus are displayed as candidate items.
[0054] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having instructions stored thereon, which, when executed by one or more processors, enables the device to execute the input method described in the first aspect.
[0055] The embodiment of the present application provides an input method, which can automatically provide the user with the reply corpus corresponding to the conversation context information as a reply candidate, and on this basis, it can further provide the user with the translation result corresponding to the reply corpus as a reply candidate, thus enriching the reply candidate that the intelligent reply function can provide. Specifically, in the input method provided in the embodiment of the present application, the target conversation context information is first obtained, and then the pre-trained dialogue model is used to determine the N (N is a positive integer) reply expectations corresponding to the target conversation context information according to the obtained target conversation context information, and then the translation result corresponding to at least one reply expectation in the N reply expectations is determined, and finally the N reply expectations and the translation result corresponding to at least one reply expectation are displayed as candidates. In this way, after the reply corpus corresponding to the target conversation context information is determined based on the dialogue model, the determined reply corpus is further translated, and finally the reply corpus and the translation result corresponding to the reply corpus are displayed to the user as candidates, so as to provide users with more diverse reply candidates, which is convenient for users to choose and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A schematic diagram of an application scenario of the input method provided in an embodiment of the present application;
[0057] Figure 2A schematic diagram of the flow of the input method provided in the embodiment of the present application;
[0058] Figure 3 A schematic diagram of a first chat scenario provided in an embodiment of the present application;
[0059] Figure 4 A schematic diagram of a second chat scenario provided in an embodiment of the present application;
[0060] Figure 5 A schematic diagram of the training principle of the dialogue model provided in the embodiment of the present application;
[0061] Figure 6 A schematic diagram showing the display of candidate items provided in an embodiment of the present application;
[0062] Figure 7 A schematic diagram of the structure of an input device provided in an embodiment of the present application;
[0063] Figure 8 A schematic diagram of the structure of an input device provided in an embodiment of the present application;
[0064] Fig. 9 A schematic diagram of the structure of a server device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0066] To facilitate understanding of the technical solution provided by this application, the background technology of this application will be described below.
[0067] The inventor discovered during the process of studying the existing intelligent reply solutions that the intelligent reply function in the current input method can automatically provide users with reply corpora corresponding to the previous information of the conversation during the user chat, but the reply corpora provided are usually only in one language, for example, only providing users with Chinese reply corpora. However, in many application scenarios, users may prefer to reply using reply corpora in other languages, such as replying using English reply corpora. At this time, users still need to manually input the reply content, which is a poor user experience.
[0068] In response to the above technical problems, an embodiment of the present application provides an input method, which specifically includes: first obtaining the target dialogue context information, then inputting the obtained target dialogue context information into a pre-trained dialogue model, using the dialogue model to determine N reply corpora corresponding to the target dialogue context information according to the target dialogue context information, the dialogue model is trained based on historical context information and historical reply corpora corresponding to the historical context information, then determining the translation results corresponding to at least one reply corpus in the N reply corpora, and finally displaying the translation results corresponding to the determined N reply corpora and at least one reply corpus as candidate items. In this way, on the basis of providing the user with the reply corpora corresponding to the target dialogue context information as candidate items, the user is further provided with the translation results corresponding to the reply corpora as candidate items, thus enriching the reply candidate items provided to the user by the intelligent reply function, facilitating the user's selection, and improving the user's experience.
[0069] It should be understood that the input method provided in the embodiment of the present application can be specifically applied to devices with natural language processing functions, such as terminal devices, servers, etc. Among them, the terminal device can be specifically a smart phone, a computer, a personal digital assistant (PDA), a tablet computer, etc.; the server can be specifically an application server or a Web server. When deployed specifically, the server can be an independent server or a cluster server.
[0070] To facilitate understanding of the input method provided in the embodiment of the present application, Figure 1 The application scenario shown explains and illustrates the input method.
[0071] See also Figure 1 , Figure 1 Schematic diagram of application scenarios of the input method provided in the embodiment of the present application. Figure 1 As shown, the application scenario includes: a terminal device 110 and a server 120, and the terminal device 110 and the server 120 can exchange data through a network; wherein an input method client is running in the terminal device 110, and the terminal device 110 can send the acquired context information of the target conversation to the server 120 through the network; the server 120 is used to execute the input method provided in the embodiment of the present application to provide the user with optional reply candidates.
[0072] In specific implementation, the terminal device 110 can obtain the target conversation content and the conversation information before the target conversation content as the target conversation context information; for example, during a chat between user A and user B, user A receives the target conversation content "I'm going to bed" sent by user B. At this time, the terminal device 110 used by user A can obtain "I'm going to bed" and several conversation messages between user A and user B before "I'm going to bed" as the target conversation context information; and then, the obtained target conversation context information is sent to the server 120 via the network.
[0073] After receiving the target conversation context information sent by the terminal device 110, the server 120 inputs the received target conversation context information into the pre-trained dialogue model, and uses the dialogue model to determine N reply corpora corresponding to the target conversation context information according to the target conversation context information; still taking the target conversation context information including "I'm going to sleep" and several dialogue messages between user A and user B before "I'm going to sleep" as an example, the server 120 can use the dialogue model to determine the reply corpora used to reply to "I'm going to sleep", such as "good night", "good night, dear", "good night, baby", etc. Further, the server 120 can select at least one reply corpus from the N reply corpora determined by the dialogue model, and translate the selected reply corpus to obtain the translation results corresponding to each of the selected reply corpora; for example, assuming that the reply corpora determined by the dialogue model include "good night", "good night, dear" and "good night, baby", the server 120 can select "good night" as the translation object and translate it into the corresponding English "good night". Finally, the server 120 uses the N reply corpora determined by the dialogue model and the translation results corresponding to at least one reply corpus selected from the N reply corpora as candidate items; for example, the reply corpora "good night", "good night, dear" and "good night, baby" determined by the dialogue model, as well as the translation result "good night" corresponding to "good night" are all used as candidate items; and these candidate items are sent to the terminal device 110 via the network.
[0074] After receiving the candidate items sent by the server 120, the terminal device 110 displays the candidate items in the candidate item display area accordingly, so as to facilitate the user to select the corpus used to reply to the target conversation content from the candidate items displayed in the candidate item display area.
[0075] It should be understood that Figure 1 The application scenarios shown are only examples. In actual applications, Figure 1The terminal device can determine candidate items by interacting with the server as shown, and the terminal device can also independently determine corresponding candidate items based on the context information of the target conversation, that is, the terminal device can independently perform the operation of determining the reply corpus corresponding to the context information of the target conversation using the conversation model, and the operation of translating the reply corpus. No limitation is made here to the application scenarios to which the input method provided in the embodiments of the present application is applicable.
[0076] The input method provided by the present application is introduced below through embodiments.
[0077] See also Figure 2 , Figure 2 The following is a flow chart of the input method provided in the embodiment of the present application. The input method is introduced below by taking the execution subject of the input method as a server as an example. Figure 2 As shown, the method comprises the following steps:
[0078] Step 201: Obtain the target conversation context information.
[0079] When a user uses an instant messaging client installed on a terminal device to chat, the input method client installed in the terminal device can, if it obtains relevant permissions, obtain target conversation information received through the instant messaging client, and obtain several pieces of conversation context information before the target conversation information, and send the target conversation information and several pieces of conversation context information before the target conversation information as target conversation context information to a server via a network, so that the server obtains the target conversation context information.
[0080] It should be noted that the above-mentioned target conversation information refers to the message received by the terminal device through the instant messaging client. The instant messaging client here includes but is not limited to WeChat, QQ and other chat applications; for example, when user A and user B are chatting through WeChat, user B receives the message "I'm going to bed" sent by user A, then the message "I'm going to bed" can be regarded as the target conversation information.
[0081] It should be noted that the present application does not impose any restrictions on the specific content of the target dialogue information, that is, the target dialogue information may include any type of dialogue information. In addition, the present application does not impose any restrictions on the expression form of the target dialogue information, and the target dialogue information may specifically include interrogative sentences, declarative sentences, imperative sentences, etc. In addition, the present application does not impose any restrictions on the format of the target dialogue information, and the target dialogue information may be information in text format, image format, video format, voice format, etc.
[0082] The multiple conversation context messages before the target conversation message refer to the multiple conversation messages before the instant messaging client receives the target conversation message. Figure 3As shown, when the target dialogue information is "I'm going to sleep", the dialogue context information before the target dialogue information specifically includes "Baby, what are you doing?", "Chasing TV series", "Then baby, watch the TV series, I'm going to play games", "Go ahead", etc.
[0083] It should be noted that the amount of conversation context information that the terminal device needs to obtain can be set according to actual needs. For example, it can be set to obtain all conversation information before the target conversation information as the conversation context information. For example, it can be set to obtain part of the conversation information before the target conversation information as the conversation context information. This application does not make any specific limitation on the amount of conversation context information that needs to be obtained.
[0084] It should also be noted that the embodiments of the present application do not limit the applicable chat scenarios, which can be Figure 3 The scene of two people chatting can also be Figure 4 The scenario of multi-person chat is shown, that is, group chat; in the scenario of two-person chat, the target conversation context information that the terminal device needs to obtain includes the target conversation information it receives and the conversation information of the two persons before the target conversation information (that is, the conversation context information); in the scenario of multi-person chat, the target conversation context information that the terminal device needs to obtain includes the target conversation information it receives and the conversation information in the group before the target conversation information (that is, the conversation context information).
[0085] It should be understood that when the execution subject of the method provided in the embodiment of the present application is a terminal device, after the terminal device obtains the target conversation context information in the above manner, it can directly perform subsequent operations on the target conversation information without sending the target conversation information to the server.
[0086] Step 202: Determine N response corpora corresponding to the target conversation context information according to the target conversation context information through a pre-trained conversation model.
[0087] After the server obtains the target conversation context information sent by the terminal device, the server inputs the obtained target conversation context information into a pre-trained conversation model, so that the conversation model performs predictive analysis based on the input target conversation context information and generates corresponding output results. Then, the server determines N reply corpora that can be used to reply to the target conversation information according to the output results generated by the conversation model, where N is an integer greater than or equal to 1.
[0088] It should be noted that the output result generated by the dialogue model may specifically include at least one corpus; it may also include at least one corpus and its corresponding score. The score corresponding to each corpus can represent the possibility of the corpus being selected by the user as the reply content of the target dialogue information. It should be understood that the higher the corresponding score, the greater the possibility that the corpus is selected by the user as the reply to the target dialogue information, and the lower the corresponding score, the smaller the possibility that the corpus is selected by the user as the reply to the target dialogue information.
[0089] When the output result of the dialogue model includes only at least one corpus, the server can directly use at least one corpus in the output result as the reply corpus corresponding to the context information of the target dialogue, that is, the number N of reply corpora determined is equal to the number of corpora included in the output result.
[0090] As an example, Figure 3 As shown, the terminal device sends the target dialogue information "I'm going to bed" sent by user A to user B and the dialogue information before "I'm going to bed" "Go ahead, go ahead; baby, watch the show, I'm going to play games;..." as target dialogue context information to the server; after the server receives the target dialogue context information, it inputs the target dialogue context information into the dialogue model, and the dialogue model generates the following output results after analyzing and processing the target dialogue context information: "Good night, baby", "Good night, kiss", "Good night, hug", and the server can directly use each corpus in the output result as a reply corpus.
[0091] Of course, the server can also select any N corpora as reply corpora, and no limitation is imposed on the way in which the server selects reply corpora.
[0092] When the output result of the dialogue model includes at least one corpus and its corresponding score, the server can select N reply corpora from the corpora included in the output result according to the score corresponding to each corpus in the output result, that is, the server can sort the score corresponding to each corpus in the output result in descending order, and then select the corpora corresponding to the top N scores as reply corpora.
[0093] As an example, Figure 3As shown, the terminal device sends the target dialogue information "I'm going to bed" sent by user A to user B and the dialogue information before "I'm going to bed" "Go ahead, go ahead; baby, watch the show, I'm going to play games;..." as target dialogue context information to the server; after receiving the target dialogue context information, the server inputs the target dialogue context information into the dialogue model, and the dialogue model generates the following output results after analyzing and processing the target dialogue context information: "Good night, baby" - 96 points, "Good night, kisses" - 85 points, "Good night, hug" - 76 points, "Good night" - 60 points; assuming that the reply corpus to be selected by the server includes 3, the server can sort the scores corresponding to each corpus in the output result in descending order, and select the top three corpuses corresponding to the scores "Good night, baby", "Good night, kisses" and "Good night, hug" as the reply corpus.
[0094] Of course, the server may not select the reply corpus based on the score corresponding to each corpus in the output results, that is, the server may directly use each corpus in the output results as the reply corpus, or may directly select N corpora from the output results as the reply corpus. No limitation is imposed on the way the server selects the reply corpus.
[0095] It should be noted that the above dialogue model is usually trained based on historical contextual information and historical response corpus corresponding to the historical contextual information, where the historical contextual information specifically includes historical target dialogue information and the dialogue context information before the historical target dialogue information, and the historical response corpus specifically refers to the user's response content to the historical target dialogue information. Figure 5 As shown, during specific training, the historical contextual information can be input into a pre-built initial dialogue model. The initial dialogue model processes the historical contextual information based on BiLSTM to obtain its corresponding vectorized representation Encode, and Encode is input into the hidden layer Hidden in the initial dialogue model. Then, the fully connected layer is used to perform a classification Classify task on the obtained vectorized representation, and finally the predicted response corpus corresponding to the historical contextual information is output. Then, according to the gap between the predicted response corpus and the historical response corpus corresponding to the historical contextual information, the model parameters of the initial dialogue model are adjusted. In this way, the model parameters of the initial dialogue model are repeatedly iteratively adjusted using the historical contextual information and the historical response corpus corresponding to the historical contextual information until the trained model meets the training end conditions.
[0096] Step 203: Determine a translation result corresponding to at least one of the N response corpora.
[0097] After the server determines N response corpora based on the dialogue model, it further selects at least one response corpus from the N response corpora, and translates the at least one response corpus into a specified language such as English, Korean, Japanese, etc., to obtain a translation result corresponding to each of the at least one response corpus.
[0098] In specific implementation, the server can determine the translation result corresponding to at least one reply corpus based on the translation result pairs stored therein; that is, a large number of translation result pairs are stored inside the server, each translation result pair includes a corpus and its corresponding translation result, and after the server selects at least one reply corpus from N reply corpora, it further searches for the translation result corresponding to each reply corpus based on the translation result pairs stored therein.
[0099] Of course, in actual applications, in addition to determining the translation result corresponding to at least one reply corpus based on the translation result, the server can also use other methods to determine the translation result corresponding to at least one reply corpus, such as using a translation model to determine the translation result. This application does not impose any limitation on the way the server determines the translation result corresponding to at least one reply corpus.
[0100] In one possible implementation, if the output result of the dialogue model includes corpora and scores corresponding to the corpora, the server may sort the N reply corpora in descending order according to the scores of each of the N reply corpora, and then select the top M (M is less than N) reply corpora from the N reply corpora; and determine the translation results corresponding to each of the M reply corpora.
[0101] Specifically, when the output result of the dialogue model includes the corpus and the score corresponding to the corpus, the server can sort the scores corresponding to each of the N reply corpora in descending order. Since the higher the score corresponding to the corpus, the greater the possibility that the corpus is selected by the user as a reply to the target dialogue information, the server can select the top M reply corpora as translation objects, that is, the server can select the M reply corpora that are most likely to be selected by the user as a reply to the target dialogue information as translation objects; then, the server translates the M reply corpora into the specified language type to obtain the translation results corresponding to each of the M reply corpora.
[0102] As an example, assume that the reply corpus determined by the server includes "Good night, baby", "Good night, kisses", and "Good night, hug", among which the score corresponding to "Good night, baby" is 96 points, the score corresponding to "Good night, kisses" is 85 points, and the score corresponding to "Good night, hug" is 76 points; assuming that M is equal to 1, it means that the server can only select one reply corpus from the above three reply corpora as the translation object. In this case, the server can sort the scores corresponding to each of the three reply corpora in descending order, and finally determine the reply corpus "Good night, baby" with the highest score as the translation object, and translate it into English to obtain the translation result "good night, baby".
[0103] It should be understood that in practical applications, M can be any positive integer less than N, and this application does not impose any limitation on the number of translation objects. In addition, in addition to sorting the reply corpora in descending order according to the scores, the server can also sort the reply corpora in ascending order according to the scores, and select the M reply corpora with the lowest ranking for translation.
[0104] In another possible implementation, the server may select several frequently used reply corpora for translation according to the user's chat habits. That is, the server may select M frequently used reply corpora by the currently logged-in user from N reply corpora; and then determine the translation result corresponding to each of the M reply corpora.
[0105] It should be noted that for each user who has registered an input method client, the server will record the user's use of the reply corpus based on the user's use of the input method. For example, the server records the historical usage counts of each reply corpus used by each user. After the server determines N reply corpora based on the dialogue model, it can further call the historical usage counts of each reply corpus recorded for the currently logged-in user to determine the historical usage counts of each of the N reply corpora, and then sort the N reply corpora in descending order according to the historical usage counts of each of the N reply corpora, select the top M reply corpora as translation objects, translate the M reply corpora into the specified language, and obtain their corresponding translation results.
[0106] As an example, assume that the reply corpus determined by the server includes "Good night, baby", "Good night, kisses", and "Good night, hug", among which the historical usage number of "Good night, baby" is 52 times, the historical usage number of "Good night, kisses" is 36 times, and the historical usage number of "Good night, hug" is 20 times; assuming that M is equal to 1, it means that the server can only select one reply corpus from the above three reply corpora as the translation object. In this case, the server can sort the historical usage times corresponding to each of the three reply corpora in descending order, and finally determine "Good night, baby" with the largest historical usage times as the translation object, and translate it into English to obtain the translation result "good night, baby".
[0107] It should be understood that in practical applications, M can be any positive integer less than N, and this application does not impose any limitation on the number of translation objects. In addition, in addition to sorting the reply corpora in descending order according to the number of historical uses, the server can also sort the reply corpora in ascending order according to the number of historical uses, and select the M reply corpora with the lowest order for translation.
[0108] In addition, in addition to using the historical usage count of the reply corpus to reflect the user's usage habits of the reply corpus, the server can also use other data such as historical usage frequency to reflect the user's usage habits of the reply corpus. No limitation is made here to the data used to reflect the user's usage habits of the reply corpus, that is, no limitation is made to the measurement data used to evaluate whether the reply corpus is frequently used by users.
[0109] In another possible implementation, the server may determine the translation results corresponding to any M reply corpora from the N reply corpora, that is, the server may select any M reply corpora from the N reply corpora as translation objects, and translate them into a specified language type to obtain translation results.
[0110] As an example, assuming that the reply corpus determined by the server includes "Good night, baby", "Good night, kiss", and "Good night, hug", and the preset M is equal to 1, the server can select "Good night, baby" as the translation object, and can also select "Good night, kiss" as the translation object, and can also select "Good night, hug" as the translation object, and then translate the selected translation objects into corresponding translation results.
[0111] It should be noted that the above three possible implementation methods are only examples. In actual applications, the server can take all N reply corpora as translation objects and translate these N reply corpora accordingly; it can also select part of the reply corpora from the N reply corpora as translation objects, and translate the selected part of the reply corpora accordingly. When selecting the translation object, the server can adopt the above three implementation methods or other implementation methods. This application does not impose any limitation on the implementation method of the server selecting the translation object.
[0112] It should be noted that, in actual applications, when the server translates at least one reply corpus, it is also necessary to determine the specified language type, that is, determine the language type to which the translation result belongs.
[0113] In a possible implementation, the server may determine, according to the commonly used foreign language type of the currently logged-in user, a translation result of the commonly used foreign language type corresponding to at least one reply corpus among the N reply corpora.
[0114] Specifically, for each user who has registered an input method client, the server will record the language types used by the user and the corresponding historical usage times of each language type based on the user's use of the input method; for example, based on the registered user's use of the input method, the server can record the language types used by the user, including Chinese, English, and Japanese, where the corresponding historical usage times for Chinese are 1,600 times, the corresponding historical usage times for English are 500 times, and the corresponding historical usage times for Japanese are 50 times.
[0115] When the server determines the language type based on which the translation operation is to be performed, it can call the language type recorded for the currently logged-in user and the corresponding historical usage times of each language type, and determine the commonly used foreign language type of the currently logged-in user based on this. Specifically, the server can exclude the language type to which the reply corpus belongs, and then determine the language type with the most historical usage times as the commonly used foreign language type of the currently logged-in user based on the historical usage times of each of the other language types used by the currently logged-in user, and then translate at least one reply corpus selected from the N reply corpora into a corpus belonging to the commonly used foreign language type as the translation result.
[0116] As an example, suppose that the server records the language types used by the currently logged-in user, including Chinese, English and Japanese, among which the historical usage times for Chinese is 1,600 times, the historical usage times for English is 500 times, and the historical usage times for Japanese is 50 times; since the reply corpus determined by the server is Chinese corpus, the server can determine the commonly used foreign language type of the currently logged-in user based on the historical usage times for English and the historical usage times for Japanese; since the historical usage times for English are higher than the historical usage times for Japanese, English can be used as the commonly used foreign language type of the currently logged-in user, and then the selected reply corpora are all translated into corresponding English corpora.
[0117] In another possible implementation, the server may determine the target foreign language type of the currently logged-in user based on the current interaction information of the currently logged-in user; and further, based on the target foreign language type, determine the translation result of the target foreign language type corresponding to at least one of the N reply corpora.
[0118] Specifically, when the server determines the language type based on which the translation operation is to be performed, the server can obtain the current interaction information of the currently logged-in user, which refers to the interaction information within a preset period of time involved in the chat session in which the currently logged-in user is located, which can include both information sent by the currently logged-in user and information sent by other users in the chat session; further, the target foreign language type is determined based on the current interaction information, and specifically, the language type that appears most frequently in the current interaction information except the language type corresponding to the reply corpus can be determined as the target foreign language type, and the language type used by the currently logged-in user except the language type corresponding to the reply corpus can also be determined as the target foreign language type, and the language type used by other users in the chat session except the language type corresponding to the reply corpus can also be determined as the target foreign language type. The method for determining the target foreign language type is not limited in any way. Further, at least one reply corpus selected from the N reply corpuses is correspondingly translated into a corpus belonging to the target foreign language type as a translation result.
[0119] As an example, the server obtains the current interactive information of the currently logged-in user, including the information "baby", "what are you doing" sent by user B and the information "chasing drama" sent by user A; since the language type corresponding to the reply corpus is Chinese, the server can use the language type that appears most frequently in the current interactive information other than Chinese, that is, English, as the target language type; it can also use the language type other than Chinese used by the currently logged-in user B, that is, English, as the target language type. Then, all the selected reply corpora are translated into corresponding English corpora. It should be understood that in actual applications, in addition to determining the specified language type based on which the translation operation is performed in the above manner, the server can also determine the specified language type based on which the translation operation is performed in other ways, for example, setting a certain language type as the specified language type by default, or determining the specified language type based on the user's settings. This application does not limit the method of determining the specified language type.
[0120] In addition, in actual applications, in addition to translating the selected response corpus into one language type, the server can also translate the selected response corpus into multiple language types, that is, multiple corresponding translation results are obtained for the same response corpus, and each translation result belongs to a different language type. This application does not impose any limitation on the number of specified language types.
[0121] Step 204: Displaying the translation results corresponding to the N reply corpora and the at least one reply corpus as candidate items.
[0122] The server uses the N reply corpora obtained in step 202 and the translation results corresponding to at least one reply corpus obtained in step 203 as candidate items, and sends these candidate items to the terminal device through the network. After the terminal device receives the candidate items sent by the server, it displays each candidate item in the reply candidate item display area accordingly, so that the user can select appropriate reply content from the reply candidate item display area to reply to the target dialogue information.
[0123] In one possible implementation, if the output result of the dialogue model includes corpora and scores corresponding to the corpora, the server may sort the N reply corpora in descending order according to the scores corresponding to each of the N reply corpora to obtain a first sorting result; then, according to the first sorting result, each of the N reply corpora is sequentially displayed as a first-category candidate, and the translation result corresponding to at least one reply corpus in the N reply results is displayed as a second-category candidate adjacent to the corresponding first-category candidate.
[0124] Specifically, the server can determine the display order of the N reply corpora according to the scores corresponding to each of the N reply corpora output by the dialogue model, that is, determine that the N reply corpora are displayed from top to bottom in the order of scores from high to low; in addition, for the translation result corresponding to at least one reply corpus in the candidate items, the server can determine to display it in the adjacent position of the reply corpus corresponding to itself, such as below the corresponding reply corpus, to the right of the corresponding reply corpus, etc. When the server sends the candidate items to the terminal device, it also sends the display order corresponding to each candidate item to the terminal device, so that the terminal device displays each candidate item in the reply candidate item display area based on the display order corresponding to each candidate item.
[0125] As an example, assuming that the candidate items determined by the server include "good night, baby", "good night, muah", "good night, hug" and the corresponding translation result of "good night, baby", the server determines that "good night, baby", "good night, muah", "good night, hug" and "good night, baby" should be displayed in order from top to bottom based on the scores corresponding to "good night, baby", "good night, muah", "good night, hug" and "good night, baby", and displays the corresponding translation result of "good night, baby" "good night, baby" in the adjacent position of "good night, baby". Figure 6 As shown, in the reply candidate display area, "Good night, baby", "Good night, kiss", "Good night, hug" and "Good night, baby" are displayed in order from top to bottom, and "good night, baby" is displayed below "Good night, baby", that is, between "Good night, baby" and "Good night, kiss".
[0126] It should be understood that in actual applications, the adjacent position corresponding to the reply corpus can also be other positions, such as the right area horizontally aligned with the reply corpus, above the reply corpus, etc. This application does not make specific limitations on the adjacent position corresponding to the reply corpus (i.e., the position where the translation result corresponding to the reply corpus is displayed).
[0127] It should be noted that, in actual applications, the server may also directly send the scores corresponding to each of the N reply corpora to the terminal device, so that the terminal device determines the display order of the N reply corpora and the translation results corresponding to each of the at least one reply corpus based on the scores corresponding to each of the N reply corpora.
[0128] In another possible implementation, the server may sort the N reply corpora and the translation results corresponding to at least one of the N reply corpora in descending order according to the frequency of use of the N reply corpora and the translation results corresponding to at least one of the N reply corpora by the currently logged-in user to obtain a second sorting result; and then, according to the second sorting result, the N reply corpora and the translation results corresponding to at least one of the N reply corpora are selected as candidates and displayed in sequence.
[0129] Specifically, for each user who has registered an input method client, the server will record the user's use of the reply corpus based on the user's use of the input method, including the historical frequency of use of the reply corpus, which includes both the user's use frequency of Chinese reply corpus and the user's use frequency of foreign reply corpus. In this case, the server can call the historical frequency of use of the reply corpus recorded for the currently logged-in user, determine the historical frequency of use corresponding to each of the N reply corpora, and the historical frequency of use of the translation result corresponding to at least one reply corpus, and then, according to the historical frequency of use corresponding to each of the N reply corpora and the historical frequency of use of the translation result corresponding to at least one reply corpus, sort the N reply corpora and the translation result corresponding to at least one reply corpus in descending order to obtain a second sorting result; the server sends the second sorting result together with the candidate items to the terminal device, so that the terminal device can display the N reply corpora and the translation result corresponding to at least one reply corpus in order in the reply candidate display area based on the second sorting result.
[0130] As an example, suppose that the candidate items determined by the server include "good night, baby", "good night, kisses", "good night, hug" and the translation result "good night, baby" corresponding to "good night, baby", among which the historical usage frequency of "good night, baby" is 52 times, the historical usage frequency of "good night, kisses" is 36 times, the historical usage frequency of "good night, hug" is 20 times, and the historical usage frequency of "good night, baby" is 43 times; the server determines the second sorting result to display "good night, baby", "goodnight, baby", "good night, kisses", and "good night, hug" in order from top to bottom according to the historical usage frequencies corresponding to the above candidate items; the candidate items and the second sorting result are sent to the terminal device, and the terminal device will respond accordingly. Figure 6 The interface shown, that is, in the reply candidate display area, displays "Good night, baby", "good night, baby", "Good night, kiss", and "Good night, hug" in order from top to bottom.
[0131] It should be noted that, in actual applications, the server may also directly send the historical usage frequencies corresponding to the N reply corpora and the translation results corresponding to at least one reply corpus to the terminal device, so that the terminal device determines a second sorting result based on the historical usage frequencies corresponding to the N reply corpora and the translation results corresponding to at least one reply corpus, and displays each candidate item based on the second sorting result.
[0132] It should be understood that in actual applications, the server or terminal device can also determine the display order corresponding to each candidate item in other ways, and this application does not impose any limitation on the implementation method of determining the display order.
[0133] The above input method not only provides users with reply corpus corresponding to the previous information of the target conversation as candidate items, but also further provides users with translation results corresponding to the reply corpus as candidate items. This enriches the reply candidate items provided to users by the intelligent reply function, facilitates user selection, and improves the user experience.
[0134] Based on the input method provided in the above method embodiment, the embodiment of the present application also provides an input device, which is explained and illustrated below in conjunction with the accompanying drawings.
[0135] See also Figure 7 , Figure 7 A schematic diagram of the structure of an input device provided in an embodiment of the present application.
[0136] The input device provided in the embodiment of the present application includes:
[0137] The acquisition module 701 is used to acquire the target conversation context information;
[0138] A reply corpus determination module 702 is used to determine N reply corpora corresponding to the target conversation context information according to the target conversation context information through a pre-trained conversation model, where N is a positive integer; the conversation model is trained based on historical context information and historical replies corresponding to the historical context information;
[0139] A translation result determination module 703 is used to determine a translation result corresponding to at least one of the N reply corpora;
[0140] The candidate item display module 704 is used to display the translation results corresponding to the N reply corpora and the at least one reply corpus as candidate items.
[0141] In a possible implementation, the translation result determination module 703 includes:
[0142] A first selection submodule is used to sort the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N;
[0143] The first determination submodule is used to determine the translation result corresponding to each reply corpus in the M reply corpora.
[0144] In a possible implementation, the translation result determination module 703 includes:
[0145] A second selection submodule is used to select M reply corpora commonly used by the current logged-in user from the N reply corpora, where M is less than N;
[0146] The second determination submodule is used to determine the translation result corresponding to each reply corpus in the M reply corpora.
[0147] In a possible implementation, the translation result determination module 703 is specifically configured to determine a translation result corresponding to one of the N reply corpora.
[0148] In a possible implementation, the translation result determination module 703 is specifically configured to determine, according to the commonly used foreign language type of the currently logged-in user, a translation result of the commonly used foreign language type corresponding to at least one reply corpus among the N reply corpora.
[0149] In a possible implementation, the translation result determination module 703 is specifically used to determine the target foreign language type of the currently logged-in user based on the current interaction information of the currently logged-in user, and determine the translation result of the target foreign language type corresponding to at least one of the N reply corpora based on the target foreign language type of the currently logged-in user.
[0150] In a possible implementation, the candidate item display module 704 includes:
[0151] A first sorting submodule, configured to sort the N reply corpora in descending order according to the score corresponding to each reply corpus in the N reply corpora to obtain a first sorting result;
[0152] The candidate item display submodule is used to sequentially display each of the N response corpora as a first-category candidate item according to the first sorting result, and to display the translation result corresponding to at least one response corpus among the N response corpora as a second-category candidate item at an adjacent position to the corresponding first-category candidate item.
[0153] In a possible implementation, the candidate item display module 704 includes:
[0154] A second sorting submodule is used to sort the N reply corpora and the translation results corresponding to at least one of the N reply corpora in descending order to obtain a second sorting result according to the usage frequency of the N reply corpora and the translation results corresponding to at least one of the N reply corpora by the current logged-in user;
[0155] The candidate item display submodule is used to sequentially display the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items according to the second sorting result.
[0156] It should be noted that the specific implementation of each module in this embodiment can be found in the above method embodiment, and this embodiment will not be repeated here.
[0157] Figure 8 8 is a block diagram of an input device 800. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0158] Reference Figure 8 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0159] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0160] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0161] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.
[0162] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0163] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0164] The I / O interface provides an interface between the processing component 802 and the peripheral interface module, which may be a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0165] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0166] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0167] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the following methods:
[0168] Get the target conversation context information;
[0169] Determine, by means of a pre-trained dialogue model, N response corpora corresponding to the target dialogue context information according to the target dialogue context information, where N is a positive integer; the dialogue model is trained according to the historical context information and the historical response corpora corresponding to the historical context information;
[0170] Determine a translation result corresponding to at least one of the N response corpora;
[0171] The translation results corresponding to the N reply corpora and the at least one reply corpus are displayed as candidate items.
[0172] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0173] Arrange the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N;
[0174] Determine a translation result corresponding to each of the M reply corpora.
[0175] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0176] Selecting M reply corpora frequently used by the current logged-in user from the N reply corpora, where M is less than N;
[0177] Determine a translation result corresponding to each of the M reply corpora.
[0178] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0179] Determine a translation result corresponding to any one of the N reply corpora.
[0180] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0181] According to the commonly used foreign language type of the currently logged-in user, a translation result of the commonly used foreign language type corresponding to at least one reply corpus in the N reply corpora is determined.
[0182] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0183] Determine the target foreign language type of the currently logged-in user according to the current interaction information of the currently logged-in user;
[0184] According to the target foreign language type of the currently logged-in user, a translation result of the target foreign language type corresponding to at least one reply corpus among the N reply corpora is determined.
[0185] Optionally, displaying the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items includes:
[0186] Sorting the N reply corpora in descending order according to the score corresponding to each reply corpus in the N reply corpora to obtain a first sorting result;
[0187] According to the first sorting result, each of the N reply corpora is sequentially displayed as a first-category candidate item, and the translation result corresponding to at least one reply corpus in the N reply corpora is displayed as a second-category candidate item at an adjacent position to the corresponding first-category candidate item.
[0188] Optionally, displaying the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items includes:
[0189] According to the usage frequency of the N reply corpora and the translation results corresponding to at least one of the N reply corpora by the current logged-in user, the N reply corpora and the translation results corresponding to at least one of the N reply corpora are sorted in descending order to obtain a second sorting result;
[0190] According to the second sorting result, the N reply corpora and the translation results corresponding to at least one of the N reply corpora are displayed in sequence as candidate items.
[0191] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform an input method, the method comprising:
[0192] Get the target conversation context information;
[0193] Determine, by means of a pre-trained dialogue model, N response corpora corresponding to the target dialogue context information according to the target dialogue context information, where N is a positive integer; the dialogue model is trained according to the historical context information and the historical response corpora corresponding to the historical context information;
[0194] Determine a translation result corresponding to at least one of the N response corpora;
[0195] The translation results corresponding to the N reply corpora and the at least one reply corpus are displayed as candidate items.
[0196] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0197] Arrange the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N;
[0198] Determine a translation result corresponding to each of the M reply corpora.
[0199] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0200] Selecting M reply corpora frequently used by the current logged-in user from the N reply corpora, where M is less than N;
[0201] Determine a translation result corresponding to each of the M reply corpora.
[0202] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0203] Determine a translation result corresponding to any one of the N reply corpora.
[0204] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0205] According to the commonly used foreign language type of the currently logged-in user, a translation result of the commonly used foreign language type corresponding to at least one reply corpus in the N reply corpora is determined.
[0206] Optionally, determining a translation result corresponding to at least one of the N reply corpora includes:
[0207] Determine the target foreign language type of the currently logged-in user according to the current interaction information of the currently logged-in user;
[0208] According to the target foreign language type of the currently logged-in user, a translation result of the target foreign language type corresponding to at least one reply corpus among the N reply corpora is determined.
[0209] Optionally, displaying the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items includes:
[0210] Sorting the N reply corpora in descending order according to the score corresponding to each reply corpus in the N reply corpora to obtain a first sorting result;
[0211] According to the first sorting result, each of the N reply corpora is sequentially displayed as a first-category candidate item, and the translation result corresponding to at least one reply corpus in the N reply corpora is displayed as a second-category candidate item at an adjacent position to the corresponding first-category candidate item.
[0212] Optionally, displaying the N reply corpora and the translation results corresponding to at least one of the N reply corpora as candidate items includes:
[0213] According to the usage frequency of the N reply corpora and the translation results corresponding to at least one of the N reply corpora by the current logged-in user, the N reply corpora and the translation results corresponding to at least one of the N reply corpora are sorted in descending order to obtain a second sorting result;
[0214] According to the second sorting result, the N reply corpora and the translation results corresponding to at least one of the N reply corpora are displayed in sequence as candidate items.
[0215] Fig. 9 9 is a schematic diagram of the structure of the server in an embodiment of the present invention. The server 900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 922 (for example, one or more processors) and memory 932, and one or more storage media 930 (for example, one or more mass storage devices) storing application programs 942 or data 944. Among them, the memory 932 and the storage medium 930 can be short-term storage or permanent storage. The program stored in the storage medium 930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 922 can be configured to communicate with the storage medium 930 to execute a series of instruction operations in the storage medium 930 on the server 900.
[0216] The terminal 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input and output interfaces 956, one or more keyboards 956, and / or one or more operating systems 941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0217] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0218] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0219] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0220] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0221] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An input method, characterized in that: The method comprises: Acquire target conversation context information; the target conversation context information includes target conversation information and conversation information before the target conversation information; Determine, by means of a pre-trained dialogue model, N response corpora corresponding to the target dialogue context information and scores corresponding to the N response corpora according to the target dialogue context information, where N is a positive integer; the dialogue model is trained based on historical context information and historical response corpora corresponding to the historical context information; Arrange the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N; Determine a translation result corresponding to each reply corpus in the M reply corpora, wherein a plurality of corresponding translation results are obtained by translating the same reply corpus in the M reply corpora, and the plurality of corresponding translation results belong to different language types; According to the usage frequency of the N reply corpora and the translation results corresponding to M of the N reply corpora by the current logged-in user, the N reply corpora and the translation results corresponding to M of the N reply corpora are sorted in descending order to obtain a second sorting result; According to the second sorting result, the N reply corpora and the translation results corresponding to M of the N reply corpora are displayed in sequence as candidate items.
2. An input method according to claim 1, characterized in that: The determining of the translation result corresponding to each of the M reply corpora includes: According to the commonly used foreign language type of the currently logged-in user, the translation results of the commonly used foreign language type corresponding to each of the M reply corpora are determined.
3. An input method according to claim 1, characterized in that: The determining of the translation result corresponding to each of the M reply corpora includes: Determine the target foreign language type of the currently logged-in user according to the current interaction information of the currently logged-in user; According to the target foreign language type of the currently logged-in user, translation results of the target foreign language type corresponding to each of the M reply corpora are determined.
4. An input device, characterized in that: The device comprises: An acquisition module, used to acquire target conversation context information; the target conversation context information includes the target conversation information and conversation information before the target conversation information; A reply corpus determination module is used to determine N reply corpora corresponding to the target conversation context information according to the target conversation context information through a pre-trained dialogue model, where N is a positive integer; the dialogue model is trained based on historical context information and historical replies corresponding to the historical context information; A first selection submodule is used to sort the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N; A first determination submodule is used to determine a translation result corresponding to each reply corpus in the M reply corpora, wherein a plurality of corresponding translation results are obtained by translating the same reply corpus in the M reply corpora, and the plurality of corresponding translation results belong to different language types; A second sorting submodule is used to sort the N reply corpora and the translation results corresponding to the M reply corpora in the N reply corpora in descending order to obtain a second sorting result according to the usage frequency of the N reply corpora and the translation results corresponding to the M reply corpora in the N reply corpora by the current logged-in user; The candidate item display submodule is used to sequentially display the N reply corpora and the translation results corresponding to M of the N reply corpora as candidate items according to the second sorting result.
5. An input device according to claim 4, characterized in that: The translation result determination module is specifically used to determine the translation results of the commonly used foreign language types corresponding to each of the M reply corpora according to the commonly used foreign language types of the currently logged-in user.
6. An input device according to claim 4, characterized in that: The translation result determination module is specifically used to determine the target foreign language type of the currently logged-in user according to the current interaction information of the currently logged-in user, and to determine the translation results of the target foreign language type corresponding to each of the M reply corpora according to the target foreign language type of the currently logged-in user.
7. An input device, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations: Acquire target conversation context information; the target conversation context information includes target conversation information and conversation information before the target conversation information; Determine, by means of a pre-trained dialogue model, N response corpora corresponding to the target dialogue context information according to the target dialogue context information, where N is a positive integer; The dialogue model is trained based on historical text information and historical responses corresponding to the historical text information; Arrange the N reply corpora in descending order according to the score of each reply corpus in the N reply corpora, and select M reply corpora with the highest ranking from the N reply corpora, where M is less than N; Determine a translation result corresponding to each reply corpus in the M reply corpora, wherein a plurality of corresponding translation results are obtained by translating the same reply corpus in the M reply corpora, and the plurality of corresponding translation results belong to different language types; According to the usage frequency of the N reply corpora and the translation results corresponding to M of the N reply corpora by the current logged-in user, the N reply corpora and the translation results corresponding to M of the N reply corpora are sorted in descending order to obtain a second sorting result; According to the second sorting result, the translation results corresponding to the N reply corpora and the M reply corpora are displayed in sequence as candidate items.
8. An input device according to claim 7, characterized in that: The processor determines a translation result corresponding to each of the M reply corpora, including: According to the commonly used foreign language type of the currently logged-in user, the translation results of the commonly used foreign language type corresponding to each of the M reply corpora are determined.
9. An input device according to claim 7, characterized in that: The processor determines a translation result corresponding to each of the M reply corpora, including: Determine the target foreign language type of the currently logged-in user according to the current interaction information of the currently logged-in user; According to the target foreign language type of the currently logged-in user, a translation result of the target foreign language type corresponding to each of the M reply corpora is determined.
10. A computer-readable storage medium, characterized in that: The method comprises instructions for instructing a device to execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Reply information recommendation method and apparatus
CN105095182A
Translation chatting device
CN109873743A
Intelligent dialogue method and device, storage medium and equipment
CN110209897A