Entity recognition method and system based on model fusion
By using the prior data set scoring and probability distribution fusion methods in model fusion, the problem of poor model fusion effect in the prior art is solved, the accuracy and credibility of entity recognition are improved, and the named entity recognition is enhanced. Accuracy.
Patent Information
- Application Number
- CN202111338582.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2041-11-12
AI Technical Summary
The existing model fusion method has limited improvement effects in specific tasks and has failed to effectively improve the marking effect of the model.
The entity recognition method based on model fusion is adopted, and the annotation unit is marked through at least two marking models. The initial annotation results are scored using the prior data set, the weight vector is generated, and the model is fused with the probability distribution vector to obtain the final annotation. result. The specific steps include scoring the annotation result, normalizing the score, obtaining the probability vector and obtaining the annotation result, and using the argmax function to process the probability vector to obtain the final annotation result.
It significantly improves the accuracy and credibility of the label, enhances the pertinence of the model fusion process, and improves the accuracy of naming entity recognition.
Smart Images

Figure CN114091458B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to an entity recognition method and system based on model fusion. Background Art
[0002] In the field of machine learning, the same problem can usually be solved using multiple models with different parameters and structures. We need a method to integrate different models into a robust model. We also need to ensure that the integrated model is better than the basic sub-models.
[0003] The existing technologies specifically include: Bagging (bootstrap aggregating), which uses N models to predict and vote for classification problems, and uses N models to predict and average for regression problems; Boosting, which assigns an equal weight to each training example at the beginning of training, and then uses the algorithm to train the training set for t rounds. After each training, a larger weight is assigned to the training examples that failed to train, that is, the learning algorithm pays more attention to the wrong samples after each learning, thereby obtaining multiple prediction functions; Stacking, which first trains multiple different models, and then uses the outputs of the previously trained models as input to train a model to obtain a final output.
[0004] However, the above-mentioned existing model fusion methods do not take into account the characteristics of the tasks being solved and the structural characteristics of the processed data. When targeting a certain type of task, the existing model fusion methods have limited effect on improving the model.
[0005] Currently, no effective solution has been proposed to address the problem of poor labeling effect after model fusion in related technologies. Summary of the invention
[0006] The embodiments of the present application provide an entity recognition method and system based on model fusion, so as to at least solve the problem of poor labeling effect after model fusion in the related art.
[0007] In a first aspect, an embodiment of the present application provides an entity recognition method based on model fusion, comprising the following steps:
[0008] The step of scoring the labeling results comprises using at least two labeling models to label a labeling unit respectively, obtaining corresponding initial labeling results, forming an initial labeling result set, and scoring each initial labeling result according to a preset priori data set;
[0009] A score normalization processing step, obtaining a score vector according to the score of each initial annotation result obtained, and performing normalization processing on the score vector to obtain a weight vector;
[0010] The probability vector acquisition step is to perform model fusion according to the weight vector and the probability matrix composed of the probability distribution vector of each labeling model to obtain the probability vector;
[0011] A step of obtaining a labeling result, obtaining a final labeling result of the labeling unit according to the probability vector;
[0012] In the entity recognition step, each annotation unit in the text sequence to be recognized is traversed in turn to obtain the final annotation result of each annotation unit, and then entity recognition is performed on the text sequence to be recognized.
[0013] In some embodiments, in the step of scoring the annotation results, each initial annotation result is scored according to a preset priori data set using the following formula:
[0014] Score i =(C i +R i )·F i +F i
[0015] Among them, Score i is the score of the labeling result of the i-th labeling model for the current labeling unit, i = 1, 2, ... n, n represents the number of labeling models, C i Indicates whether the labeling result of the i-th labeling model for the previous labeling unit of the current labeling unit exists in the prior data set. If so, C i =1, otherwise C i =0; R i Whether the labeling result of the i-th labeling model for the current labeling unit exists in the prior data set, if so, R i =1, otherwise, R i =0; F i Indicates the number of times the labeling result of the i-th labeling model for the current labeling unit appears in the corresponding labeling result set.
[0016] In some embodiments, the weight vector is obtained specifically in the following manner:
[0017] Concatenate the scores of each initial annotation result to obtain a score vector;
[0018] The score vector is normalized to obtain a weight vector, and the normalization method includes a softmax function, a min-max normalization method, a Z-score normalization method, and / or a Z-score simplification method.
[0019] In some embodiments, the probability vector is obtained specifically in the following manner:
[0020] Through deep learning, the probability distribution vector of each labeling model for the labeling result type is obtained, and the probability matrix is obtained according to the probability distribution vector;
[0021] According to the weight vector and probability matrix, the model is integrated through the following formula to obtain the probability vector:
[0022] Pro mix =Pro·Weight
[0023] Among them, Pro mix is a probability vector, Weight is a weight vector, Pro is a probability matrix, and the probability matrix is an n×m matrix, where n represents the number of label types corresponding to the annotation unit and m is the number of labeling models.
[0024] In some of the embodiments, the probability vector is processed using an argmax function to obtain a final labeling result of the labeling unit.
[0025] In some embodiments, the annotation result set includes at least a label of a single-word entity, labels of each position of a multi-word entity, and / or a non-entity label.
[0026] In some of the embodiments, the labeling model includes but is not limited to an LSTM model, a BILSTM model, a BILSTM+CRF model, a BERT model, and a BERT+CRF model.
[0027] In a second aspect, an embodiment of the present application provides an entity recognition system based on model fusion, comprising:
[0028] The marking result scoring module uses at least two marking models to mark a marking unit respectively, obtains the corresponding initial marking results, forms an initial marking result set, and scores each initial marking result according to a preset priori data set;
[0029] A score normalization processing module obtains a score vector according to the score of each initial annotation result obtained, and normalizes the score vector to obtain a weight vector;
[0030] The probability vector acquisition module performs model fusion based on the weight vector and the probability matrix composed of the probability distribution vector of each labeling model to obtain the probability vector;
[0031] The labeling result acquisition module acquires the final labeling result of the labeling unit according to the probability vector;
[0032] The entity recognition module traverses each annotation unit in the text sequence to be recognized in turn, obtains the final annotation result of each annotation unit, and then performs entity recognition on the text sequence to be recognized.
[0033] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the entity recognition method based on model fusion as described in the first aspect above is implemented.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the entity recognition method based on model fusion as described in the first aspect above.
[0035] Compared with related technologies, the entity recognition method, system, computer device and storage medium based on model fusion provided in the embodiments of the present application can be applied to the field of knowledge graph technology and graph construction technology. It has the following advantages:
[0036] 1. By scoring the labeling results of multiple labeling models according to the prior data set and the labeling result set, the weight vector of each model is obtained, and the model is fused accordingly to obtain the final labeling result, which greatly improves the accuracy and credibility of the label.
[0037] 2. A named entity recognition method based on model fusion was designed, which increased the specificity of the model fusion process for specific tasks, more effectively utilized the annotation capabilities of the sub-models, and improved the accuracy of named entity recognition.
[0038] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0040] Figure 1 is a flow chart of an entity recognition method based on model fusion according to an embodiment of the present application;
[0041] Figure 2 is a flow chart of an entity recognition method based on model fusion according to a preferred embodiment of the present application;
[0042] Figure 3 is a structural block diagram of an entity recognition system based on model fusion according to an embodiment of the present application;
[0043] Figure 4 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
[0044] in:
[0045] Annotation result scoring module 1; score normalization processing module 2; probability vector acquisition module 3;
[0046] Labeling result acquisition module 4; entity recognition module 5;
[0047] Processor 81; memory 82; communication interface 83; bus 80. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0049] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0050] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0051] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0052] An embodiment of the present application provides an entity recognition method based on model fusion. Figure 1 is a flow chart of an entity recognition method based on model fusion according to an embodiment of the present application, such as Figure 1 As shown, the process includes the following steps:
[0053] The marking result scoring step S1 uses at least two marking models to mark a marking unit respectively, obtains the corresponding initial marking results, forms an initial marking result set, and scores each initial marking result according to a preset priori data set;
[0054] It should be noted that a labeling unit includes at least one byte, one labeling unit corresponds to one labeling result, and one labeling result may include one or more tags.
[0055] Score normalization processing step S2, obtaining a score vector according to the score of each initial annotation result obtained, and normalizing the score vector to obtain a weight vector;
[0056] Probability vector acquisition step S3, performing model fusion according to the weight vector and the probability matrix composed of the probability distribution vector of each marking model to obtain the probability vector;
[0057] The labeling result acquisition step S4 is to acquire the final labeling result of the labeling unit according to the probability vector;
[0058] In the entity recognition step S5, each annotation unit in the text sequence to be recognized is traversed in turn to obtain the final annotation result of each annotation unit, and then entity recognition is performed on the text sequence to be recognized.
[0059] It should be noted that the annotation result set includes the annotation results of each tagging model for each byte of the text sequence. According to the annotation results, it can be determined whether the unit is an entity, and if so, its position in the entity.
[0060] Through the above steps, the pre-labeled prior data set includes pre-labeled entities, which are used as prior information and as one of the references for scoring, which can improve the accuracy of scoring and obtain more accurate evaluation of each labeling result, so as to obtain more accurate weight information, which is an important reference for subsequent model fusion and greatly improves the accuracy and credibility of the labels generated after model fusion. At the same time, a model fusion method for named entity recognition tasks is designed to increase the pertinence of the model fusion process to specific tasks, more effectively utilize the labeling ability of the sub-model, and improve the accuracy of named entity recognition.
[0061] It should be noted that in the prior art, labeled data is only used to train the model. The embodiment of the present application creatively uses the existing labeled data as prior knowledge for model fusion, thereby improving the efficiency of model fusion.
[0062] In some of these embodiments, the annotation results include single-word entity tags, position tags of multi-word entities, and / or non-entity tags.
[0063] In some of the embodiments, the labeling model includes but is not limited to an Istm model, a bilstm model, a bilstm+CRF model, a bert model, and a bert+CRF model.
[0064] In some embodiments, in the annotation result scoring step S1, each initial annotation result is scored according to a preset priori data set using the following formula:
[0065] Score i =(C i +R i )·F i +F i
[0066] Among them, Score i is the score of the labeling result of the i-th labeling model for the current labeling unit, i = 1, 2, ... n, n represents the number of labeling models, Ci represents whether the labeling result of the i-th labeling model for the previous labeling unit of the current labeling unit exists in the prior data set, if so, then Ci =1, otherwise C i =0,; R i Whether the labeling result of the i-th labeling model for the current labeling unit exists in the prior data set, if so, R i =1, otherwise, R i =0; F i Indicates the number of times the labeling result of the i-th labeling model for the current labeling unit appears in the corresponding labeling result set.
[0067] It should be noted that the previous annotation unit can be a single-word entity, a multi-word entity or a non-entity.
[0068] It should be noted that different labeling models may label the same text sequence with different results. For example, for "machine learning", some labeling models label "machine" and "learning" as separate entities, and some labeling models label "machine learning" as a whole entity. According to different entity labeling situations, the labeling units that need to be scored are dynamically adjusted.
[0069] For example, the labeling model will label each word in the sentence, and m models will label the same word with m labels (some of these labels may be the same). These labels generally include "BMESO", which means that the label of a word can only be one of these four labels. Each label has its own corresponding meaning. B represents the beginning of an entity, M represents the middle, E represents the end, S represents a single-word entity, and 0 represents a non-entity. For example, the labeling result of a labeling model for the sentence "Type of units to be labeled" is "BMMMMEOBE". When the second B is scored, its previous labeling unit is O; when O is scored, its previous labeling unit is the first BMMMME.
[0070] Through the above steps, by scoring the labeling results of multiple labeling models according to the prior data set and the labeling result set, it is convenient to evaluate the labeling effect of the labeling model, so as to improve the accuracy of the subsequent weight effect and realize the integrated fusion of the labeling results of multiple models.
[0071] In some embodiments, in the score normalization processing step S2, the weight vector is obtained specifically in the following manner:
[0072] Concatenate the scores of each initial annotation result to obtain a score vector;
[0073] The score vector is normalized to obtain a weight vector, and the normalization method includes a softmax function, a min-max normalization method, a Z-score normalization method, and / or a Z-score simplification method.
[0074] The above data standardization (normalization) processing is a task of data mining. Different evaluation indicators often have different dimensions and dimensional units, which will affect the results of data analysis. In order to eliminate the dimensional impact between indicators, data standardization is required to solve the comparability between data indicators. After the original data is processed by data standardization, each indicator is at the same order of magnitude, which is suitable for comprehensive comparative evaluation. The following is a brief description of the normalization method:
[0075] 1. Min-Max Normalization, also known as deviation normalization, is a linear transformation of the original data so that the resulting value is mapped to between [0–1]. The conversion function is as follows:
[0076]
[0077] Where max is the maximum value of the sample data, and min is the minimum value of the sample data. A drawback of this method is that when new data is added, max and min may change and need to be redefined.
[0078] 2. Z-score standardization method, this method gives the mean and standard deviation of the original data to standardize the data. The processed data conforms to the standard normal distribution, that is, the mean is 0 and the standard deviation is 1. The conversion function is:
[0079]
[0080] Where μ is the mean of all sample data, and σ is the standard deviation of all sample data.
[0081] 3. Simplified Z-scores, the model is as follows:
[0082]
[0083] The larger the x, the greater the * The smaller it is, the larger the number can be normalized between [0-1].
[0084] The above methods 1 and 2 both rely on all the data to be normalized, while method 3 only relies on the current data and can be used dynamically, which is easy to understand.
[0085] 4. The softmax function maps the obtained score to the interval (0, 1). Suppose there is a vector V, Vi represents the i-th element in V, and the softmax value of the element is the ratio of the exponent of the element to the sum of the exponents of all elements. The specific formula is:
[0086]
[0087] In some embodiments, in the probability vector acquisition step S3, the probability vector is obtained specifically in the following manner:
[0088] Through deep learning, the probability distribution vector of each labeling model for the labeling result type is obtained, and the probability matrix is obtained according to the probability distribution vector;
[0089] According to the weight vector and probability matrix, the model is integrated through the following formula to obtain the probability vector:
[0090] Pro mix =Pro·Weight
[0091] Among them, Pro mix is a probability vector, Weight is a weight vector, Pro is a probability matrix, and the probability matrix is an n×m matrix, where n represents the number of label types corresponding to the annotation unit and m is the number of labeling models.
[0092] Exemplarily, in the deep learning process, the models used can be BiLSTM, BiLSTM+crf, bert+crf, etc. All models that solve the NER task obtain a probability vector, and the probability vectors of all integrated models can form a probability matrix.
[0093] In some embodiments, in the labeling result obtaining step S4, the probability vector is processed using the argmax function to obtain the final labeling result of the labeling unit.
[0094] The above argmax is a function, function y = f(x), x 0 =argmax(f(x)) means the parameter x 0 Satisfy f(x 0 ) is the maximum value of f(x); in other words, argmax(f(x)) is the variable x that makes f(x) reach its maximum value.
[0095] This embodiment also provides an entity recognition method based on model fusion. Figure 2 is a flow chart of an entity recognition method based on model fusion according to a preferred embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0096] S201, scoring the labeling results of the labeling model according to the prior information and the set rules.
[0097] For a certain annotated unit (a character, a word, a vocabulary, etc.) in the text sequence, m labeling models give their own labeling results respectively. After obtaining the labeling result set of all models, they are scored and sorted according to the label type.
[0098] Taking the labeling result of labeling model i as an example, the score calculation process corresponding to the labeling result of labeling model i is as follows:
[0099] Score i =(C i +R i )·F i +F i
[0100] Score i represents the score of the labeling result of labeling model i; C i Indicates whether the context of the current annotation result exists in the existing annotated data set. The context is the annotation result of the labeling model i on the text immediately before the current annotation position. If the context annotation result exists in the existing data set, C i =1, otherwise C i =0; R i (Recurrent) indicates whether the labeling result of the current labeling model i for the current labeling unit exists in the existing labeled data set. If so, R i =1, otherwise R i =0; F i It indicates the number of times the labeling result of the current labeling model i for the current labeling unit appears in the labeling results of m models (the labeling result set of the current labeling unit).
[0101] It should be noted that the above-mentioned marking results may at least include a label of a single-word entity, a label of a non-entity, a label of a multi-word entity start position, a label of a multi-word entity middle position, and a label of a multi-word entity end position.
[0102] It should be noted that when the annotation result shows that the corresponding annotation unit is an entity, no score is given to each word within the entity.
[0103] S202, obtaining a weight vector according to the score.
[0104] Get the score of all m models i Then concatenate into score vector Score = [Score 1 ...Score m ]. Perform SoftMax normalization on the score vector to obtain the weight vector.
[0105] Weight = SoffMax(Score)
[0106] S203, obtaining a probability vector according to the weight vector and the probability matrix.
[0107] The label set that needs to solve the task has a total of n labels, so the probability matrix of m models is Pro n×m The final probability vector Pro obtained by model fusion mix for:
[0108] Pro mix =Pro·Weight
[0109] The above probability matrix Pro n×m The probability distribution vectors of each model can be obtained through deep learning, and then the probability distribution vectors can be spliced together.
[0110] S204, obtaining the final labeling result according to the probability vector.
[0111] By Probability Vector Pro mix Get the final annotation result after model fusion:
[0112] Label mix =argmax(Pro mix )
[0113] S205, repeat the above process from left to right for a text sequence, finally obtain the entire sequence annotation results, and perform entity recognition based on them.
[0114] Through the above steps, m labeling models are used to label the same labeling unit, and m labels are obtained to form a labeling data set. The score is obtained according to the preset scoring rules using the prior information (i.e., the existing labeled data set) and the labeling data set. The score combines the characteristics of the prior information and the labeling effects of all labeling models to improve the accuracy of the label effect evaluation. Based on this, the model weight is obtained, and the model is fused in combination with the probability matrix, and the most accurate labeling result is obtained according to the argmax function.
[0115] It should be noted that there are multiple methods or models for entity extraction for the same article. The method in the embodiment of the present application is used to integrate and fuse the annotation results of the above different methods or models to obtain the final entity extraction result of the article.
[0116] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0117] This embodiment also provides an entity recognition system based on model fusion, which is used to implement the above embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0118] Figure 3 is a structural block diagram of an entity recognition system based on model fusion according to an embodiment of the present application, such as Figure 3 As shown, the system includes:
[0119] The marking result scoring module 1 uses at least two marking models to mark a marking unit respectively, obtains the corresponding initial marking results, forms an initial marking result set, and scores each initial marking result according to a preset priori data set;
[0120] The score normalization processing module 2 obtains a score vector according to the score of each initial annotation result obtained, and normalizes the score vector to obtain a weight vector;
[0121] The probability vector acquisition module 3 performs model fusion according to the probability matrix composed of the probability distribution vector of each marking model according to the weight vector to obtain the probability vector;
[0122] The labeling result acquisition module 4 acquires the final labeling result of the labeling unit according to the probability vector;
[0123] The entity recognition module 5 traverses each annotation unit in the text sequence to be recognized in turn, obtains the final annotation result of each annotation unit, and then performs entity recognition on the text sequence to be recognized.
[0124] In some embodiments, the marking result scoring module 1 scores the marking result of one of the marking models i, and the score formula is as follows:
[0125] Score i =(C i +R i )·F i +F i
[0126] Among them, Score i is the score of the labeling result of the i-th labeling model for the current labeling unit, i = 1, 2, ... n, n represents the number of labeling models, C i Indicates whether the labeling result of the i-th labeling model for the previous labeling unit of the current labeling unit exists in the prior data set. If so, C i=1, otherwise C i =0; R i Whether the labeling result of the i-th labeling model for the current labeling unit exists in the prior data set, if so, R i =1, otherwise, R i =0; F i Indicates the number of times the labeling result of the i-th labeling model for the current labeling unit appears in the corresponding labeling result set.
[0127] In some of the embodiments, the score normalization processing module 2 concatenates the scores of each initial annotation result to obtain a score vector;
[0128] The score vector is normalized to obtain a weight vector, and the normalization method includes a softmax function, a min-max normalization method, a Z-score normalization method, and / or a Z-score simplification method.
[0129] In some embodiments, the probability vector acquisition module 3 obtains the probability distribution vector of each marking model for the type of marking result through deep learning, and obtains the probability matrix according to the probability distribution vector;
[0130] According to the weight vector and probability matrix, the model is integrated through the following formula to obtain the probability vector:
[0131] Pro mix =Pro·Weight
[0132] Among them, Pro mix is a probability vector, Weight is a weight vector, Pro is a probability matrix, and the probability matrix is an n×m matrix, where n represents the number of label types corresponding to the annotation unit and m is the number of labeling models.
[0133] In some embodiments, the labeling result acquisition module 4 processes the probability vector using the argmax function to obtain the final labeling result of the labeling unit.
[0134] The above argmax is a function, function y = f(x), x 0 =argmax(f(x)) means the parameter x 0 Satisfy f(x 0 ) is the maximum value of f(x); in other words, argmax(f(x)) is the variable x that makes f(x) reach its maximum value.
[0135] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0136] In addition, combined Figure 1 The entity recognition method based on model fusion described in the embodiment of the present application can be implemented by a computer device. Figure 4 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present application.
[0137] The computer device may include a processor 81 and a memory 82 storing computer program instructions.
[0138] Specifically, the processor 81 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0139] Among them, the memory 82 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 82 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 82 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 82 may be inside or outside the data processing device. In a specific embodiment, the memory 82 is a non-volatile memory. In a specific embodiment, the memory 82 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable ProgrammableRead-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable ProgrammableRead-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0140] The memory 82 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 81 .
[0141] The processor 81 implements any one of the entity recognition methods based on model fusion in the above embodiments by reading and executing computer program instructions stored in the memory 82 .
[0142] In some of these embodiments, the computer device may further include a communication interface 83 and a bus 80. Figure 4 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 80 and communicate with each other.
[0143] The communication interface 83 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication port 83 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.
[0144] The bus 80 includes hardware, software or both, and couples the components of the computer device to each other. The bus 80 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 80 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel 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 Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 80 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0145] The computer device can perform the labeling result scoring step in the embodiment of the present application based on the acquired pre-labeled prior data set, thereby realizing the combination of Figure 1 Described model fusion based entity recognition method.
[0146] In addition, in combination with the entity recognition method based on model fusion in the above embodiments, the embodiment of the present application can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the entity recognition methods based on model fusion in the above embodiments is implemented.
[0147] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0148] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An entity recognition method based on model fusion, characterized in that: Using at least two marking models to mark a marking unit respectively, obtain corresponding initial marking results, wherein the marking results include single-word entity labels, position labels of multi-word entities and / or non-entity labels, forming an initial marking result set, and scoring each initial marking result according to a preset priori data set; Specifically, each initial annotation result is scored according to the preset prior data set using the following formula: in, For the The score of the labeling result of the current labeling unit by the labeling model, i=1, 2, ...n, n represents the number of labeling models, Indicates The labeling model determines whether the labeling result of the previous labeling unit of the current labeling unit exists in the prior data set. If so, ,otherwise ; Indicates Whether the labeling result of the current labeling unit by the labeling model exists in the prior data set, if so, ,otherwise, ; Indicates The number of times the labeling result of the current labeling unit by a labeling model appears in the labeling result set of the current labeling unit; A score vector is obtained according to the score of each initial annotation result, and the score vector is normalized to obtain a weight vector; Performing model fusion according to the weight vector and the probability matrix composed of the probability distribution vector of each marking model to obtain the probability vector, wherein the probability distribution vector of each marking model for the type of labeling result is obtained by deep learning, and the probability matrix is obtained according to the probability distribution vector; Obtain the final annotation result of the annotation unit according to the probability vector; Each annotation unit in the text sequence to be recognized is traversed in turn to obtain the final annotation result of each annotation unit, and then entity recognition is performed on the text sequence to be recognized.
2. The entity recognition method based on model fusion according to claim 1 is characterized in that: The weight vector is obtained in the following way: Concatenate the scores of each initial annotation result to obtain a score vector; The score vector is normalized to obtain a weight vector, and the normalization method includes a softmax function, a min-max normalization method, a Z-score normalization method, and / or a Z-score simplification method.
3. The entity recognition method based on model fusion according to claim 1 is characterized in that: The probability vector is obtained in the following way: According to the weight vector and probability matrix, the model is integrated through the following formula to obtain the probability vector: in, is the probability vector, is the weight vector, is the probability matrix, and the probability matrix is , n represents the number of label types corresponding to the annotation unit, and m is the number of labeling models.
4. The entity recognition method based on model fusion according to claim 1 is characterized in that: The argmax function is used to process the probability vector to obtain the final annotation result of the annotation unit.
5. The entity recognition method based on model fusion according to any one of claims 1 to 4, characterized in that: The labeling models include but are not limited to the LSTM model, the BILSTM model, the BILSTM+CRF model, the BERT model, and the BERT+CRF model.
6. An entity recognition system based on model fusion, characterized in that: include: A marking result scoring module, using at least two marking models to mark a marking unit respectively, to obtain a corresponding initial marking result, wherein the marking result includes a single-word entity label, a position label of a multi-word entity and / or a non-entity label, forming an initial marking result set, and scoring each initial marking result according to a preset priori data set; Specifically, each initial annotation result is scored according to the preset prior data set using the following formula: in, For the The score of the labeling result of the current labeling unit by the labeling model, i=1, 2, ...n, n represents the number of labeling models, Indicates The labeling model determines whether the labeling result of the previous labeling unit of the current labeling unit exists in the prior data set. If so, ,otherwise ; Indicates Whether the labeling result of the current labeling unit by the labeling model exists in the prior data set, if so, ,otherwise, ; Indicates The number of times the labeling result of the current labeling unit by a labeling model appears in the labeling result set of the current labeling unit; A score normalization processing module obtains a score vector according to the score of each initial annotation result obtained, and normalizes the score vector to obtain a weight vector; A probability vector acquisition module performs model fusion according to the weight vector and the probability matrix composed of the probability distribution vector of each marking model to obtain the probability vector, wherein the probability distribution vector of each marking model for the type of marking result is obtained through deep learning, and the probability matrix is obtained according to the probability distribution vector; The labeling result acquisition module acquires the final labeling result of the labeling unit according to the probability vector; The entity recognition module traverses each annotation unit in the text sequence to be recognized in turn, obtains the final annotation result of each annotation unit, and then performs entity recognition on the text sequence to be recognized.
7. 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 based on model fusion as described in any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the entity recognition method based on model fusion as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Entity identification method and device, electronic equipment and storage medium
CN111985239A