Information extraction method, device and electronic device based on LSTM model

By introducing attention mechanism and vocabulary information into the LSTM model, the problem of difficulty in identifying polysemous words in the transaction information of the current coupon is solved, and the accuracy of information extraction is improved.

CN114970539BActive Publication Date: 2025-04-18BEIJING KUAQUO INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210316887.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2025-04-18
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

In the prior art, when identifying transaction information of current coupons, the recognition effect of polysynthetics is poor, resulting in low efficiency in identifying transaction information of current coupons.

Method used

Using the information extraction method based on the LSTM model, by constructing an LSTM model based on the attention mechanism, combining character-level word vectors and word vectors of vocabulary, vocabulary information is dynamically introduced, and semantic information of polysemous words is fused through the attention mechanism.

Benefits of technology

The semantic information understanding ability of the model has been improved and the accuracy of the collection of current coupon transaction information has been improved, which is specifically manifested as the accuracy of information extraction has been increased by 3%-5%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114970539B_ABST
    Figure CN114970539B_ABST
Patent Text Reader

Abstract

The present invention discloses an information extraction method, device and electronic device based on LSTM model, the method comprising: obtaining training samples, performing text preprocessing on the training samples, generating preprocessed training texts and corresponding annotation sequences; constructing an LSTM model based on an attention mechanism, training the LSTM model based on the attention mechanism based on the preprocessed training texts and corresponding annotation sequences, generating a target LSTM model; obtaining event texts to be extracted, preprocessing the event texts to be extracted, generating preprocessed target texts; inputting the target texts into the target LSTM model, and obtaining the extracted structured texts according to the output of the target LSTM model. The embodiment of the present invention is based on the LSTM model, improves the semantic information understanding ability of the model, and thus improves the accuracy of information extraction of current bond transactions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and particularly to an information extraction method, device and electronic device based on an LSTM model. Background Art

[0002] Spot trading is the most common type of trading in the financial fixed income field. In the text understanding of spot trading, the situation of a word having multiple meanings often occurs. Traders who see the news are often confused by the multiple meanings existing in the information sent by the other party without understanding all the information, and thus the model is even more so. In spot trading, the following corpora often appear: "Bond A 019865.SH 2000W 3.65 YY Securities issued by XX Bank" and "Sell Bond B 109765.SH 1000W 3.45 Issued by XX Bank to ZZ Securities". In the above two corpora, the meaning of "issued" is not the same. The first "issued" means "sold", and the second "issued" means "requested". Even non-financial professionals may not be able to understand the meaning of "issued" in the two corpora. Therefore, the model may not be able to learn these two situations well without prior knowledge.

[0003] There are mainly two existing methods for solving the problem of a word having multiple meanings. The first is to learn through large models with a large amount of data, such as BERT, Roberta, XLM-Robert, etc. These models have more than 100 million parameters, enabling the model to learn the multiple meanings of a word as much as possible even without external prior knowledge. The second is to add external prior knowledge and fuse multiple meanings of a word into the model, enabling the model to use the appropriate semantics to learn the text information, thereby being able to correctly learn the semantic information of the text and improving the accuracy of the model.

[0004] Current large models are all built based on pre-trained models. Pre-trained models such as BERT, Robert, XLM-Robert, etc. are all models with a huge number of parameters. Such models with a huge number of parameters are not applicable in some cases in actual industrial tasks. Companies may not have sufficient computing resources to build models with a huge number of parameters. Therefore, lightweight models need to be considered.

[0005] Secondly, external prior knowledge is introduced into lightweight models, that is, word vectors with multiple meanings of a word are introduced. However, the existing models for introducing external prior knowledge are very crude, directly adding or splicing multiple word vectors without considering which meaning the word in the text偏向s more.

[0006] Therefore, in the prior art, when identifying spot trading information, the recognition effect of polysemous words is poor, resulting in low efficiency in identifying spot trading information.

[0007] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0008] In view of the above-mentioned deficiencies in the prior art, the present invention provides an information extraction method, device and electronic device based on the LSTM model, aiming to solve the problem that when identifying current bond transaction information in the prior art, the recognition effect of polysemous words is poor, resulting in low efficiency in identifying current bond transaction information.

[0009] The technical solution of the present invention is as follows:

[0010] The first embodiment of the present invention provides an information extraction method based on an LSTM model, the method comprising:

[0011] Acquire training samples, perform text preprocessing on the training samples, and generate preprocessed training texts and corresponding annotation sequences;

[0012] Constructing an LSTM model based on an attention mechanism, training the LSTM model based on the attention mechanism based on the preprocessed training text and the corresponding annotation sequence to generate a target LSTM model;

[0013] Acquire the event text to be extracted, preprocess the event text to be extracted, and generate a preprocessed target text;

[0014] The target text is input into the target LSTM model, and the extracted structured text is obtained according to the output of the target LSTM model.

[0015] Furthermore, the obtaining of training samples, performing text preprocessing on the training samples, and generating preprocessed training texts and corresponding annotation sequences include:

[0016] Obtain training samples, and separate the annotation information and text in the training samples;

[0017] Convert text content into character-level word vectors;

[0018] Convert the annotation information into the corresponding annotation sequence.

[0019] Furthermore, the step of converting the text content into a character-level word vector includes:

[0020] Get the words in the text content and convert them into character-level word vectors;

[0021] Get the starting and ending word positions of a word;

[0022] The word vector, the starting character position and the ending character position of the word are stored.

[0023] Furthermore, the step of obtaining words in the text content and converting the words into character-level word vectors further includes:

[0024] Obtain words from text content and identify the semantic types of the words;

[0025] If the semantic type of a word is one, the word is encoded and converted into a character-level word vector;

[0026] If a word has more than one semantic type, the word vector information corresponding to each semantic type of the word is fused to generate a character-level word vector.

[0027] Furthermore, the word vector information corresponding to various semantics of the words is fused to generate a word vector at the character level, including:

[0028] Get the weight coefficient of the word vector corresponding to each semantic meaning of the word;

[0029] After the word vector information is fused according to the weight coefficient, a character-level word vector is generated.

[0030] Furthermore, the construction of the LSTM model based on the attention mechanism, based on the preprocessed training text and the corresponding annotation sequence, the LSTM model based on the attention mechanism is trained to generate a target LSTM model, including:

[0031] Constructing an LSTM model based on an attention mechanism, wherein the LSTM model includes an LSTM cell, an input gate, a forget gate, and an output gate;

[0032] The word vector is input into the LSTM model, and the starting word position and the ending word position of the word are spliced ​​through the LSTM cell;

[0033] According to the splicing results, the LSTM model based on the attention mechanism is trained to generate the target LSTM model.

[0034] Furthermore, the construction of the LSTM model based on the attention mechanism, based on the preprocessed training text and the corresponding annotation sequence, the LSTM model based on the attention mechanism is trained to generate a target LSTM model, including:

[0035] Constructing an LSTM model based on an attention mechanism, wherein the LSTM model includes an LSTM cell, an input gate, a forget gate, and an output gate;

[0036] The word vector is input into the LSTM model, and the starting word position and the ending word position of the word are spliced ​​through the LSTM cell;

[0037] Obtain the corresponding words through the splicing results, obtain the semantic types of the words, and obtain the weight coefficients of various semantics;

[0038] The LSTM model is trained according to the weight coefficients to generate a target LSTM model.

[0039] Another embodiment of the present invention provides an information extraction device based on an LSTM model, the device comprising:

[0040] A sample preprocessing module is used to obtain training samples, perform text preprocessing on the training samples, and generate preprocessed training texts and corresponding annotation sequences;

[0041] A model training module is used to build an LSTM model based on an attention mechanism, and to train the LSTM model based on the attention mechanism based on the preprocessed training text and the corresponding annotation sequence to generate a target LSTM model;

[0042] A text preprocessing module to be extracted, used to obtain the event text to be extracted, preprocess the event text to be extracted, and generate a preprocessed target text;

[0043] The information extraction module is used to input the target text into the target LSTM model and obtain the extracted structured text according to the output of the target LSTM model.

[0044] Another embodiment of the present invention provides an electronic device, the electronic device comprising at least one processor; and,

[0045] a memory communicatively connected to the at least one processor; wherein,

[0046] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned information extraction method based on the LSTM model.

[0047] Another embodiment of the present invention also provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned information extraction method based on the LSTM model.

[0048] Beneficial effect: The embodiment of the present invention is based on the LSTM model, which improves the semantic information understanding ability of the model, thereby improving the accuracy of information extraction of current bond transactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0050] Figure 1 This is a flow chart of a preferred embodiment of an information extraction method based on an LSTM model of the present invention;

[0051] Figure 2 A schematic diagram of an LSTM model integrating characters and words in a preferred embodiment of an information extraction method based on an LSTM model of the present invention;

[0052] Figure 3 A schematic diagram of a polysemous LSTM model based on the fusion of characters and words in a preferred embodiment of an information extraction method based on an LSTM model of the present invention;

[0053] Figure 4 A schematic diagram of functional modules of a preferred embodiment of an information extraction device based on an LSTM model of the present invention;

[0054] Figure 5 The figure is a schematic diagram of the hardware structure of a preferred embodiment of an electronic device of the present invention. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0056] The embodiments of the present invention are described below with reference to the accompanying drawings.

[0057] In view of the above problems, the present invention provides an information extraction method based on LSTM model. Figure 1 , Figure 1 This is a flow chart of a preferred embodiment of an information extraction method based on an LSTM model of the present invention. Figure 1 As shown, it includes:

[0058] Step S100: obtaining training samples, performing text preprocessing on the training samples, and generating preprocessed training texts and corresponding annotation sequences;

[0059] Step S200: constructing an LSTM model based on an attention mechanism, training the LSTM model based on the attention mechanism based on the preprocessed training text and the corresponding annotation sequence to generate a target LSTM model;

[0060] Step S300, obtaining the event text to be extracted, preprocessing the event text to be extracted, and generating a preprocessed target text;

[0061] Step S400: input the target text into the target LSTM model, and obtain the extracted structured text according to the output of the target LSTM model.

[0062] In specific implementation, the embodiment of the present invention is aimed at the situation where a word has multiple meanings in the text information in the current bond transaction field, but it is not limited to the current bond transaction field, and can also be used in other financial fields. The information extraction method is mainly used in information extraction tasks, but can also be applied to other tasks in the financial field, including but not limited to classification tasks, relationship extraction, and entity linking tasks.

[0063] The embodiment of the present invention adopts the LSTM lightweight model as the baseline model. The input of the LSTM adopted in this solution is the word vector information at the character level. However, the input at the character level will lack vocabulary information, and boundary problems will occur in the information extraction task. Therefore, the present invention transforms the LSTM model and dynamically introduces vocabulary information. In order to solve the problem of polysemy, the present invention also introduces external prior knowledge. Words with polysemy need to first obtain the word vector information of the different meanings of this word, and then this solution integrates the multiple meanings of this word into the LSTM model through the attention mechanism.

[0064] In one embodiment, obtaining a training sample, performing text preprocessing on the training sample, and generating preprocessed training text and a corresponding annotation sequence include:

[0065] Obtain training samples, and separate the annotation information and text in the training samples;

[0066] Convert text content into character-level word vectors;

[0067] Convert the annotation information into the corresponding annotation sequence.

[0068] In specific implementation, prior knowledge is obtained, and the corpus corresponding to the prior knowledge is used as a training sample. The training sample also includes annotation information and text. The annotation information and text are separated, and the separated text content is converted into a character-level word vector. At the same time, the annotation information is converted into a corresponding annotation sequence.

[0069] In one embodiment, converting text content into character-level word vectors includes:

[0070] Get the words in the text content and convert them into character-level word vectors;

[0071] Get the starting and ending word positions of a word;

[0072] The word vector, the starting character position and the ending character position of the word are stored.

[0073] In specific implementation, the internal structure formula of the LSTM cell in the prior art is as follows:

[0074] Forget gate: f t =σ(W f ·[h t-1 ,x t ]+b f ) (Formula 1)

[0075] Input gate: i t =σ(W i ·[h t-1 ,x t ]+b i ),

[0076]

[0077] Output gate: o t =σ(W o ·[h t-1 ,x t ]+b o ), h t =o t *tanh(C t ) (Formula 3)

[0078] where f t is the forgetting coefficient, i t is the input coefficient, o t is the input coefficient, represents the input state of the cell, C t represents the information state retained by the cell, h t-1 is the output of the previous cell, x t represents the input of the current cell, σ represents the sigmoid function, tanh represents the tanh function, W,b represents the weighted weight and bias coefficient, h t is the output of the current cell.

[0079] The existing LSTM model can only extract semantic information, but the model's understanding of semantic information depends on the word embedding information input to the model from the outside. Due to the limited number of parameters, it often has deviations in understanding some difficult and complex text information. Moreover, many researchers choose to use externally trained word embeddings as the input of the LSTM model when using the LSTM model. At this time, the LSTM model only needs to fine-tune the word embedding according to the semantics of the text information to achieve better results. It is conceivable that external prior knowledge is very important for the LSTM model.

[0080] This solution introduces word vector information of vocabulary based on word vector information at the character level. The specific model diagram is as follows Figure 2 As shown. Figure 2 As can be seen from the figure, the input of LSTM is at the character level, while in Chinese, it is at the "word" level. Each word corresponds to an embedding information, but this situation will cause some boundary problems for the model to understand semantic information. Therefore, the LTSM cell of each word is spliced ​​between the starting word position and the ending word position of each word, so that the semantic information of the word can be integrated into the model, enhancing the semantic understanding ability of the model.

[0081] In one embodiment, obtaining words in text content and converting the words into character-level word vectors further includes:

[0082] Obtain words from text content and identify the semantic types of the words;

[0083] If the semantic type of a word is one, the word is encoded and converted into a character-level word vector;

[0084] If a word has more than one semantic type, the word vector information corresponding to each semantic type of the word is fused to generate a character-level word vector.

[0085] In the specific implementation, on the improved model that introduces vocabulary information, this solution further discovered that there may be polysemy in the vocabulary, so the polysemy must also be taken into account in the model. Therefore, for the above situation, the model is further modified. Therefore, the attention mechanism is considered, and the multiple semantics of a word are integrated into the model through the attention mechanism, so that the model can select words with appropriate semantics according to the text content, further improving the semantic understanding ability of the model and the accuracy of information extraction tasks. Therefore, a LSTM model based on character and word fusion polysemy is as follows Figure 3 shown.

[0086] from Figure 3 It can be seen that the word "please send" has two meanings in the current bond transaction, "sell" and "request". It is necessary to select the two meanings and integrate them into the model through the attention mechanism to obtain appropriate semantic information.

[0087] In one embodiment, after the word vector information corresponding to various semantics of a word is integrated, a word vector at the character level is generated, including:

[0088] Get the weight coefficient of the word vector corresponding to each semantic meaning of the word;

[0089] After the word vector information is fused according to the weight coefficient, a character-level word vector is generated.

[0090] In specific implementation, when a word has multiple semantics, the weight coefficient corresponding to each semantics can be obtained respectively, and multiple meanings of the same word can be obtained by weighted fusion. For example, the calculation formula is as follows:

[0091] E w =α1E w1 +α2E w2 +L+α n E wn , (Formula 4)

[0092] Where E w The word vector after the fusion of word vector information representing multiple meanings, α i ,i=1,L,n represents the weight of attention, E wi ,i=1,L,n represents the i-th meaning of this word.

[0093] In one embodiment, an LSTM model based on an attention mechanism is constructed, and based on the preprocessed training text and the corresponding annotation sequence, the LSTM model based on the attention mechanism is trained to generate a target LSTM model, including:

[0094] Constructing an LSTM model based on an attention mechanism, wherein the LSTM model includes an LSTM cell, an input gate, a forget gate, and an output gate;

[0095] The word vector is input into the LSTM model, and the starting word position and the ending word position of the word are spliced ​​through the LSTM cell;

[0096] According to the splicing results, the LSTM model based on the attention mechanism is trained to generate the target LSTM model.

[0097] In the specific implementation, an LSTM model based on the attention mechanism is constructed. The LSTM model consists of LSTM cells, input gates, forget gates, and output gates. The core concept of LSTM lies in the cell state and the "gate" structure. The cell state is equivalent to the path of information transmission, allowing information to be passed on in the sequence connection. You can think of it as the "memory" of the network. In theory, the cell state can always pass on relevant information in the sequence processing process. Therefore, even information from earlier time steps can be carried to cells in later time steps, which overcomes the influence of short-term memory. We add and remove information through the "gate" structure, which will learn what information to save or forget during the training process.

[0098] By recording the starting and ending positions of words, LSTM can identify character boundaries during training, further improving the accuracy of information recognition.

[0099] In one embodiment, an LSTM model based on an attention mechanism is constructed, and based on the preprocessed training text and the corresponding annotation sequence, the LSTM model based on the attention mechanism is trained to generate a target LSTM model, including:

[0100] Constructing an LSTM model based on an attention mechanism, wherein the LSTM model includes an LSTM cell, an input gate, a forget gate, and an output gate;

[0101] The word vector is input into the LSTM model, and the starting word position and the ending word position of the word are spliced ​​through the LSTM cell;

[0102] According to the splicing results, the LSTM model based on the attention mechanism is trained to generate the target LSTM model.

[0103] When implementing it, Figure 3 As shown in the figure, the LSTM model formula for polysemous words based on the fusion of characters and words is as follows:

[0104]

[0105]

[0106]

[0107]

[0108]

[0109] in The input word vector representing the Kth meaning of the word starting from b and ending at e. Represents the LSTM cell output of the b-th character. The forget gate coefficient representing the Kth meaning of the word starting from b and ending at e. The input gate coefficient representing the Kth meaning of the word starting from b and ending at e. The input state of the LSTM cell representing the Kth meaning of the word starting with b and ending with e. The retained information state of the LSTM cell representing the Kth meaning of the word starting from b and ending with e. This represents the cell state after all the meanings of the words starting from b and ending at e are weighted. Represents the cell status information of the e-th character. represents the weight coefficient of the Kth meaning of the word starting from b and ending at e, represents the weight coefficient of the words starting from b and ending at e, Indicates the weight coefficient of the e-th character.

[0110] The embodiment of the present invention provides an information extraction method based on the LSTM model, which adopts a polysemous LSTM model based on the fusion of characters and words, so that the model is effectively improved in understanding semantic information; the accuracy of the information extraction task of current bond transactions is improved by 3%-5%.

[0111] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.

[0112] Another embodiment of the present invention provides an information extraction device based on the LSTM model, such as Figure 4 As shown, the device 1 comprises:

[0113] The sample preprocessing module 11 is used to obtain training samples, perform text preprocessing on the training samples, and generate preprocessed training texts and corresponding annotation sequences;

[0114] A model training module 12 is used to construct an LSTM model based on an attention mechanism, and to train the LSTM model based on the attention mechanism based on the preprocessed training text and the corresponding annotation sequence to generate a target LSTM model;

[0115] The to-be-extracted text preprocessing module 13 is used to obtain the to-be-extracted event text, preprocess the to-be-extracted event text, and generate the preprocessed target text;

[0116] The information extraction module 14 is used to input the target text into the target LSTM model, and obtain the extracted structured text according to the output of the target LSTM model.

[0117] The specific implementation method is shown in the method embodiment, which will not be described in detail here.

[0118] Another embodiment of the present invention provides an electronic device, such as Figure 5 As shown, the electronic device 10 includes:

[0119] One or more processors 110 and memory 120, Figure 5 A processor 110 is used as an example for description. The processor 110 and the memory 120 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.

[0120] The processor 110 is used to complete various control logics of the electronic device 10, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISCMachine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware control, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.

[0121] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the information extraction method based on the LSTM model in the embodiment of the present invention. The processor 110 executes various functional applications and data processing of the device 10 by running the non-volatile software programs, instructions and units stored in the memory 120, that is, implementing the information extraction method based on the LSTM model in the above method embodiment.

[0122] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store applications required for operating the device and at least one function; the data storage area may store data created according to the use of the device 10, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include a memory remotely arranged relative to the processor 110, and these remote memories may be connected to the device 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0123] One or more units are stored in the memory 120, and when executed by one or more processors 110, the information extraction method based on the LSTM model in any of the above method embodiments is executed, for example, the above described Figure 1 The method comprises steps S100 to S400.

[0124] An embodiment of the present invention provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 1 The method comprises steps S100 to S400.

[0125] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory controls or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.

[0126] Another embodiment of the present invention provides a computer program product, the computer program product includes a computer program stored on a non-volatile computer-readable storage medium, the computer program includes program instructions, when the program instructions are executed by a processor, the processor executes the information extraction method based on the LSTM model of the above method embodiment. For example, executing the above described Figure 1 The method comprises steps S100 to S400.

[0127] The embodiments described above are merely illustrative, in which the units described as separate components may or may not be physically separated, and the components shown as units 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 achieve the purpose of the solution of this embodiment.

[0128] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can exist in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0129] Conditional language such as "can," "can," "might," or "may," among other things, unless specifically stated otherwise or otherwise understood within the context as used, is generally intended to convey that particular embodiments can include (while other embodiments do not) particular features, elements, and / or operations. Thus, such conditional language is also generally intended to imply that features, elements, and / or operations are anyway required for one or more embodiments or that one or more embodiments must include logic for determining, with or without input or prompting, whether such features, elements, and / or operations are included or will be performed in any particular embodiment.

[0130] What has been described herein in this specification and the accompanying drawings includes examples that can provide information extraction methods and devices based on LSTM models. Of course, it is not possible to describe every conceivable combination of elements and / or methods for the purpose of describing the various features of the present disclosure, but it is recognized that many other combinations and permutations of the disclosed features are possible. Therefore, it is obvious that various modifications can be made to the present disclosure without departing from the scope or spirit of the present disclosure. In addition, or in an alternative, other embodiments of the present disclosure may be apparent from consideration of this specification and the accompanying drawings and from the practice of the present disclosure as presented herein. It is intended that the examples proposed in this specification and the accompanying drawings are considered to be illustrative and not restrictive in all respects. Although specific terms are employed herein, they are used in a general and descriptive sense and are not used for limiting purposes.

Claims

1. An information extraction method based on LSTM model, characterized by , the method comprises: Acquire training samples, perform text preprocessing on the training samples, and generate preprocessed training texts and corresponding annotation sequences; Constructing an LSTM model based on an attention mechanism, training the LSTM model based on the attention mechanism based on the preprocessed training text and the corresponding annotation sequence to generate a target LSTM model; Acquire the event text to be extracted, preprocess the event text to be extracted, and generate a preprocessed target text; Inputting the target text into the target LSTM model, and obtaining the extracted structured text according to the output of the target LSTM model; Performing text preprocessing on the training sample to generate preprocessed training text and corresponding annotation sequence, including: Obtain training samples, and separate the annotation information and text in the training samples; Convert text content into character-level word vectors; Convert the annotation information into the corresponding annotation sequence; The process of converting text content into character-level word vectors includes: Get the words in the text content and convert them into character-level word vectors; Get the starting and ending word positions of a word; Storing the word vector, the starting word position and the ending word position of the word; After fusing the word vector information corresponding to various semantics of the words, a word vector at the character level is generated, including: Get the weight coefficient of the word vector corresponding to each semantic meaning of the word; After fusing the word vector information according to the weight coefficient, a word vector at the character level is generated; The construction of the LSTM model based on the attention mechanism, based on the preprocessed training text and the corresponding annotation sequence, the LSTM model based on the attention mechanism is trained to generate a target LSTM model, including: Constructing an LSTM model based on an attention mechanism, wherein the LSTM model includes an LSTM cell, an input gate, a forget gate, and an output gate; The word vector is input into the LSTM model, and the starting word position and the ending word position of the word are spliced ​​through the LSTM cell; Obtain the corresponding words through the splicing results, obtain the semantic types of the words, and obtain the weight coefficients of various semantics; The LSTM model is trained according to the weight coefficients to generate a target LSTM model.

2. The method according to claim 1, characterized in that: The step of obtaining words in the text content and converting the words into character-level word vectors further includes: Obtain words from text content and identify the semantic types of the words; If the semantic type of a word is one, the word is encoded and converted into a character-level word vector; If a word has more than one semantic type, the word vector information corresponding to each semantic type of the word is fused to generate a character-level word vector.

3. The method according to claim 1, characterized in that The construction of the LSTM model based on the attention mechanism, based on the preprocessed training text and the corresponding annotation sequence, the LSTM model based on the attention mechanism is trained to generate a target LSTM model, including: Constructing an LSTM model based on an attention mechanism, wherein the LSTM model includes an LSTM cell, an input gate, a forget gate, and an output gate; The word vector is input into the LSTM model, and the starting word position and the ending word position of the word are spliced ​​through the LSTM cell; According to the splicing results, the LSTM model based on the attention mechanism is trained to generate the target LSTM model.

4. An information extraction device based on LSTM model, characterized in that: The device comprises: A sample preprocessing module is used to obtain training samples, perform text preprocessing on the training samples, and generate preprocessed training texts and corresponding annotation sequences; A model training module is used to build an LSTM model based on an attention mechanism, and to train the LSTM model based on the attention mechanism based on the preprocessed training text and the corresponding annotation sequence to generate a target LSTM model; A text preprocessing module to be extracted, used to obtain the event text to be extracted, preprocess the event text to be extracted, and generate a preprocessed target text; An information extraction module, used for inputting the target text into the target LSTM model, and obtaining the extracted structured text according to the output of the target LSTM model; Performing text preprocessing on the training sample to generate preprocessed training text and corresponding annotation sequence, including: Obtain training samples, and separate the annotation information and text in the training samples; Convert text content into character-level word vectors; Convert the annotation information into the corresponding annotation sequence; The process of converting text content into character-level word vectors includes: Get the words in the text content and convert them into character-level word vectors; Get the starting and ending word positions of a word; Storing the word vector, the starting word position and the ending word position of the word; After fusing the word vector information corresponding to various semantics of the words, a word vector at the character level is generated, including: Get the weight coefficient of the word vector corresponding to each semantic meaning of the word; After fusing the word vector information according to the weight coefficient, a word vector at the character level is generated; The construction of the LSTM model based on the attention mechanism, based on the preprocessed training text and the corresponding annotation sequence, the LSTM model based on the attention mechanism is trained to generate a target LSTM model, including: Constructing an LSTM model based on an attention mechanism, wherein the LSTM model includes an LSTM cell, an input gate, a forget gate, and an output gate; The word vector is input into the LSTM model, and the starting word position and the ending word position of the word are spliced ​​through the LSTM cell; Obtain the corresponding words through the splicing results, obtain the semantic types of the words, and obtain the weight coefficients of various semantics; The LSTM model is trained according to the weight coefficients to generate a target LSTM model.

5. An electronic device, characterized in that: The electronic device comprises at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the information extraction method based on the LSTM model described in any one of claims 1-3.

6. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the information extraction method based on the LSTM model described in any one of claims 1-3.

Citation Information

Patent Citations

  • A method for jointly extracting entity relations from sequential annotations based on attention mechanism

    CN109408812A

  • Named entity recognition model training method and device and named entity recognition method and device

    CN113255294A