Military text recognition method and device and medium
By using deep learning methods of BERT word vector transformation, Bi-LSTM and self-attention mechanism in military text recognition, the problem of difficulty in identifying complex military texts in the prior art is solved, and the accurate recognition and understanding of military texts is achieved.
Patent Information
- Application Number
- CN202510047654.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-01-13
AI Technical Summary
Existing text recognition methods are difficult to effectively identify complex military texts, especially in the absence of extensive training samples and complex semantic expressions.
Deep learning methods based on BERT word vector transformation, Bi-LSTM and self-attention mechanism are used to perform word segmentation, named entity type prediction and relationship extraction on military text, and information in the text is identified by integrating named entity type prediction results and relation prediction results.
It realizes accurate identification of complex military texts, can identify the upper and lower hierarchical relationships and sentence meanings between different entities, and improves the ability to understand military texts.
Smart Images

Figure CN119990117A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to text recognition technology, and in particular to a military text recognition method, device, computer-readable storage medium and computer program product. Background Art
[0002] Military texts are usually highly professional and confidential, and are not commonly found in various public materials. Therefore, there is a lack of extensive training samples. In addition, military texts have complex semantic expressions and often lack complete sentence components. Therefore, existing recognition methods cannot correctly and effectively recognize military texts. Summary of the invention
[0003] In a first aspect, the present application proposes a military text recognition method, the method comprising:
[0004] S1. Segment the military text;
[0005] S2. Perform BERT word vector conversion on the word segmentation results through the input layer, convert the word segmentation results into word vector representations of fixed dimensions, and output the corresponding word vector sequence tensor;
[0006] S3. The encoding layer processes the word vector sequence tensor output by the input layer, which includes:
[0007] S31. All input word vectors are processed sequentially along the time step through the forward and reverse LSTM units in the Bi-LSTM, and each LSTM unit outputs a hidden state vector at each time step, wherein the forward LSTM processes the word vector from the beginning to the end of the input sequence, and the reverse LSTM processes from the end to the beginning of the input sequence; the input sequence includes the entire article in which the text is located;
[0008] S32. Output an output tensor formed by the hidden state vector based on each word vector after Bi-LSTM;
[0009] S33. Accept the output tensor after Bi-LSTM, and calculate the attention weight of each word relative to other words based on the self-attention mechanism, wherein the calculation includes: performing a linear transformation on the hidden state vector in the Bi-LSTM output tensor to generate three matrices of query, key and value, and then calculating the attention weight using the dot product of the query and the key, and then weighting and summing the value using the attention weight to obtain the re-weighted integrated vector representation of each word, and outputting the corresponding tensor;
[0010] S41. The output layer receives the tensor outputted from step S33 and performs a linear transformation, maps the word vector therein to a vector space with a dimension equal to the number of named entity types, and outputs the corresponding mapped vector;
[0011] S42. The output layer applies Softmax activation to the vector of each word mapped in step S41, converting it into a probability distribution of each named entity type corresponding to each word, and the named entity type with the highest probability is regarded as the named entity type prediction result of the word and is output externally;
[0012] S5. The output layer performs relation extraction to obtain relation prediction results; the relation extraction includes:
[0013] S51. Identify candidate entity groups in the text based on the feature vector of the named entity type obtained by the output layer;
[0014] S52. For each candidate entity group, extract the vector representation corresponding to the entity group from the feature vectors calculated by the encoding layer based on the self-attention mechanism, and then concatenate multiple feature vectors in the entity group to form a joint vector representation of the entity group;
[0015] S53. Input the concatenated joint vector into a linear transformation layer, map it to a vector space with a dimension equal to the number of relationship categories and output the mapped vector;
[0016] S54. Apply the Softmax activation function to the vector output by S53 to convert it into a probability distribution; the probability distribution represents the probability that the entity group belongs to each relationship category, and the relationship category with the highest probability is regarded as the relationship prediction result of the entity group and is output externally;
[0017] S6. Integrate the named entity type prediction results and relationship prediction results to identify information in the text.
[0018] According to some embodiments of the present invention, the output layer includes a named entity output module and a relationship extraction module.
[0019] According to some embodiments of the present invention, the named entity types include: organization class, action class, location class, data, symbol, direction coordinates, group, battalion, army, team, detachment, class, platoon, brigade, soldier, preposition, composition class and other classes.
[0020] According to some embodiments of the present invention, performing BERT word vector conversion on the word segmentation result through the input layer includes structured representation of named entities in the text.
[0021] According to some embodiments of the present invention, the method further includes storing the city-province-region-country information corresponding to the location in an associated database, so that when a structured representation of a location needs to be determined, it can be obtained by calling the associated database.
[0022] According to some embodiments of the present invention, the number of forward and reverse hidden layer units is 256 respectively.
[0023] According to some embodiments of the present invention, the identifying further comprises converting relative time in the text into absolute time.
[0024] The present application also provides a device for military text recognition, which includes a processor and a memory; the processor executes the described method based on a computer program stored in the memory.
[0025] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the method described is performed.
[0026] The present application also provides a computer program product, comprising a computer program, characterized in that the method described is implemented when the computer program is executed by a processor.
[0027] Through the above-mentioned embodiments of the present invention, military texts can be effectively identified, especially the hierarchical relationships between different entities in complex military text expressions, as well as the corresponding sentence meanings can be effectively identified. Taking the sentence "The information warfare group is composed of an electronic reconnaissance battalion and an unmanned aerial vehicle jamming electronic destruction battalion" as an example, through the present invention, it can be identified that the electronic reconnaissance battalion and the unmanned aerial vehicle jamming electronic destruction battalion in the sentence together constitute the information warfare group. Moreover, for the equally complex sentences that appear after it, the present invention will not only identify the hierarchical relationships between the named entities in the sentence itself, but also group the next sentence content and the previous sentence content (that is, the contextual relationship between all named entities in the entire paragraph) together to perform operations such as grouping multiple candidate entity groups and feature extraction of the relationship extraction model, thereby realizing accurate recognition of the next sentence content and sequentially realizing recognition of the entire text. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings herein are incorporated into and constitute a part of the specification, and the accompanying drawings illustrate embodiments consistent with the present invention and are used together with the specification to explain the present invention. Elements with the same reference numerals in the accompanying drawings represent similar elements, and unless otherwise stated, the drawings in the accompanying drawings do not constitute a scale limitation.
[0029] Figure 1 A schematic diagram showing a network structure based on a text recognition method according to some embodiments of the present invention;
[0030] Figure 2 A schematic diagram of a network structure and a portion of its operation based on a text recognition method according to some embodiments of the present invention;
[0031] Figure 3 A schematic flow chart showing a military text recognition method according to some embodiments of the present invention;
[0032] Figure 4 A schematic structural block diagram of an apparatus for military text recognition according to some embodiments of the present invention is shown;
[0033] Figure 5 A schematic structural diagram of a device for military text recognition according to some embodiments of the present invention is shown. DETAILED DESCRIPTION
[0034] The present invention will be exemplarily described below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments in this application can be combined with each other without conflict. In addition, the described embodiments are only some embodiments of the present invention, not all embodiments.
[0035] In the first aspect of the present application, a military text recognition method based on a self-built network structure is proposed, wherein the self-built network structure includes an input layer, a coding layer and an output layer, and the coding layer is based on Bi-LSTM and a self-attention mechanism. Figure 1 As shown, a schematic diagram of the self-built network structure of the present invention is given. After the text is input, it is first converted to a BERT word vector. The converted word vector enters the input layer, the encoding layer, and finally reaches the output layer. According to some embodiments of the present invention, Figure 2 As shown in the figure, the layer where the BERT word vector conversion is located can also be regarded as an input layer as a whole together with the input layer to realize the BERT word vector conversion. Figure 2 Schematic diagram of the network structure and its partial operation based on the text recognition method according to some embodiments of the present invention. Figure 3 A schematic flow chart of a military text recognition method according to some embodiments of the present invention is shown. As shown in the figure, it includes the following steps S1-S6:
[0036] S1. Segment the military text. Taking the text input "Reconnaissance Battalion Conducts Electronic Countermeasure Reconnaissance against the Enemy" as an example, the segmentation result should be: ["Reconnaissance Battalion", "to", "enemy", "implement", "electronic countermeasure reconnaissance"]. You can use professional segmentation tools, such as Jieba, to segment the text into individual words. For special words in the military field, such as names of military equipment and military terms, you can customize the dictionary to improve the accuracy of segmentation.
[0037] S2. Perform BERT word vector conversion on the word segmentation result through the input layer, convert the word segmentation result into a word vector representation of a fixed dimension, and output the corresponding word vector sequence tensor. The input layer performs BERT word vector conversion on the word segmentation result. The input layer may include a word vector embedding module, which uses BERT word embedding to convert the word segmentation result into a vector representation of a fixed dimension. Assuming that the output vector dimension is 768 dimensions, after being processed by this module, the word vector representation of the entire sentence constitutes a two-dimensional tensor with a shape of [number of words (5 in this case), 768], that is, each word corresponds to a 768-dimensional vector. For example, the vector corresponding to "Reconnaissance Camp" is a vector form of [0.23, -0.32, 0.46, ...] (only some dimensions are displayed).
[0038] The BERT word vector conversion of the word segmentation results through the input layer includes the structured expression of the named entities in the text. For example, the word "Changsha City" can be restructured from the original label "place" to the label "place-city-province-region-country". The structured information such as city-province-region-country corresponding to the place can also be stored in an associated database, so that when the structured expression of "Changsha City" needs to be determined, it can be obtained by calling the associated database.
[0039] S3. The encoding layer receives and processes the word vector sequence tensor output by the input layer, which includes:
[0040] S31. Through the forward and reverse LSTM units inside the Bi-LSTM, all input word vectors are processed sequentially along the time step (that is, the order of words), and each LSTM unit outputs a hidden state vector at each time step, where the forward LSTM processes the word vector from the beginning to the end of the input sequence, and the reverse LSTM processes from the end to the beginning of the input sequence; the input sequence includes the entire article in which the text is located.
[0041] S32. Output the output tensor formed by the hidden state vector based on each word vector after Bi-LSTM.
[0042] Assuming the number of hidden layer units set by Bi-LSTM is h, then after Bi-LSTM, a hidden state vector that incorporates contextual information will be output at each time step (i.e., the position of each word), and the shape of its output tensor becomes [number of words (n), 2*h (the sum of the number of forward and reverse hidden layer units)], that is, [5, 2*256] = [5, 512]. In the present invention, the model result corresponding to h being 256 is optimal, which can avoid the problems of increased overfitting risk caused by h being too large, excessive consumption of computing resources, and the problems of insufficient expression ability caused by h being too small, and inability to fully capture complex features in the text.
[0043] Taking the word "scout camp" as an example, the hidden state vector corresponding to the word "scout camp" after Bi-LSTM may be in the form of [0.21, -0.12, 0.45, ...] (a total of 512 dimensions, only the schematic part is shown). This vector integrates the semantic, grammatical and other information carried by itself and the context.
[0044] S33. Accept the output tensor after Bi-LSTM and use the self-attention mechanism ( Figure 2 The Self-Attention of Bi-LSTM is used to calculate the attention weight of each word relative to other words. The calculation includes: performing a linear transformation on the hidden state vector in the output tensor of Bi-LSTM to generate three matrices of query, key and value, and then using the dot product of query and key to calculate the attention weight, and then using the attention weight to perform weighted summation on the value to obtain the re-weighted integrated vector representation of each word, and output the corresponding tensor.
[0045] After the self-attention mechanism of the encoding layer, the output tensor dimension remains unchanged, which is still [number of words (n), 512]. However, in the vector representation of each word, those parts that are closely semantically related to other words in the sentence will be highlighted. For example, after the vector of the word "electronic countermeasure reconnaissance" passes through the self-attention mechanism, the weight of the semantically related parts of "reconnaissance camp" and "implementation, etc." may be higher. The values of each dimension of the vector will be redistributed according to the new attention weights. It is assumed that it becomes [0.34, 0.08, -0.21, ...] (indicating some dimensions), which further strengthens the long-distance semantic relationship between words in the sentence.
[0046] S41. The output layer receives the tensor outputted from step S33 and performs a linear transformation (fully connected operation), maps the word vectors therein to a vector space whose dimension is equal to the number of named entity types and outputs the corresponding mapped vectors.
[0047] The 512-dimensional word vector is mapped to a space with a dimension equal to the number of named entity types, and the resulting tensor dimension shape is [number of words (n), m], where m is the number of named entity types.
[0048] The output layer may include a named entity (NER) output module. According to some embodiments of the present invention, the named entity types particularly include: organization class, action class, location class, data, symbol, direction coordinate, group, battalion, army, team, squad, class, platoon, brigade, soldier, preposition, composition class and other classes, a total of 18 categories, that is, m=18, and the tensor dimension shape obtained here is [number of words (n), 18], that is, [5,18]. In the prior art, named entities are usually proper nouns, and in the present invention, action class, data, symbol, direction coordinate, group, battalion, army, team, squad, class, platoon, brigade, soldier, preposition, etc. are creatively used as named entities. This processing method is specially proposed for the complexity of military texts.
[0049] S42. The output layer applies Softmax activation to the vector of each word mapped in step S41, and converts it into a probability distribution of each named entity type corresponding to each word (the probability distribution indicates the probability that the word belongs to each named entity type). The named entity type with the highest probability is regarded as the named entity type prediction result of the word and is output externally.
[0050] For example, for the word "scout camp", the output probability may be [0.01, 0.004, 0.002, 0.006, 0.008, 0.003, 0.005, 0.9, ...] (the sum is 1), which means that the model believes that there is a 90% probability that "scout camp" belongs to the category of "camp".
[0051] S5. The output layer performs relation extraction to obtain relation prediction results.
[0052] The output layer may include a relation extraction module. The relation extraction module includes:
[0053] S51. Identify candidate entity groups in the text based on the feature vector of the named entity type obtained by the output layer.
[0054] Based on the feature vector of the named entity type obtained by the output layer, words of different entity types are grouped to form several candidate entity groups. The feature vector contains the entity type information of the named entity (as determined in step S42) and the association characteristics of the word with respect to other words (as reflected in the calculation of step S33).
[0055] S52. For each candidate entity group, extract the vector representation corresponding to the entity group from the vector calculated by the S33 encoding layer based on the self-attention mechanism, and then concatenate multiple feature vectors in the entity group to form a joint vector representation of the entity group.
[0056] For example: Brigade 03 is deployed at Hill (107,216), where Brigade 03, Hill, and coordinates can be identified as a group, namely [Brigade 03, Hill, (107, 216)]. The dimension of the multiple feature vectors in the entity group after concatenation should be [3,n], where 3 represents the number of phrases and n represents the one-dimensional feature vector of each phrase.
[0057] S53. Input the concatenated joint vector into a linear transformation layer (i.e., a fully connected layer), map it to a vector space whose dimension is equal to the number of relationship categories and output the mapped vector.
[0058] Assuming there are r types of relationship categories, the dimension of the output vector is [1, r].
[0059] The relationship categories include "attack", "defense", "deployment", etc.
[0060] S54. Apply the Softmax activation function to the vector output by S53 to convert it into a probability distribution; the probability distribution represents the probability that the entity group belongs to each relationship category, and the relationship category with the highest probability is regarded as the relationship prediction result of the entity group and is output externally.
[0061] S6. Integrate the named entity type prediction results and relationship prediction results to identify information in the text.
[0062] In the above-mentioned embodiment of the present invention, a plurality of different entity groups are grouped and feature extraction is performed on the next-layer relationship extraction model to obtain the relationship probability distribution corresponding to the different entity groups. After filtering out the entity groups with low probability distribution, relationship judgment is performed on the entity groups with high probability to obtain the upper and lower hierarchical relationships between different entities.
[0063] Through the above-mentioned embodiments of the present invention, military texts can be effectively identified, especially the hierarchical relationships between different entities in complex military text expressions, as well as the corresponding sentence meanings can be effectively identified. Taking the sentence "The information warfare group is composed of an electronic reconnaissance battalion and an unmanned aerial vehicle jamming electronic destruction battalion" as an example, through the present invention, it can be identified that the electronic reconnaissance battalion and the unmanned aerial vehicle jamming electronic destruction battalion in the sentence together constitute the information warfare group. Moreover, for the equally complex sentences that appear after it, the present invention will not only identify the hierarchical relationships between the named entities in the sentence itself, but also group the next sentence content and the previous sentence content (that is, the contextual relationship between all named entities in the entire paragraph) together to perform operations such as grouping multiple candidate entity groups and feature extraction of the relationship extraction model, thereby realizing accurate recognition of the next sentence content and sequentially realizing recognition of the entire text.
[0064] According to some embodiments of the present invention, the recognition may also include enhanced semantic understanding of the text. For example, the recognition may also include converting relative time in the text into absolute time. For example, for a relatively recent time, the time nodes are converted for ease of use and understanding. For example, the sentence "Complete the login at noon tomorrow" will be interpreted as "Complete the login at 12:00 on August 10, 2024" after deep semantic interpretation if today is August 9, 2024.
[0065] In addition, you can also provide a deeper explanation on entities such as quantity based on the current context.
[0066] The following will further provide the training process of the above recognition method or the model involved therein as well as the data collection, cleaning and preprocessing processes before training.
[0067] The data collection may include:
[0068] 1. Obtain text data from data sources in related fields such as military news reports, military documents, and military forums. For example, crawl news articles from news websites of authoritative military media, or collect electronic versions of military history research documents.
[0069] 2. It can also include professional documents such as military equipment manuals and military combat reports to ensure that the data covers all aspects of the military field, such as military figures, military organizations, military equipment, military events and other related information.
[0070] The data cleaning may include:
[0071] 1. Remove noise data, such as advertising information and irrelevant comments on web pages. For crawled web page data, you may need to remove irrelevant elements such as HTML tags.
[0072] 2. Process duplicate data and keep only one copy of the same text content to avoid unnecessary impact on model training.
[0073] 3. Check the integrity of the data and delete text with incomplete or unrecognizable character encodings.
[0074] Data preprocessing can include:
[0075] 1. Use professional word segmentation tools, such as Jieba, to segment the text into individual words. For special words in the military field, such as names of military equipment and military terms, you can customize the dictionary to improve the accuracy of word segmentation.
[0076] 2. Perform part-of-speech tagging on the words after segmentation, such as nouns, verbs, adjectives, etc. This helps the subsequent model better understand the grammatical function of words in sentences.
[0077] 3. Based on the word segmentation results, construct a vocabulary in the military field and count the frequency of each word. Appropriately process low-frequency words, such as merging or replacing them, to reduce the vocabulary and improve model training efficiency.
[0078] 4. Structuring named entities. For example, during training, structured naming analysis and entity naming are performed on the training data set; and during text recognition, structured settings are performed on the links involving named entity types (such as vector space, etc.).
[0079] The named entity structuring may include, for example, organizational structuring and position deployment structuring, wherein the organizational structuring includes dividing the organization into xx group, xx battalion, xx army, xx team, xx company, xx squad, xx class, xx platoon, xx brigade, etc. The position deployment structuring includes dividing the position into artillery position, command post, air defense missile position, howitzer artillery company position, etc.
[0080] According to some embodiments of the present invention, named entity structuring can be achieved by further granularizing the named entities. For example, the word "Changsha City" can be changed from the original label "place" to the label "place-city-province-region-country", and the structured information such as city-province-region-country corresponding to the place can be stored in an associated database, so that when the structured data of "Changsha City" needs to be determined, it can be obtained by calling the associated database.
[0081] 5. Use synonym replacement method for data augmentation
[0082] The synonym replacement method is mainly used to optimize the data augmentation method. When the sample size is small, combined with a more complete knowledge graph, more valid data text can be generated.
[0083] Further data enhancement is performed on the basis of the existing military text dataset. For example, after synonym replacement for "the rear defense team retreated to Tianzhuang", a new training data is added: "the combat support group retreated to Wangzhuang".
[0084] As mentioned above, similar entities including time type entities, location type entities, and organization type entities can all use a similar synonym replacement method to replace different detailed entities under the same entity type. For example, replace xx battalion with xx company, etc.
[0085] The model training and verification process of the text recognition method includes:
[0086] 1. Data preparation
[0087] Extract entity groups and their relationship annotation information from text data. For example, for "a certain general commanded a certain unit to fight", extract triple data such as (a certain general, a certain unit, command relationship).
[0088] Divide this data into training set, validation set, and test set.
[0089] 2. Initialize the model
[0090] Randomly initialize model parameters according to the selected self-built model.
[0091] 3. Define the loss function
[0092] The classification cross entropy loss function can be used to measure the accuracy of the model's prediction of relationship categories if it is a multi-classification relationship category.
[0093] 4. Model Training
[0094] The training set data is input into the self-built network structure, the prediction results of the entity relationship are calculated by the forward propagation model, and then the loss value is calculated according to the loss function.
[0095] The model parameters are updated using the back-propagation algorithm, and the model is optimized through multiple training rounds until the performance of the model on the validation set is stable or the predetermined training rounds are reached.
[0096] 5. Model Validation
[0097] The test set can be used to test the trained named entity recognition model and relation extraction model separately.
[0098] For named entity recognition models, evaluation indicators may include precision, recall, and F1 value. For example, the ratio of the number of correctly identified military entities to the number of military entities predicted by the model is used to obtain the precision, the ratio of the number of correctly identified military entities to the actual number of military entities is used to obtain the recall, and the F1 value is the harmonic mean of the precision and recall.
[0099] For the relation extraction model, you can also use indicators such as accuracy, recall, and F1 value, but here we evaluate the results of relation extraction. For example, the ratio of the number of correctly extracted relations to the number of relations predicted by the model is calculated as the accuracy rate.
[0100] Based on the results of model verification, the performance of the model is analyzed to identify problems and deficiencies in the model, such as inaccurate recognition of certain types of military entities or poor extraction of specific relationship categories, so as to further optimize and improve the model.
[0101] Figure 4The schematic structural block diagram of a device 5000 for military text recognition according to some embodiments of the present invention is shown. As shown in the figure, the device 5000 may include: an input layer 5001, an encoding layer 5002 and an output layer 5003. For the introduction of the input layer, the encoding layer and the output layer, please refer to the previous description of the invention. Figure 1-3 The descriptions made hereinabove with reference to the various figures are incorporated herein by reference, and more corresponding detailed functions may be realized by adding corresponding functional units or modules, or by further limiting the above-mentioned units, which will not be repeated here.
[0102] Figure 5 A schematic structural diagram of a device 500 for military text recognition according to some embodiments of the present invention is shown. The device comprises a processor 51 , a memory 52 and a bus 53 .
[0103] In some examples, the device may also include an input device 501, an input port 502, an output port 503, and an output device 504. The input port 502, the processor 51, the memory 52, and the output port 503 are interconnected through a bus 53, and the input device 501 and the output device 504 are connected to the bus 53 through the input port 502 and the output port 503, respectively, and then connected to other components of the device. It should be noted that the output interface and the input interface here can also be represented by an I / O interface. Specifically, the input device 501 receives input information from the outside, such as an image, and transmits the input information to the processor 51 through the input port 502; the processor 51 processes the input information based on the computer executable instructions stored in the memory 52 to generate output information, temporarily or permanently stores the output information in the memory 52, and then transmits the output information to the output device 504 through the output port 503; the output device 504 outputs the output information to the outside of the device.
[0104] The above-mentioned memory 52 includes a large capacity memory for data or instructions. For example, but not limitation, the memory 52 may include a HDD, a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 52 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 52 may be inside or outside the device. In a specific embodiment, the memory 52 is a non-volatile solid-state memory. In a specific embodiment, the memory 52 includes a read-only memory (ROM). In appropriate cases, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0105] The bus 53 includes hardware, software or both, and multiple components are coupled to each other. For example, but not limitation, the bus 53 may include an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus or a combination of two or more of these. Although the embodiments of the present invention describe and illustrate a specific bus, the present invention considers any suitable bus or interconnect.
[0106] The processor 51 executes the military text recognition method based on the computer program stored in the memory 52 .
[0107] According to some further embodiments of the present invention, the computer program may be divided into one or more units in various ways and stored in the memory, and executed by the processor to complete the present invention. The one or more units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the device. The computer program may be divided into multiple units according to the functions of the various units in the various embodiments described above with reference to the various figures, or include the various units in the various embodiments described above with reference to the various figures. For simplicity, it will not be repeated here.
[0108] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The processor is the control center of the device, and various interfaces and lines are used to connect the various parts of the entire device. The device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server, or a part thereof. The device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the schematic diagram is merely an example of a device and does not constitute a limitation on the device.
[0109] The corresponding detailed descriptions made above with reference to the various figures are incorporated herein by reference and will not be repeated here.
[0110] The present application also proposes a computer-readable storage medium, which stores a computer program, and is characterized in that the military text recognition method is implemented when the computer program is executed by a processor.
[0111] The present application also proposes a computer program product, including a computer program, characterized in that the military text recognition method is implemented when the computer program is executed by a processor.
[0112] The corresponding detailed descriptions made above with reference to the various figures are incorporated herein by reference and will not be repeated here.
[0113] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0114] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention. It should be noted that although the structure of the device of the present invention and the method of its operation are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in this specific order or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flowchart can change the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.
Claims
1. A military text recognition method, the method comprising: S1. Segment the military text; S2. Perform BERT word vector conversion on the word segmentation results through the input layer, convert the word segmentation results into word vector representations of fixed dimensions, and output the corresponding word vector sequence tensor; S3. The encoding layer processes the word vector sequence tensor output by the input layer, which includes: S31. All input word vectors are processed sequentially along the time step through the forward and reverse LSTM units in the Bi-LSTM, and each LSTM unit outputs a hidden state vector at each time step, wherein the forward LSTM processes the word vector from the beginning to the end of the input sequence, and the reverse LSTM processes from the end to the beginning of the input sequence; the input sequence includes the entire article in which the text is located; S32. Output an output tensor formed by the hidden state vector based on each word vector after Bi-LSTM; S33. Accept the output tensor after Bi-LSTM, and calculate the attention weight of each word relative to other words based on the self-attention mechanism, wherein the calculation includes: performing a linear transformation on the hidden state vector in the Bi-LSTM output tensor to generate three matrices of query, key and value, and then calculating the attention weight using the dot product of the query and the key, and then weighting and summing the value using the attention weight to obtain the re-weighted integrated vector representation of each word, and outputting the corresponding tensor; S41. The output layer receives the tensor outputted from step S33 and performs a linear transformation, maps the word vector therein to a vector space with a dimension equal to the number of named entity types, and outputs the corresponding mapped vector; S42. The output layer applies Softmax activation to the vector of each word mapped in step S41, converting it into a probability distribution of each named entity type corresponding to each word, and the named entity type with the highest probability is regarded as the named entity type prediction result of the word and is output externally; S5. The output layer performs relation extraction to obtain relation prediction results; the relation extraction includes: S51. Identify candidate entity groups in the text based on the feature vector of the named entity type obtained by the output layer; S52. For each candidate entity group, extract the vector representation corresponding to the entity group from the feature vectors calculated by the encoding layer based on the self-attention mechanism, and then concatenate multiple feature vectors in the entity group to form a joint vector representation of the entity group; S53. Input the concatenated joint vector into a linear transformation layer, map it to a vector space with a dimension equal to the number of relationship categories and output the mapped vector; S54. Apply the Softmax activation function to the vector output by S53 to convert it into a probability distribution; the probability distribution represents the probability that the entity group belongs to each relationship category, and the relationship category with the highest probability is regarded as the relationship prediction result of the entity group and is output externally; S6. Integrate the named entity type prediction results and relationship prediction results to identify information in the text.
2. The method according to claim 1, wherein: The output layer includes a named entity output module and a relation extraction module.
3. The method according to claim 1, wherein: The named entity types include: organization class, action class, location class, data, symbol, direction coordinate, group, battalion, army, team, squad, class, platoon, brigade, soldier, preposition, composition class and other classes.
4. The method according to claim 1, wherein: The BERT word vector conversion of the word segmentation results through the input layer includes a structured representation of the named entities in the text.
5. The method according to claim 4 includes storing the city-province-region-country information corresponding to the location in an associated database, so that when it is necessary to determine the structured expression of a location, it can be obtained by calling the associated database.
6. The method according to claim 1, wherein: The number of forward and reverse hidden layer units is 256 respectively.
7. The method according to claim 1, wherein: The identifying also includes converting relative time in the text into absolute time.
8. A device for military text recognition, comprising a processor and a memory; the processor executes the method according to any one of claims 1 to 7 based on a computer program stored in the memory.
9. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is performed.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Special equipment Chinese named entity identification method based on pre-training model
CN113609859A
Chinese named entity recognition method and system fusing vocabulary and syntactic information
CN114818717A
BERT-based military field composite named entity recognition method
CN115238690A
Military simulation optimal path identification method in multi-domain joint combat environment
CN119005468A
Text semantic recognition method and apparatus, computer device, and storage medium
WO2021027533A1