Chat message processing method and device, equipment and storage medium
By receiving chat messages in the instant messaging software and performing event extraction, the problem of wasting time for users to find important information in a large number of chat records is solved, and real-time event extraction and information processing efficiency is improved.
Patent Information
- Application Number
- CN202310964520.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2025-02-18
AI Technical Summary
In the group chat function of instant messaging software, users need to flip through a large number of chat records to find important information, which leads to wasted time and is easily overwhelmed.
After receiving the current chat message in the chat interface, convert it into a word vector, and enter a pre-trained event extraction model to perform event extraction, and determine the target event extraction result of the chat content.
Real-time event extraction is realized, helping users quickly understand chat content, improve information processing efficiency, save time to read chat records, and reduce chat message processing time and storage space.
Smart Images

Figure CN119474384A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of instant messaging, and in particular to a chat message processing method, device, equipment and storage medium. Background Art
[0002] With the development of Internet technology, society has entered the era of mobile communications, and people frequently use instant messaging software for daily social and work communications. Usually, when a user does not open a communication software for a period of time, hundreds or even thousands of unread messages will accumulate. This situation is more obvious in the group chat function of the communication software. Although the group chat function can realize multi-person communication, it will also generate a large number of messages in a short period of time due to the increase in the number of chatters. After the chat, the user needs to carefully browse through the numerous chat records to find the required information, which is very time-consuming.
[0003] Therefore, how to prevent users from missing important event information in unread messages and save users time in browsing chat records has become one of the technical problems that need to be solved urgently. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the embodiments of the present disclosure provide a chat message processing method, device, equipment and storage medium to solve the defects in the related art.
[0005] According to a first aspect of an embodiment of the present disclosure, a chat message processing method is provided, the method comprising:
[0006] In response to receiving a current chat message in the chat interface, converting a word in the current chat message into a first word vector;
[0007] Inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message;
[0008] Based on the current event extraction result, a target event extraction result corresponding to the current chat content is determined, where the current chat content is a plurality of chat messages received in the chat interface including the current chat message.
[0009] In some embodiments, the event extraction result includes the event type and event description information, and the event extraction model includes an encoder and a decoder;
[0010] The step of inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message includes:
[0011] Inputting the first word vector into the encoder to obtain an encoding vector;
[0012] Determine the event type based on the encoding vector;
[0013] Inputting the encoding vector into the decoder to obtain a decoding vector;
[0014] The current event description information is determined based on the decoding vector.
[0015] In some embodiments, the encoder includes a first multi-head self-attention module Multi-Head Attention, a first residual connection and layer normalization operation module Add&Norm, a first feedforward connection layer FeedForward, and a second residual connection and layer normalization operation module Add&Norm connected in sequence;
[0016] The step of inputting the first word vector into the encoder comprises:
[0017] Input the first word vector into the first multi-head self-attention module.
[0018] In some embodiments, the encoder is sequentially connected to a first fully connected layer Linear and a first normalization operation layer Softmax;
[0019] The determining the event type based on the encoding vector includes:
[0020] The encoding vector is processed by the first fully connected layer Linear and the first normalization operation layer Softmax in sequence to obtain the event type.
[0021] In some embodiments, inputting the encoding vector into the decoder comprises:
[0022] The historical event description information and the encoding vector are input into the decoder, wherein the historical event description information is the event description information in the historical event extraction result extracted based on the historical chat message, and the historical chat message is the chat message in the current chat content whose receiving time is earlier than the current chat message.
[0023] In some embodiments, the decoder includes a masked multi-head self-attention module MaskedMulti-Head Attention, a third residual connection and layer normalization operation module Add&Norm, a second multi-head self-attention module Multi-Head Attention, a fourth residual connection and layer normalization operation module Add&Norm, a second feedforward connection layer FeedForward, and a fifth residual connection and layer normalization operation module Add&Norm connected in sequence;
[0024] The step of inputting the historical event description information and the encoding vector into the decoder comprises:
[0025] Converting words in the historical event description information into a second word vector, and inputting the second word vector into the masked multi-head self-attention module;
[0026] The encoded vector is input into the second multi-head self-attention module.
[0027] In some embodiments, the decoder is sequentially connected to a second fully connected layer Linear and a second normalization operation layer Softmax;
[0028] The determining the current event description information based on the decoding vector includes:
[0029] The encoding vector is processed by the second fully connected layer Linear and the second normalization operation layer Softmax in sequence to obtain the description information of the current event.
[0030] In some embodiments, the method further comprises:
[0031] In response to the current chat message satisfying a set condition, executing the operation of converting a word in the current chat message into a first word vector;
[0032] The current chat message satisfies a set condition, including at least one of the following:
[0033] No other chat messages are received within a set time period before receiving the current chat message;
[0034] The current chat message is the first unviewed chat message displayed in the chat interface;
[0035] The current chat message includes a set trigger word.
[0036] In some embodiments, the step of determining the target event extraction result corresponding to the current chat content based on the current event extraction result includes:
[0037] In response to the fact that the current chat message is irrelevant to the historical event extraction result, the current event extraction result is used as the target event extraction result. The historical event extraction result is the result obtained by extracting events based on historical chat messages. The historical chat message is a chat message in the current chat content that is received earlier than the current chat message.
[0038] In some embodiments, the step of determining the target event extraction result corresponding to the current chat content based on the current event extraction result includes:
[0039] In response to the current chat message being related to a historical event extraction result, the historical event extraction result is verified based on the current event extraction result, the historical event extraction result being a result obtained by extracting an event based on a historical chat message, and the historical chat message being a chat message in the current chat content that is received earlier than the current chat message;
[0040] In response to the mismatch between the current event extraction result and the historical event extraction result, based on the current event description information in the current event extraction result, the historical event description information in the historical event extraction result is updated, and the updated historical event extraction result is used as the target event extraction result.
[0041] According to a second aspect of an embodiment of the present disclosure, a chat message processing device is provided, the device comprising:
[0042] A vector conversion module, configured to, in response to receiving a current chat message in the chat interface, convert a word in the current chat message into a first word vector;
[0043] A result acquisition module, used to input the first word vector into a pre-trained event extraction model to obtain the event extraction result corresponding to the current chat message;
[0044] A result determination module is used to determine the target event extraction result corresponding to the current chat content based on the current event extraction result. The current chat content is a plurality of chat messages received in the chat interface, including the current chat message.
[0045] In some embodiments, the event extraction result includes the event type and event description information, and the event extraction model includes an encoder and a decoder;
[0046] The result acquisition module comprises:
[0047] A vector encoding unit, used for inputting the first word vector into the encoder to obtain an encoding vector;
[0048] A type determination unit, configured to determine the type of the event based on the encoding vector;
[0049] A vector decoding unit, used for inputting the encoding vector into the decoder to obtain a decoding vector;
[0050] An information determining unit is used to determine the current event description information based on the decoding vector.
[0051] In some embodiments, the encoder includes a first multi-head self-attention module Multi-Head Attention, a first residual connection and layer normalization operation module Add&Norm, a first feedforward connection layer FeedForward, and a second residual connection and layer normalization operation module Add&Norm connected in sequence;
[0052] The vector encoding unit is also used to input the first word vector into the first multi-head self-attention module.
[0053] In some embodiments, the encoder is sequentially connected to a first fully connected layer Linear and a first normalization operation layer Softmax;
[0054] The type determination unit is further used to process the encoding vector in sequence through the first fully connected layer Linear and the first normalization operation layer Softmax to obtain the event type.
[0055] In some embodiments, the vector decoding unit is also used to input historical event description information and the encoding vector into the decoder, the historical event description information is event description information in the historical event extraction result extracted based on the historical chat message, and the historical chat message is a chat message in the current chat content that is received earlier than the current chat message.
[0056] In some embodiments, the decoder includes a masked multi-head self-attention module MaskedMulti-Head Attention, a third residual connection and layer normalization operation module Add&Norm, a second multi-head self-attention module Multi-Head Attention, a fourth residual connection and layer normalization operation module Add&Norm, a second feedforward connection layer FeedForward, and a fifth residual connection and layer normalization operation module Add&Norm connected in sequence;
[0057] The vector decoding unit is further used for:
[0058] Converting words in the historical event description information into a second word vector, and inputting the second word vector into the masked multi-head self-attention module;
[0059] The encoded vector is input into the second multi-head self-attention module.
[0060] In some embodiments, the decoder is sequentially connected to a second fully connected layer Linear and a second normalization operation layer Softmax;
[0061] The information determination unit is also used to process the encoding vector in turn through the second fully connected layer Linear and the second normalization operation layer Softmax to obtain the current event description information.
[0062] In some embodiments, the vector conversion module is further used to execute the operation of converting the words in the current chat message into the first word vector in response to the current chat message satisfying a set condition;
[0063] The current chat message satisfies a set condition, including at least one of the following:
[0064] No other chat messages are received within a set time period before receiving the current chat message;
[0065] The current chat message is the first unviewed chat message displayed in the chat interface;
[0066] The current chat message includes a set trigger word.
[0067] In some embodiments, the result determination module is also used to respond to the fact that the current chat message is irrelevant to the historical event extraction result, and use the current event extraction result as the target event extraction result. The historical event extraction result is the result obtained based on the historical chat message extraction event, and the historical chat message is the chat message in the current chat content that is received earlier than the current chat message.
[0068] In some embodiments, the result determination module further includes:
[0069] a result verification unit, configured to verify the historical event extraction result based on the current event extraction result in response to the current chat message being related to the historical event extraction result, wherein the historical event extraction result is a result obtained by extracting events based on historical chat messages, and the historical chat message is a chat message in the current chat content that is received earlier than the current chat message;
[0070] An information updating unit is used to update the historical event description information in the historical event extraction result in response to the mismatch between the current event extraction result and the historical event extraction result, based on the current event description information in the current event extraction result, and use the updated historical event extraction result as the target event extraction result.
[0071] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, the device comprising:
[0072] a processor and a memory for storing a computer program;
[0073] Wherein, the processor is configured to implement, when executing the computer program:
[0074] In response to receiving a current chat message in the chat interface, converting a word in the current chat message into a first word vector;
[0075] Inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message;
[0076] Determine the target event extraction result corresponding to the current chat content based on the current event extraction result, wherein the current chat content is a plurality of chat messages received in the chat interface including the current chat message 。
[0077] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the following is implemented:
[0078] In response to receiving a current chat message in the chat interface, converting a word in the current chat message into a first word vector;
[0079] Inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message;
[0080] Determine the target event extraction result corresponding to the current chat content based on the current event extraction result, wherein the current chat content is a plurality of chat messages received in the chat interface including the current chat message 。
[0081] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0082] The present disclosure converts words in the current chat message into a first word vector in response to receiving a current chat message in a chat interface, and inputs the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message, and then determines a target event extraction result corresponding to the current chat content based on the current event extraction result, wherein the current chat content is a plurality of chat messages received in the chat interface including the current chat message, so that real-time event extraction of chat messages can be realized, which can be understood by users, and can greatly improve the efficiency of users in processing information in social and work aspects, saving users time in browsing chat records, and by processing each chat message end-to-end, compared with the scheme of processing chat messages by multiple models in the related art, the processing time of chat messages and the occupancy of storage space can be effectively reduced.
[0083] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0085] Figure 1 is a flowchart of a chat message processing method according to an exemplary embodiment of the present disclosure;
[0086] Figure 2A is a flowchart showing how to obtain the event extraction result corresponding to the current chat message according to an exemplary embodiment of the present disclosure;
[0087] Figure 2B is a structural diagram of an event extraction model according to an exemplary embodiment of the present disclosure;
[0088] Figure 3 is a flowchart showing how to determine the target event extraction result corresponding to the current chat content based on the current event extraction result according to an exemplary embodiment of the present disclosure;
[0089] Figure 4 is a block diagram of a chat message processing device according to an exemplary embodiment of the present disclosure;
[0090] Figure 5 is a block diagram of another chat message processing device according to an exemplary embodiment of the present disclosure;
[0091] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0092] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0093] Among the various existing communication methods, instant messaging (IM) communication has become a commonly used communication method by users due to its advantages of quick use, powerful functions, low cost, and convenient communication. In existing IM services, users can conveniently communicate with each other through instant messaging software, such as MiChat, and transmit various text, voice, video, data and other information.
[0094] An application scenario of a chat message processing method shown in an exemplary embodiment of the present disclosure may include a smart terminal (also referred to as a user terminal, client) and a server. The smart terminal may be any electronic device installed with instant messaging software, and the electronic device may be a handheld electronic device or other electronic device. For example, it may be a smart phone, a media player or other handheld portable device, such as a wristwatch device, a pendant device, or a gaming device, a tablet computer, a laptop computer, a desktop computer, etc. The smart terminal may also be an instant messaging software, for example, it may be an application such as Mi Chat that uses instant messaging as the main service, or it may be an application such as Mi Home that uses instant messaging as an auxiliary service. The server may process and forward chat messages. The server may be a general term for multiple server devices, or it may be a general term for at least one software installed on a server device. The smart terminal may interact with the server through a mobile communication network or the Internet.
[0095] Currently, in the chat interface provided by instant messaging software, someone may post very important chat messages, such as information related to an organization's activities, but as time goes by, important chat messages are easily submerged in historical message records. Especially in group chat scenarios, users need to carefully browse through numerous chat records to find the information they need, which is very time-consuming. Moreover, chats are usually spoken, so although there are many message items, there is a lot of redundancy and the proportion of useful information is low.
[0096] In view of this, the present disclosure provides the following chat message processing method, device, equipment and storage medium to extract events according to the chat content, help users automatically process a large number of chat messages, and generate brief event descriptions for users to understand, thereby greatly improving the efficiency of instant message processing and saving users time in flipping through chat records.
[0097] Figure 1 is a flowchart of a chat message processing method according to an exemplary embodiment; the method of this embodiment can be executed by a chat message processing device, and the chat message processing device can be configured in an electronic device installed with instant messaging software. Specifically, Figure 1 As shown, the method includes the following steps S101-S103:
[0098] In step S101, in response to receiving a current chat message in a chat interface, words in the current chat message are converted into a first word vector.
[0099] In this embodiment, the electronic device can convert the words in the current chat message into a first word vector in response to receiving the current chat message in the chat interface. The chat interface can be a chat interface in an instant messaging software pre-installed in the electronic device. Exemplarily, the chat interface can be a multi-person chat interface (i.e., a group chat interface) or a single-person chat interface.
[0100] In some embodiments, the electronic device may perform the above-mentioned operation of converting the words in the current chat message into the first word vector after receiving the current chat message; or, after receiving the current chat message, in response to the current chat message satisfying the set conditions, perform the above-mentioned operation of converting the words in the current chat message into the first word vector.
[0101] The above-mentioned current chat message satisfies the set conditions, which may include at least one of the following (a) to (c):
[0102] (a) No other chat messages are received within a set time period before receiving the current chat message;
[0103] The above-mentioned set time period can be set based on the needs of the actual application scenario, such as being set to 12 hours or 24 hours, etc., which is not limited in this embodiment.
[0104] (b) the current chat message is the first unviewed chat message displayed in the chat interface;
[0105] (c) The current chat message includes a set trigger word.
[0106] Exemplarily, the trigger words may be pre-specified words related to various event types, such as "hiking", "dancing", "dinner party" and the like related to the event type "organizing activities", which is not limited in this embodiment.
[0107] In step S102, the first word vector is input into a pre-trained event extraction model to obtain the event extraction result corresponding to the current chat message.
[0108] In this embodiment, after the words in the current chat message are converted into the first word vector, the first word vector can be input into a pre-trained event extraction model to obtain the event extraction result corresponding to the current chat message.
[0109] Among them, the above-mentioned event extraction model can be a model obtained by performing multiple rounds of iterative training based on sample chat messages in advance and when the training cutoff conditions are met (such as reaching a preset number of training rounds and / or the model output accuracy meets the set requirements, etc.).
[0110] In other embodiments, the structure of the above event extraction model can be seen in the following Figure 2A The illustrated embodiment will not be described in detail here.
[0111] In step S103, the target event extraction result corresponding to the current chat content is determined based on the current event extraction result.
[0112] In this embodiment, after obtaining the current event extraction result corresponding to the current chat message, the target event extraction result corresponding to the current chat content can be determined based on the current event extraction result.
[0113] Among them, the above-mentioned chat content is a plurality of chat messages received in the chat interface, including the current chat message, for example, it can be the chat content shown in the first column of the following Table 1.
[0114] Table 1
[0115]
[0116] As shown in Table 1 above, assuming that the content of this chat is "Paragraph One", that is, the five messages from "Let's go hiking together next week!" sent by "Father" at 14:04 to "Of course, you are very welcome" sent by "Mother" at 14:16, then the "Current Chat Message" can be the latest chat message in this chat content, that is, "Of course, you are very welcome" sent by "Mother" at 14:16, and then the target event extraction result corresponding to the current chat content of "Paragraph One" can be determined based on the method of this embodiment, that is, the "target time extraction result" on the right side of "Paragraph One".
[0117] It is understandable that as time goes by, new chat content will appear in this chat content. For example, the appearance of "Paragraph 2" will cause the "current chat message" to change, such as "Xiao Ming and I also agree to climb Mount Huangshan." sent by "Daughter" at 14:38. Then, the target event extraction result corresponding to the current chat content of "Paragraph 2" can be determined, that is, the "target time extraction result" on the right side of "Paragraph 2".
[0118] In some embodiments, the above method of determining the target event extraction result corresponding to the current chat content based on the current event extraction result can refer to the following Figure 3 The illustrated embodiment will not be described in detail here.
[0119] In other embodiments, after the target event extraction result corresponding to the chat content is determined, the target event extraction result may be output, for example, at least one of the following (1) and (2) may be executed:
[0120] (1) Outputting the target event extraction result to a preset storage location for storage, such as storing it in a memo of an electronic device, so that it can be queried by a user;
[0121] (2) Outputting the target event extraction result to a preset display area for display, such as displaying it in a preset area in the above-mentioned chat interface, for user viewing.
[0122] As can be seen from the above description, the method of this embodiment converts the words in the current chat message into a first word vector in response to receiving the current chat message in the chat interface, and inputs the first word vector into a pre-trained event extraction model to obtain the current event extraction result corresponding to the current chat message, and then determines the target event extraction result corresponding to the current chat content based on the current event extraction result. The current chat content is a plurality of chat messages received in the chat interface including the current chat message. The event extraction of the chat message can be realized in real time, which can be understood by the user, and can greatly improve the efficiency of the user's information processing in social and work aspects, saving the user time to browse the chat records, and processing each chat message end-to-end (using one model to complete the task is called end-to-end End to end), compared with the scheme of using multiple models to process chat messages in the related art, it can effectively reduce the processing time of the chat message and the occupancy of the storage space.
[0123] Figure 2A It is a flowchart showing how to obtain the event extraction result corresponding to the current chat message according to an exemplary embodiment of the present disclosure; based on the above embodiment, this embodiment uses how to obtain the event extraction result corresponding to the current chat message as an example to exemplify.
[0124] In this embodiment, the event extraction result may include the event type and the event description information. The event type may be set based on the needs of the actual application scenario, such as being set to at least one of the types of organizational activities, public security cases, and traffic accidents.
[0125] The specific content of the event description information can be set by presetting the event extraction template. For example, if the event extraction template includes four contents: trigger words, participants, time and location, at least one of the contents can be used as the event description information.
[0126] The above event extraction model may be a model of a Transformer structure, and the model may include an encoder (Transformer encoder) and a decoder (Transformer decoder).
[0127] On this basis, if Figure 2A As shown, the step S102 described above of inputting the first word vector into a pre-trained event extraction model to obtain the event extraction result corresponding to the current chat message may include the following steps S201-S204:
[0128] In step S201, the first word vector is input into the encoder to obtain an encoding vector;
[0129] In step S202, the event type is determined based on the encoding vector;
[0130] In step S203, the encoding vector is input into the decoder to obtain a decoding vector;
[0131] In step S204, the current event description information is determined based on the decoding vector.
[0132] For example, Figure 2B is a structural diagram of an event extraction model according to an exemplary embodiment of the present disclosure; Figure 2B As shown, the event extraction model of this embodiment includes an encoder 100 and a decoder 200, wherein:
[0133] The encoder 100 includes a first multi-head self-attention module Multi-Head Attention 101, a first residual connection and layer normalization operation module Add&Norm 102, a first feedforward connection layer FeedForward 103, and a second residual connection and layer normalization operation module Add&Norm 104 which are connected in sequence;
[0134] The decoder 200 includes a Masked Multi-Head Attention module 201, a third residual connection and layer normalization operation module Add&Norm 202, a second Multi-Head Attention module 203, a fourth residual connection and layer normalization operation module Add&Norm 204, a second feedforward connection layer FeedForward 205, and a fifth residual connection and layer normalization operation module Add&Norm 206, which are sequentially connected;
[0135] Furthermore, the encoder 100 is also sequentially connected to a first fully connected layer Linear 300 and a first normalization operation layer Softmax 400; the decoder 200 is also sequentially connected to a second fully connected layer Linear 500 and a second normalization operation layer Softmax 600.
[0136] On this basis, when the current chat message is received in the chat interface, the current chat message (i.e. Figure 2B The “message text” in the text (the “message text”) is converted by the first word vector embedding layer 700 to obtain the first word vector, and then the first word vector is input into the first multi-head self-attention module 101 to obtain the encoded vector after being processed by each layer module in the encoder 100.
[0137] Furthermore, the encoding vector may be input to the first fully connected layer Linear 300 through the first branch, so as to be processed by the first fully connected layer Linear 300 and the first normalization operation layer Softmax 400 to obtain the current event type;
[0138] On the other hand, the above-mentioned encoding vector can be input into the second multi-head self-attention module Multi-Head Attention 203 through the second branch, and the historical event description information can be converted through the second word vector embedding layer 800 to obtain a second word vector, and the second word vector is input into the masked multi-head self-attention module Masked Multi-HeadAttention 201 to obtain a decoded vector after being processed by each layer module in the decoder 200. Among them, the historical event description information can be the event description information in the historical event extraction result extracted based on the historical chat message, and the historical chat message is the chat message in the chat content that is received earlier than the current chat message. It can be understood that in some cases, the input information of the masked multi-head self-attention module Masked Multi-Head Attention 201 can be empty, that is, the second word vector of the historical event description information is not input into the masked multi-head self-attention module Masked Multi-Head Attention201. Exemplarily, the above situation can include but is not limited to (i) and (ii):
[0139] (i) The current chat message is the first message of this chat content, that is, there is no historical event extraction result;
[0140] (ii) The current chat message is irrelevant to the historical event extraction result. If the event type corresponding to the current chat message is different from the historical event type corresponding to the historical event extraction result, the two can be considered irrelevant.
[0141] On this basis, the above encoding vector may be processed by the second fully connected layer Linear 500 and the second normalization operation layer Softmax 600 in sequence to obtain the description information of this event.
[0142] As can be seen from the above description, this embodiment obtains an encoding vector by inputting the first word vector into the encoder, and determines the event type based on the encoding vector, and then inputs the encoding vector into the decoder to obtain a decoding vector, and then determines the event description information based on the decoding vector. It can be achieved that the event extraction result corresponding to the current chat message is obtained based on the event extraction model, and then the target event extraction result corresponding to the chat content can be determined based on the event extraction result. The event extraction of chat messages can be performed in real time, which can be understood by users. It can greatly improve the efficiency of user information processing in social and work aspects, save users time to browse chat records, and by processing each chat message end-to-end, compared with the scheme of processing chat messages by multiple models in the related technology, it can effectively reduce the processing time of chat messages and the occupancy of storage space.
[0143] Figure 3 It is a flowchart showing how to determine the target event extraction result corresponding to the current chat content based on the current event extraction result according to an exemplary embodiment of the present disclosure; based on the above-mentioned embodiment, this embodiment uses the example of how to determine the target event extraction result corresponding to the current chat content based on the current event extraction result as an example to illustrate.
[0144] like Figure 3 As shown, the above step S103, determining the target event extraction result corresponding to the current chat content based on the current event extraction result, may include the following steps S301-S306:
[0145] In step S301, it is determined whether the current chat message is related to the historical event extraction result: if not, step S302 is executed; if yes, step S303 is executed;
[0146] In some embodiments, if the current event type corresponding to the current chat message is different from the historical event type corresponding to the historical event extraction result, the two can be considered to be unrelated; otherwise, if the current event type corresponding to the current chat message is the same as the historical event type corresponding to the historical event extraction result, the two can be considered to be related.
[0147] In step S302, the current event extraction result is used as the target event extraction result;
[0148] In step S303, the historical event extraction result is checked based on the current event extraction result;
[0149] Among them, the above-mentioned historical event extraction result can be a result obtained by extracting events based on historical chat messages, and the historical chat message can be a chat message in the current chat content that is received earlier than the current chat message.
[0150] In some embodiments, when the historical event extraction result is verified based on the current event extraction result, the current event description information in the current event extraction result can be compared with the historical event description information in the historical event extraction result to obtain corresponding comparison results, such as a first comparison result representing that the two are "consistent or non-conflicting", or a second comparison result representing that the two are "inconsistent or conflicting".
[0151] In step S304, it is determined whether the current event extraction result matches the historical event extraction result: if not, step S305 is executed; if yes, step S306 is executed;
[0152] In this embodiment, whether the current event extraction result matches the historical event extraction result can be judged based on the comparison result obtained in step S303, that is, if the comparison result obtained is the first comparison result, then the current event extraction result can be regarded as matching the historical event extraction result; on the contrary, if the comparison result obtained is the second comparison result, then the current event extraction result can be regarded as not matching the historical event extraction result.
[0153] In step S305, based on the current event description information in the current event extraction result, the historical event description information in the historical event extraction result is updated, and the updated historical event extraction result is used as the target event extraction result.
[0154] In this embodiment, when the historical event description information is updated based on the current event description information, the corresponding content in the historical event description information can be updated based on the corresponding content in the current event description information, for example, replacing the "location" in the historical event description information based on the "location" in the current event description information, and / or, adding the "participants" in the historical event description information based on the "participants" in the current event description information, etc.
[0155] In step S306, the historical event extraction result is used as the target event extraction result.
[0156] As can be seen from the above description, this embodiment uses the current event extraction result as the target event extraction result in response to the fact that the current chat message is independent of the historical event extraction result, and verifies the historical event extraction result based on the current event extraction result in response to the fact that the current chat message is related to the historical event extraction result, and then updates the historical event description information in the historical event extraction result based on the current event description information in the current event extraction result in response to the fact that the current event extraction result does not match the historical event extraction result, and uses the updated historical event extraction result as the target event extraction result. This can determine the target event extraction result corresponding to the current chat content based on the current event extraction result, thereby realizing the subsequent output of the target event extraction result for the user to understand, which can greatly improve the efficiency of user information processing in social and work aspects, and save the user time in flipping through chat records.
[0157] Figure 4 is a block diagram of a chat message processing device according to an exemplary embodiment of the present disclosure; the device of this embodiment can be configured in an electronic device installed with instant messaging software. Specifically, Figure 4 As shown, the device may include: a vector conversion module 110, a result acquisition module 120 and a result determination module 130, wherein:
[0158] A vector conversion module 110, configured to convert a word in the current chat message into a first word vector in response to receiving the current chat message in the chat interface;
[0159] A result acquisition module 120, configured to input the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message;
[0160] The result determination module 130 determines the target event extraction result corresponding to the current chat content based on the current event extraction result, where the current chat content is a plurality of chat messages received in the chat interface including the current chat message.
[0161] As can be seen from the above description, the device of this embodiment converts the words in the current chat message into a first word vector in response to receiving the current chat message in the chat interface, and inputs the first word vector into a pre-trained event extraction model to obtain the current event extraction result corresponding to the current chat message, and then determines the target event extraction result corresponding to the current chat content based on the current event extraction result. The current chat content is a plurality of chat messages received in the chat interface including the current chat message. This can realize real-time event extraction of chat messages, which can be understood by users, and can greatly improve the efficiency of users in processing information in social and work aspects, saving users time in browsing chat records. Moreover, by processing each chat message end-to-end, compared with the scheme of processing chat messages by multiple models in the related art, it can effectively reduce the processing time of chat messages and the occupancy of storage space.
[0162] Figure 5 is a block diagram of another chat message processing device according to an exemplary embodiment of the present disclosure; the device of this embodiment can be configured in an electronic device installed with instant messaging software. Among them, the vector conversion module 210, the result acquisition module 220 and the result determination module 230 are the same as the aforementioned Figure 4 The functions of the vector conversion module 110 , the result acquisition module 120 and the result determination module 130 in the illustrated embodiment are the same and will not be described in detail herein.
[0163] like Figure 5 As shown, in this embodiment, the event extraction result may include the event type and the event description information, and the event extraction model may include an encoder and a decoder;
[0164] Furthermore, the result acquisition module 220 may include:
[0165] A vector encoding unit 221, configured to input the first word vector into the encoder to obtain an encoding vector;
[0166] A type determination unit 222, configured to determine the type of the event based on the encoding vector;
[0167] A vector decoding unit 223, configured to input the encoding vector into the decoder to obtain a decoding vector;
[0168] The information determining unit 224 is configured to determine the current event description information based on the decoding vector.
[0169] In some embodiments, the encoder includes a first multi-head self-attention module Multi-Head Attention, a first residual connection and layer normalization operation module Add&Norm, a first feedforward connection layer FeedForward, and a second residual connection and layer normalization operation module Add&Norm connected in sequence;
[0170] Furthermore, the vector encoding unit 221 can also be used to input the first word vector into the first multi-head self-attention module.
[0171] In some embodiments, the encoder is sequentially connected with a first fully connected layer Linear and a first normalization operation layer Softmax;
[0172] Furthermore, the type determination unit 222 may also be configured to process the encoding vector in sequence through the first fully connected layer Linear and the first normalization operation layer Softmax to obtain the event type.
[0173] In some embodiments, the vector decoding unit 223 can also be used to input historical event description information and the encoding vector into the decoder, wherein the historical event description information is event description information in the historical event extraction result extracted based on the historical chat message, and the historical chat message is a chat message in the current chat content that is received earlier than the current chat message.
[0174] In some embodiments, the decoder includes a masked multi-head self-attention module MaskedMulti-Head Attention, a third residual connection and layer normalization operation module Add&Norm, a second multi-head self-attention module Multi-Head Attention, a fourth residual connection and layer normalization operation module Add&Norm, a second feedforward connection layer FeedForward, and a fifth residual connection and layer normalization operation module Add&Norm connected in sequence;
[0175] Furthermore, the vector decoding unit 221 may also be used for:
[0176] Converting words in the historical event description information into a second word vector, and inputting the second word vector into the masked multi-head self-attention module;
[0177] The encoded vector is input into the second multi-head self-attention module.
[0178] In some embodiments, the decoder is sequentially connected with a second fully connected layer Linear and a second normalization operation layer Softmax;
[0179] Furthermore, the information determination unit 224 can also be used to process the encoding vector in sequence through the second fully connected layer Linear and the second normalization operation layer Softmax to obtain the current event description information.
[0180] In some embodiments, the vector conversion module 210 may also be used to execute the operation of converting the words in the current chat message into the first word vector in response to the current chat message satisfying the set condition;
[0181] The above-mentioned current chat message satisfies the set condition, which may include at least one of the following:
[0182] No other chat messages are received within a set time period before receiving the current chat message;
[0183] The current chat message is the first unviewed chat message displayed in the chat interface;
[0184] The current chat message includes a set trigger word.
[0185] In some embodiments, the result determination module 230 can also be used to respond to the fact that the current chat message is independent of the historical event extraction result, and use the current event extraction result as the target event extraction result. The historical event extraction result is the result obtained based on the historical chat message extraction event, and the historical chat message is the chat message in the current chat content that is received earlier than the current chat message.
[0186] In some embodiments, the result determination module 230 may further include:
[0187] The result verification unit 231 may be used to verify the historical event extraction result based on the current event extraction result in response to the current chat message being related to the historical event extraction result, wherein the historical event extraction result is a result obtained by extracting an event based on a historical chat message, and the historical chat message is a chat message in the current chat content that is received earlier than the current chat message;
[0188] The information updating unit 232 can be used to respond to the mismatch between the current event extraction result and the historical event extraction result, update the historical event description information in the historical event extraction result based on the current event description information in the current event extraction result, and use the updated historical event extraction result as the target event extraction result.
[0189] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0190] Figure 6 900 is a block diagram of an electronic device according to an exemplary embodiment. For example, the device 900 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.
[0191] Reference Figure 6 , device 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 906 , a multimedia component 908 , an audio component 910 , an input / output (I / O) interface 912 , a sensor component 914 , and a communication component 916 .
[0192] The processing component 902 generally controls the overall operation of the device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the chat message processing method described above. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 908 and the processing component 902.
[0193] The memory 904 is configured to store various types of data to support operations on the device 900. Examples of such data include instructions for any application or method operating on the device 900, contact data, phone book data, messages, pictures, videos, etc. The memory 904 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.
[0194] The power supply component 906 provides power to the various components of the device 900. The power supply component 906 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 900.
[0195] The multimedia component 908 includes a screen that provides an output interface between the device 900 and the user. In some embodiments, the screen may include a liquid crystal display panel 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 908 includes a front camera and / or a rear camera. When the device 900 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 the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0196] The audio component 910 is configured to output and / or input audio signals. For example, the audio component 910 includes a microphone (MIC), and when the device 900 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 904 or sent via the communication component 916. In some embodiments, the audio component 910 also includes a speaker for outputting audio signals.
[0197] I / O interface 912 provides an interface between processing component 902 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0198] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the device 900. For example, the sensor assembly 914 can detect the open / closed state of the device 900, the relative positioning of components, such as the display panel and keypad of the device 900, and the sensor assembly 914 can also detect the position change of the device 900 or a component of the device 900, the presence or absence of user contact with the device 900, the orientation or acceleration / deceleration of the device 900, and the temperature change of the device 900. The sensor assembly 914 can also include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0199] The communication component 916 is configured to facilitate wired or wireless communication between the device 900 and other devices. The device 900 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G or a combination thereof. In an exemplary embodiment, the communication component 916 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 916 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.
[0200] In an exemplary embodiment, the device 900 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 above-mentioned chat message processing method.
[0201] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 904 including instructions, and the instructions can be executed by the processor 920 of the device 900 to complete the above chat message processing method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0202] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0203] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A chat message processing method, characterized in that: The method comprises: In response to receiving a current chat message in the chat interface, converting a word in the current chat message into a first word vector; Inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message; Based on the current event extraction result, a target event extraction result corresponding to the current chat content is determined, where the current chat content is a plurality of chat messages received in the chat interface including the current chat message.
2. The method according to claim 1, characterized in that The event extraction result includes the event type and event description information, and the event extraction model includes an encoder and a decoder; The step of inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message includes: Inputting the first word vector into the encoder to obtain an encoding vector; Determine the event type based on the encoding vector; Inputting the encoding vector into the decoder to obtain a decoding vector; The current event description information is determined based on the decoding vector.
3. The method according to claim 2, characterized in that The encoder includes a first multi-head self-attention module Multi-Head Attention, a first residual connection and layer normalization operation module Add&Norm, a first feedforward connection layer FeedForward, and a second residual connection and layer normalization operation module Add&Norm connected in sequence; The step of inputting the first word vector into the encoder comprises: Input the first word vector into the first multi-head self-attention module.
4. The method according to claim 2, characterized in that: The encoder is sequentially connected to a first fully connected layer Linear and a first normalized operation layer Softmax; The determining the event type based on the encoding vector includes: The encoding vector is processed by the first fully connected layer Linear and the first normalization operation layer Softmax in sequence to obtain the event type.
5. The method according to claim 2, characterized in that: The step of inputting the encoding vector into the decoder comprises: The historical event description information and the encoding vector are input into the decoder, wherein the historical event description information is the event description information in the historical event extraction result extracted based on the historical chat message, and the historical chat message is the chat message in the current chat content whose receiving time is earlier than the current chat message.
6. The method according to claim 5, characterized in that The decoder includes a Masked Multi-Head Attention module, a third residual connection and layer normalization operation module Add&Norm, a second Multi-Head Attention module, a fourth residual connection and layer normalization operation module Add&Norm, a second feedforward connection layer FeedForward, and a fifth residual connection and layer normalization operation module Add&Norm, which are connected in sequence; The step of inputting the historical event description information and the encoding vector into the decoder comprises: Converting words in the historical event description information into a second word vector, and inputting the second word vector into the masked multi-head self-attention module; The encoded vector is input into the second multi-head self-attention module.
7. The method according to claim 2, characterized in that The decoder is sequentially connected to a second fully connected layer Linear and a second normalized operation layer Softmax; The determining the current event description information based on the decoding vector includes: The encoding vector is processed by the second fully connected layer Linear and the second normalization operation layer Softmax in sequence to obtain the description information of the current event.
8. The method according to claim 1, characterized in that: The method further comprises: In response to the current chat message satisfying a set condition, executing the operation of converting a word in the current chat message into a first word vector; The current chat message satisfies a set condition, including at least one of the following: No other chat messages are received within a set time period before receiving the current chat message; The current chat message is the first unviewed chat message displayed in the chat interface; The current chat message includes a set trigger word.
9. The method according to claim 1, characterized in that: The step of determining the target event extraction result corresponding to the chat content based on the event extraction result includes: In response to the fact that the current chat message is irrelevant to the historical event extraction result, the current event extraction result is used as the target event extraction result. The historical event extraction result is the result obtained by extracting events based on historical chat messages. The historical chat message is a chat message in the current chat content that is received earlier than the current chat message.
10. The method according to claim 1, characterized in that The step of determining the target event extraction result corresponding to the chat content based on the event extraction result includes: In response to the current chat message being related to a historical event extraction result, the historical event extraction result is verified based on the current event extraction result, the historical event extraction result being a result obtained by extracting an event based on a historical chat message, and the historical chat message being a chat message in the current chat content that is received earlier than the current chat message; In response to the mismatch between the current event extraction result and the historical event extraction result, based on the current event description information in the current event extraction result, the historical event description information in the historical event extraction result is updated, and the updated historical event extraction result is used as the target event extraction result.
11. A chat message processing device, characterized in that: The device comprises: A vector conversion module, configured to, in response to receiving a current chat message in the chat interface, convert a word in the current chat message into a first word vector; A result acquisition module, used to input the first word vector into a pre-trained event extraction model to obtain the event extraction result corresponding to the current chat message; The result determination module determines the target event extraction result corresponding to the current chat content based on the current event extraction result, wherein the current chat content is a plurality of chat messages received in the chat interface including the current chat message.
12. The device according to claim 11, characterized in that The event extraction result includes the event type and event description information, and the event extraction model includes an encoder and a decoder; The result acquisition module comprises: A vector encoding unit, used for inputting the first word vector into the encoder to obtain an encoding vector; A type determination unit, configured to determine the type of the event based on the encoding vector; A vector decoding unit, used for inputting the encoding vector into the decoder to obtain a decoding vector; An information determining unit is used to determine the current event description information based on the decoding vector.
13. The device according to claim 12, characterized in that The encoder includes a first multi-head self-attention module Multi-Head Attention, a first residual connection and layer normalization operation module Add&Norm, a first feedforward connection layer FeedForward, and a second residual connection and layer normalization operation module Add&Norm connected in sequence; The vector encoding unit is also used to input the first word vector into the first multi-head self-attention module.
14. The device according to claim 12, characterized in that The encoder is sequentially connected to a first fully connected layer Linear and a first normalized operation layer Softmax; The type determination unit is further used to process the encoding vector in sequence through the first fully connected layer Linear and the first normalization operation layer Softmax to obtain the event type.
15. The device according to claim 12, characterized in that The vector decoding unit is also used to input historical event description information and the encoding vector into the decoder, wherein the historical event description information is event description information in a historical event extraction result extracted based on a historical chat message, and the historical chat message is a chat message in the current chat content that is received earlier than the current chat message.
16. The device according to claim 15, characterized in that The decoder includes a Masked Multi-Head Attention module, a third residual connection and layer normalization operation module Add&Norm, a second Multi-Head Attention module, a fourth residual connection and layer normalization operation module Add&Norm, a second feedforward connection layer FeedForward, and a fifth residual connection and layer normalization operation module Add&Norm, which are connected in sequence; The vector decoding unit is further used for: Converting words in the historical event description information into a second word vector, and inputting the second word vector into the masked multi-head self-attention module; The encoded vector is input into the second multi-head self-attention module.
17. The device according to claim 12, characterized in that The decoder is sequentially connected to a second fully connected layer Linear and a second normalized operation layer Softmax; The information determination unit is also used to process the encoding vector in turn through the second fully connected layer Linear and the second normalization operation layer Softmax to obtain the current event description information.
18. The device according to claim 11, characterized in that The vector conversion module is also used to execute the operation of converting the words in the current chat message into the first word vector in response to the current chat message satisfying the set condition; The current chat message satisfies a set condition, including at least one of the following: No other chat messages are received within a set time period before receiving the current chat message; The current chat message is the first unviewed chat message displayed in the chat interface; The current chat message includes a set trigger word.
19. The device according to claim 11, characterized in that The result determination module is also used to respond to the fact that the current chat message is independent of the historical event extraction result, and use the current event extraction result as the target event extraction result. The historical event extraction result is the result obtained based on the historical chat message extraction event. The historical chat message is a chat message in the current chat content that is received earlier than the current chat message.
20. The device according to claim 11, characterized in that The result determination module also includes: a result verification unit, configured to verify the historical event extraction result based on the current event extraction result in response to the current chat message being related to the historical event extraction result, wherein the historical event extraction result is a result obtained by extracting events based on historical chat messages, and the historical chat message is a chat message in the current chat content that is received earlier than the current chat message; An information updating unit is used to update the historical event description information in the historical event extraction result in response to the mismatch between the current event extraction result and the historical event extraction result, based on the current event description information in the current event extraction result, and use the updated historical event extraction result as the target event extraction result.
21. An electronic device, characterized in that: The device comprises: a processor and a memory for storing a computer program; Wherein, the processor is configured to implement, when executing the computer program: In response to receiving a current chat message in the chat interface, converting a word in the current chat message into a first word vector; Inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message; Determine the target event extraction result corresponding to the current chat content based on the current event extraction result, wherein the current chat content is a plurality of chat messages received in the chat interface including the current chat message 。 22. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processor, it realizes: In response to receiving a current chat message in the chat interface, converting a word in the current chat message into a first word vector; Inputting the first word vector into a pre-trained event extraction model to obtain a current event extraction result corresponding to the current chat message; Determine the target event extraction result corresponding to the current chat content based on the current event extraction result, wherein the current chat content is a plurality of chat messages received in the chat interface including the current chat message 。