A joint detection method for drug names and adverse drug reactions in online texts

Through the CNN-SelfAttention-Softmax framework and the multi-head self-attention mechanism, local and global context information of online text is extracted, solving the problem of detecting drug names and adverse drug reactions in online text, improving detection results and reducing the need for manual annotation. .

CN114492386BActive Publication Date: 2024-09-27TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210111971.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-29
Publication Date
2024-09-27
Estimated Expiration
2042-01-29

AI Technical Summary

Technical Problem

When existing technology detects drug names and adverse drug reactions from online text, it is difficult to handle a large number of spelling errors and user-created abbreviations, and it cannot effectively learn the interaction between words and the contextual information of the text, resulting in poor detection results.

Method used

Using the CNN-SelfAttention-Softmax framework, by extracting local and global context information, combined with the multi-head self-attention mechanism and the additional attention mechanism, a better network text representation is constructed for the joint detection of drug names and adverse drug reactions.

Benefits of technology

It improves the detection effect of drug names and adverse drug reactions in online text, especially when training data is scarce, significantly improving performance and reducing the workload of manual annotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492386B
    Figure CN114492386B
Patent Text Reader

Abstract

The present application relates to the field of text processing technology, and in particular to a joint detection method for drug names and adverse drug reactions in network texts, the method comprising: extracting local context information of network texts to obtain local context representations of words in network texts; extracting global context information of network texts to obtain global context representations of network texts; based on local context representations and global context representations, using a pre-trained classification model to identify the actual category of network texts, and obtaining the detection effect of drug names and adverse drug reactions in network texts according to the actual category. Thus, the detection effect of drug names and adverse drug reactions in network texts is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of text processing, and in particular to a method for jointly detecting drug names and adverse drug reactions in network texts. Background Art

[0002] Large-scale automatic detection of web texts that mention drug names and adverse drug reactions is an important task in the field of natural language processing and data mining, and has many important applications. Traditional methods for adverse drug reaction detection focus on electronic health records and clinical reports, but electronic health records and clinical reports on specific adverse drug reactions are not abundant and difficult to collect, so it is difficult to establish a robust adverse drug reaction detection model based on electronic health records and clinical reports. At the same time, the adverse drug reactions covered by electronic health records and clinical reports are also very limited.

[0003] In recent years, the task of detecting drug names and adverse drug reactions from web text has been widely studied. Compared with electronic health records and clinical reports, web text is huge in volume and can be easily collected in real time. Detecting web text that mentions drug names and adverse drug reactions has the potential to help discover serious or unknown consequences of drug use that are not covered in medical records, helping drug manufacturers ensure the safety of drugs and reduce their harmful effects on patients.

[0004] Detecting drug names or adverse drug reactions from online text is usually considered as a binary text classification task. Existing methods include machine learning-based methods and neural network-based methods. Machine learning methods are usually based on support vector machines and usually rely on heavy manual feature engineering. For example, using support vector machines to detect online texts that mention adverse drug reactions uses n-gram features, lexical features, sentiment features, and topic features; another example is using maximum entropy algorithms and model integration, which uses lexical features, n-gram features, word embeddings, etc. Neural network methods are often based on convolutional neural networks; another example is using convolutional neural networks and maximum pooling techniques to classify whether online texts mention adverse drug reactions; another example is applying a convolutional neural network framework to detect online texts that mention adverse drug reactions, and pre-training unlabeled data to enhance word embeddings. Deep learning-based methods can reduce the workload of manual feature engineering and can achieve better performance than traditional methods such as support vector machines.

[0005] However, these methods have difficulty learning high-quality tweet representations from words due to the presence of a large number of spelling errors and user-created abbreviations that are out of vocabulary. In addition, these methods cannot model the interactions between words in tweets and cannot learn the contextual information of the text with high quality. Summary of the invention

[0006] The present application provides a method for jointly detecting drug names and adverse drug reactions in online texts, which effectively improves the detection effect of drug names and adverse drug reactions in online texts.

[0007] The first embodiment of the present application provides a method for jointly detecting drug names and adverse drug reactions in network texts, comprising the following steps:

[0008] Extracting local context information of network text to obtain local context representation of words in the network text;

[0009] Extracting global context information of the network text to obtain a global context representation of the network text;

[0010] Based on the local context representation and the global context representation, a pre-trained classification model is used to identify the actual category of the network text, and the detection effect of the drug name and the adverse drug reaction in the network text is obtained according to the actual category.

[0011] Optionally, before using the pre-trained classification model to identify the actual category of the network text, the method further includes:

[0012] Modeling local information of the text and constructing a local context representation model of the word to extract the local context information;

[0013] Modeling the global information of the text and constructing a global context representation model of the text to extract the global context information;

[0014] The local context representation model and the global context representation model are jointly trained to obtain a classification model for classifying whether a drug name or an adverse drug reaction is contained.

[0015] Optionally, the local information modeling of the text and constructing a local context representation model of the word includes:

[0016] Finding vector representations of characters of the text using a character vector embedding matrix;

[0017] Using a character-level convolutional neural network to learn a latent vector representation of a character based on the local context information of the character;

[0018] Find the word vector representation of the text using the word vector embedding matrix;

[0019] Concatenate the character vector representation and the word vector representation of the text.

[0020] Optionally, the global information modeling of the text and constructing a global context representation model of the text includes:

[0021] Using a bidirectional long short-term memory network to learn global context information of the text;

[0022] Use a multi-head self-attention mechanism to draw word interactions and construct word context representations whose quality meets preset conditions;

[0023] Use additional attention mechanism to model the amount of context information and calculate importance weight for each word;

[0024] The final representation is obtained by weighted summing up the importance weights of each word.

[0025] Optionally, the joint training of the local context representation model and the global context representation model to obtain a classification model for classifying whether a drug name or an adverse drug reaction is included includes:

[0026] transforming a hidden representation of the text using a fully connected layer and an activation function;

[0027] Use two separate fully connected layers and the SoftMax function to predict the final label;

[0028] Combined drug name classification model and adverse drug reaction classification model.

[0029] The second aspect of the present application provides a combined detection device for drug names and adverse drug reactions in network texts, including:

[0030] A first extraction module is used to extract local context information of the network text to obtain the local context representation of the words in the network text;

[0031] A second extraction module is used to extract the global context information of the network text to obtain the global context representation of the network text;

[0032] The recognition module is used to identify the actual category of the network text based on the local context representation and the global context representation using a pre-trained classification model, and obtain the detection effect of the drug name and adverse drug reaction in the network text according to the actual category.

[0033] Optionally, before using the pre-trained classification model to identify the actual category of the network text, the recognition module is further used to:

[0034] Modeling local information of the text and constructing a local context representation model of the word to extract the local context information;

[0035] Modeling the global information of the text and constructing a global context representation model of the text to extract the global context information;

[0036] The local context representation model and the global context representation model are jointly trained to obtain a classification model for classifying whether a drug name or an adverse drug reaction is contained.

[0037] Optionally, the identification module is further used for:

[0038] Finding vector representations of characters of the text using a character vector embedding matrix;

[0039] Using a character-level convolutional neural network to learn a latent vector representation of a character based on the local context information of the character;

[0040] Find the word vector representation of the text using the word vector embedding matrix;

[0041] Concatenate the character vector representation and the word vector representation of the text.

[0042] Optionally, the identification module is further used for:

[0043] Using a bidirectional long short-term memory network to learn global context information of the text;

[0044] Use a multi-head self-attention mechanism to draw word interactions and construct word context representations whose quality meets preset conditions;

[0045] Use additional attention mechanism to model the amount of context information and calculate importance weight for each word;

[0046] The final representation is obtained by weighted summing up the importance weights of each word.

[0047] Optionally, the identification module is further used for:

[0048] transforming a hidden representation of the text using a fully connected layer and an activation function;

[0049] Use two separate fully connected layers and the SoftMax function to predict the final label;

[0050] Combined drug name classification model and adverse drug reaction classification model.

[0051] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a method for jointly detecting drug names and adverse drug reactions in network texts as described in the above embodiments.

[0052] The fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the above-mentioned method for jointly detecting drug names and adverse drug reactions in network texts.

[0053] Therefore, the CNN (Convolutional Neural Networks)-SelfAttention-Softmax framework was used to first capture the local information of the text, and then use these local information-based text representations to learn global information-based text representations. The two representations were used to jointly train the two tasks of drug name detection and adverse drug reaction detection. Compared with the drug name detection task and the adverse drug reaction detection task trained separately, the joint training can achieve better performance and bring more significant performance improvements when training data is scarce. It also helps to reduce the workload of manual labeling. The combination of the multi-head self-attention mechanism and the additional attention mechanism used in the method can more effectively improve the performance of the system by constructing better network text and its word representations.

[0054] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0056] Figure 1 A flowchart of a method for jointly detecting drug names and adverse drug reactions in network texts provided according to an embodiment of the present application;

[0057] Figure 2 It is a schematic diagram of the principle of a method for jointly detecting drug names and adverse drug reactions in network texts according to one embodiment of the present application;

[0058] Figure 3 A flowchart of a method for jointly detecting drug names and adverse drug reactions in network texts according to an embodiment of the present application;

[0059] Figure 4 This is an example diagram of a combined detection device for drug names and adverse drug reactions in network texts according to an embodiment of the present application;

[0060] Figure 5 is an exemplary diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0061] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0062] The following describes a method for jointly detecting drug names and adverse drug reactions in network texts of an embodiment of the present application with reference to the accompanying drawings.

[0063] Before introducing the combined detection method of drug names and adverse drug reactions in network texts of the embodiments of the present application, a brief introduction to the currently existing related problems is first given.

[0064] First, online texts are usually very noisy and informal, and are full of spelling errors and user-created abbreviations; second, the drug names and adverse drug reactions mentioned in online texts are usually context-dependent; third, different words in the same online text usually have different amounts of information in terms of drug names and adverse drug reaction detection; fourth, online texts that mention adverse drug reactions may also mention drug names, and online texts that mention drug names may also provide some information on adverse drug reactions.

[0065] It is precisely based on the above problems that the task of detecting drug names from network texts and the task of detecting adverse drug reactions have an intrinsic correlation, and the joint training model of these two tasks may improve the model effects of the two tasks. The joint detection method of drug names and adverse drug reactions in network texts in the embodiments of the present application uses the CNN-SelfAttention-Softmax framework. First, local information of the text is captured from the text, and then these text representations based on local information are used to learn text representations based on global information. The two representations are used to jointly train the two tasks of drug name detection and adverse drug reaction detection. Compared with the separately trained drug name detection task and adverse drug reaction detection task, the joint training can achieve better performance and bring more significant performance improvements when training data is scarce. At the same time, it helps to reduce the workload of manual labeling. The combination of the multi-head self-attention mechanism and the additional attention mechanism used in the method can more effectively improve the performance of the system by constructing better network text and its word representation.

[0066] Specifically, Figure 1 A flowchart of a method for jointly detecting drug names and adverse drug reactions in network text provided in an embodiment of the present application.

[0067] like Figure 1 As shown, the combined detection method of drug names and adverse drug reactions in the network text includes the following steps:

[0068] In step S101, local context information of the network text is extracted to obtain the local context representation of the words in the network text.

[0069] In step S102, global context information of the network text is extracted to obtain a global context representation of the network text.

[0070] It can be understood that the embodiment of the present application is based on the CNN-SelfAttention-SoftMax structure. By using a hierarchical text representation model, a convolutional neural network is used to learn word representations from local contexts from characters, and word embedding is used to enhance text information representation; a long short-term memory network is used to learn word representations from a global context, and a multi-head self-attention mechanism fully captures the context in network text by modeling the interactions between words. An additional attention mechanism is used to select informative words in network text.

[0071] In step S103, based on the local context representation and the global context representation, the actual category of the network text is identified using a pre-trained classification model, and the detection effect of the drug name and the adverse drug reaction in the network text is obtained according to the actual category.

[0072] Among them, the embodiment of the present application can use SoftMax to classify whether the network text contains the name of the drug or the adverse drug reaction.

[0073] Optionally, in some embodiments, before using the pre-trained classification model to identify the actual category of the network text, the method further includes:

[0074] (1) Model the local information of the text and construct a local context representation model of the word to extract the local context information;

[0075] In some embodiments, local information of a text is modeled and a local context representation model of a word is constructed, including: using a character vector embedding matrix to find vector representations of characters in the text; using a character-level convolutional neural network to learn latent vector representations of characters based on local context information of the characters; using a word vector embedding matrix to find word vector representations of the text; and connecting the character vector representation and word vector representation of the text.

[0076] Specifically, the embodiments of the present application can use a character vector embedding matrix to find the vector representation of the text characters; use a convolutional neural network to learn the latent vector representation of the text characters based on the local context of the characters; use a word vector embedding matrix to find the word vector representation of the text; and connect the character vector representation and the word vector representation of the text.

[0077] Local information is very important for entity recognition, and obtaining local context information of words can help detect online texts that mention drug names and adverse drug reactions.

[0078] Specifically, if Figure 2 As shown, in the embodiment of the present application, for a text sequence s=[w1,w2,…,w M ], where M is the length of the text sequence, and the character sequence of the i-th word is denoted as w i =[C i,1 ,C i,2 ,…,C i,N ], where N represents the length of the word, and each word is embedded in the character matrix is mapped to a sequence of vectors Where V is the vocabulary size and D is the embedding dimension.

[0079] The next layer is a character-level convolutional neural network. The convolutional neural network can effectively capture local context information and construct a local context representation of the character. The embodiment of the present application can apply the convolutional neural network layer to all character sequences in the network text. i,j The final context representation is the concatenation of multiple filter outputs, denoted as h i,j , which is calculated as follows:

[0080] h i,j =ReLU(U c ×e (j-w:j+w) +b c ),

[0081] Among them, e (j-w:j+w) is the concatenation of the character embedding vectors from position jw to j+w, U c and b c and F1 are filter parameters in the convolutional neural network, 2w+1 is the filter window size; ReLU is a nonlinear activation function; the embodiment of the present application can use the maximum pooling operation to construct a character-based word representation from the representation of each character in the word to retain the most significant information in the character representation, and the character-based representation of the i-th word is denoted as p i =max(h i,1 ,h i,2 ,…,h i,N ); The final output of the network is a series of character-based contextual representations of words, represented as [p1, p2, ..., p N ].

[0082] In the embodiment of the present application, word embedding can be used to enhance the representation of text information. Word embedding transforms the text sequence s=[w1,w2,…,w M ]Through the word embedding matrix Mapped to a vector sequence E w =[e1,e2,…,e N ], where V′ is the vocabulary size and D′ is the embedding dimension.

[0083] The final representation c of each word i is the concatenation of character-based representation and word embedding, i.e., c i =[p i ;e i ], the embodiment of the present application can express the output sequence of the text as C = [c1, c2, ..., c N ].

[0084] It should be noted that before extracting the local context information of the network text and obtaining the local context representation of the words in the network text, the embodiment of the present application can preprocess the network text data set, filter special symbols, split sentences, and convert the text into a word sequence.

[0085] (2) Model the global information of the text and construct a global context representation model of the text to extract global context information;

[0086] Optionally, in some embodiments, the global information of the text is modeled and a global context representation model of the text is constructed, including: using a bidirectional long short-term memory network to learn the global context information of the text; using a multi-head self-attention mechanism to draw the interaction of words and construct a word context representation whose quality meets preset conditions; using an additional attention mechanism to model the amount of context information and calculate the importance weight for each word; and taking the weighted sum according to the importance weight of each word to obtain the final representation.

[0087] Specifically, the embodiments of the present application can use a bidirectional long short-term memory network to learn global context information; use a multi-head self-attention mechanism to draw the interaction of words and build a high-quality word context representation; use an additional attention mechanism to model the amount of context information and calculate the importance weight for each word; and obtain the final representation by weighted summation based on the calculated weights.

[0088] The mentions of drug names and adverse drug reactions in online texts are usually context-related, and a word in the text may interact with multiple words. Therefore, the global context representation of the text and the interaction between words are very important for detecting drug names and adverse drug reactions in online texts. The embodiment of the present application uses a multi-head self-attention mechanism to model the global information of the text using the local context representation of the text characters to obtain the global context representation of the text characters, and uses an additional attention network to model the amount of context information, calculates the importance weight for each word, and uses the calculated weights for weighted summation to obtain the final global context representation of the text.

[0089] The first layer is a bidirectional long short-term memory network. The long short-term memory network is used to model long-distance information. The bidirectional long short-term memory network scans the word representation vector sequence in two directions and outputs the hidden state at each position, while using past and future information to build the contextual representation of the word. In this embodiment of the application, the output hidden state of all words in the network text can be represented as H = [h1,…,h M ], by H = LSTM ([c1, c2, ..., c M ])get.

[0090] The second layer is a multi-head self-attention network. The self-attention mechanism is an effective way to capture the information interaction between words in a text. The multi-head self-attention mechanism builds high-quality word context representations by jointly drawing the interaction between words and multiple words. In the multi-head self-attention network, the representation vector m of the jth word generated by the i-th attention head is i,j is the weighted sum of all word representation vectors in H, which is calculated as follows:

[0091]

[0092]

[0093]

[0094] Among them, U i and W i is the projection parameter of the i-th self-attention head, represents the relative importance of the interaction between the jth and kth words; the multi-head of the jth word represents m j is the concatenation of the representation vectors generated by h individual self-attention heads, and the final global context of the text is represented as [m1,m2,…,m M ] That is, it is calculated as follows:

[0095] m j =[m 1,j ;m 2,j ;…;m i,j ;…m h,j ];

[0096] The third layer is the additional attention network. Since web text can be very noisy and different words contain different amounts of information, the additional attention mechanism models the amount of contextual information and focuses on context that is useful for drug names and adverse drug reaction detection. The additional attention network takes word representations as input and calculates a weight α for each word that reflects its importance. i , which is calculated as:

[0097]

[0098]

[0099] Finally, the weight α is calculated i To perform weighted summation on the global context representation of the text, we get the final representation of the network text, which is calculated as follows:

[0100]

[0101] (3) The local context representation model and the global context representation model are jointly trained to obtain a classification model that classifies whether the context contains drug names or adverse drug reactions.

[0102] In some embodiments, a local context representation model and a global context representation model are jointly trained to obtain a classification model that classifies whether a drug name or an adverse drug reaction is contained, including: using a fully connected layer and an activation function to transform the hidden representation of the text; using two separate fully connected layers and a SoftMax function to predict the final label; and combining a drug name classification model and an adverse drug reaction classification model.

[0103] Specifically, the embodiments of the present application can use a fully connected layer and an activation function to transform the hidden representation of the network text; use two separate fully connected layers and a SoftMax function to predict the final label; and jointly train two models.

[0104] Specifically, the embodiment of the present application can first use a fully connected layer and a ReLU activation function to transform the hidden representation of the network text:

[0105] r′=ReLU(U r r+b r );

[0106] Two separate fully connected layers and SoftMax activation functions are used to calculate the predicted labels of Twitter in the drug name and adverse drug reaction tasks respectively. and The calculation method is:

[0107]

[0108]

[0109] Taking advantage of the inherent correlation between drug names and adverse drug reaction tasks, the model of this application is jointly trained in the two tasks. The loss function L is calculated as:

[0110]

[0111] In this embodiment of the present application, the loss function can be optimized by using the RMSProp optimizer To optimize and train the model of the embodiment of the present application.

[0112] As a result, it can capture local and global information well, alleviate the impact of a large number of spelling errors and user-created abbreviations in online texts, model the interactions between words, and accelerate the training and prediction speed.

[0113] In order to enable those skilled in the art to further understand the combined detection method of drug names and adverse drug reactions in the network text of the embodiment of the present application, a detailed description is given below in conjunction with specific embodiments.

[0114] like Figure 3 As shown, the combined detection method of drug names and adverse drug reactions in the network text includes the following steps:

[0115] S301, preprocessing the text data, filtering special symbol sentences, and converting the text into a word sequence.

[0116] S302, modeling the local information of the text and constructing the local context representation of the word.

[0117] S303, modeling the global information of the text and constructing a global context representation of the text.

[0118] S304, classifying whether the network text contains a drug name or an adverse drug reaction based on the identification of the network text, and jointly training two models.

[0119] According to the joint detection method of drug names and adverse drug reactions in network texts proposed in the embodiments of the present application, the CNN-SelfAttention-Softmax framework is used. First, local information of the text is captured from the text, and then the text representation based on global information is learned using these local information-based text representations. The two representations are used to jointly train the two tasks of drug name detection and adverse drug reaction detection. Compared with the drug name detection task and the adverse drug reaction detection task trained separately, the joint training can achieve better performance and bring more significant performance improvements when training data is scarce. At the same time, it helps to reduce the workload of manual labeling. The combination of the multi-head self-attention mechanism and the additional attention mechanism used in the method can more effectively improve the performance of the system by constructing better network text and its word representation.

[0120] Next, a device for jointly detecting drug names and adverse drug reactions in network texts proposed in accordance with an embodiment of the present application will be described with reference to the accompanying drawings.

[0121] Figure 4 It is a block diagram of a device for jointly detecting drug names and adverse drug reactions in network texts according to an embodiment of the present application.

[0122] like Figure 4 As shown, the combined detection device 10 for drug names and adverse drug reactions in network texts includes: a first extraction module 100, a second extraction module 200 and a recognition module 300.

[0123] The first extraction module 100 is used to extract local context information of the network text to obtain the local context representation of the words in the network text;

[0124] The second extraction module 200 is used to extract the global context information of the network text to obtain the global context representation of the network text;

[0125] The recognition module 300 is used to identify the actual category of the network text based on the local context representation and the global context representation using a pre-trained classification model, and obtain the detection effect of the drug name and the adverse drug reaction in the network text according to the actual category.

[0126] Optionally, before using the pre-trained classification model to identify the actual category of the network text, the recognition module 300 is further used to:

[0127] Model the local information of the text and build a local context representation model of the word to extract the local context information;

[0128] Model the global information of the text and build a global context representation model of the text to extract global context information;

[0129] The local context representation model and the global context representation model are jointly trained to obtain a classification model that classifies whether the information contains drug names or adverse drug reactions.

[0130] Optionally, the identification module 300 is further configured to:

[0131] Find the vector representation of the characters of the text using the character vector embedding matrix;

[0132] Use character-level convolutional neural networks to learn latent vector representations of characters based on their local context information;

[0133] Use the word embedding matrix to find the word vector representation of the text;

[0134] Concatenate the character vector representation and word vector representation of the text.

[0135] Optionally, the identification module 300 is further configured to:

[0136] Use bidirectional long short-term memory networks to learn global contextual information of text;

[0137] Use a multi-head self-attention mechanism to draw word interactions and construct word context representations whose quality meets preset conditions;

[0138] Use additional attention mechanism to model the amount of context information and calculate importance weight for each word;

[0139] The final representation is obtained by weighting and summing the importance of each word.

[0140] Optionally, the identification module 300 is further configured to:

[0141] Transform the hidden representation of text using fully connected layers and activation functions;

[0142] Use two separate fully connected layers and the SoftMax function to predict the final label;

[0143] Combined drug name classification model and adverse drug reaction classification model.

[0144] It should be noted that the above explanation of the embodiment of the method for joint detection of drug names and adverse drug reactions in online texts is also applicable to the device for joint detection of drug names and adverse drug reactions in online texts of this embodiment, and will not be repeated here.

[0145] According to the device for joint detection of drug names and adverse drug reactions in network texts proposed in the embodiments of the present application, the CNN-SelfAttention-Softmax framework is used. First, local information of the text is captured from the text, and then the text representation based on global information is learned using these local information-based text representations. The two representations are used to jointly train the two tasks of drug name detection and adverse drug reaction detection. Compared with the drug name detection task and the adverse drug reaction detection task trained separately, the joint training can achieve better performance and bring more significant performance improvements when training data is scarce. At the same time, it helps to reduce the workload of manual labeling. The combination of the multi-head self-attention mechanism and the additional attention mechanism used in the method can more effectively improve the performance of the system by constructing better network text and its word representation.

[0146] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:

[0147] A memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .

[0148] When the processor 502 executes the program, the combined detection method of drug names and adverse drug reactions in network text provided in the above embodiment is implemented.

[0149] Furthermore, the electronic device further comprises:

[0150] The communication interface 503 is used for communication between the memory 501 and the processor 502 .

[0151] The memory 501 is used to store computer programs that can be executed on the processor 502 .

[0152] The memory 501 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0153] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0154] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.

[0155] The processor 502 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0156] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the combined detection method of drug names and adverse drug reactions in network texts as described above is implemented.

[0157] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0158] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0159] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0160] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0161] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0162] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0163] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0164] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A joint detection method for drug names and adverse drug reactions in network texts, characterized in that: The following steps are involved: Extracting local context information of network text to obtain local context representation of words in the network text; Extracting global context information of the network text to obtain a global context representation of the network text; Based on the local context representation and the global context representation, a pre-trained classification model is used to identify the actual category of the network text, and the detection effect of the drug name and the adverse drug reaction in the network text is obtained according to the actual category; Before using the pre-trained classification model to identify the actual category of the network text, the method further includes: modeling the local information of the text and constructing a local context representation model of the word to extract the local context information; modeling the global information of the text and constructing a global context representation model of the text to extract the global context information; jointly training the local context representation model and the global context representation model to obtain a classification model for classifying whether the text contains a drug name or an adverse drug reaction; The local information of the text is modeled to construct a local context representation model of the word, including: using a character vector embedding matrix to find the vector representation of the characters of the text; using a character-level convolutional neural network to learn the latent vector representation of the characters according to the local context information of the characters; using a word vector embedding matrix to find the word vector representation of the text; connecting the character vector representation and the word vector representation of the text; The global information modeling of the text and the construction of the global context representation model of the text include: using a bidirectional long short-term memory network to learn the global context information of the text; using a multi-head self-attention mechanism to draw the interaction of words and construct a word context representation whose quality meets preset conditions; using an additional attention mechanism to model the amount of context information and calculate the importance weight for each word; and obtaining a final representation by weighted summation according to the importance weight of each word; The joint training of the local context representation model and the global context representation model to obtain a classification model for classifying whether a drug name or an adverse drug reaction is contained includes: using a fully connected layer and an activation function to transform the hidden representation of the text; using two separate fully connected layers and a SoftMax function to predict the final label; and combining a drug name classification model and an adverse drug reaction classification model.

2. A combined detection device for drug names and adverse drug reactions in network texts, characterized in that: include: A first extraction module is used to extract local context information of the network text to obtain the local context representation of the words in the network text; A second extraction module, used to extract the global context information of the network text to obtain the global context representation of the network text; An identification module, used to identify the actual category of the network text based on the local context representation and the global context representation using a pre-trained classification model, and obtain the detection effect of the drug name and the adverse drug reaction in the network text according to the actual category; Before using the pre-trained classification model to identify the actual category of the network text, the recognition module is also used to: model the local information of the text and construct a local context representation model of the word to extract the local context information; model the global information of the text and construct a global context representation model of the text to extract the global context information; jointly train the local context representation model and the global context representation model to obtain a classification model for classifying whether the text contains a drug name or an adverse drug reaction; The recognition module is also used to: use a character vector embedding matrix to find the vector representation of the characters of the text; use a character-level convolutional neural network to learn the latent vector representation of the characters according to the local context information of the characters; use a word vector embedding matrix to find the word vector representation of the text; connect the character vector representation and the word vector representation of the text; The recognition module is also used to: use a bidirectional long short-term memory network to learn the global context information of the text; use a multi-head self-attention mechanism to draw the interaction of words and construct a word context representation whose quality meets preset conditions; Use additional attention mechanism to model the amount of context information and calculate the importance weight for each word; sum the weighted values ​​of each word to get the final representation; The recognition module is also used to: transform the hidden representation of the text using a fully connected layer and an activation function; predict the final label using two separate fully connected layers and a SoftMax function; and combine a drug name classification model and a drug adverse reaction classification model.

3. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for jointly detecting drug names and adverse drug reactions in network texts as described in claim 1.

4. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the combined detection method of drug names and adverse drug reactions in network texts as described in claim 1.