Contact relation analysis method and device based on multi-label classification and readable medium
By introducing a multi-label classification method in contact relationship analysis, using information such as chat content, notes, tags and common group chat names, a contact relationship analysis model is built, which solves the problem of poor recognition effect caused by ignoring important information in the existing technology, and achieves a broader and more accurate relationship category recognition.
Patent Information
- Application Number
- CN202411796963.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-18
AI Technical Summary
When building a contact relationship analysis model, the prior art ignores valuable information such as notes, labels and common group chat names, resulting in wasting time and energy when judging the relationship category between the user and the contact, and the recognition effect is not good.
The contact relationship analysis method based on multi-label classification is adopted. By obtaining the data of chat content, notes, tags and common group chat names in social communication tools, single-hot encoding and feature extraction are carried out, and a contact relationship analysis model including chat feature extraction module, non-chat feature extraction module and global feature fusion module is constructed to perform relationship prediction.
It effectively solves the identification problem of multiple complex relationship categories in social relationships, has better identification effect and wider scope of application, and reduces analysis time and energy.
Smart Images

Figure CN119848320A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis, and in particular to a contact relationship analysis method, device and readable medium based on multi-label classification. Background Art
[0002] With the development of instant messaging technology, hundreds of millions of active users are communicating through instant social communication tools every moment. The chat records generated by social communication tools carry more and more personal relationships and social networks. At present, after extracting electronic data from the medium through computer or mobile phone forensic equipment, it is only possible to make simple relationship inferences through notes, tags and other information, or manually search through historical chat records to further infer the relationship category between users and contacts based on the chat content. Although the above methods can be used to analyze relationship categories from electronic data, it not only takes a lot of time and effort, but also has some shortcomings.
[0003] In the existing technologies, when building contact relationship analysis models, most of them only consider the information of the chat content, while ignoring valuable information, such as notes, tags, and other auxiliary information such as the common group chat name of the two. In addition, some people do not set notes or tags on social communication tools to avoid inspection, so it is impossible to determine the relationship category between the two; some group chats or private chats have a large amount of chat content information, and it is impossible to determine the relationship category between the two immediately. Summary of the invention
[0004] The purpose of this application is to propose a contact relationship analysis method, device and readable medium based on multi-label classification to address the above-mentioned technical problems.
[0005] In a first aspect, the present invention provides a contact relationship analysis method based on multi-label classification, comprising the following steps:
[0006] Obtaining social data of the contact to be analyzed in the target user's social communication tool, the social data includes chat content, notes, tags, and common group chat names, preprocessing the chat content to obtain chat data, and obtaining non-chat data based on the notes, tags, and common group chat names;
[0007] Perform one-hot encoding on the chat data and non-chat data respectively to obtain the chat embedded representation of each word in each sentence in the chat data and the non-chat embedded representation of each word in the non-chat data;
[0008] Constructing and training a contact relationship analysis model to obtain a trained contact relationship analysis model, wherein the contact relationship analysis model includes a chat feature extraction module, a non-chat feature extraction module, and a global feature fusion module;
[0009] The chat embedded representation and the non-chat embedded representation are input into the trained contact relationship analysis model. The chat embedded representation passes through the chat feature extraction module to obtain the chat feature; the non-chat embedded representation passes through the non-chat feature extraction module to obtain the non-chat feature; the chat feature and the non-chat feature are fused through the global feature fusion module to obtain the relationship prediction probability vector, and the prediction result of the relationship category between the target user and the contact to be analyzed is determined based on the relationship prediction probability vector.
[0010] Preferably, the chat feature extraction module includes a word-level Bi-LSTM encoding and attention mechanism layer and a sentence-level Bi-LSTM encoding and attention mechanism layer connected in sequence, the word-level Bi-LSTM encoding and attention mechanism layer includes a first Bi-LSTM layer and a first attention layer connected in sequence, the sentence-level Bi-LSTM encoding and attention mechanism layer includes a second Bi-LSTM layer and a second attention layer connected in sequence, the non-chat feature extraction module includes a third Bi-LSTM layer, a first fully connected layer with a ReLU activation function, and a third attention layer connected in sequence, the first Bi-LSTM layer, the second Bi-LSTM layer and the third Bi-LSTM layer are all Bi-LSTM structures, and the first attention layer, the second attention layer and the third attention layer are all attention structures;
[0011] In the chat feature extraction module, the chat embedded representation of each word in each sentence in the chat data is input into the first Bi-LSTM layer, the output features of the first Bi-LSTM layer are input into the first attention layer, the output features of the first attention layer are input into the second Bi-LSTM layer, the output features of the second Bi-LSTM layer are input into the second attention layer, and the output features of the second attention layer are used as chat features;
[0012] In the non-chat feature extraction module, the non-chat embedded representation of each word in the non-chat data is input into the third Bi-LSTM layer, the output features of the third Bi-LSTM layer are input into the first fully connected layer, the output features of the first fully connected layer are input into the third attention layer, and the output features of the third attention layer are used as non-chat features.
[0013] Preferably, the Bi-LSTM structure includes a forward LSTM layer and a backward LSTM layer; the input features of the Bi-LSTM structure pass through the forward LSTM layer and the backward LSTM layer respectively to obtain the output features of the forward LSTM layer and the output features of the backward LSTM layer, the output features of the forward LSTM layer and the output features of the backward LSTM layer are spliced to obtain a first spliced feature, and the first spliced feature is used as the output feature of the Bi-LSTM structure.
[0014] Preferably, in the attention structure, the input features of the attention structure first pass through a second fully connected layer with a tanh activation function to obtain weights, the weights are normalized to obtain attention weights, the attention weights are weightedly summed with the input features of the attention structure to obtain output features of the attention structure.
[0015] Preferably, the global feature fusion module includes a third fully connected layer with a tanh activation function and a softmax classification layer, concatenates the chat features and the non-chat features to obtain a second concatenated feature, inputs the second concatenated feature into the third fully connected layer to obtain a fused feature, and inputs the fused feature into the softmax classification layer to obtain a relationship prediction probability vector.
[0016] Preferably, the loss function used in the training process of the contact relationship analysis model is:
[0017]
[0018] Among them, m is one of the samples in the training data, Y mn represents the true label of sample m in the nth relation category, Z mn represents the predicted value of sample m in the nth relationship category in the relationship prediction probability vector, C represents the total number of relationship categories, Θ represents the model parameter, and η represents the regularization factor.
[0019] In a second aspect, the present invention provides a contact relationship analysis device based on multi-label classification, comprising:
[0020] A data acquisition module is configured to acquire social data of the contact to be analyzed in the social communication tool of the target user, the social data including chat content, notes, tags, and common group chat names, pre-process the chat content to obtain chat data, and obtain non-chat data according to the notes, tags, and common group chat names;
[0021] An encoding module is configured to perform one-hot encoding on the chat data and the non-chat data respectively to obtain chat embedded representations and non-chat embedded representations;
[0022] A model building module is configured to build and train a contact relationship analysis model to obtain a trained contact relationship analysis model, wherein the contact relationship analysis model includes a chat feature extraction module, a non-chat feature extraction module, and a global feature fusion module;
[0023] The prediction module is configured to input the chat embedded representation and the non-chat embedded representation into the trained contact relationship analysis model, the chat embedded representation is passed through the chat feature extraction module to obtain the chat feature; the non-chat embedded representation is passed through the non-chat feature extraction module to obtain the non-chat feature; the chat feature and the non-chat feature are fused through the global feature fusion module to obtain the relationship prediction probability vector, and the prediction result of the relationship category between the target user and the contact to be analyzed is determined based on the relationship prediction probability vector.
[0024] In a third aspect, the present invention provides an electronic device comprising one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.
[0025] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.
[0026] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.
[0027] Compared with the prior art, the present invention has the following beneficial effects:
[0028] (1) The contact relationship analysis method based on multi-label classification proposed in the present invention introduces feature information such as notes, tags, and common group chat names on the basis of analyzing the chat content, and utilizes the multi-label classification mechanism to effectively solve the multiple and complex relationship categories existing in social relationships. It not only has a wider scope of application but also has a better recognition effect.
[0029] (2) In the contact relationship analysis model constructed by the contact relationship analysis method based on multi-label classification proposed in the present invention, a chat feature extraction module including a word-level Bi-LSTM encoding and attention mechanism layer and a sentence-level Bi-LSTM encoding and attention mechanism layer is designed for chat data, which can effectively extract chat features, and a non-chat feature extraction module is designed for non-chat data such as notes, tags, and common group chat names, which can effectively extract non-chat features. The chat features and non-chat features are further fused through the global feature fusion module to obtain the prediction result of the relationship category.
[0030] (3) The contact relationship analysis method based on multi-label classification proposed in the present invention can predict multiple relationship categories and is more universal. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 A schematic diagram of a flow chart of a contact relationship analysis method based on multi-label classification according to an embodiment of the present application;
[0033] Figure 2 A flowchart of a contact relationship analysis method based on multi-label classification according to an embodiment of the present application;
[0034] Figure 3 A schematic diagram of the structure of a contact relationship analysis model of a contact relationship analysis method based on multi-label classification according to an embodiment of the present application;
[0035] Figure 4 A schematic diagram of the calculation process of a contact relationship analysis model of a contact relationship analysis method based on multi-label classification according to an embodiment of the present application;
[0036] Figure 5 A schematic diagram of a contact relationship analysis device based on multi-label classification according to an embodiment of the present application;
[0037] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] Figure 1 A contact relationship analysis method based on multi-label classification provided by an embodiment of the present application is shown, comprising the following steps:
[0040] S1, obtaining the social data of the contact to be analyzed in the social communication tool of the target user, the social data including chat content, notes, tags and common group chat name, preprocessing the chat content to obtain chat data, and obtaining non-chat data according to the notes, tags and common group chat name.
[0041] Specifically, refer to Figure 2, extract all contact accounts F of the target user and their corresponding note set Note, tag set Tag and common group chat name set GN. Each contact has only one note, but there can be multiple tags and common group chat names. i Remarks for ∈F(i=1,2,3,…,I)
[0042] note i ∈Note(i=1,2,3,…,I), tag i ∈Tag(i=1,2,3,…,I), common group chat name
[0043] gn i ∈GN(i=1,2,3,…,I) for splicing, and the splicing result is used as the i-th contact f i Non-chat data T fi (i=1,2,3,…,I), where I is the total number of contacts. Details are as follows:
[0044] T fi =[note i ]∪[tag i1 ,tag i2 ,…,tag ip ]∪[gn i1 ,gn i2 ,…,gn iq ];
[0045] Among them, tag ip represents the i-th contact f i The pth label, gn iq Represents the target user and the i-th contact f i The qth common group chat name of . i As a contact to be analyzed
[0046] Connect the target user to the i-th contact f i The chat content of the target user is preprocessed by filtering expressions, deleting invalid links and Chinese word segmentation, and sorting by sending time to obtain the target user and the i-th contact f i Chat data C fi , as shown below:
[0047] C fi =[c1,c2,…,c r ];
[0048] Among them, c r Represents the target user and the i-th contact f i The rth sentence in the chat data.
[0049] S2, perform one-hot encoding on the chat data and non-chat data respectively to obtain the chat embedded representation of each word in each sentence in the chat data and the non-chat embedded representation of each word in the non-chat data.
[0050] Specifically, for chat data C fi and non-chat data T fi Perform one-hot encoding to obtain the chat embedded representation E Ci and non-chat embedded representation E Ti , as shown below:
[0051] E Ci =[[w 11 ,w 12 ,...],…,[w b1 ,w b2 ,...,w bu ]];
[0052] E Ti =[t1,t2,…,t v ];
[0053] Among them, w ru Represents the target user and the i-th contact f i The embedded representation of the uth word in the bth sentence in the chat data; t v Represented as contact f i Non-chat data T fi The embedded representation of the vth word in .
[0054] S3, constructing and training a contact relationship analysis model to obtain a trained contact relationship analysis model, wherein the contact relationship analysis model includes a chat feature extraction module, a non-chat feature extraction module, and a global feature fusion module.
[0055] In a specific embodiment, the loss function used by the contact relationship analysis model during the training process is:
[0056]
[0057] Among them, m is one of the samples in the training data, Y mn represents the true label of sample m in the nth relation category, Z mn represents the predicted value of sample m in the nth relationship category in the relationship prediction probability vector, C represents the total number of relationship categories, Θ represents the model parameter, and η represents the regularization factor.
[0058] Specifically, refer to Figure 3First, a contact relationship analysis model is constructed. The contact relationship analysis model includes a chat feature extraction module, a non-chat feature extraction module and a global feature fusion module. The chat feature extraction module includes a word-level Bi-LSTM encoding and attention mechanism layer and a sentence-level Bi-LSTM encoding and attention mechanism layer connected in sequence. The two have the same structure, both including a Bi-LSTM structure and an attention structure; the non-chat feature extraction module also adopts a Bi-LSTM structure and an attention structure, and adds a first fully connected layer with a ReLU activation function between the Bi-LSTM structure and the attention structure. Then, training data is constructed. The training data contains samples and their corresponding true labels. The samples include chat embedded representations corresponding to the chat data between the user and each contact and non-chat embedded representations corresponding to the non-chat data. Each sample of the training data is input into the contact relationship analysis model, and the relationship prediction probability vector is obtained. A loss function is constructed based on the relationship prediction probability vector and the true label. The contact relationship analysis model is trained based on the loss function to obtain a trained contact relationship analysis model.
[0059] S4, input the chat embedded representation and the non-chat embedded representation into the trained contact relationship analysis model, the chat embedded representation passes through the chat feature extraction module to obtain the chat feature; the non-chat embedded representation passes through the non-chat feature extraction module to obtain the non-chat feature; the chat feature and the non-chat feature are fused by the global feature fusion module to obtain the relationship prediction probability vector, and the prediction result of the relationship category between the target user and the contact to be analyzed is determined based on the relationship prediction probability vector.
[0060] In a specific embodiment, the chat feature extraction module includes a word-level Bi-LSTM encoding and attention mechanism layer and a sentence-level Bi-LSTM encoding and attention mechanism layer connected in sequence, the word-level Bi-LSTM encoding and attention mechanism layer includes a first Bi-LSTM layer and a first attention layer connected in sequence, the sentence-level Bi-LSTM encoding and attention mechanism layer includes a second Bi-LSTM layer and a second attention layer connected in sequence, the non-chat feature extraction module includes a third Bi-LSTM layer, a first fully connected layer with a ReLU activation function, and a third attention layer connected in sequence, the first Bi-LSTM layer, the second Bi-LSTM layer, and the third Bi-LSTM layer are all Bi-LSTM structures, and the first attention layer, the second attention layer, and the third attention layer are all attention structures;
[0061] In the chat feature extraction module, the chat embedded representation of each word in each sentence in the chat data is input into the first Bi-LSTM layer, the output features of the first Bi-LSTM layer are input into the first attention layer, the output features of the first attention layer are input into the second Bi-LSTM layer, the output features of the second Bi-LSTM layer are input into the second attention layer, and the output features of the second attention layer are used as chat features;
[0062] In the non-chat feature extraction module, the non-chat embedded representation of each word in the non-chat data is input into the third Bi-LSTM layer, the output features of the third Bi-LSTM layer are input into the first fully connected layer, the output features of the first fully connected layer are input into the third attention layer, and the output features of the third attention layer are used as non-chat features.
[0063] In a specific embodiment, the Bi-LSTM structure includes a forward LSTM layer and a backward LSTM layer; the input features of the Bi-LSTM structure pass through the forward LSTM layer and the backward LSTM layer respectively to obtain the output features of the forward LSTM layer and the output features of the backward LSTM layer, the output features of the forward LSTM layer and the output features of the backward LSTM layer are spliced to obtain a first spliced feature, and the first spliced feature is used as the output feature of the Bi-LSTM structure.
[0064] Specifically, the calculation process of the Bi-LSTM structure is as follows:
[0065]
[0066] Among them, x j Represents the input vector of the Bi-LSTM structure at time j, represents the forward LSTM layer, represents the output vector of the forward LSTM layer at time j-1, represents the output vector of the forward LSTM layer at time j, represents the backward LSTM layer, represents the output vector of the backward LSTM layer at time j+1, represents the output vector of the backward LSTM layer at time j, h j Represents the output vector of the Bi-LSTM structure at time j.
[0067] In a specific embodiment, in the attention structure, the input features of the attention structure first pass through a second fully connected layer with a tanh activation function to obtain weights, the weights are normalized to obtain attention weights, and the attention weights are weighted and summed with the input features of the attention structure to obtain output features of the attention structure.
[0068] Specifically, the calculation process of the attention structure is as follows:
[0069] The input features of the attention structure are input to the second fully connected layer with the tanh activation function to obtain the weights as shown in the following formula:
[0070] u k =tanh(W2h k +b2);
[0071] Where tanh represents the tanh activation function; W2 is the weight of the second fully connected layer, b2 represents the bias of the second fully connected layer, and h k represents the input feature of the kth attention structure, u k Represents the weight corresponding to the input feature of the kth attention structure;
[0072] Normalize each weight to get the corresponding attention weight, as shown in the following formula:
[0073]
[0074] Among them, α k is the attention weight corresponding to the input feature of the kth attention structure, u s represents the query vector, which is used as a parameter and optimized in back propagation, and T represents the transposed matrix;
[0075] The input features of all attention structures and their corresponding attention weights are weighted summed to obtain the output features of the attention structure, as shown in the following formula:
[0076]
[0077] Among them, s is the output feature of the attention structure.
[0078] Specifically, the chat embedded representation of each word in each sentence in the chat data is input into the word-level Bi-LSTM encoding and attention mechanism layer, and passes through the first Bi-LSTM layer and the first attention layer in sequence. Since there is a weighted summation in the first attention layer, the output feature of the first attention layer is the sentence vector representation of each sentence in the chat data. The sentence vector representation of each sentence in the chat data is input into the sentence-level Bi-LSTM encoding and attention mechanism layer, and passes through the second Bi-LSTM layer and the second attention layer in sequence. Since there is a weighted summation in the second attention layer, the output feature of the second attention layer is the chat feature v c .
[0079] Furthermore, the non-chat embedded representation of each word in the non-chat data is input into the non-chat feature extraction module, first passing through the third Bi-LSTM layer, the output feature of the third Bi-LSTM layer is the non-chat data vector representation, the non-chat data vector representation is input into the first fully connected layer, the output feature of the first fully connected layer is the non-chat data feature representation, the non-chat data feature representation is input into the third attention layer for attention learning, the attention weights of different non-chat data are learned, and finally the weighted sum is used to obtain the non-chat feature v t .
[0080] h' g =ReLU(W1h g +b1);
[0081] Where ReLU represents the ReLU activation function, W1 is the weight of the first fully connected layer, b1 represents the bias of the first fully connected layer, and h g Represents the non-chat data vector representation, h' g Represents non-chat data feature representation.
[0082] In a specific embodiment, the global feature fusion module includes a third fully connected layer with a tanh activation function and a softmax classification layer, the chat features and the non-chat features are spliced to obtain a second spliced feature, the second spliced feature is input into the third fully connected layer to obtain a fused feature, the fused feature is input into the softmax classification layer to obtain a relationship prediction probability vector.
[0083] Specifically, the chat feature v c and non-chat featuresv t Perform splicing to obtain the splicing feature v l , and the fusion features are obtained by mapping through the third fully connected layer, as shown in the following formula:
[0084] r l =tanh(W3v l +b3);
[0085] Among them, W3 is the weight of the third fully connected layer, b3 represents the bias of the third fully connected layer, and r l Represents fusion features.
[0086] The fused features are input into the softmax classification layer, which is a multi-label classifier with multiple classification heads. Each classification head outputs the probability value of the corresponding relationship category. The probability values of all relationship categories constitute the relationship prediction probability vector, as shown in the following formula:
[0087] Z in =softmax(r l );
[0088] Among them, Z in Represents the target user and the i-th contact f i The probability value of the nth relationship category, softmax
[0089] Represents the softmax function, through argmax(Z in ) Obtain the index corresponding to the maximum value of the probability values of all relationship categories to determine the prediction result of the relationship category between the target user and the contact to be analyzed. The relationship categories may include classmates, car friends, relatives, customers, colleagues, etc.
[0090] Further references Figure 5 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a contact relationship analysis device based on multi-label classification. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0091] The embodiment of the present application provides a contact relationship analysis device based on multi-label classification, comprising:
[0092] The data acquisition module 1 is configured to acquire the social data of the contact to be analyzed in the social communication tool of the target user, the social data including chat content, notes, tags and common group chat name, pre-process the chat content to obtain chat data, and obtain non-chat data according to the notes, tags and common group chat name;
[0093] Encoding module 2, configured to perform one-hot encoding on the chat data and the non-chat data respectively to obtain chat embedded representation and non-chat embedded representation;
[0094] A model building module 3 is configured to build and train a contact relationship analysis model to obtain a trained contact relationship analysis model, wherein the contact relationship analysis model includes a chat feature extraction module, a non-chat feature extraction module, and a global feature fusion module;
[0095] The prediction module 4 is configured to input the chat embedded representation and the non-chat embedded representation into the trained contact relationship analysis model, the chat embedded representation passes through the chat feature extraction module to obtain the chat feature; the non-chat embedded representation passes through the non-chat feature extraction module to obtain the non-chat feature; the chat feature and the non-chat feature are fused by the global feature fusion module to obtain a relationship prediction probability vector, and the prediction result of the relationship category between the target user and the contact to be analyzed is determined based on the relationship prediction probability vector.
[0096] Figure 6 Schematic diagram of the hardware structure of the electronic device provided by the embodiment of the present invention. Figure 6As shown, the electronic device of this embodiment includes: a processor 601 and a memory 602; wherein the memory 602 is used to store computer-executable instructions; the processor 601 is used to execute the computer-executable instructions stored in the memory to implement the various steps performed by the electronic device in the above embodiment. For details, please refer to the relevant description in the above method embodiment.
[0097] Optionally, the memory 602 may be independent or integrated with the processor 601 .
[0098] When the memory 602 is independently provided, the electronic device further includes a bus 603 for connecting the memory 602 and the processor 601 .
[0099] The embodiment of the present invention further provides a computer storage medium, in which computer execution instructions are stored. When the processor 601 executes the computer execution instructions, the above method is implemented.
[0100] The embodiment of the present invention further provides a computer program product, including a computer program. When the computer program is executed by the processor 601, the above method is implemented.
[0101] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0102] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.
[0103] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The unit formed by the above modules may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0104] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor 601 to perform some steps of the methods of various embodiments of the present application.
[0105] It should be understood that the processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or the processor 601 may be any conventional processor 601, etc. The steps of the method disclosed in the invention may be directly embodied in the execution of the hardware processor 601, or may be executed by a combination of hardware and software modules in the processor 601.
[0106] The memory 602 may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk, or an optical disk.
[0107] The bus 603 may be an Industry Standard Architecture (ISA), a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 603 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus 603 in the drawings of the present application is not limited to only one bus 603 or one type of bus 603.
[0108] The above storage medium 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. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0109] An exemplary storage medium is coupled to the processor 601, so that the processor 601 can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor 601. The processor 601 and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor 601 and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0110] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A contact relationship analysis method based on multi-label classification, characterized in that: The following steps are involved: Acquire social data of the contact to be analyzed in the social communication tool of the target user, wherein the social data includes chat content, notes, tags, and common group chat name, pre-process the chat content to obtain chat data, and obtain non-chat data according to the notes, tags, and common group chat name; Performing one-hot encoding on the chat data and the non-chat data respectively to obtain a chat embedded representation of each word in each sentence in the chat data and a non-chat embedded representation of each word in the non-chat data; Constructing and training a contact relationship analysis model to obtain a trained contact relationship analysis model, wherein the contact relationship analysis model includes a chat feature extraction module, a non-chat feature extraction module, and a global feature fusion module; Inputting the chat embedded representation and the non-chat embedded representation into the trained contact relationship analysis model, wherein the chat embedded representation passes through the chat feature extraction module to obtain chat features; The non-chat embedded representation is passed through the non-chat feature extraction module to obtain non-chat features; the chat features and non-chat features are fused through the global feature fusion module to obtain a relationship prediction probability vector, and the prediction result of the relationship category between the target user and the contact to be analyzed is determined based on the relationship prediction probability vector.
2. The contact relationship analysis method based on multi-label classification according to claim 1, characterized in that: The chat feature extraction module includes a word-level Bi-LSTM encoding and attention mechanism layer and a sentence-level Bi-LSTM encoding and attention mechanism layer connected in sequence, the word-level Bi-LSTM encoding and attention mechanism layer includes a first Bi-LSTM layer and a first attention layer connected in sequence, the sentence-level Bi-LSTM encoding and attention mechanism layer includes a second Bi-LSTM layer and a second attention layer connected in sequence, the non-chat feature extraction module includes a third Bi-LSTM layer, a first fully connected layer with a ReLU activation function, and a third attention layer connected in sequence, the first Bi-LSTM layer, the second Bi-LSTM layer and the third Bi-LSTM layer are all Bi-LSTM structures, and the first attention layer, the second attention layer and the third attention layer are all attention structures; In the chat feature extraction module, the chat embedded representation of each word of each sentence in the chat data is input into the first Bi-LSTM layer, the output feature of the first Bi-LSTM layer is input into the first attention layer, the output feature of the first attention layer is input into the second Bi-LSTM layer, the output feature of the second Bi-LSTM layer is input into the second attention layer, and the output feature of the second attention layer is used as the chat feature; In the non-chat feature extraction module, the non-chat embedded representation of each word in the non-chat data is input into the third Bi-LSTM layer, the output features of the third Bi-LSTM layer are input into the first fully connected layer, the output features of the first fully connected layer are input into the third attention layer, and the output features of the third attention layer are used as the non-chat features.
3. The contact relationship analysis method based on multi-label classification according to claim 2, characterized in that: The Bi-LSTM structure includes a forward LSTM layer and a backward LSTM layer; the input features of the Bi-LSTM structure pass through the forward LSTM layer and the backward LSTM layer respectively to obtain the output features of the forward LSTM layer and the output features of the backward LSTM layer, the output features of the forward LSTM layer and the output features of the backward LSTM layer are spliced to obtain a first spliced feature, and the first spliced feature is used as the output feature of the Bi-LSTM structure.
4. The contact relationship analysis method based on multi-label classification according to claim 2, characterized in that: In the attention structure, the input features of the attention structure first pass through a second fully connected layer with a tanh activation function to obtain weights, the weights are normalized to obtain attention weights, the attention weights are weighted and summed with the input features of the attention structure to obtain output features of the attention structure.
5. The contact relationship analysis method based on multi-label classification according to claim 1, characterized in that: The global feature fusion module includes a third fully connected layer with a tanh activation function and a softmax classification layer, the chat feature and the non-chat feature are spliced to obtain a second spliced feature, the second spliced feature is input into the third fully connected layer to obtain a fused feature, and the fused feature is input into the softmax classification layer to obtain the relationship prediction probability vector.
6. The contact relationship analysis method based on multi-label classification according to claim 1, characterized in that: The loss function used in the training process of the contact relationship analysis model is: Among them, m is one of the samples in the training data, Y mn represents the true label of sample m in the nth relation category, Z mn represents the predicted value of sample m in the relationship prediction probability vector in the nth relationship category, C represents the total number of relationship categories, Θ represents the model parameter, and η represents the regularization factor.
7. A contact relationship analysis device based on multi-label classification, characterized in that: include: A data acquisition module is configured to acquire social data of a contact to be analyzed in a social communication tool of a target user, wherein the social data includes chat content, notes, tags, and a common group chat name, pre-process the chat content to obtain chat data, and obtain non-chat data according to the notes, tags, and the common group chat name; An encoding module is configured to perform one-hot encoding on the chat data and the non-chat data respectively to obtain a chat embedded representation and a non-chat embedded representation; A model building module is configured to build and train a contact relationship analysis model to obtain a trained contact relationship analysis model, wherein the contact relationship analysis model includes a chat feature extraction module, a non-chat feature extraction module, and a global feature fusion module; A prediction module is configured to input the chat embedded representation and the non-chat embedded representation into the trained contact relationship analysis model, and the chat embedded representation is passed through the chat feature extraction module to obtain a chat feature; The non-chat embedded representation is passed through the non-chat feature extraction module to obtain non-chat features; the chat features and non-chat features are fused through the global feature fusion module to obtain a relationship prediction probability vector, and the prediction result of the relationship category between the target user and the contact to be analyzed is determined based on the relationship prediction probability vector.
8. An electronic device comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Contact person label determination method, medium, contact person label determination device and computing device
CN107734081A
Chat data detection method and device
CN111861379A
Method and device for constructing character relation graph and storage medium
CN114443836A
Machine learning systems and methods for metadata classification of electronic data
US20240232614A1
Neural network relationship extraction method, computer device, and readable storage medium
WO2021174774A1