Military text recognition method, device and medium
Through the self-built network structure of Bi-LSTM and self-attention mechanism, the complexity of military text recognition is solved, and the accurate identification of named entity types and relationships in military texts is achieved, especially the identification of upper and lower hierarchical relationships.
Patent Information
- Application Number
- CN202510047654.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-01-13
AI Technical Summary
Existing text recognition methods cannot effectively identify military texts, especially due to their high professionalism, confidentiality, complex semantics and lack of complete sentence components.
The network structure based on BERT word vector transformation is adopted, and military text recognition is recognized through word segmentation, word vector representation, naming entity type prediction and relationship extraction, combined with the self-built network structure.
It can accurately identify named entity types and relationship predictions in military texts, especially the upper and lower hierarchical relationships in complex military texts, and achieve effective identification and understanding of military texts.
Smart Images

Figure CN119990117B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to text recognition technology, and particularly to a military text recognition method, device, computer-readable storage medium, and computer program product. Background Art
[0002] Military texts usually have a high degree of professionalism and confidentiality and are not common in various public materials. Therefore, there is a lack of extensive training samples. Moreover, the semantic expressions of military texts are complex, and there are often problems with missing complete sentence components. Therefore, existing recognition methods cannot correctly and effectively recognize military texts. Summary of the Invention
[0003] A first aspect of the present application proposes a military text recognition method, which includes:
[0004] S1. Segment the military text;
[0005] S2. Perform BERT word vector conversion on the segmented results through the input layer, convert the segmented results into word vector representations of a fixed dimension, 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. Process all input word vectors sequentially along the time steps through the forward and backward LSTM units inside the Bi-LSTM. Each LSTM unit outputs a hidden state vector at each time step, where the forward LSTM processes the word vectors from the beginning to the end of the input sequence, and the backward LSTM processes from the end to the beginning of the input sequence; the input sequence includes the entire article where the text is located;
[0008] S32. Output the output tensor formed by the hidden state vectors based on each word vector after passing through the Bi-LSTM;
[0009] S33. Receive the output tensor after passing through the Bi-LSTM and calculate the attention weight of each word relative to other words based on the self-attention mechanism. The calculation includes: performing a linear transformation on the hidden state vectors in the Bi-LSTM output tensor to generate three matrices of query, key, and value, then using the dot product of the query and the key to calculate the attention weight, and then weighted summing the value with the attention weight to obtain the re-weighted and integrated vector representation of each word, and output the corresponding tensor;
[0010] S41. The output layer receives the tensor output in step S33 and performs a linear transformation, maps the word vectors therein to a vector space with a dimension equal to the number of named entity types, and outputs the corresponding mapped vectors;
[0011] S42. The output layer applies the Softmax activation to the vector of each word after the mapping in step S41, converts it into a probability distribution of each word corresponding to each named entity type, and regards the named entity type with the highest probability as the prediction result of the named entity type of this word and outputs it externally;
[0012] S5. The output layer performs relation extraction to obtain a relation prediction result; the relation extraction includes:
[0013] S51. Identify candidate entity groups in the text based on the feature vectors of the named entity types obtained by the output layer;
[0014] S52. For each candidate entity group, respectively 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 perform a concatenation operation on the multiple feature vectors within 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 relation categories, and output the mapped vector;
[0016] S54. Apply the Softmax activation function to the vector output in S53 to convert it into a probability distribution; this probability distribution represents the probability that this entity group belongs to each relation category, and the relation category with the highest probability is regarded as the relation prediction result of this entity group and is output externally;
[0017] S6. Integrate the named entity type prediction result and the relation prediction result to identify the information in the text.
[0018] According to some embodiments of the present invention, the output layer includes a named entity output module and a relation extraction module.
[0019] According to some embodiments of the present invention, the named entity types include: organization type, action type, location type, data, symbol, direction coordinate, group, battalion, army, team, detachment, squad, platoon, brigade, soldier, preposition, composition type, and other types.
[0020] According to some embodiments of the present invention, the BERT word vector conversion of the word segmentation result by the input layer includes a structured representation of the 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 it is necessary to determine the structured representation of a location, the associated database can be retrieved to obtain it.
[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 recognition further includes 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 above-mentioned method based on the computer program stored in the memory.
[0025] The present application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the above-mentioned method is executed.
[0026] The present application also provides a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the above-mentioned method is implemented.
[0027] Through the above embodiments of the present invention, military texts can be effectively recognized. In particular, the hierarchical relationship between different entities in complex military text expressions and the corresponding sentence meanings can be effectively recognized. Taking the sentence "The information operation group is composed of an electronic reconnaissance battalion assigned with unmanned aerial vehicles to interfere with the electronic destruction battalion" as an example, through the present invention, it can be recognized that the electronic reconnaissance battalion and the unmanned aerial vehicle interference electronic destruction battalion jointly form the information operation group in this sentence. Moreover, for the equally complex sentences that appear later, the present invention will, while recognizing the hierarchical relationship between the named entities within the sentence itself, also perform operations such as grouping multiple candidate entity groups and extracting features of the relationship extraction model on the content of the next sentence and the content of its previous sentence (i.e., the context relationship between all named entities in the entire paragraph), so as to achieve accurate recognition of the content of the next sentence and sequentially achieve recognition of the entire text. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings herein are incorporated into the specification and form a part of this specification. The 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 drawings are represented as similar elements, unless otherwise stated, and the figures in the drawings do not constitute a scale limitation.
[0029] Figure 1 Schematic diagram of the network structure based on the text recognition method according to some embodiments of the present invention;
[0030] Figure 2 Schematic diagram of the network structure based on the text recognition method according to some embodiments of the present invention and its partial operation;
[0031] Figure 3 Schematic flowchart showing the military text recognition method according to some embodiments of the present invention;
[0032] Figure 4 Schematic structural block diagram showing a device for military text recognition according to some embodiments of the present invention;
[0033] Figure 5 Schematic structural diagram showing a device for military text recognition according to some embodiments of the present invention. Detailed implementation manners
[0034] The present invention will be exemplarily described below with reference to the accompanying drawings and in conjunction with embodiments. It should be noted that, without conflict, the embodiments and features in the embodiments of the present application can be combined with each other. In addition, the described embodiments are some embodiments of the present invention, rather than all embodiments.
[0035] A military text recognition method based on a self-built network structure is proposed in the first aspect of the present application. The self-built network structure includes an input layer, an encoding layer, and an output layer. The encoding layer is based on Bi-LSTM and self-attention mechanism. As Figure 1 shown, a schematic diagram of the self-built network structure of the present invention is given. After the text is input, it first undergoes BERT word vector conversion. The converted word vectors enter the input layer, the encoding layer, and finally reach the output layer. According to some embodiments of the present invention, as Figure 2 shown, the layer where the BERT word vector conversion is located can also be regarded as an overall input layer together with the input layer to implement BERT word vector conversion. Figure 2 It is a network structure and a partial operation schematic diagram based on which the text recognition method according to some embodiments of the present invention is based. Figure 3 Schematic flowchart showing a military text recognition method according to some embodiments of the present invention. As shown in the figure, it includes the following steps S1 - S6:
[0036] S1. Segment the military text. Taking the text input "The reconnaissance battalion conducts electronic countermeasure reconnaissance on the enemy army" as an example, its segmentation result should be: ["reconnaissance battalion", "on", "enemy army", "conduct", "electronic countermeasure reconnaissance"]. Professional segmentation tools such as jieba can be used to segment the text into individual words. For special words in the military field, such as military equipment names and military terms, a custom dictionary can be used to improve the accuracy of segmentation.
[0037] S2. The input layer performs BERT word vector conversion on the word segmentation result, converts the word segmentation result into a word vector representation of a fixed dimension, and outputs 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 the output vector dimension is 768 dimensions, after being processed by this module, the word vector representation of the entire sentence forms a two-dimensional tensor with a shape of [number of words (5 in this example), 768], that is, each word corresponds to a 768-dimensional vector. For example, the vector corresponding to "reconnaissance battalion" is in the form of [0.23, -0.32, 0.46,...] (only showing some dimensions).
[0038] Performing BERT word vector conversion on the word segmentation result by the input layer includes structuring the named entities in the text. For example, the word "Changsha City" can be restructured from the original label "location" to the label "location - city - province - region - country". The structured information such as city - province - region - country corresponding to this location can also be stored in an associated database, so that when it is necessary to determine the structured representation of "Changsha City", it can be obtained by retrieving 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 backward LSTM units inside the Bi-LSTM, all input word vectors are processed sequentially along the time steps (that is, the order direction of the words). Each LSTM unit outputs a hidden state vector at each time step. Among them, the forward LSTM processes the word vectors from the beginning to the end of the input sequence, and the backward LSTM processes from the end to the beginning of the input sequence; the input sequence includes the entire article where the text is located.
[0041] S32. Output the output tensor formed by the hidden state vectors based on each word vector after passing through the Bi-LSTM.
[0042] Assuming the number of hidden layer units set in the Bi-LSTM is h, then after passing through the Bi-LSTM, a hidden state vector integrating context information will be output at each time step (that is, the position of each word). The shape of its output tensor becomes [number of words (n), 2*h (the sum of the number of forward and backward hidden layer units)], that is, [5, 2*256] = [5, 512]. In the present invention, the model result is optimal when h is 256, which can avoid problems such as an increased risk of overfitting and excessive consumption of computing resources caused by too large h, and avoid problems such as insufficient expressive ability and inability to fully capture complex features in the text caused by too small h.
[0043] Taking the word "reconnaissance battalion" as an example, the hidden state vector corresponding to the word "reconnaissance battalion" after Bi-LSTM may be in the form of [0.21, -0.12, 0.45,...] (a total of 512 dimensions, only part is shown for illustration). This vector integrates the semantic, syntactic, and other information carried by itself and the context.
[0044] S33. Accept the output tensor after Bi-LSTM and calculate the attention weights of each word relative to other words based on the self-attention mechanism ( Figure 2 Self-Attention). The calculation includes: performing a linear transformation on the hidden state vectors in the Bi-LSTM output tensor to generate three matrices of query, key, and value, then using the dot product of the query and the key to calculate the attention weights, and then weighted summing the values with the attention weights to obtain the re-weighted and integrated vector representation of each word, and output the corresponding tensor.
[0045] After the self-attention mechanism of the above encoding layer, the dimension of the output tensor remains unchanged, still [number of words (n), 512]. However, in the vector representation of each word at this time, those parts that are closely semantically related to other words in the sentence will be prominently reflected. For example, after the vector of the word "electronic countermeasure reconnaissance" passes through the self-attention mechanism, the weights of the parts semantically related to "reconnaissance battalion", "implementation", etc. may be higher, and the numerical values of each dimension of the vector will be re-distributed according to the new attention weights, assuming it becomes in the form of [0.34, 0.08, -0.21,...] (partial dimensions shown for illustration), further strengthening the long-distance semantic relationship between words in the sentence.
[0046] S41. The output layer accepts the tensor output in step S33 and performs a linear transformation (fully connected operation), mapping the word vectors therein to a vector space with a dimension equal to the number of named entity types and outputting the corresponding mapped vectors.
[0047] Mapping the 512-dimensional word vectors to a space with a dimension equal to the number of named entity types, the dimension shape of the obtained tensor is [number of words (n), m], where m is the number of the 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 type, action type, location type, data, symbol, direction coordinate, group, battalion, army, team, detachment, squad, platoon, brigade, soldier, preposition, composition type, and other types, a total of 18 categories, that is, m = 18. The obtained tensor dimension shape here is [number of words (n), 18], that is, [5, 18]. In the prior art, named entities are usually proper nouns, while in the present invention, action types, data, symbols, direction coordinates, groups, battalions, armies, teams, detachments, squads, platoons, brigades, soldiers, prepositions, etc. are also creatively regarded as named entities. This processing method is specifically proposed for the complexity of military texts.
[0049] S42. The output layer applies the Softmax activation to the vector of each word after mapping in step S41, and converts it into a probability distribution of each word corresponding to each named entity type (this probability distribution represents the probability that the word belongs to each named entity type). The named entity type with the highest probability is regarded as the prediction result of the named entity type of the word and is output externally.
[0050] For example, for the word "reconnaissance battalion", 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), indicating that the model believes that "reconnaissance battalion" has a 90% probability of belonging to the category of "battalion".
[0051] S5. The output layer performs relation extraction to obtain a relation prediction result.
[0052] The output layer may include a relation extraction module. The relation extraction includes:
[0053] S51. Identify candidate entity groups in the text based on the feature vectors of the named entity types obtained by the output layer.
[0054] Based on the feature vectors of the named entity types obtained by the output layer, group the words of different entity types to form several candidate entity groups. This feature vector contains the entity type information of the named entity (as determined in step S42) and the correlation features of the word relative to other words (as reflected in the calculation of step S33).
[0055] S52. For each candidate entity group, respectively extract the vector representation corresponding to the entity group from the vectors calculated by the S33 encoding layer based on the self-attention mechanism. Then, perform a concatenation operation on the multiple feature vectors within the entity group to form a combined vector representation of the entity group.
[0056] For example: Brigade 03 is deployed at Hill (107, 216), where the coordinates of Brigade 03 and Hill can be identified as a group, i.e., [Brigade 03, Hill (107, 216)]. The dimension of the multiple feature vectors in this 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 with a dimension 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 then subjected to feature extraction of the next-level 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, the relationship judgment is performed on the entity groups with high probability to obtain the hierarchical relationship 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 perform operations such as grouping the next sentence content and the previous sentence content (that is, the contextual relationship between all named entities in the entire paragraph) into multiple candidate entity groups and extracting features from 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 further include enhancing the semantic understanding of the text. For example, the recognition may further include converting relative time in the text into absolute time. For example, within a relatively recent time period, the time nodes are converted to facilitate use and understanding. For example, the sentence "Complete the landing at noon tomorrow", after being interpreted with deep semantics, if today is August 9, 2024, it will be interpreted as: "Complete the landing at 12:00 on August 10, 2024".
[0065] In addition, for the current context, deeper interpretations can also be made on entities such as quantity.
[0066] The following will further give the training process of the above recognition method or the models involved therein, as well as the processes of data collection, cleaning, and preprocessing 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 literature, and military forums. For example, crawl news articles from the news websites of authoritative military media, or collect electronic versions of military historical research literature.
[0069] 2. It may also include professional documents such as military equipment manuals and military operation reports to ensure that the data covers all aspects of the military field, such as information related to military personnel, military organizations, military equipment, military events, etc.
[0070] The data cleaning may include:
[0071] 1. Remove noise data, such as advertisement information and irrelevant comments on the web page. For the crawled web page data, it may be necessary to remove irrelevant elements such as HTML tags.
[0072] 2. Process duplicate data and only retain one copy of the same text content to avoid unnecessary impacts on model training.
[0073] 3. Check the integrity of the data and delete the text with incomplete or unrecognizable character encodings.
[0074] The data preprocessing may include:
[0075] 1. Use professional word segmentation tools, such as jieba, etc., to segment the text into individual words. For special military domain vocabulary, such as military equipment names and military terms, a custom dictionary can be used to improve the accuracy of word segmentation.
[0076] 2. Perform part-of-speech tagging on the segmented words, such as nouns, verbs, adjectives, etc. This helps the subsequent model better understand the grammatical functions of the words in the sentence.
[0077] 3. Based on the word segmentation results, construct a vocabulary for 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 size and improve the model training efficiency.
[0078] 4. Structure the named entities. For example, during training, perform structured named analysis and entity naming on the training dataset; and during the text recognition process, perform structured settings on the links (such as vector spaces) involving named entity types.
[0079] The structuring of the named entities may include, for example, organizational structuring and position deployment structuring. The organizational structuring includes dividing the organization into xx groups, xx battalions, xx armies, xx teams, xx companies, xx detachments, xx squads, xx platoons, xx brigades, etc. The position deployment structuring includes dividing the positions into artillery positions, command posts, air defense missile positions, howitzer battery positions, etc.
[0080] According to some embodiments of the present invention, the structuring of the named entities can be achieved by further granularizing the named entities. For example, for the word "Changsha City", the original label "location" can be specified as the label "location - city - province - region - country". The structured information such as city - province - region - country corresponding to this location can also be stored in an associated database, so that when the structured data of "Changsha City" needs to be determined, it can be obtained by retrieving the associated database.
[0081] 5. Use the method of synonym replacement for data augmentation
[0082] The method of synonym replacement is mainly used to optimize the method for data augmentation. In the case of a small sample size, combined with a relatively complete knowledge graph, more effective data texts can be generated.
[0083] Perform further data enhancement on the existing military text dataset. For example: "The rear defense team retreated to the farmstead", after synonym replacement, a new training data "The combat support group retreated to Wangzhuang" is added.
[0084] As above, similarly, entities of time type, location type, and organization type can all use a method similar to synonym replacement to replace different refined 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 the text data. For example, for "A certain general commands a certain unit to conduct operations", extract triple data like (a certain general, a certain unit, command relationship).
[0088] Divide these data into training set, validation set, and test set.
[0089] 2. Initialize the model
[0090] Randomly initialize the model parameters according to the selected self-built model.
[0091] 3. Define the loss function
[0092] The categorical cross-entropy loss function can be used. If it is a multi-class relationship category, it is used to measure the accuracy of the model's prediction of relationship categories.
[0093] 4. Model training
[0094] Input the training set data into the self-built network structure, calculate the prediction results of the model for entity relationships through forward propagation, and then calculate the loss value according to the loss function.
[0095] Use the backpropagation algorithm to update the model parameters, optimize the model through multiple training rounds until the performance of the model on the validation set is stable or reaches the predetermined number of training rounds.
[0096] 5. Model validation
[0097] The trained named entity recognition model and relationship extraction model can be tested separately using the test set.
[0098] For the named entity recognition model, the evaluation metrics can include precision, recall, and F1 value. For example, calculate the ratio of the number of correctly recognized military entities to the number of military entities predicted by the model to obtain precision, calculate the ratio of the number of correctly recognized military entities to the actual number of military entities to obtain recall, and the F1 value is the harmonic mean of precision and recall.
[0099] For the relationship extraction model, the same metrics such as precision, recall, and F1 value can be used, but here it is for evaluating the results of relationship extraction. For example, calculate the ratio of the number of correctly extracted relationships to the number of relationships predicted by the model as precision, etc.
[0100] According to the results of model validation, analyze the performance advantages and disadvantages of the model, find out the problems and deficiencies of the model, such as inaccurate recognition of certain specific types of military entities or poor extraction effect for specific relationship categories, etc., in order to further optimize and improve the model.
[0101] Figure 4Schematic 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, reference can be made to the description made previously around Figures 1 - 3 The description made previously with reference to the respective figures is incorporated herein by reference. More corresponding detailed functions can be achieved by adding corresponding functional units or modules, or by further defining the above units. Details are not elaborated herein.
[0102] Figure 5 Schematic structural diagram of a device 500 for military text recognition according to some embodiments of the present invention is shown. The device includes a processor 51, a memory 52, and a bus 53.
[0103] In some instances, the device may further include an input device 501, an input port 502, an output port 503, and an output device 504. Among them, the input port 502, the processor 51, the memory 52, and the output port 503 are interconnected through the bus 53. The input device 501 and the output device 504 are respectively connected to the bus 53 through the input port 502 and the output port 503, 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 the 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, stores the output information temporarily or permanently 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 mass storage for data or instructions. By way of example and not limitation, the memory 52 may include an HDD, a floppy disk drive, a flash memory, an optical disc, a magneto-optical disc, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In a suitable case, the memory 52 may include a removable or non-removable (or fixed) medium. In a suitable case, 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 a suitable case, 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 couples multiple components to each other. By way of example and not limitation, the bus 53 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand 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 Standards Association Local (VLB) bus, or other suitable buses or a combination of two or more of these. Although embodiments of the present invention describe and illustrate specific buses, the present invention contemplates any suitable bus or interconnect.
[0106] The processor 51 executes a military text recognition method based on a computer program stored in the memory 52.
[0107] According to still some other embodiments of the present invention, the computer program may be segmented 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 performing specific functions, and these instruction segments are used to describe the execution process of the computer program in the device. The computer program may be segmented into multiple units according to the functions of the respective units in the various embodiments described with reference to the foregoing figures, or include the respective units in the various embodiments described with reference to the foregoing figures. For the sake of simplicity, it will not be repeated here.
[0108] The so-called processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the device, connecting various parts of the entire device through various interfaces and lines. The device may be a computing device such as a desktop computer, notebook, palm computer, and 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 can understand that the schematic diagram is only an example of the device and does not constitute a limitation on the device.
[0109] The corresponding detailed descriptions made with reference to the various figures above are incorporated herein by reference and will not be repeated here.
[0110] The present application also provides a computer-readable storage medium storing a computer program, characterized in that when the computer program is executed by a processor, the military text recognition method described above is implemented.
[0111] The present application also provides a computer program product including a computer program, characterized in that when the computer program is executed by a processor, the military text recognition method described above is implemented.
[0112] The corresponding detailed descriptions made with reference to the various figures above are incorporated herein by reference and will not be repeated here.
[0113] The computer program includes computer program code, and the computer program code may be in the form of source code, object code, 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), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0114] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within 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 drawings, this does not require or imply that these operations must be performed in that specific order or that all the operations shown must be performed to achieve the desired result. On the contrary, the order of execution of the steps depicted in the flowchart can be changed. 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. Military text recognition method, the method comprising: S1. Segment the military text; S2. Perform BERT word vector conversion on the segmented results through the input layer, convert the segmented results into word vector representations of a fixed dimension, 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. Through the forward and backward LSTM units inside the Bi-LSTM, process all the input word vectors sequentially along the time steps. Each LSTM unit outputs a hidden state vector at each time step. Among them, the forward LSTM processes the word vectors from the beginning to the end of the input sequence, and the backward LSTM processes from the end to the beginning of the input sequence; the input sequence includes the entire article where the text is located; S32. Output the output tensor formed by the hidden state vectors based on each word vector after Bi-LSTM; S33. Receive the output tensor after Bi-LSTM, and calculate the attention weight of each word relative to other words based on the self-attention mechanism. The calculation includes: performing a linear transformation on the hidden state vectors in the Bi-LSTM output tensor to generate three matrices of query, key, and value, then using the dot product of the query and the key to calculate the attention weight, and then weighted summing the value with the attention weight to obtain the re-weighted and integrated vector representation of each word, and output the corresponding tensor; S41. The output layer receives the tensor output in step S33 and performs a linear transformation, maps the word vectors therein to a vector space with a dimension equal to the number of named entity types, and outputs the corresponding mapped vectors; S42. The output layer applies the Softmax activation to each word vector after mapping in step S41, converts it into a probability distribution corresponding to each named entity type for 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 the relation prediction result; the relation extraction includes: S51. Identify the candidate entity groups in the text based on the feature vectors of the named entity types obtained by the output layer; S52. For each candidate entity group, respectively extract the vector representations corresponding to the entity group from the feature vectors calculated based on the self-attention mechanism by the encoding layer, and then splice the multiple feature vectors within the entity group to form the joint vector representation of the entity group; S53. Input the spliced joint vector into a linear transformation layer, map it to a vector space with a dimension equal to the number of relation categories, and output the mapped vector; S 2. The method according to claim 1, wherein 3. The method according to claim 1, wherein The named entity types include: organization types, action types, location types, data, symbols, direction coordinates, groups, battalions, armies, troops, detachments, squads, platoons, brigades, soldiers, prepositions, composition types, and other types.
4. The method according to claim 1, wherein, Performing BERT word vector conversion on the segmented results through the input layer includes structuring the named entities in the text.
5. The method according to claim 4, including 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 representation of a location, it can be obtained by retrieving 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 recognition further includes converting the relative time in the text into absolute time.
8. A device for military text recognition, which includes a processor and a memory; the processor executes the method according to any one of claims 1-7 based on the computer program stored in the memory.
9. A computer-readable storage medium storing a computer program, wherein, When the computer program is executed by the processor, it executes the method according to any one of claims 1-7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1-7.
Citation Information
Patent Citations
Chinese named entity recognition method and system fusing vocabulary and syntactic information
CN114818717A
Military simulation optimal path identification method in multi-domain joint combat environment
CN119005468A