Entity recognition method, device, computer equipment and storage medium
By obtaining the text to be identified, determining the text area positioning method, and performing text positioning and entity recognition, the problems of low efficiency and low accuracy of manual entry of information are solved, and efficient and accurate entity recognition is achieved.
Patent Information
- Application Number
- CN202111356390.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2041-11-16
AI Technical Summary
In the prior art, manual information entry efficiency and accuracy are low, resulting in the incoming efficiency and accuracy of information entry cannot meet actual needs.
By obtaining the text to be identified, determining the text area positioning method corresponding to the text type, performing text positioning to determine the target text paragraph, and entity recognition is performed on the target text paragraph to obtain the entity recognition result.
The accuracy and efficiency of target text area determination are improved, the impact of non-target text paragraphs on entity recognition is avoided, and the accuracy of entity recognition is significantly improved.
Smart Images

Figure CN114036952B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of detection model technology, and in particular to an entity recognition method, device, computer equipment and storage medium. Background Art
[0002] With the development of science and technology, digital information technology has also gradually developed. In different fields, there is a large amount of data that needs to be registered and entered into the corresponding database, such as in the medical field, insurance field, project application field, etc. In these fields, some report text content needs to be stored to determine whether it can be reimbursed or insured, so the efficiency and accuracy of information entry is very important.
[0003] In the prior art, the report text content is often entered into the corresponding database manually, but the manual entry method is inefficient and prone to errors, which ultimately leads to low accuracy of the conclusions given (such as reimbursable or not, insurable or not). Summary of the invention
[0004] Embodiments of the present invention provide an entity recognition method, apparatus, computer equipment and storage medium to solve the problem of low efficiency and low accuracy of manual information entry.
[0005] An entity recognition method, comprising:
[0006] Acquire the text to be recognized; the text to be recognized is associated with a text type;
[0007] Determine a text area positioning method corresponding to the text type, and determine a target text area corresponding to the text to be recognized according to the text area positioning method; the target text area contains at least one paragraph to be positioned;
[0008] Performing text positioning on the target text area to determine the target text paragraph from each of the paragraphs to be positioned;
[0009] Perform entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph.
[0010] An entity recognition device, comprising:
[0011] A text acquisition module, used to acquire text to be recognized; the text to be recognized is associated with a text type;
[0012] A text area determination module, used to determine a text area positioning method corresponding to the text type, so as to determine a target text area corresponding to the text to be recognized according to the text area positioning method; the target text area contains at least one paragraph to be positioned;
[0013] A text positioning module, used for performing text positioning on the target text area to determine the target text paragraph from the paragraphs to be positioned;
[0014] The entity recognition module is used to perform entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph.
[0015] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned entity recognition method when executing the computer program.
[0016] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned entity recognition method are implemented.
[0017] The above-mentioned entity recognition method, device, computer equipment and storage medium, the method is as follows: obtaining a text to be recognized; associating the text to be recognized with a text type; determining a text area positioning method corresponding to the text type, and determining a target text area corresponding to the text to be recognized according to the text area positioning method; the target text area contains at least one paragraph to be located; performing text positioning on the target text area to determine a target text paragraph from each of the paragraphs to be located; performing entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph.
[0018] The present invention determines the target text area by different text area positioning methods for the text to be recognized of different text types, so as to improve the accuracy and efficiency of the target text area determination, thereby laying a foundation for the subsequent accurate recognition of the target entity. Furthermore, through the text positioning method, the influence of other text paragraphs except the target text paragraph on the entity recognition can be avoided, and finally the entity recognition result is obtained through the entity recognition method, thereby improving the accuracy of the entity recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0020] Figure 1 is a schematic diagram of an application environment of an entity recognition method in an embodiment of the present invention;
[0021] Figure 2is a flow chart of an entity identification method in one embodiment of the present invention;
[0022] Figure 3 is a flow chart of step S40 in the entity identification method in one embodiment of the present invention;
[0023] Figure 4 is a principle block diagram of an entity identification device in one embodiment of the present invention;
[0024] Figure 5 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The entity recognition method provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the entity recognition method is applied in an entity recognition system, and the entity recognition system includes: Figure 1 The client and server shown in the figure communicate with each other through the network to solve the problem of low efficiency and low accuracy of manual information entry. Among them, the client, also known as the user end, refers to the program corresponding to the server that provides local services to customers. The client can be installed on but not limited to various personal computers, laptops, smart phones, tablets and portable wearable devices. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0027] In one embodiment, if Figure 2 As shown, a method for entity recognition is provided, which is applied in Figure 1 The server in the example is used as an example to illustrate the process, including the following steps:
[0028] S10: Acquire text to be recognized; the text to be recognized is associated with a text type.
[0029] Exemplarily, the text to be identified may be a physical examination report text, a project evaluation report text, etc., and the text to be identified may be crawled from text databases in different fields. The text type refers to the text format type of the text to be identified. Exemplarily, the text type may be a pdf text type, a word text type, etc. In this embodiment, the text type is divided into two text types, one of which is a pdf text type, and the other is a non-pdf text type. In this embodiment, the non-pdf text type to be identified is text identified by text recognition technology such as OCR (Optical Character Recognition).
[0030] S20: Determine a text area positioning method corresponding to the text type, and determine a target text area corresponding to the text to be recognized according to the text area positioning method; the target text area contains at least one paragraph to be positioned.
[0031] It can be understood that the above description points out that in this embodiment, the text type is divided into PDF text type and non-PDF text type; the text to be recognized of PDF text type is generally a text with complete format, so the position information in the text to be recognized can be directly used to directly locate the target text area; while the text to be recognized of non-PDF text type is often a text with a random format, so in order to eliminate the influence of other text content, it is necessary to identify the title and end text area of the text to be recognized of the non-PDF text type, and then determine the target text area. Therefore, different text area positioning methods can be used for two different text types to determine the target text area in the text to be recognized, and the target text area contains multiple paragraphs to be located. For example, assuming that the text to be recognized is a physical examination report text, when it is necessary to enter information on the physical examination report text, in addition to the basic information such as the name of the examiner in the corresponding physical examination report, the doctor's final examination conclusion also needs to be entered. Therefore, the area containing the final examination result is the target text area, and the paragraph text in the final examination conclusion is the paragraph to be located; assuming that the text to be recognized is a project evaluation report text, when it is necessary to enter information on the project evaluation report text, in addition to the basic information such as the corresponding project name, the final conclusion of the project evaluation also needs to be entered. Therefore, the area containing the final conclusion is the target text area, and the paragraph text in the final conclusion is the paragraph to be located.
[0032] S30: Performing text positioning on the target text area to determine a target text paragraph from the paragraphs to be positioned.
[0033] It can be understood that text positioning is a method of determining a target text paragraph from a number of paragraphs to be positioned in the target text area. When the target text area contains only one paragraph to be positioned, the paragraph to be positioned can be directly recorded as the target text paragraph; when the target text area contains at least two paragraphs to be positioned, for example, when the text to be identified is a physical examination report text, there may be multiple paragraphs to be positioned in the target text area of the physical examination report, such as a physical examination conclusion paragraph, a suggestion paragraph, an explanation paragraph, etc. Therefore, it is necessary to find the paragraph that actually contains the conclusion in each paragraph to be positioned, such as the physical examination conclusion paragraph mentioned above; in a project evaluation report, it may be a paragraph containing the project evaluation conclusion.
[0034] In this embodiment, the target text area can be positioned by a pre-trained text positioning model, and then the target text paragraph can be determined from each paragraph to be positioned. Among them, texts in different fields (such as physical examination report text, project evaluation report text, etc.) can be collected, and the texts in the same field have similarities, that is, the target text paragraphs have the same characteristics (for example, they contain certain specific conclusion words, such as the target text paragraph of the physical examination report text may contain disease name entities, conclusion words, etc.), so these features can be annotated, and then the model can identify the target text paragraphs of these texts, so that the loss of the model is determined according to the results of the recognition and the results of the annotation, and then the model is trained according to the loss, so that when the loss reaches a specific condition (such as when the loss value is reduced to a value and then no longer decreases), a trained text positioning model is obtained, and then the target text area can be texted by the text positioning model to obtain the target text paragraph.
[0035] S40: Perform entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph.
[0036] It can be understood that the entity recognition result in this implementation is the target entity contained in the target text paragraph, and a target entity in this embodiment may contain one or more sentences. Exemplarily, assuming that the text to be recognized is a physical examination report text, the corresponding target entity may be "blood pressure: 141 / 78mmHg". The content in the target entity indicates that the blood pressure of the person being examined is abnormal (hypertension is defined as systolic blood pressure>140 or diastolic blood pressure>90), so the target entity will be output, and then these target entities representing the abnormalities can be output, and the conclusion information representing the abnormality of the person being examined can be automatically entered into the physical examination report text, without the need for manual input, and with high efficiency and accuracy. In this way, after identifying the target entity representing the abnormality in the physical examination report text, it can be convenient for the insured person to determine whether the applicant meets the insurance conditions based on the target entity.
[0037] In this embodiment, for different text types of text to be recognized, the target text area is determined by different text area positioning methods, which can improve the accuracy and efficiency of the target text area determination, thereby laying a foundation for the subsequent accurate recognition of the target entity. Further, through the text positioning method, the influence of other text paragraphs other than the target text paragraph on entity recognition can be avoided, and finally the entity recognition result is obtained through the entity recognition method, which improves the accuracy of entity recognition.
[0038] In one embodiment, before step S10, that is, before obtaining the text to be recognized, the process further includes:
[0039] Receive an entity recognition instruction; the entity recognition instruction includes initial text data and a text type corresponding to the initial text data;
[0040] It is understandable that the entity recognition instruction can be sent by the user, or it can be automatically generated after the user transmits the initial text data. Exemplarily, the initial text data can be a physical examination report text, a project application text, etc. The text type is the two types defined in step S10, one is a pdf text type, and the other is a text type obtained by a text recognition method such as OCR.
[0041] Performing text parsing on the initial text data by a data reading method to obtain text reading data; the data reading method corresponds to the text type;
[0042] It can be understood that when the text type is a pdf text type, the data reading method can be a PyMuPDF method (one of the methods for python to parse pdf text type files, which can be obtained by pip install PyMuPDF). When the text type is a text type identified by an OCR text recognition method, the data reading method can be a cnocr (Chinese OCR) method, which can perform text recognition on screenshots, scanned images, etc., and then accurately extract the text content in the image to obtain the corresponding text reading data. The text reading data is the data read from the initial text data by the data reading method.
[0043] The text reading data is cleaned to obtain the text to be recognized, and the text to be recognized is associated with the text type.
[0044] It can be understood that data cleaning is to make the text reading data uniform, so as to facilitate the subsequent entity recognition and other processing of the text to be identified after data cleaning; illustratively, data cleaning includes punctuation standardization (such as converting punctuation marks into English punctuation), entity splitting (splitting the text containing multiple entities in the same sentence, such as "dental calculus, impacted teeth, dental caries, tooth residual roots" into "dental calculus\nimpacted teeth\ndental caries\ntooth residual roots"), stop word removal (that is, removing the part of the read data containing stop words, stop words are such as: characteristic, unspecified, etc.), and term normalization (that is, normalizing words with the same meaning but different personal expressions into specific and representative entity names), etc.
[0045] In one embodiment, determining the target text area corresponding to the to-be-recognized text according to the text area positioning method includes:
[0046] The text to be recognized is subjected to text position detection to determine the title text position and the ending text position in the text to be recognized.
[0047] It is understandable that it is pointed out in the above description that there are different text area positioning methods for different text types. Assuming that the text type of the text to be identified is a pdf text type, the position of the target text area in the text to be identified can be directly identified. Assuming that the text type of the text to be identified is a non-pdf text type, it is necessary to perform text position detection on the text to be identified, so as to determine the title text position and the ending text position of the text to be identified, and then traverse the remaining text to be identified to determine the target text area. Among them, the title text position is the position containing the title content in the text to be identified, and the ending text position is the position containing the ending content in the text to be identified. Further, the title content and the ending content of different texts to be identified are different. For example, assuming that the text to be identified is a physical examination report text, the title text position is the position containing other basic information such as the name and gender of the examinee, and the ending text position is the position containing other information such as the doctor's signature or the hospital seal.
[0048] Furthermore, in this embodiment, a number of sample data can be randomly sampled (the sample data can be such as a physical examination report, a project application report, etc.), and the title text position and the ending text position of the sample data can be annotated manually, and then the sample data can be identified through a regex model, and the parameters of the model can be adjusted according to the recognition results and the annotated part, so that the trained model can accurately detect the text position of various types of texts, thereby accurately locating the title text position and the ending text position.
[0049] The text to be recognized at other positions except the title text position and the ending text position is recorded as the text to be traversed; the text to be traversed includes at least one paragraph to be traversed.
[0050] Specifically, after the text position detection is performed on the text to be recognized to determine the title text position and the ending text position in the text to be recognized, the text to be recognized in other positions except the title text position and the ending text position is recorded as the text to be traversed, that is, the text to be traversed does not contain the text content in the title text position, nor does it contain the text content in the ending text position. Furthermore, the text to be traversed includes at least one paragraph to be traversed.
[0051] A preset target text template is obtained, and in the process of performing text traversal on the text to be traversed, the text to be traversed is matched with the preset target text template.
[0052] It can be understood that the preset target text template is a template obtained by normalizing and summarizing different sample data, and the preset target text template may include text format, text entity, etc. Then, in the process of text traversal of the text to be traversed, the text to be traversed can be matched with the preset target text template. Among them, the text traversal is to match each paragraph to be traversed in the text to be traversed with the preset target template along the direction from the starting position to the end position of the text to be traversed.
[0053] The paragraphs to be traversed that match the preset target text template are recorded as the paragraphs to be located, and the text area containing all the paragraphs to be located is recorded as the target text area.
[0054] Specifically, during the text traversal process of the to-be-traversed text, after matching the to-be-traversed text with the preset target text template, if there is a to-be-traversed paragraph that matches the preset target text template, it is recorded as a to-be-located paragraph, and the text region containing all the to-be-located paragraphs is determined as the target text region. Generally, the to-be-located paragraphs in the target text region are continuous paragraphs.
[0055] In one embodiment, the target text paragraph includes at least one target text sentence; Figure 3 As shown, in step S40, that is, performing entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph, includes:
[0056] S401: Performing entity prediction based on pointer annotation on target text sentences in the target text paragraph to obtain first entity prediction results corresponding to each target text sentence.
[0057] It can be understood that each target text paragraph may contain multiple different sentences, and each sentence is then regarded as a target text sentence. In this way, entity prediction can be performed on each target text sentence through an entity prediction method based on pointer annotation to obtain a first entity prediction result. Among them, entity prediction based on pointer annotation is to perform pointer annotation encoding on the target text sentence, and then determine the probability that the target text sentence contains the target entity. When the probability value is greater than or equal to a preset probability threshold, it can be determined that the target text sentence contains the target entity; when the probability value is less than the preset probability threshold, it can be determined that the target text sentence does not contain the target entity. Among them, the first entity prediction result can be a result that characterizes the presence of the target entity in the target text sentence, or it can be a result that characterizes the absence of the target entity in the target text sentence.
[0058] In one embodiment, in step S401, that is, performing entity prediction based on pointer annotation on the target text sentences in the target text paragraph to obtain a first entity prediction result corresponding to each of the target text sentences includes:
[0059] Performing pointer-annotated word vector embedding on the target text sentence to obtain at least one text word vector corresponding to the target text sentence;
[0060] Specifically, after determining the target text paragraph, the target text sentences in the target text paragraph are embedded with word vectors based on pointer annotation, that is, each text word in the target text sentence is converted into a word vector, and then the text word vector corresponding to each text word in the target text sentence can be obtained.
[0061] Perform word information processing on each of the text word vectors to obtain a feature extraction vector corresponding to each of the text word vectors.
[0062] It can be understood that the word information processing in this embodiment refers to learning the features between each text word vector through a bidirectional neural network. Among them, the bidirectional neural network is a forward LSTM (Long Short Term Memory) network and a backward LSTM network. The forward LSTM network is used to learn the forward context sequence relationship of each text word vector; the backward LSTM network is used to learn the reverse context sequence relationship of each text word vector, which can improve the efficiency and accuracy of subsequent entity recognition.
[0063] Specifically, after embedding the target text sentence with a word vector based on pointer annotation to obtain at least one text word vector corresponding to the target text sentence, the text word vector is processed with a bidirectional neural network to obtain a feature extraction vector corresponding to each text word vector. It can be understood that the feature extraction vector is the sum of the features learned by the forward LSTM network and the features learned by the backward LSTM network corresponding to the text word vector.
[0064] Each of the feature extraction vectors is randomly sampled to obtain a first sampling word vector, and each of the first sampling word vectors is processed with word information to obtain a second sampling word vector that corresponds one-to-one to each of the first sampling word vectors.
[0065] It can be understood that after performing word information processing on each of the text word vectors to obtain feature extraction vectors corresponding one-to-one to each of the text word vectors, first sampling word vectors are randomly sampled from each feature extraction vector. Generally, the number of first sampling word vectors is 50% of the feature extraction vector. Then, the same word information processing is performed on the first sampling word vectors to obtain second sampling word vectors corresponding one-to-one to each first sampling word vector.
[0066] A first entity prediction result corresponding to the target text sentence is determined according to each of the second sampled word vectors.
[0067] Specifically, after randomly sampling each of the feature extraction vectors to obtain a first sampling word vector, and performing word information processing on each of the first sampling word vectors to obtain a second sampling word vector corresponding one to one to each of the first sampling word vectors, a third sampling word vector is randomly sampled from the second sampling word vector, and entity prediction is performed based on the third sampling word vector through a fully connected layer and a crf layer, thereby determining a first entity prediction result corresponding to the target text sentence.
[0068] S402: When the first entity prediction result indicates that the target entity exists in the target text sentence, the target text sentence is recorded as a successful entity prediction sentence; when the first entity prediction result indicates that the target entity does not exist in the target text sentence, the target text sentence is recorded as a failed entity prediction sentence.
[0069] Specifically, after the target text sentences in the target text paragraph are predicted based on the pointer annotation and the first entity prediction results corresponding to each of the target text sentences are obtained, if the first entity prediction result indicates that the target entity exists in the target text sentence, the target text sentence is directly recorded as a successful entity prediction sentence; if the first entity prediction result indicates that the target entity does not exist in the target text sentence, the target text sentence is recorded as a failed entity prediction sentence. The target entity is different in different texts to be recognized. For example, when the text to be recognized is a physical examination report text, the target entity can be an entity containing symptoms, etc.
[0070] S403: Performing entity prediction based on sequence labeling on the sentence for which entity prediction failed, to obtain a second entity prediction result corresponding to the sentence for which entity prediction failed.
[0071] It can be understood that the method of performing entity prediction based on pointer annotation on the target text sentence in the above step S401 can better target the phenomenon when the target text sentence is long (such as a target text sentence containing more than 30 words), but when the target text sentence in the text to be recognized is short (that is, when a target text sentence contains fewer nouns, for example, when the target text sentence contains only five nouns), the entity prediction method based on pointer annotation may not be able to recognize the features in this target text sentence, and then directly determine that the target entity does not exist in the target text sentence. Therefore, in this embodiment, the entity prediction method based on sequence annotation is used to perform entity prediction on the sentence where the entity prediction fails, and obtain the second entity prediction result, which can well make up for the defects of the entity prediction method based on pointer annotation in step S401, thereby improving the accuracy of entity recognition. Among them, the second entity prediction result includes a result that represents the existence of the target entity in the sentence where the entity prediction fails, and also includes a result that represents the absence of the target entity in the sentence where the entity prediction fails.
[0072] Furthermore, the entity prediction method based on sequence labeling is similar to the entity prediction method based on pointer labeling. The difference is that the entity prediction method based on sequence labeling is based on word vector embedding based on sequence labeling. After obtaining the corresponding word vector, word information processing is performed through a bidirectional neural network, and after random sampling and other steps, the second entity prediction result can be obtained.
[0073] S404: Perform rule-enhanced entity prediction on target text sentences in the target text paragraph to obtain third entity prediction results corresponding to each target text sentence.
[0074] It can be understood that rule-enhanced entity prediction refers to the recognition of target text sentence entities through a knowledge database in the scene corresponding to the text to be recognized. Among them, the knowledge database can collect other texts in the scene corresponding to the text to be recognized in advance, and generate them by means of manual review and summary by experts. Among them, the third entity prediction result includes the result of characterizing the existence of the target entity in the target text sentence, and also includes the result of characterizing the absence of the target entity in the target text sentence.
[0075] In one embodiment, in step S404, that is, performing rule-enhanced entity prediction on the target text sentences in the target text paragraph to obtain third entity prediction results corresponding to each of the target text sentences includes:
[0076] A preset indicator database is obtained; the preset indicator database contains at least one indicator data group; one indicator data group includes a project entity and a project indicator value corresponding to the project entity.
[0077] It can be understood that the preset indicator database is obtained by summarizing several different texts in the scene corresponding to the text to be recognized, and the preset indicator database contains at least one indicator data group, and an indicator data group includes an item entity and an item indicator value corresponding to the item entity. Exemplarily, assuming that an indicator data group is: blood pressure: less than 140 / greater than 90 mmHg, then the item entity is blood pressure, and the item indicator value corresponding to the blood pressure is less than 140 (systolic pressure) and greater than 90 (diastolic pressure).
[0078] Entity matching is performed on each of the target text sentences according to the project entity to determine whether each of the target text sentences contains the project entity.
[0079] It can be understood that after obtaining the preset indicator database, the project entity is matched with the target text sentence to determine whether the target text sentence contains the project entity. Exemplarily, the project entity can be converted into a corresponding entity vector, and each word in the target text sentence is also converted into a vector model, and then the entity vector can be matched with each word vector in the target text sentence to determine whether the target text sentence contains the project entity.
[0080] When the target text sentence contains the item entity, a text index value corresponding to the item entity is obtained from the target text sentence.
[0081] Specifically, after entity matching is performed on each of the target text sentences according to the project entity to determine whether each of the target text sentences contains the project entity, if the target text sentence contains the project entity, a text index value corresponding to the project entity is obtained from the target text sentence.
[0082] According to the project index value and the text index value, a third entity prediction result corresponding to the target text sentence is determined.
[0083] Specifically, when the target text sentence contains the project entity, after obtaining the text index value corresponding to the project entity from the target text sentence, the project index value corresponding to the project entity is compared with the text index value, and then the third entity prediction result corresponding to the target text sentence can be determined. If the text index value is the same as the project index value, or is within the range of the project index value, it is determined that the project entity in the target text sentence is not the target entity; if the text index value does not meet the range of the project index value, it is determined that the project entity in the target text sentence is the target entity.
[0084] In one embodiment, after performing entity matching on each of the target text sentences according to the project entity to determine whether each of the target text sentences contains the project entity, the method further includes:
[0085] When the target text sentence does not contain the project entity, the target text sentence not containing the project entity is recorded as a sentence to be matched.
[0086] Specifically, after entity matching is performed on each of the target text sentences according to the project entity to determine whether each of the target text sentences contains the project entity, if the target text sentence does not contain the project entity, the target text sentence not containing the project entity is recorded as a sentence to be matched.
[0087] According to a preset word frequency extraction method, target keywords are extracted from the sentence to be matched.
[0088] The preset word frequency extraction method in this embodiment is as follows: segment the text in the text area other than the target text area in the text to be recognized, and build a first word library based on the result of the segmentation; segment the text in the target text area, and build a second word library based on the result of the segmentation. Determine the high-frequency words in the first word library (such as the number of times a certain word appears in the text in the text area other than the target text area is higher than a set threshold, etc.), and if the high-frequency word has not appeared in the second word library, or the frequency of appearance is small (such as only appearing once), then the high-frequency word is used as the target keyword.
[0089] According to the target keyword, a third entity prediction result corresponding to the sentence to be matched is determined.
[0090] Specifically, after extracting the target keyword from the sentence to be matched according to the preset word frequency extraction method, the text content corresponding to the target keyword is extracted from the target text sentence, such as the indicator value corresponding to the target keyword, etc., to further determine the third entity prediction result corresponding to the sentence to be matched.
[0091] S405: Determine the entity recognition results corresponding to each of the target text sentences based on the first entity prediction result corresponding to the sentence for which the entity prediction is successful, the second entity prediction result corresponding to the sentence for which the entity prediction is unsuccessful, and the third entity prediction result corresponding to the target text sentence.
[0092] Specifically, after the target text sentence is predicted based on pointer annotation, entity prediction based on sequence annotation, and entity prediction based on rule enhancement, the first entity prediction result corresponding to the sentence with successful entity prediction, the second entity prediction result corresponding to the sentence with failed entity prediction, and the third entity prediction result corresponding to the target text sentence are comprehensively considered, that is, the entity recognition result of each target text sentence is determined. Among them, the entity recognition result represents whether the target text sentence contains the target entity. If the target text sentence contains the target entity, the target entity will be marked in the entity recognition result; if the target text sentence does not contain the target entity, the entity recognition result will indicate that the target text sentence does not contain the target entity.
[0093] Exemplarily, assuming that the first entity prediction result of one of the target text sentences is a characterization that the target entity is not contained, the second entity prediction result corresponding to the target text sentence is a characterization that the target entity is not contained, and the third entity prediction result also represents that the entity is not contained, then it can be determined that the target text sentence does not contain the target entity.
[0094] In this embodiment, entity prediction is performed on the target text sentence through three different entity prediction methods, namely, entity prediction based on pointer annotation, entity prediction based on sequence annotation, and entity prediction based on rule enhancement, which can improve the accuracy and efficiency of entity recognition.
[0095] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0096] In one embodiment, an entity recognition device is provided, which corresponds one-to-one to the entity recognition method in the above embodiment. Figure 4 As shown, the entity recognition device includes a text acquisition module 10, a text area determination module 20, a text positioning module 30 and an entity recognition module 40. Each functional module is described in detail as follows:
[0097] A text acquisition module 10 is used to acquire text to be recognized; the text to be recognized is associated with a text type;
[0098] A text area determination module 20 is used to determine a text area positioning method corresponding to the text type, so as to determine a target text area corresponding to the text to be recognized according to the text area positioning method; the target text area contains at least one paragraph to be positioned;
[0099] A text positioning module 30, used for performing text positioning on the target text area to determine the target text paragraph from the paragraphs to be positioned;
[0100] The entity recognition module 40 is used to perform entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph.
[0101] For the specific definition of the entity recognition device, please refer to the definition of the entity recognition method above, which will not be repeated here. Each module in the above-mentioned entity recognition device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0102] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data used by the entity recognition method in the above embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an entity recognition method is implemented.
[0103] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the entity recognition method in the above embodiment is implemented.
[0104] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the entity recognition method in the above embodiment is implemented.
[0105] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0106] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0107] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. An entity recognition method, characterized in that: include: Get the text to be recognized; The text type associated with the text to be identified; Determine a text area positioning method corresponding to the text type, and determine a target text area corresponding to the text to be recognized according to the text area positioning method; the target text area contains at least one paragraph to be positioned; Performing text positioning on the target text area to determine the target text paragraph from each of the paragraphs to be positioned; Performing entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph; The target text paragraph includes at least one target text sentence; performing entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph includes: Performing entity prediction based on pointer annotation on target text sentences in the target text paragraph to obtain first entity prediction results corresponding to each target text sentence; When the first entity prediction result indicates that the target entity exists in the target text sentence, the target text sentence is recorded as a successful entity prediction sentence; when the first entity prediction result indicates that the target entity does not exist in the target text sentence, the target text sentence is recorded as a failed entity prediction sentence; Performing entity prediction based on sequence labeling on the sentence for which entity prediction failed, to obtain a second entity prediction result corresponding to the sentence for which entity prediction failed; Performing rule-enhanced entity prediction on target text sentences in the target text paragraph to obtain third entity prediction results corresponding to each target text sentence; According to the first entity prediction result corresponding to the sentence for which entity prediction is successful, the second entity prediction result corresponding to the sentence for which entity prediction is unsuccessful, and the third entity prediction result corresponding to the target text sentence, the entity recognition result corresponding to each of the target text sentences is determined.
2. The entity recognition method according to claim 1, characterized in that: Before obtaining the text to be recognized, the method further includes: Receive an entity recognition instruction; the entity recognition instruction includes initial text data and a text type corresponding to the initial text data; Performing text parsing on the initial text data by a data reading method to obtain text reading data; the data reading method corresponds to the text type; The text reading data is cleaned to obtain the text to be recognized, and the text to be recognized is associated with the text type.
3. The entity recognition method according to claim 1, characterized in that: The step of determining a target text area corresponding to the text to be recognized according to the text area positioning method includes: Performing text position detection on the text to be recognized to determine the title text position and the ending text position in the text to be recognized; Recording the text to be recognized at other positions except the title text position and the ending text position as the text to be traversed; the text to be traversed includes at least one paragraph to be traversed; Acquire a preset target text template, and in the process of performing text traversal on the text to be traversed, match the text to be traversed with the preset target text template; The paragraphs to be traversed that match the preset target text template are recorded as the paragraphs to be located, and the text area containing all the paragraphs to be located is recorded as the target text area.
4. The entity recognition method according to claim 1, characterized in that: The step of performing entity prediction based on pointer annotation on target text sentences in the target text paragraph to obtain first entity prediction results corresponding to each target text sentence includes: Performing pointer-annotated word vector embedding on the target text sentence to obtain at least one text word vector corresponding to the target text sentence; Performing word information processing on each of the text word vectors to obtain a feature extraction vector corresponding to each of the text word vectors; Randomly sampling each of the feature extraction vectors to obtain a first sampling word vector, and performing word information processing on each of the first sampling word vectors to obtain a second sampling word vector corresponding to each of the first sampling word vectors; A first entity prediction result corresponding to the target text sentence is determined according to each of the second sampled word vectors.
5. The entity recognition method according to claim 1, characterized in that: The performing rule-enhanced entity prediction on the target text sentences in the target text paragraph to obtain a third entity prediction result corresponding to each of the target text sentences includes: Acquire a preset indicator database; the preset indicator database contains at least one indicator data group; one of the indicator data groups includes a project entity and a project indicator value corresponding to the project entity; Perform entity matching on each of the target text sentences according to the project entity to determine whether each of the target text sentences contains the project entity; When the target text sentence contains the project entity, obtaining a text index value corresponding to the project entity from the target text sentence; According to the project index value and the text index value, a third entity prediction result corresponding to the target text sentence is determined.
6. The entity recognition method according to claim 5, characterized in that: After performing entity matching on each of the target text sentences according to the project entity to determine whether each of the target text sentences contains the project entity, the method further includes: When the target text sentence does not contain the project entity, recording the target text sentence not containing the project entity as a sentence to be matched; Extracting target keywords from the sentences to be matched according to a preset word frequency extraction method; According to the target keyword, a third entity prediction result corresponding to the sentence to be matched is determined.
7. An entity recognition device, characterized in that: The entity recognition device is used to perform the entity recognition method according to any one of claims 1 to 6, and the entity recognition device includes: A text acquisition module, used to acquire text to be recognized; the text to be recognized is associated with a text type; A text area determination module, used to determine a text area positioning method corresponding to the text type, so as to determine a target text area corresponding to the text to be recognized according to the text area positioning method; the target text area contains at least one paragraph to be positioned; A text positioning module, used for performing text positioning on the target text area to determine the target text paragraph from the paragraphs to be positioned; The entity recognition module is used to perform entity recognition on the target text paragraph to obtain an entity recognition result corresponding to the target text paragraph.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the entity recognition method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the entity recognition method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Recognition method and device and device for recognition
CN109726612A
Biomedical entity recognition method for PDF format paper
CN111797630A
Insurance clause-oriented entity identification information extraction, storage and display method
CN113627189A