Entity processing method and device, model training method and device, computer equipment and medium

By performing entity boundary processing and vocabulary expansion on entity data in text, and post-processing combined with language model and post-processing model, the problem of inaccurate entity boundary marking in named entity recognition is solved, and entity data processing is realized without relying on pre-established knowledge bases and dictionaries, which improves the portability and extensibility of entity processing.

CN119692341APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411449111.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

There is a problem of inaccurate entity boundary marking in named entity recognition, especially in the field of expertise, where professional terms and term abbreviations are often not covered by pre-established knowledge bases and dictionaries.

Method used

By performing entity boundary processing on entity data in text, vocabulary expansion is used for context information in text, and post-processing is combined with language model and post-processing model to obtain the final entity data.

Benefits of technology

Without relying on pre-established knowledge bases and dictionaries, it can effectively process entity data in various fields, improving the portability and scalability of entity processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119692341A_ABST
    Figure CN119692341A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses an entity processing method and device, a model training method and device, computer equipment and a medium, and the method comprises the steps: carrying out the entity recognition of a text, and obtaining first entity data and the context information of the first entity data in the text; performing entity boundary processing on the first entity data based on the context information to obtain second entity data; the context information indicates adjacent reference vocabularies of the first entity data in the text; and post-processing the first entity data and the second entity data to obtain third entity data of the text. In the whole entity processing process, a knowledge base and a dictionary do not need to be established in advance, and the final entity data can be obtained only according to the context information of the entity data in the text, so that the entity processing method and device can be applied to entity processing in various fields, and portability and expansibility of entity processing are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and specifically to an entity processing method, a model training method, an apparatus, a computer device and a medium. Background Art

[0002] Named Entity Recognition (NER) is a key task in natural language processing, which aims to identify entities with specific meanings from text. The solution to implement NER technology usually involves steps such as data preparation, feature engineering, model selection and training, model evaluation and optimization, model deployment and application. However, NER faces some challenges, such as the ambiguity of named entity boundaries, that is, the problem of inaccurate entity boundary marking. Therefore, on the basis of named entity recognition, the post-processing methods that can optimize this problem mainly include additional particle separation method, adjacent word integration into new entity method and special symbol entity marking method. The above methods rely on the establishment of knowledge base and dictionary. However, in professional fields, professional texts often contain a large number of professional terms and term abbreviations, which may not exist in the established knowledge base and dictionary. Summary of the invention

[0003] Embodiments of the present application provide an entity processing method, a model training method, an apparatus, a computer device, and a medium.

[0004] In a first aspect, an embodiment of the present application provides an entity processing method, including:

[0005] Performing entity recognition on the text to obtain first entity data and context information of the first entity data in the text; the context information indicates adjacent reference words of the first entity data in the text;

[0006] Based on the context information, performing entity boundary processing on the first entity data to obtain second entity data;

[0007] The first entity data and the second entity data are post-processed to obtain third entity data of the text.

[0008] In a second aspect, an embodiment of the present application provides a model training method, comprising:

[0009] Performing entity boundary processing on the third sample entity in the training data set to obtain a fourth sample entity, and setting a corresponding third sample label for the third sample entity, and setting a corresponding fourth sample label for the fourth sample entity;

[0010] Scoring the third sample entity based on the language model to obtain a third sample feature score of the third sample entity, and scoring the fourth sample entity based on the language model to obtain a fourth sample feature score of the fourth sample entity;

[0011] Based on the third sample entity and its corresponding third sample feature score and third sample label, as well as the fourth sample entity and its corresponding fourth sample feature score and fourth sample label, the pre-trained classification model is trained to obtain a post-processing model.

[0012] In a third aspect, an embodiment of the present application provides a physical processing device, including:

[0013] An entity recognition module, configured to perform entity recognition on a text to obtain first entity data and context information of the first entity data in the text; the context information indicates adjacent reference words of the first entity data in the text;

[0014] A first entity boundary processing module, configured to perform entity boundary processing on the first entity data based on the context information to obtain second entity data;

[0015] A post-processing module is used to post-process the first entity data and the second entity data to obtain third entity data of the text.

[0016] In a fourth aspect, an embodiment of the present application provides a model training device, including:

[0017] A second entity boundary processing module, used to perform entity boundary processing on the third sample entity in the training data set to obtain a fourth sample entity, and set a corresponding third sample label for the third sample entity, and set a corresponding fourth sample label for the fourth sample entity;

[0018] a scoring module, configured to score the third sample entity based on the language model to obtain a third sample feature score of the third sample entity, and score the fourth sample entity based on the language model to obtain a fourth sample feature score of the fourth sample entity;

[0019] A model training module is used to perform model training on the pre-trained classification model based on the third sample entity and its corresponding third sample feature score and third sample label, as well as the fourth sample entity and its corresponding fourth sample feature score and fourth sample label to obtain a post-processing model

[0020] In a fifth aspect, an embodiment of the present application also provides a computer device, comprising a memory storing multiple computer programs; a processor loads the computer program from the memory to execute the entity processing method or model training method provided in the embodiment of the present application.

[0021] In a sixth aspect, an embodiment of the present application also provides a computer-readable storage medium, which stores multiple computer programs, and the computer programs are suitable for loading by a processor to execute the entity processing method or model training method provided in the embodiment of the present application.

[0022] In the seventh aspect, the embodiments of the present application also provide a computer program product, including a computer program or a computer program, which, when executed by a processor, implements the entity processing method or model training method provided by the embodiments of the present application.

[0023] By adopting the scheme of the application embodiment, entity boundary processing is performed on the first entity data according to the context information of the first entity data in the text, that is, the first entity data is vocabulary expanded according to the adjacent reference words of the first entity data in the text, and then the original first entity data and the second entity data after the vocabulary expansion are post-processed to obtain the third entity data. Therefore, in the whole entity processing process, there is no need to rely on the pre-established knowledge base and dictionary, and the final entity data can be obtained only according to the context information of the entity data in the text. Therefore, it can be applied to entity processing in various fields, which improves the portability and extensibility of entity processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 It is a schematic diagram of the application environment of the entity processing method provided in the embodiment of the present application;

[0026] Figure 2 It is a flowchart of the entity processing method provided in the embodiment of the present application;

[0027] Figure 3 It is a flowchart of the model training method provided in the embodiments of the present application;

[0028] Figure 4 is a flow chart of the language model training process provided in the embodiments of the present application;

[0029] Figure 5It is a schematic diagram of the process of constructing entity data for model training provided in an embodiment of the present application;

[0030] Figure 6 is a schematic diagram of entity data for post-processing model training provided in an embodiment of the present application;

[0031] Figure 7 It is a schematic diagram of the overall processing flow of the entity processing method provided in the embodiment of the present application;

[0032] Figure 8 is a schematic diagram of the classification effect of a single feature provided in an embodiment of the present application;

[0033] Fig. 9 is a schematic diagram of post-processing evaluation of the recognition results provided in the embodiments of the present application;

[0034] Fig.10 It is one of the structural schematic diagrams of the entity processing device provided in the embodiments of the present application;

[0035] Fig.11 This is the second structural diagram of the entity processing device provided in the embodiment of the present application;

[0036] Fig.12 It is a schematic diagram of the internal structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0038] In one embodiment of the present application, the entity processing method and the model training method can be run on a local terminal device or a server. When the entity processing method and the model training method are run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0039] In order to better understand the entity processing method, model training method, device, computer equipment and medium provided in the embodiments of the present application, the application environment applicable to the embodiments of the present application is first described below.

[0040] See also Figure 1 , Figure 1 A schematic diagram of an application environment of an entity processing method and a model training method provided in an embodiment of the present application is shown.

[0041] As an implementation mode, the entity processing method and the model training method provided in the embodiment of the present application can be applied to the same electronic device, wherein the electronic device can be as follows: Figure 1 The server 110 shown in the figure can be connected to the terminal device 120 through a network. The network is used to provide a medium for a communication link between the server 110 and the terminal device 120. The network can include various connection types, such as a wired communication link, a wireless communication link, etc., which are not limited in the embodiments of the present application. Optionally, in other embodiments, the electronic device can also be a smart phone, a laptop computer, etc.

[0042] It should be understood that Figure 1 The server 110, network and terminal device 120 are merely illustrative. Depending on the implementation requirements, there may be any number of servers, networks and terminal devices. For example, the server 110 may be a physical server or a server cluster composed of multiple servers, and the terminal device 120 may be a mobile phone, a tablet, a desktop computer, a laptop computer, and the like. It is understood that the embodiments of the present application may also allow multiple terminal devices 120 to access the server 110 at the same time.

[0043] In some embodiments, the terminal device 120 can record the user's voice to obtain the user's audio data. Further, the terminal device 120 sends the user's audio data to the server 110 through the network. After the server 110 receives the user's audio data, it converts the audio data into text, and these texts can be processed by the entity processing method and model training method of the embodiment of the present application.

[0044] As another implementation, the entity processing method and model training method provided in the embodiment of the present application can be applied to different electronic devices. For example, the entity processing method is applied to electronic device A, the model training method is applied to electronic device B, and so on.

[0045] The following is a detailed description in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal device as an example. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.

[0046] The entity processing method of this embodiment can be applied to task recognition scenarios, such as sentiment analysis task scenarios, intent analysis task scenarios, etc. Therefore, in task recognition scenarios, it is often required to perform named entity recognition on the data input by the user (such as text, voice, etc.), obtain the entities in the input data, and then perform sentiment analysis, intent analysis, etc. based on the recognized entities. Task recognition can also be understood as a kind of natural language processing. Therefore, named entity recognition NER is a key task in natural language processing, and its purpose is to identify entities with specific meanings from text. The solution to implement NER technology usually involves steps such as data preparation, feature engineering, model selection and training, model evaluation and optimization, model deployment and application. However, NER faces some challenges, such as the ambiguity of named entity boundaries, that is, the problem of inaccurate entity boundary marking.

[0047] Therefore, on the basis of named entity recognition, the post-processing methods that can optimize this problem mainly include additional particle separation method, adjacent word integration into new entity method and special symbol entity marking method. The above methods rely on the establishment of knowledge base and dictionary. However, in professional fields, professional texts often contain a large number of professional terms and abbreviations, and the established knowledge base and dictionary may not contain these professional terms and abbreviations. Therefore, for named entity recognition in different fields, different databases and dictionaries need to be established, and in this process, the databases and dictionaries need to be continuously updated according to the newly emerging professional terms and abbreviations, resulting in poor portability and scalability of entity processing.

[0048] In order to solve the above technical problems, the inventors proposed an entity processing method based on context information, namely, performing entity boundary processing on the first entity data according to the context information of the first entity data in the text, namely, performing vocabulary expansion on the first entity data according to the adjacent reference words of the first entity data in the text, and then post-processing the original first entity data and the second entity data after vocabulary expansion to obtain third entity data. Therefore, in the entire entity processing process, there is no need to rely on the pre-established knowledge base and dictionary, and the final entity data can be obtained only based on the context information of the entity data in the text. Therefore, it can be applied to entity processing in various fields, which improves the portability and extensibility of entity processing.

[0049] In some embodiments, the terminal device 120 can respond to user operations (such as clicking on the entity processing entrance to enter the entity processing operation page, and operating the page to input text, voice, etc.), generate a trigger request for entity processing, and then perform entity processing on the input text, voice, etc. through the entity processing method of the embodiment of the present application.

[0050] In other embodiments, the terminal device 120 can respond to the user's operation (such as clicking on the entity processing entrance to enter the entity processing operation page, and operating the page to input text, voice, etc.), generate a trigger request for entity processing, and then send the trigger request to the server 110 through the network. When the server 110 receives the trigger request, it can perform entity processing on the input text, voice, etc. through the entity processing method of the embodiment of the present application.

[0051] refer to Figure 2 , Figure 2 : is a flow chart of the entity processing method provided in the embodiment of the present application. The specific flow of the entity processing method can be as follows: Step 10 to Step 30, wherein:

[0052] Step 10: Perform entity recognition on the text to obtain first entity data and context information of the first entity data in the text.

[0053] Optionally, the terminal device obtains the text to be processed from the Internet, or obtains the text to be processed input by the user, or obtains the voice to be processed input by the user, and converts the voice into the text to be processed, wherein there may be one or more texts, and the text is unlabeled text. In one embodiment, the text is "I want to go to Y place at X time to do XXX things".

[0054] Furthermore, a named entity recognition model is trained in the terminal device of the embodiment of the present application, wherein the named entity recognition model may include a recurrent neural network (RNN), a long short-term memory network (LSTM), a bidirectional encoder representation (BERT), etc.

[0055] Therefore, the terminal device inputs the text to be processed into the named entity recognition model, performs entity recognition on the text to be processed through the named entity recognition model, and obtains the first entity data of the text to be processed output by the named entity recognition model, as well as the entity information of the first entity data.

[0056] It should be noted that the first entity data in the embodiment of the present application does not specifically refer to one data, and the first entity data can be understood as a set of entities identified in the text, that is, the first entity data includes at least two entities.

[0057] The entity information may include an entity ID (Identity Document), a start subscript, an end subscript and a corresponding text ID of the entity. The start subscript indicates the start position of the entity data in the text, and the end subscript indicates the end position of the entity data in the text.

[0058] In one embodiment, the text to be processed obtained from the Internet is [According to Xinhua News Agency, Beijing, May 4 (Reporter Zhou XY), when the list of designers of the "Galaxy III" supercomputer is opened, what is as surprising as this world-renowned major scientific research achievement is the age of the designers]. After the text is input into the named entity recognition model, the result of the named entity recognition model output is: {entity: Xinhua News Agency, entity superscript: 2, entity subscript: 5}, {entity: Beijing, entity superscript: 5, entity subscript: 7}, {entity: May 4, entity superscript: 7, entity subscript: 11}, {entity: Zhou X, entity superscript: 15, entity subscript: 17}, {entity: No. 3, entity superscript: 24, entity subscript: 26}.

[0059] Furthermore, the entity information may also include the data type of the entity, which may include GPE type, DATE type, LOC type, EVENT type, TIME type, PERSON type, LAW type, WORK_OF_ART type, etc. However, the data type is not a feature that post-processing is concerned about. What needs to be paid attention to in the embodiments of the present application are the entity superscript, entity subscript and the text in which the entity is located.

[0060] Therefore, the terminal device obtains context information of the first entity data in the text based on the entity superscript and entity subscript in the entity information, wherein the context information indicates adjacent reference words of the first entity data in the text, and the adjacent words may be reference words corresponding to the starting position of the first entity data in the text, or may be reference words corresponding to the ending position of the first entity data in the text.

[0061] Continuing with the above embodiment, according to {entity: Xinhua News Agency, entity superscript: 2, entity subscript: 5}, the reference vocabulary of the entity "Xinhua News Agency" can be obtained as "according to", "North", "Beijing", etc., according to {entity: Beijing, entity superscript: 5, entity subscript: 7}, the reference vocabulary of the entity "Beijing" can be obtained as "Huashe", "She", "5", "May", etc., according to {entity: May 4th, entity superscript: 7, entity subscript: 11}, the reference vocabulary of the entity "May 4th" can be obtained as "Beijing", "Jing", "Dian", "Dian (", etc., according to {entity: Zhou X, entity superscript: 15, entity subscript: 17}, the reference vocabulary of the entity "Zhou X" can be obtained as "reporter", "writer", "Y", etc., according to {entity: No. 3, entity superscript: 24, entity subscript: 26}, the reference vocabulary of the entity "No. 3" can be obtained as "Galaxy", "River", etc.

[0062] Step 20: Based on the context information, perform entity boundary processing on the first entity data to obtain second entity data.

[0063] Optionally, the terminal device performs entity boundary processing on the first entity data according to context information of the first entity data in the text to obtain second entity data, wherein the entity boundary processing is to expand or reduce the words of the first entity data.

[0064] It should be noted that the second entity data in the embodiment of the present application does not specifically refer to a piece of data, but is a collection of data obtained after entity boundary processing of each entity in the first entity data.

[0065] Therefore, it can be understood that the terminal device expands or reduces the words of the first entity data according to the context information of the first entity data in the text to obtain the second entity data, as described in steps 201 to 203.

[0066] In one embodiment, the entity boundary processing in the embodiment of the present application is to continue to add or reduce one or two characters based on the first entity data. If the words of the first entity data are reduced, the characters of the reduced words cannot be less than 2.

[0067] Continuing with the above embodiment, the second entity data obtained after the entity boundary processing of the first entity data "Xinhua News Agency" is "Xinhua", "Xinhua News Agency North", "Xinhua News Agency Beijing". The second entity data obtained after the entity boundary processing of the first entity data "Beijing" is "Beijing 5", "Beijing May". The second entity data obtained after the entity boundary processing of the first entity data "May 4th" is "May", "May 4", "May 4th Telegraph", "May 4th Telegraph (". The first entity data Zhou X, entity superscript: 15, entity subscript: 17}, the reference vocabulary of the entity "Zhou X" can be obtained as "reporter", "writer", "Y", etc. According to {entity: No. 3, entity superscript: 24, entity subscript: 26}, the reference vocabulary of the entity "No. 3" can be obtained as "Milky Way", "River", etc.

[0068] Step 30, post-processing the first entity data and the second entity data to obtain third entity data of the text.

[0069] Furthermore, a language model and a post-processing model are also trained in the terminal device of the embodiment of the present application, wherein the training process of the language model and the post-processing model is described in detail in the subsequent model training part and will not be repeated here.

[0070] Therefore, the terminal device inputs the first entity data and the second entity data into the language model and the post-processing model, and post-processes the first entity data and the second entity data through the language model and the post-processing model to obtain the third entity data of the text, as described in steps 301 to 303.

[0071] The embodiment of the present application performs entity boundary processing on the first entity data according to the context information of the first entity data in the text, that is, the first entity data is vocabulary expanded according to the adjacent reference words of the first entity data in the text, and then the original first entity data and the second entity data after the vocabulary expansion are post-processed to obtain the third entity data. Therefore, in the whole entity processing process, there is no need to rely on the pre-established knowledge base and dictionary, and the final entity data can be obtained only according to the context information of the entity data in the text. Therefore, it can be applied to entity processing in various fields, which improves the portability and extensibility of entity processing.

[0072] Further, the description of step 201 to step 203 is as follows:

[0073] Step 201, performing entity boundary processing on the first entity data based on a first reference vocabulary corresponding to the start position of the first entity data in the text to obtain first processed entity data;

[0074] Step 202, performing entity boundary processing on the first entity data based on the second reference vocabulary corresponding to the end position of the first entity data in the text to obtain second processed entity data;

[0075] Step 203: Obtain second entity data based on the first processed entity data and the second processed entity data.

[0076] Optionally, the terminal device performs entity boundary processing on the first entity data according to a first reference vocabulary corresponding to the starting position of the first entity data in the text to obtain first processed entity data, that is, according to the first reference vocabulary corresponding to the starting position of the first entity data in the text, the terminal device expands or reduces the words of the first entity data to obtain the first processed entity data.

[0077] Furthermore, the terminal device performs entity boundary processing on the first entity data according to the second reference vocabulary corresponding to the end position of the first entity data in the text to obtain second processed entity data, that is, according to the second reference vocabulary corresponding to the end position of the first entity data in the text, the terminal device expands or reduces the words of the first entity data to obtain the second processed entity data.

[0078] Furthermore, the terminal device combines the first processed entity data and the second processed entity data to obtain second entity data.

[0079] In one embodiment, the text is [According to Xinhua News Agency, Beijing, May 4 (Reporter Zhou XY), looking through the list of designers of the "Galaxy III" supercomputer, what is as surprising as this world-renowned major scientific research achievement is the ages of the designers], and the entities "Xinhua News Agency", "Beijing", "May 4", "Zhou X", and "No. 3" are identified.

[0080] For the entity "Xinhua News Agency", the first reference word obtained according to its starting position is "according to", and the first processed entity data obtained is "according to Xinhua News Agency". The second reference words obtained according to its ending position are "North" and "Beijing", and the second processed entity data obtained are "Xinhua News Agency North" and "Xinhua News Agency Beijing". Therefore, the second entity data of the entity "Xinhua News Agency" is "according to Xinhua News Agency", "Xinhua News Agency North" and "Xinhua News Agency Beijing".

[0081] For the entity "May 4th", the first reference words obtained according to its starting position are "Beijing", "Beijing", and the first processed entity data obtained are "Beijing May 4th", "Beijing May 4th", and the second reference words obtained according to its ending position are "electricity", "electricity (", and the second processed entity data obtained are "May 4th Electric Power", "May 4th Electric Power (", therefore, the second entity data of the entity "May 4th" is "Beijing May 4th", "Beijing May 4th", "May 4th Electric Power", "May 4th Electric Power (".

[0082] The embodiment of the present application performs vocabulary expansion on the first entity data according to adjacent reference words of the first entity data in the text, and then performs post-processing on the original first entity data and the second entity data after the vocabulary expansion, so that during the entire entity processing process, there is no need to rely on a pre-established knowledge base and dictionary, and it can be applied to entity processing in various fields, thereby improving the portability and extensibility of entity processing.

[0083] Further, the description of step 301 to step 303 is as follows:

[0084] Step 301, scoring first entity data based on a language model to obtain a first feature score of the first entity data;

[0085] Step 302, scoring the second entity data based on the language model to obtain a second feature score of the second entity data;

[0086] Step 303: Obtain third entity data based on the post-processing model, the first feature score, and the second feature score.

[0087] Optionally, the terminal device inputs the first entity data into a language model, scores the first entity data through the language model, and obtains a first feature score of the first entity data.

[0088] Furthermore, the terminal device inputs the second entity data into the language model, scores the second entity data through the language model, and obtains a second feature score of the second entity data.

[0089] Further, the terminal device inputs the first feature score of the first entity data and the second feature score of the second entity data into the post-processing model, and obtains the third entity data in the first entity data and the second entity data by combining the first feature score of the first entity data and the second feature score of the second entity data through the post-processing model, as specifically described in steps 3031 to 3033.

[0090] Further, the description of step 3031 to step 3033 is as follows:

[0091] Step 3031: perform label prediction on the first entity data based on the post-processing model and the first feature score to obtain a first label of the first entity data;

[0092] Step 3032: Based on the post-processing model and the second feature score, perform label prediction on the second entity data to obtain a second label of the second entity data;

[0093] Step 3033: Obtain third entity data based on the first tag and the second tag.

[0094] Optionally, the terminal device inputs the first feature score of the first entity data into a post-processing model, and performs label prediction on the first entity data through the post-processing model to obtain a first label of the first entity data.

[0095] Furthermore, the terminal device inputs the second feature score of the second entity data into the post-processing model, and performs label prediction on the second entity data through the post-processing model to obtain a second label of the second entity data.

[0096] Furthermore, the terminal device determines the entity data that meets the preset label in the first label of the first entity data and the second label of the second entity data as the third entity data, wherein the preset label is set according to actual conditions, and the preset label can be a number such as 1, 0, etc., or a character such as F, T, etc.

[0097] In one embodiment, the preset label is T, the first entity data includes entity A1, the second entity data includes entity A2, entity A3 and entity A4 obtained after entity A is processed by entity boundary, entity A1, entity A2, entity A3 and entity A4 are input into the language model, and the language model outputs the feature score of entity A1 as a1, the feature score of entity A2 as a2, the feature score of entity A3 as a3, and the feature score of entity A4 as a4. Further, the feature scores a1, a2, a3 and a4 are input into the post-processing model, and the post-processing model outputs the label of entity A1 as T, the label of entity A2 as T, the label of entity A3 as F, and the label of entity A4 as F, and then the entities A1 and A2 that meet the preset label T are determined as the third entity data.

[0098] The embodiment of the present application only needs to use a language model and a post-processing model, combined with a general post-labeling rule, to determine the third entity data in the text, so that in the entire entity processing process, there is no need to rely on a pre-established knowledge base and dictionary, and it can be applied to entity processing in various fields, thereby improving the portability and scalability of entity processing.

[0099] Furthermore, after obtaining the third entity data, it is necessary to verify that the post-processing strategy is effective. The specific steps include step a to step b, wherein:

[0100] Step a, determining the number of corrections and the number of eliminations of the first entity data based on the first entity data, the second entity data and the third entity data;

[0101] Step b: if the number of corrections is less than the number of eliminations, the post-processing model is updated based on the first sample entity to obtain an updated post-processing model.

[0102] Optionally, the terminal device determines the number of corrections and the number of eliminations of the first entity data according to the first entity data, the second entity data and the third entity data, specifically: the terminal device compares the first entity data and the second entity data with the third entity data respectively, and determines the data relationship between the first entity data and the second entity data and the third entity data respectively, wherein the data relationship may be that the third entity data includes the first entity data, the third entity data includes the second entity data, the third entity data includes the first entity data and the second entity data, or the third entity data does not include the first entity data and the second entity data. If it is determined that the data relationship is that the third entity data includes the second entity data, the terminal device determines to correct the first entity data, and counts the number of corrections to the first entity data to obtain the number of corrections. If it is determined that the data relationship is that the third entity data does not include the first entity data and the second entity data, the terminal device determines to eliminate the first entity data, and counts the number of eliminations to obtain the number of eliminations.

[0103] In one embodiment, the text is [According to Xinhua News Agency, Beijing, May 4 (Reporter Zhou XY) When the list of designers of the "Galaxy III" supercomputer is opened, the age of the designers is as surprising as this major scientific research achievement that has attracted worldwide attention]. Therefore, the first entity data identified from the above text by the named entity recognition model are "Xinhua News Agency", "Beijing", "May 4", "Zhou X", "No. 3", and further, after entity boundary processing, the data obtained is:

[0104] ①Xinhua, Xinhua News Agency, Xinhua News Agency North, Xinhua News Agency Beijing;

[0105] ②Beijing, Beijing May, Beijing May;

[0106] ③May, May 4, May 4, May 4th, May 4th, May 4th (;

[0107] ④ Week X, Week XY, ​​Week XY);

[0108] ⑤ No. 3, No. 3”, No. 3” giant;

[0109] After passing through the language model and post-processing model, "Xinhua News Agency" in ① is identified as the correct entity and retained, while the remaining words are judged as non-entities and removed; in ②, only "Beijing" is the correct entity, and the remaining words are removed; in ③, the entity "May 4th" is retained; in ④, the original entity "Zhou X" is removed, and "Zhou XY" after entity boundary processing is added to the correct entity list; in ⑤, no entity is retained.

[0110] Therefore, in this process, one erroneous entity ④ is corrected and one erroneous entity ⑤ is eliminated. Therefore, the number of corrections of the first entity data is 1, and the number of eliminations is 1.

[0111] Furthermore, if it is determined that the number of corrections is greater than or equal to the number of eliminations, the post-processing strategy is effective, and there is no need to update the post-processing model. The entity processing can be continued through the post-processing model.

[0112] Furthermore, the terminal device compares the number of corrections and the number of eliminations. If it is determined that the number of corrections is less than the number of eliminations, the post-processing strategy is not effective, and a new entity needs to be obtained to update the post-processing model. Therefore, the terminal device obtains a new first sample entity, and updates the post-processing model according to the first sample entity to obtain an updated post-processing model, as described in steps b1 to b3.

[0113] Further, the descriptions of steps b1 to b3 are as follows:

[0114] Step b1, performing entity boundary processing on the first sample entity to obtain a second sample entity, and setting a corresponding first sample label for the first sample entity, and setting a corresponding second sample label for the second sample entity;

[0115] Step b2, scoring the first sample entity based on the language model to obtain a first sample feature score of the first sample entity, and scoring the second sample entity based on the language model to obtain a second sample feature score of the second sample entity;

[0116] Step b3, based on the first sample entity and its corresponding first sample feature score and first sample label, as well as the second sample entity and its corresponding second sample feature score and second sample label, update the post-processing model and obtain an updated post-processing model.

[0117] Optionally, the terminal device performs entity boundary processing on the first sample entity to obtain a second sample entity. The specific processing process is as described in the embodiments of steps 201 to 203, and a corresponding first sample tag is set for the first sample entity, and a corresponding second sample tag is set for the second sample entity.

[0118] Furthermore, the terminal device inputs the first sample entity (without labels) and the second sample data (without labels) into the language model, scores the first sample entity and the second sample entity through the language model, and obtains the language model outputs the first sample feature score of the first sample entity and the second sample feature score of the second sample entity.

[0119] Furthermore, the terminal device binds the first sample entity and its corresponding first sample feature score and first sample label, binds the second sample entity and its corresponding second sample feature score and second sample label, and updates and trains the post-processing model with the bound first sample entity and the bound second sample entity to obtain an updated post-processing model.

[0120] The embodiment of the present application updates the post-processing model by the number of corrections and eliminations of the first entity data, continuously optimizes the effectiveness of the post-processing model, and improves the accuracy of entity processing.

[0121] Furthermore, after obtaining the third entity data, it is necessary to perform deduplication processing on the entity data in the third entity data, and the specific steps include step c to step d, wherein:

[0122] Step c, determining the number of entity data of the same type in the third entity data;

[0123] Step d: if the number of entity data in the third entity data is , then the entity data with the largest character length in the third entity data is determined as the final entity data of the text.

[0124] Optionally, the terminal device obtains the number of times the same type of entity data in the third entity data is obtained.

[0125] It should be noted that the data relationship between entity data of the same type, i.e., entity data, is that in the entity data of the same type, other entity data is data after entity boundary processing of a certain entity data. In one embodiment, the third entity data includes entity A1, entity A2, entity B, and entity C, and entity A2 is data after entity boundary processing of entity A1. Therefore, entity A1 and entity A2 are entity data of the same type.

[0126] Further, if it is determined that the number of entity data of the same type in the third entity data is, the terminal device determines the entity data with the largest character length in the third entity data as the final entity data of the text. In one embodiment, the third entity data includes entity A1, entity A2, entity B, and entity C, entity A2 is the data after entity boundary processing of entity A1, the character length of entity A1 is 2, and the character length of entity A2 is 3. Since entity A1 and entity A2 are entity data of the same type, and the character length of entity A2 is greater than the character length of entity A1, entity A2 is determined as the final entity data in the entity data of the same type of entity A1 and entity A2, and therefore, the final entity data of the text is entity A2, entity B, and entity C.

[0127] The embodiment of the present application accurately deduplicates entity data of the same type by using the number of entity data of the same type and the character length of the entity data, thereby avoiding the problem of incorrect use in subsequent processes caused by the presence of multiple entity data of the same type.

[0128] Furthermore, before performing entity processing, it is necessary to train the post-processing model, see Figure 3 , Figure 3 : is a flow chart of the model training method provided in the embodiment of the present application, and the steps of processing the model after training include steps 40 to 60, wherein:

[0129] Step 40, performing entity boundary processing on the third sample entity in the training data set to obtain a fourth sample entity, and setting a corresponding third sample label for the third sample entity, and setting a corresponding fourth sample label for the fourth sample entity;

[0130] Step 50, scoring the third sample entity based on the language model to obtain a third sample feature score of the third sample entity, and scoring the fourth sample entity based on the language model to obtain a fourth sample feature score of the fourth sample entity;

[0131] Step 60, based on the third sample entity and its corresponding third sample feature score and third sample label, as well as the fourth sample entity and its corresponding fourth sample feature score and fourth sample label, the pre-trained classification model is trained to obtain a post-processing model.

[0132] Optionally, the terminal device obtains a training data set, where the training data set includes multiple third sample entities.

[0133] Furthermore, before training the post-processing model, the language model is first trained using unlabeled text. Each time a language model is trained, a corresponding feature can be calculated. The embodiment of the present application performs feature extraction based on a statistical language model and a neural network language model, and has the following main features:

[0134] 1. The first feature is perplexity:

[0135] Perplexity describes the ability of a language model to predict a language sample. The lower the Perplexity, the better the language model fits the sample.

[0136] Use w=x1x2Lx N Represents a string combination consisting of N words. Perplexity is defined as the inverse of the probability of the string after smoothing:

[0137]

[0138] Among them, PPL(w) is the characteristic score of perplexity, p(x1x2...x N ) is the probability of the string after smoothing, p(x i ) is the probability of string i after smoothing, which can be understood as the number of words that can be selected in the position of the phrase when the context is determined. The lower the perplexity, the more accurate the language model's prediction of the word. The higher the perplexity, on the one hand, it may be that the language model is not good, and on the other hand, if the language model is fully trained but it is difficult to predict the phrase, it is likely that the phrase is difficult to form a word.

[0139] The embodiment of the present application uses kenlm's Perplexity function to calculate the perplexity.

[0140] 2. The second feature is new word discovery (HelloNLP):

[0141] When the left and right neighbor entropy and information entropy of a string are relatively large, the possibility that the string can be regarded as an independent word is greater.

[0142] Entropy left (w) is:

[0143]

[0144] Among them, Dm 为 The left neighbor character set, x i is the i-th left neighbor character, w is a string combination, P(x i |w) represents the character x in the string combination w i The conditional probability of occurrence.

[0145] Entropy right (w) is:

[0146]

[0147] Where D n is the set of characters adjacent to the right, x i is the i-th left neighbor character, w is a string combination, P(x i |w) represents the character x in the string combination w i The conditional probability of occurrence.

[0148] Furthermore, the left and right neighbor entropy is used to describe the richness index of the left and right neighbor words of the string. For the convenience of description, EL is used to represent the left neighbor entropy and ER is used to represent the right neighbor entropy. Therefore, the richness index of the left and right neighbor words L(w) is:

[0149]

[0150] Mutual information evaluates the meaning of two strings combined together. The greater the mutual information, the stronger the mutual dependence. The average mutual information is further used as a measure of the degree of word cohesion:

[0151]

[0152] Where AMI(w) is the average mutual information, n is the length of string w, p(w) is the probability of string w, p(x1) is the probability of the first string in string w, p(x2) is the probability of the second string in string w, and p(x n ) is the probability of the nth string in string w.

[0153] Finally, after obtaining the two evaluation indicators of left and right neighbor word richness and average mutual information, the calculation formula of HelloNLP feature score is:

[0154] score=α·L(w)+β·AMI(w)

[0155] Among them, α and β are preset coefficients.

[0156] 3. The third characteristic is cohesion (PMI):

[0157] Traverse all the cuts in the phrase w and find the smallest value as the cohesion of the word: a word should be "cohesive" everywhere, and the cohesion is defined as PMI:

[0158]

[0159] Among them, p(w) is the probability of phrase w, p(x1) is the probability of the first word in phrase w, p(x2) is the probability of the second word in phrase w, and p(x i ) is the probability of the i-th word in phrase w, p(x i+1 ) is the probability of the i+1th word in the phrase w, p(x n ) is the probability of the nth word in phrase w.

[0160] For example, for the word "publishing house", for "publishing" and "society", if "publishing" and "society" have nothing to do with each other, the probability of them being put together is p('publishing')×p('society'), and if the real p('publishing house') is much greater than p('publishing')×p('society'), that is

[0161]

[0162] When it is relatively large, it is considered that "publication" and "society" are not accidentally put together, and "publishing house" is very likely to be a meaningful collocation. Therefore, traverse all the segmentation methods in the phrase and find the smallest value as the cohesion of the word, because a word should be "cohesive" everywhere.

[0163] 4. The fourth feature is Segmental Language Models (SLMs):

[0164] It explicitly focuses on the segmented nature of Chinese and retains several characteristics of the language model, such as the probability attribute. In SLMs, the context encoder encodes the previous context, while the segment decoder gradually generates segments, aiming to learn the joint probability function of the segmented character sequence. The probability that SLMs can generate a given sentence is the joint probability of all possible segmentations. Therefore, it is considered that in addition to achieving word segmentation, SLMs can better capture the patterns and structures of nested entities in Chinese texts.

[0165] Dynamic programming finds the segmentation with the maximum probability in linear time:

[0166]

[0167] where p(·) represents the joint probability of all possible segments, is the probability of a segment, and K represents the maximum length of the segmentation of the input sequence w. Traverse all possible segmentation lengths k through the following formula and select the maximum value:

[0168]

[0169] where, is the probability of the best segmentation, decoded through δ backtracking:

[0170]

[0171] Find all k values that maximize and substitute them into the joint probability formula.

[0172] 5. The fifth feature is BERT:

[0173] For the string w = x1x2L x n , after being encoded by BERT, the output sequence is X,

[0174]

[0175] represents the vector representation given by BERT for the sequence where the i-th token of the sequence X is replaced by [MASK], H i,jThe sequence after the i-th and j-th tokens of X are replaced by [MASK] is represented by the vector at the i-th position given by BERT. The sequence after the i-th and j-th tokens of X are replaced by [MASK] is represented by the vector at the j-th position given by BERT. It is different and is represented as H i,j . Calculate vector distance using Euclidean distance.

[0176] The more [MASK], the harder it is to predict. i H i,j can predict more accurately, while H i,j Compared with H i Removed the x j The information of the two is expressed as x i x j The degree of dependence, similarly |H j,i -H j | represents x j x i If two labels x i , x j If two tokens are essentially related and close and should be combined into one word, the detection distance d should be large. On the contrary, if two tokens are loosely connected, d should be small.

[0177] In the embodiment of the present application, the mask_distance function in the paper source code is used to obtain the distance d between the last two characters of the entity as a feature value to determine whether the last two adjacent characters should be merged into a word. The boundary information is mainly related to the last character of the entity.

[0178] 6. The sixth feature is direct (eIDF) and filtered (sIDF):

[0179] When calculating IDF, each sentence can be considered as a document. IDF is a traditional information retrieval metric that measures how much information a word provides in order to retrieve a small number of documents from a corpus. The fewer documents a word appears in, the greater its ability to distinguish between documents. This is also consistent with the characteristics of entities, which usually appear in documents with specific content. Generally speaking, the average IDF of high-quality entities will not be too small.

[0180]

[0181] Among them, |D| represents the total number of documents in the document set, |D w | represents the number of occurrences of word w in the document set. The denominator +1 uses Laplace smoothing to avoid the denominator being 0 due to some new words not appearing in the corpus.

[0182] The present embodiment tests two modes, direct (eIDF) and filtered (sIDF).

[0183] ① Direct (eIDF): Calculated directly according to the IDF calculation formula, the numerator is |D| the total number of documents, and the denominator represents the number of documents in which word w appears in the document set.

[0184] ② Filtering (sIDF): Load the stop word list, segment the text and filter the stop words to obtain the phrase frequency dictionary, and then calculate the IDF value according to the calculation formula.

[0185] 7. The seventh feature is PKL:

[0186] Similar to the mutual information of feature points, add feature points to the Kullback-Leibler divergence:

[0187]

[0188] The additional multiplication with the pointwise mutual information results in PKL being less biased towards rarely occurring phrases.

[0189] 8. The eighth feature is cosine similarity (simCos):

[0190] The relevance of the context is used to further describe the degree of integration within the string. For an entity, its internal fragments should be closely integrated and have a high probability of appearing together in a sentence, which means that these fragments must have similar contexts.

[0191] Assume that the string W = x1x2Lx i x i+1 Lx n , divided into two character segments x1x2L x i and x i+1 L n , whose vector is represented as and The cosine similarity is:

[0192]

[0193] Since the character fragment x1x2L x i and x i+1 Lx n It is not necessarily a reasonable word. Due to the limitation of the vocabulary, it is actually difficult to obtain a vector representation by training word vectors. Therefore, the Word2Vec model is used to train word vectors. These word vectors contain contextual semantics within a certain range. Finally, the obtained word vectors are added and averaged to obtain the vector of the character segment. Suppose any character x i The word vector obtained by Word2Vec training is Then the character fragment x1x2L x iThe vector is calculated using the following formula:

[0194]

[0195] Further, the terminal device performs entity boundary processing on the third sample entity to obtain a fourth sample entity, and sets a corresponding third sample tag for the third sample entity, and sets a corresponding fourth sample tag for the fourth sample entity.

[0196] Furthermore, the terminal device inputs the third sample entity and the fourth sample entity into the language model obtained through the above training, scores the third sample entity and the fourth sample entity through the language model, and obtains the third sample feature score of the third sample entity output by the language model, and the fourth sample feature score of the fourth sample entity.

[0197] Furthermore, the terminal device binds the third sample entity and its corresponding third sample feature score and third sample label, and binds the fourth sample entity and its corresponding fourth sample feature score and fourth sample label to construct a data set for model training.

[0198] Optional, see Figure 5 , Figure 5 This is a flow chart of entity data for constructing model training provided in an embodiment of the present application. The specific construction process is as follows:

[0199] Step 1: Entity boundary processing. The third sample entity ent is the entity in the training data set, and the others are entities after adding or subtracting characters. Using one correct third sample entity ent, at most four incorrect fourth sample entities del_1, del_2, add_1, and add_2 can be generated, that is, one correct third sample entity can generate at most five entity data for post-processing model training.

[0200] Step 2: Set the label label. The third sample entity ent is labeled with label 1, indicating a correct entity, and the fourth sample entities del_1, del_2, add_1 and add_2 after adding or subtracting characters are labeled with label 0, indicating an incorrect entity.

[0201] Step 3: Calculate feature scores. Using the language model trained above, score the third sample entity ent in step 1, as well as the fourth sample entities del_1, del_2, add_1, and add_2, to obtain the feature scores of each sample entity. Figure 6 , Figure 6 It is a schematic diagram of entity data for post-processing model training provided in an embodiment of the present application.

[0202] Step 4: Filter single words. In the entity data used for post-processing model training, if the character length of the entity is 1, it is removed from the entity data used for post-processing model training.

[0203] Step 5: Upsampling. In order to avoid the problem of classifier model learning failure caused by imbalanced sample categories, we randomly upsampled the negative examples according to the ratio of positive to negative examples, and adjusted the ratio of the third sample entity to the fourth sample entity to 1:1.

[0204] Furthermore, the terminal device performs model training on the pre-trained classification model according to the data set used for model training to obtain a post-processing model. In the embodiment of the present application, the pre-trained classification model is an XGBoost Classifier, which is a classifier based on a gradient boosting tree. Therefore, the post-processing model can be understood as a trained XGBClassifier, and the specific process is as follows:

[0205] Step 1: Data preparation

[0206] Collect and clean data to ensure data quality; divide the data set into features (X) and labels (Y).

[0207] Step 2: Data preprocessing

[0208] Standardization: Standardizing features to have zero mean and unit variance helps improve model performance.

[0209] Shuffle: Randomly shuffle the order of the data to prevent the model from learning potential order biases in the dataset.

[0210] Step 3: Divide the data set

[0211] Divide the dataset into a training set and a validation set (or test set).

[0212] Step 4: Model selection

[0213] Select XGBClassifier as the classifier.

[0214] Step 5: Model training

[0215] Use the training set data to train the XGBClassifier model. During the training process, you can adjust the parameters of XGBoost, such as learning rate, maximum depth of the tree, number of trees, etc., to optimize the model performance.

[0216] Step 6: Model Evaluation

[0217] The performance of the model is evaluated using the validation set data. Accuracy is usually used as a quantitative indicator, which indicates the proportion of samples correctly classified by the model to the total number of samples.

[0218] Step 7: Result Analysis

[0219] Analyze the accuracy of the model to determine whether the model meets the expected performance requirements.

[0220] The embodiment of the present application trains a language model and a post-processing model. Subsequently, the third entity data in the text can be determined only through the language model and the post-processing model in combination with a general labeling rule. This allows the entire entity processing process to be conducted without relying on a pre-established knowledge base and dictionary. The method can be applied to entity processing in various fields, thereby improving the portability and extensibility of entity processing.

[0221] Optional, see Figure 7 , Figure 7 It is a schematic diagram of the overall processing flow of the entity processing method provided in the embodiment of the present application, and the specific analysis process is as follows:

[0222] The text is [According to Xinhua News Agency, Beijing, May 4 (Reporter Zhou XY) When you look at the list of designers of the "Galaxy III" supercomputer, the age of the designers is as surprising as this major scientific research achievement that has attracted worldwide attention]. The named entity recognition model zh_core_web_sm is used to identify the five entities "Xinhua News Agency", "Beijing", "May 4", "Zhou X", and "No. 3" from the above text. On the basis of the entities "Xinhua News Agency", "Beijing", "May 4", "Zhou X", and "No. 3", one or two words are added (or subtracted), that is, after the entity boundary processing, the entity data obtained is:

[0223] ①Xinhua, Xinhua News Agency, Xinhua News Agency North, Xinhua News Agency Beijing;

[0224] ②Beijing, Beijing May, Beijing May;

[0225] ③May, May 4, May 4, May 4th, May 4th, May 4th (;

[0226] ④ Week X, Week XY, ​​Week XY);

[0227] ⑤ No. 3, No. 3”, No. 3” giant;

[0228] Then use the trained XGBClassifier to determine whether the entity data is the correct entity:

[0229] In ①, "Xinhua News Agency" is identified as the correct entity and retained, while the remaining words are judged as non-entities and removed; in ②, only "Beijing" is the correct entity, and the remaining words are removed; in ③, the entity "May 4th" is retained; in ④, the original entity "Zhou X" is removed, and "Zhou XY" after entity boundary processing is added to the correct entity list; in ⑤, no entity is retained.

[0230] Compared with the original recognition result, the post-processing model used in the embodiment of the present application performs processing on the basis of the original five entities, eliminates an erroneous entity "No. 3" (⑤), and corrects an erroneous entity "Zhou X" (④) to "Zhou XY".

[0231] The named entity recognition model zh_core_web_sm and the dataset are used to evaluate the classification effect of a single feature and the post-processing of the zh_core_web_sm recognition results. Figure 8 , Figure 8 It is a schematic diagram of the classification effect of a single feature provided in an embodiment of the present application.

[0232] Except for CRF, the recall of other features is much lower than NER. The features with higher recall are sIDF, Co-prob, and HelloNLP. The features with higher precision are BERT, Perplexity, and sIDF.

[0233] Next, check the effect of feature combination. Add features Perplexity, HelloNLP, sIDF, eIDF, SLM, PMI, PKL, BERT, Co-prob, simCos, CRF in turn, refer to Fig. 9 , Fig. 9 It is a schematic diagram of post-processing evaluation of the recognition results provided in an embodiment of the present application.

[0234] Precision is higher than the original NER score in any result. After the third feature, f1 is higher than the original NER model score. The improvements of recall and f1 are basically the same. After the third feature, the improvement slows down.

[0235] Table 1 Evaluation of post-processing of zh_core_web_sm on different datasets

[0236] Dataset MSRA Post-processing Precision 0.8400 0.8608 recall 0.659 0.6 f1 0.7386 0.7071 Post-processing + crf features Precision 0.8913 0.7955 recall 0.6890 0.6225 f1 0.7772 0.6985 zhcorewebsm Precision 0.6909 0.6615 recall 0.6805 0.6745 f1 0.6856 0.6680

[0237] 1. When adding CRF features is not considered in post-processing, compared with the named entity recognition model zh_core_web_sm, the post-processing indicators precision and f1 can be improved. On the data set, at the cost of a small decrease in recall (0.0215), the precision is significantly improved (0.1491) and the f1 is improved (0.053).

[0238] 2. The result set has changed from 1970 entries, of which 1361 are correct responses, to 1569 entries, of which 1318 are correct responses. This shows that the post-processing does not discard too many correct entities while ensuring precision. However, discarding these correct entities will lead to a decrease in recall.

[0239] 3. The post-processing performs better on the dataset, and the recall decreases less than that of the MSRA dataset. In fact, this part of the difference is mostly because there are no entities of length 1 in the test set, while there are 198 (accounting for 9.9% of the test set) entities of length 1 in the MSRA dataset. The model zh_core_web_sm recognizes 85 single-word entities, but all entities of length 1 are filtered out during post-processing.

[0240] 4. If the CRF feature is added in post-processing, the recall can be higher than the model zh_core_web_sm, but the recall is still reduced when the CRF feature is added to the MSRA dataset. This may be because the training label of MSRA is the "BIO" label, which cannot clearly distinguish whether "I" is inside the entity or at the end of the entity, while the label of people_daily is "BIOES", which uses "I" to identify the inside of the entity and "E" to identify the end of the entity, which is more effective in identifying boundaries.

[0241] All repair results constitute the final entity recognition result. The performance of the model on the data is evaluated by precision and recall. The results of the embodiment of this application show that the post-processing strategy can effectively improve the effect of named entity recognition.

[0242] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0243] Based on the same inventive concept, the embodiment of the present application also provides an entity processing device for implementing the above entity processing method, and a model training device for the model training method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more entity processing devices and model training devices provided below can refer to the above limitations on the entity processing method and model training method, and the specific limitations will not be repeated here.

[0244] This embodiment also provides a physical processing device, which can be integrated into a terminal device. Fig.10 As shown, the physical processing device may include:

[0245] An entity recognition module 1001 is used to perform entity recognition on a text to obtain first entity data and context information of the first entity data in the text; the context information indicates adjacent reference words of the first entity data in the text;

[0246] A first entity boundary processing module 1002, configured to perform entity boundary processing on the first entity data based on the context information to obtain second entity data;

[0247] The post-processing module 1003 is used to post-process the first entity data and the second entity data to obtain third entity data of the text.

[0248] The above-mentioned entity processing device performs entity boundary processing on the first entity data according to the context information of the first entity data in the text, that is, the first entity data is vocabulary expanded according to the adjacent reference words of the first entity data in the text, and then the original first entity data and the second entity data after vocabulary expansion are post-processed to obtain the third entity data. Therefore, in the whole entity processing process, there is no need to rely on the pre-established knowledge base and dictionary, and the final entity data can be obtained only according to the context information of the entity data in the text. Therefore, it can be applied to entity processing in various fields, which improves the portability and extensibility of entity processing.

[0249] This embodiment also provides a model training device, which can be integrated into a terminal device. Fig.11 As shown, the model training device may include:

[0250] The second entity boundary processing module 1101 is used to perform entity boundary processing on the third sample entity in the training data set to obtain a fourth sample entity, and set a corresponding third sample label for the third sample entity, and set a corresponding fourth sample label for the fourth sample entity;

[0251] A scoring module 1102 is configured to score the third sample entity based on the language model to obtain a third sample feature score of the third sample entity, and score the fourth sample entity based on the language model to obtain a fourth sample feature score of the fourth sample entity;

[0252] The model training module 1103 is used to perform model training on the pre-trained classification model based on the third sample entity and its corresponding third sample feature score and third sample label, as well as the fourth sample entity and its corresponding fourth sample feature score and fourth sample label to obtain a post-processing model.

[0253] The above-mentioned entity processing device trains a language model and a post-processing model. Subsequently, the third entity data in the text can be determined by using the language model and the post-processing model in combination with a general labeling rule. This makes it possible to apply the entity processing in various fields without relying on a pre-established knowledge base and dictionary during the entire entity processing process, thereby improving the portability and extensibility of entity processing.

[0254] Based on the same inventive concept, the embodiment of the present application also provides a computer device, which may be a server or a terminal device, and includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the above-mentioned entity processing method and model training method are implemented. Thus, various functions are implemented, such as the entity processing method:

[0255] Performing entity recognition on the text to obtain first entity data and context information of the first entity data in the text; the context information indicates adjacent reference words of the first entity data in the text;

[0256] Based on the context information, performing entity boundary processing on the first entity data to obtain second entity data;

[0257] The first entity data and the second entity data are post-processed to obtain third entity data of the text.

[0258] Beneficial effect: The entity boundary of the first entity data is processed according to the context information of the first entity data in the text, that is, the first entity data is vocabulary expanded according to the adjacent reference words of the first entity data in the text, and then the original first entity data and the second entity data after the vocabulary expansion are post-processed to obtain the third entity data. Therefore, in the whole entity processing process, there is no need to rely on the pre-established knowledge base and dictionary, and the final entity data can be obtained only according to the context information of the entity data in the text. Therefore, it can be applied to entity processing in various fields, which improves the portability and extensibility of entity processing.

[0259] Model training methods such as:

[0260] Performing entity boundary processing on the third sample entity in the training data set to obtain a fourth sample entity, and setting a corresponding third sample label for the third sample entity, and setting a corresponding fourth sample label for the fourth sample entity;

[0261] Scoring the third sample entity based on the language model to obtain a third sample feature score of the third sample entity, and scoring the fourth sample entity based on the language model to obtain a fourth sample feature score of the fourth sample entity;

[0262] Based on the third sample entity and its corresponding third sample feature score and third sample label, as well as the fourth sample entity and its corresponding fourth sample feature score and fourth sample label, the pre-trained classification model is trained to obtain a post-processing model.

[0263] Beneficial effects: After training the language model and the post-processing model, the third entity data in the text can be determined by combining the language model and the post-processing model with the general labeling rules. This makes it possible to apply the entity processing in various fields without relying on the pre-established knowledge base and dictionary during the entire entity processing process, thereby improving the portability and scalability of entity processing.

[0264] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0265] In one embodiment, the computer device is a terminal device, for example, its internal structure diagram can be as follows: Fig.12 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a physical processing method and a model training method are implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.

[0266] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0267] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0268] Since the computer program stored in the computer-readable storage medium can execute any one of the entity processing methods and model training methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the entity processing methods and model training methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0269] Based on the same inventive concept, the embodiment of the present application further provides a computer program product or a computer program, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the methods provided in various optional implementations in the above embodiments.

[0270] It should be noted that the object data (including but not limited to user device information, user personal information, etc.) and conversation data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by computer programs and computer program-related hardware, 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.

[0271] Any reference to the memory, database or other media used in the embodiments provided in the present application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (Re RAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0272] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0273] In the above-mentioned entity processing device, computer-readable storage medium, computer equipment, and computer program product embodiments, the descriptions of the embodiments have different focuses. For parts that are not described in detail in a certain embodiment, refer to the relevant descriptions of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the above-described entity processing device, computer-readable storage medium, computer program product, computer equipment and its corresponding units can refer to the description of the entity processing method and model training method in the above embodiments, and will not be repeated here.

[0274] The technical features of the above embodiments may be arbitrarily combined. 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.

[0275] The above is a detailed introduction to an entity processing method, a model training method, an apparatus, a computer device, a computer storage medium and a computer program product provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for entity processing, characterized in that: The method comprises: Performing entity recognition on the text to obtain first entity data and context information of the first entity data in the text; the context information indicates adjacent reference words of the first entity data in the text; Based on the context information, performing entity boundary processing on the first entity data to obtain second entity data; The first entity data and the second entity data are post-processed to obtain third entity data of the text.

2. The entity processing method according to claim 1, characterized in that: The post-processing of the first entity data and the second entity data to obtain the third entity data of the text includes: Scoring the first entity data based on the language model to obtain a first feature score of the first entity data; Scoring the second entity data based on the language model to obtain a second feature score of the second entity data; The third entity data is obtained based on the post-processing model, the first feature score, and the second feature score.

3. The entity processing method according to claim 2, characterized in that: The obtaining the third entity data based on the post-processing model, the first feature score and the second feature score includes: Based on the post-processing model and the first feature score, predict a label for the first entity data to obtain a first label for the first entity data; Based on the post-processing model and the second feature score, predict a label for the second entity data to obtain a second label for the second entity data; The third entity data is obtained based on the first tag and the second tag.

4. The entity processing method according to claim 3, characterized in that: After the first entity data and the second entity data are post-processed to obtain the third entity data of the text, the method further includes: Determine, based on the first entity data, the second entity data, and the third entity data, a number of corrections and a number of eliminations of the first entity data; If the number of corrections is less than the number of eliminations, the post-processing model is updated based on the first sample entity to obtain an updated post-processing model.

5. The entity processing method according to claim 4, characterized in that: The determining, based on the first entity data, the second entity data and the third entity data, the number of corrections and the number of eliminations of the first entity data comprises: Determine a data relationship between the first entity data and the second entity data and the third entity data respectively; If the data relationship is that the third entity data includes the second entity data, it is determined that the first entity data is to be modified, and the number of times the first entity data is modified is counted to obtain the number of modifications; If the data relationship is that the third entity data does not include the first entity data and the second entity data, it is determined that the first entity data is to be eliminated, and the number of times the first entity data is eliminated is counted to obtain the number of eliminations.

6. The entity processing method according to claim 4, characterized in that: The step of updating the post-processing model based on the first sample entity to obtain an updated post-processing model includes: Performing entity boundary processing on the first sample entity to obtain a second sample entity, and setting a corresponding first sample label for the first sample entity, and setting a corresponding second sample label for the second sample entity; Scoring the first sample entity based on the language model to obtain a first sample feature score for the first sample entity, and scoring the second sample entity based on the language model to obtain a second sample feature score for the second sample entity; Based on the first sample entity and its corresponding first sample feature score and first sample label, as well as the second sample entity and its corresponding second sample feature score and second sample label, the post-processing model is updated and trained to obtain the updated post-processing model.

7. The entity processing method according to claim 1, characterized in that: The performing entity boundary processing on the first entity data based on the context information to obtain second entity data includes: Based on a first reference word corresponding to the first entity data at the start position of the text, performing entity boundary processing on the first entity data to obtain first processed entity data; Based on a second reference vocabulary corresponding to the first entity data at the end position of the text, performing entity boundary processing on the first entity data to obtain second processed entity data; The second entity data is obtained based on the first processed entity data and the second processed entity data.

8. The entity processing method according to any one of claims 1 to 7, characterized in that: After the first entity data and the second entity data are post-processed to obtain the third entity data of the text, the method further includes: Determine the number of entity data of the same type in the third entity data; If the number of entity data in the third entity data is , then the entity data with the largest character length in the third entity data is determined as the final entity data of the text.

9. A model training method, characterized in that: The method comprises: Performing entity boundary processing on the third sample entity in the training data set to obtain a fourth sample entity, and setting a corresponding third sample label for the third sample entity, and setting a corresponding fourth sample label for the fourth sample entity; Scoring the third sample entity based on the language model to obtain a third sample feature score of the third sample entity, and scoring the fourth sample entity based on the language model to obtain a fourth sample feature score of the fourth sample entity; Based on the third sample entity and its corresponding third sample feature score and third sample label, as well as the fourth sample entity and its corresponding fourth sample feature score and fourth sample label, the pre-trained classification model is trained to obtain a post-processing model.

10. A physical processing device, characterized in that: The device comprises: An entity recognition module, configured to perform entity recognition on a text to obtain first entity data and context information of the first entity data in the text; the context information indicates adjacent reference words of the first entity data in the text; A first entity boundary processing module, configured to perform entity boundary processing on the first entity data based on the context information to obtain second entity data; A post-processing module is used to post-process the first entity data and the second entity data to obtain third entity data of the text.

11. A model training device, characterized in that: The device comprises: A second entity boundary processing module, used to perform entity boundary processing on the third sample entity in the training data set to obtain a fourth sample entity, and set a corresponding third sample label for the third sample entity, and set a corresponding fourth sample label for the fourth sample entity; a scoring module, configured to score the third sample entity based on the language model to obtain a third sample feature score of the third sample entity, and score the fourth sample entity based on the language model to obtain a fourth sample feature score of the fourth sample entity; The model training module is used to perform model training on the pre-trained classification model based on the third sample entity and its corresponding third sample feature score and third sample label, as well as the fourth sample entity and its corresponding fourth sample feature score and fourth sample label to obtain a post-processing model.

12. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a plurality of computer programs; the processor loads the computer program from the memory to execute the method according to any one of claims 1 to 8 or 9.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of computer programs, and the computer programs are suitable for being loaded by a processor to execute the method according to any one of claims 1 to 8 or 9.

14. A computer software, characterized in that The computer software comprises a computer program, and the computer program is executed by a processor to execute the method according to any one of claims 1 to 8 or 9.