Nested entity recognition model training method, nested entity recognition method and device

By training the nested entity recognition model, accurately identifying the start character, ending character and its body type of nested entities, the problem of nested entity recognition is solved and the accurate recognition of nested entities is achieved.

CN114281937BActive Publication Date: 2025-08-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111173085.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-08
Publication Date
2025-08-12
Estimated Expiration
2041-10-08

AI Technical Summary

Technical Problem

The prior art is difficult to accurately identify the entity type of a nested entity, especially multiple sub-entities nested inside a nested entity, resulting in difficulty in identifying.

Method used

By obtaining the label information and prediction information of nested entities, the network model is trained to generate a nested entity recognition model to identify the start character, end character and body type of nested entities.

Benefits of technology

Accurate identification of nested entities is realized, and each child entity and its body type can be accurately identified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114281937B_ABST
    Figure CN114281937B_ABST
Patent Text Reader

Abstract

The present application discloses a training method for a nested entity recognition model, a nested entity recognition method and a device, and belongs to the field of artificial intelligence technology. The method includes: obtaining label information of multiple first nested entities; for any first nested entity, determining the first prediction information of any first nested entity according to the first network model; based on the label information and the first prediction information of the multiple first nested entities, training the first network model to obtain a second network model; in response to satisfying the first condition, using the second network model as a nested entity recognition model, and the nested entity recognition model is used to identify the entity type of the nested entity. The nested entity recognition model can accurately identify the characters that can be used as the starting characters of the sub-entity and the characters that can be used as the ending characters of the sub-entity from the various characters of the nested entity, so as to combine the various sub-entities of the nested entity, thereby accurately identifying the entity type of the various sub-entities of the nested entity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a nested entity recognition model training method, a nested entity recognition method, and a nested entity recognition device. Background Art

[0002] Natural language analysis is an important technology that covers technical fields such as information retrieval, information extraction, and natural language question answering. Among them, entity recognition technology is an important part of natural language analysis. Entity recognition technology is a technology that identifies the entity type of an entity.

[0003] In the related art, an entity can be a nested entity. There is at least one entity nested inside a nested entity. Therefore, the nested entity corresponds to at least one internal entity and one external entity, that is, the nested entity corresponds to at least two sub-entities. For example, for the nested entity "chronic tonsillitis", its internal entities are "tonsil" and "tonsillitis", and the external entity is "chronic tonsillitis". Therefore, the nested entity "chronic tonsillitis" corresponds to three sub-entities "tonsil", "tonsillitis" and "chronic tonsillitis". Since a nested entity corresponds to at least two sub-entities, it is difficult to identify the entity type of the nested entity. Therefore, there is an urgent need for a nested entity recognition model to accurately identify the entity type of the nested entity. Summary of the Invention

[0004] The embodiments of the present application provide a nested entity recognition model training method, a nested entity recognition method and a device, which can be used to accurately identify the entity type of nested entities. The technical solution includes the following contents.

[0005] In one aspect, an embodiment of the present application provides a method for training a nested entity recognition model, the method comprising:

[0006] Obtaining label information of multiple first nested entities, the label information of the first nested entities including a first label for each character in the first nested entity, a second label for each character in the first nested entity, and a third label for each sub-entity of the first nested entity, wherein the first label of the character indicates whether the character is the starting character of the sub-entity, the second label of the character indicates whether the character is the ending character of the sub-entity, and the third label of the sub-entity indicates the entity type of the sub-entity;

[0007] For any first nested entity, determining first prediction information of the any first nested entity according to the first network model, the first prediction information of the any first nested entity including a first probability that each character in the any first nested entity is a start character of a sub-entity, a first probability that each character in the any first nested entity is an end character of a sub-entity, and a first entity type probability of each sub-entity of the any first nested entity;

[0008] Training the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain a second network model;

[0009] In response to satisfying the first condition, the second network model is used as a nested entity recognition model, where the nested entity recognition model is used to identify entity types of nested entities.

[0010] On the other hand, an embodiment of the present application provides a nested entity recognition method, the method comprising:

[0011] Get the target nested entity;

[0012] Determining, according to a nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity, a probability that each character in the target nested entity is an end character of a sub-entity, and an entity type probability of each sub-entity of the target nested entity, wherein the nested entity recognition model is trained according to any of the above-described nested entity recognition model training methods;

[0013] Based on the entity type probabilities of the sub-entities of the target nested entity, the entity type of each sub-entity of the target nested entity is determined.

[0014] On the other hand, an embodiment of the present application provides a training device for a nested entity recognition model, the device comprising:

[0015] an acquisition module, configured to acquire label information of a plurality of first nested entities, the label information of the first nested entities including a first label for each character in the first nested entity, a second label for each character in the first nested entity, and a third label for each sub-entity of the first nested entity, wherein the first label of the character indicates whether the character is the starting character of the sub-entity, the second label of the character indicates whether the character is the ending character of the sub-entity, and the third label of the sub-entity indicates the entity type of the sub-entity;

[0016] a determination module, configured to determine, for any first nested entity, first prediction information of the any first nested entity based on the first network model, the first prediction information of the any first nested entity including a first probability that each character in the any first nested entity is a start character of a sub-entity, a first probability that each character in the any first nested entity is an end character of a sub-entity, and a first entity type probability of each sub-entity of the any first nested entity;

[0017] A training module, configured to train the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain a second network model;

[0018] The determining module is further configured to use the second network model as a nested entity recognition model in response to satisfying the first condition, wherein the nested entity recognition model is configured to recognize an entity type of a nested entity.

[0019] In one possible implementation, the determination module is used to determine, based on a first network model, a first probability that each character in any first nested entity is a starting character of a sub-entity and a first probability that each character in any first nested entity is an ending character of a sub-entity; determine, based on the first network model, each sub-entity of any first nested entity based on the first probability that each character in any first nested entity is a starting character of a sub-entity and a first probability that each character in any first nested entity is an ending character of a sub-entity; and determine, based on the first network model, a first entity type probability of each sub-entity of any first nested entity.

[0020] In one possible implementation, the determination module is used to determine, for any sub-entity of any first nested entity, the sub-entity features of the any sub-entity based on the character features of the start characters of the any sub-entity and the character features of the end characters of the any sub-entity; and to determine the first entity type probability of the any sub-entity based on the sub-entity features of the any sub-entity.

[0021] In one possible implementation, the determination module is used to determine a character relationship feature based on the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity, wherein the character relationship feature is used to characterize the character relationship between the start character of any sub-entity and the end character of any sub-entity; and determine the sub-entity feature of any sub-entity based on the character feature of the start character of any sub-entity, the character feature of the end character of any sub-entity and the character relationship feature.

[0022] In a possible implementation, the character relationship feature includes a character difference feature, and the character difference feature is used to represent the character difference between the start character of any sub-entity and the end character of any sub-entity;

[0023] The determining module is configured to determine a difference between a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity to obtain a character difference feature.

[0024] In a possible implementation, the character relationship feature includes a character similarity feature, and the character similarity feature is used to represent the character similarity between the start character of any sub-entity and the end character of any sub-entity;

[0025] The determination module is configured to determine a dot product between a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity to obtain a character similarity feature.

[0026] In one possible implementation, the training module is used to determine the loss value of any first nested entity based on the label information and first prediction information of any first nested entity; and train the first network model based on the loss values of the multiple first nested entities to obtain a second network model.

[0027] In one possible implementation, the training module is used to determine a first loss value of any first nested entity based on a first label of each character in the any first nested entity and a first probability that each character in the any first nested entity is a starting character of a sub-entity; determine a second loss value of any first nested entity based on a second label of each character in the any first nested entity and a first probability that each character in the any first nested entity is an ending character of a sub-entity; determine a third loss value of any first nested entity based on a third label of each sub-entity of the any first nested entity and a first entity type probability of each sub-entity of the any first nested entity; and determine the loss value of any first nested entity based on the first loss value, the second loss value, and the third loss value of the any first nested entity.

[0028] In one possible implementation, the determination module is further configured to, in response to the first condition not being met, determine, for any first nested entity, second prediction information of the any first nested entity based on the second network model, the second prediction information of the any first nested entity including a second probability that each character in the any first nested entity is a starting character of a sub-entity, a second probability that each character in the any first nested entity is an ending character of a sub-entity, and a second entity type probability of each sub-entity of the any first nested entity;

[0029] The training module is further configured to train the second network model based on the label information and the second prediction information of the plurality of first nested entities to obtain a third network model;

[0030] The determining module is further configured to use the third network model as the nested entity recognition model in response to satisfying the first condition.

[0031] In one possible implementation, the acquisition module is further configured to acquire label information of a plurality of second nested entities, where the label information of the second nested entities includes a first label for each character in the second nested entity, a second label for each character in the second nested entity, and a third label for each sub-entity of the second nested entity;

[0032] The determination module is further configured to determine, for any second nested entity, first prediction information of the any second nested entity based on the first network model, the first prediction information of the any second nested entity including a first probability that each character in the any second nested entity is a start character of a sub-entity, a first probability that each character in the any second nested entity is an end character of a sub-entity, and a first entity type probability of each sub-entity of the any second nested entity;

[0033] The training module is further configured to train the first network model based on the label information and first prediction information of the multiple first nested entities and the label information and first prediction information of the multiple second nested entities to obtain a second network model.

[0034] In one possible implementation, the determination module is further configured to determine, for any first nested entity, third prediction information of the any first nested entity based on the fourth network model, the third prediction information of the any first nested entity including a third probability that each character in the any first nested entity is a starting character of a sub-entity, a third probability that each character in the any first nested entity is an ending character of the sub-entity, and a third entity type probability of each sub-entity of the any first nested entity;

[0035] The training module is further configured to train the fourth network model based on the label information of the plurality of first nested entities and the third prediction information to obtain a fifth network model;

[0036] The determining module is further configured to use the fifth network model as a teacher model in response to satisfying a second condition;

[0037] The acquisition module is used to obtain label information of multiple second nested entities based on the teacher model.

[0038] In one possible implementation, the teacher model includes a transformer-based bidirectional encoder representation network model, and the nested entity recognition model includes a long short-term memory network model.

[0039] On the other hand, an embodiment of the present application provides a nested entity recognition device, the device comprising:

[0040] Acquisition module, used to obtain the target nested entity;

[0041] a determination module, configured to determine, based on a nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity, a probability that each character in the target nested entity is an end character of a sub-entity, and an entity type probability of each sub-entity of the target nested entity, wherein the nested entity recognition model is trained according to any of the above-described nested entity recognition model training methods;

[0042] The determination module is configured to determine the entity type of each sub-entity of the target nested entity based on the entity type probability of each sub-entity of the target nested entity.

[0043] In a possible implementation, the determination module is configured to determine, based on the nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity and a probability that each character in the target nested entity is an end character of a sub-entity;

[0044] Determining, according to the nested entity recognition model, each sub-entity of the target nested entity based on a probability that each character in the target nested entity is a start character of a sub-entity and a probability that each character in the target nested entity is an end character of a sub-entity;

[0045] The entity type probability of each sub-entity of the target nested entity is determined according to the nested entity recognition model.

[0046] In a possible implementation, the target nested entity is a nested entity in the media information;

[0047] The device further comprises:

[0048] a recommendation module, configured to recommend the media information to a target object in response to the presence of a target entity type in the entity types of each sub-entity of the target nested entity;

[0049] The filtering module is configured to filter out the media information in response to the target entity type not existing in the entity types of the sub-entities corresponding to the target nested entity.

[0050] On the other hand, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one program code, and the at least one program code is loaded and executed by the processor so that the electronic device implements any of the above-mentioned nested entity recognition model training methods or any of the above-mentioned nested entity recognition methods.

[0051] On the other hand, a computer-readable storage medium is also provided, in which at least one program code is stored, and the at least one program code is loaded and executed by a processor so that the computer implements any of the above-mentioned nested entity recognition model training methods or any of the above-mentioned nested entity recognition methods.

[0052] On the other hand, a computer program or computer program product is also provided, wherein the computer program or computer program product stores at least one computer instruction, and the at least one computer instruction is loaded and executed by a processor so that the computer implements any of the above-mentioned nested entity recognition model training methods or any of the above-mentioned nested entity recognition methods.

[0053] The technical solutions provided by the embodiments of the present application bring at least the following beneficial effects:

[0054] The technical solution provided by the embodiment of the present application is to obtain a nested entity recognition model based on the probability that each character in the first nested entity is the starting character of the sub-entity and the first label of each character in the first nested entity, the probability that each character in the first nested entity is the ending character of the sub-entity and the second label of each character in the first nested entity, so that the nested entity recognition model can accurately identify the characters that can serve as the starting characters of the sub-entity and the characters that can serve as the ending characters of the sub-entity from the characters of the nested entity, so as to combine the various sub-entities of the nested entity and accurately identify the various sub-entities of the nested entity. In addition, since the nested entity recognition model is obtained based on the entity type probability and the third label of each sub-entity of the first nested entity, the nested entity recognition model can accurately identify the entity type of each sub-entity of the nested entity, that is, the nested entity recognition model can accurately identify the nested entity. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0056] Figure 1 Schematic diagram of a training method for a nested entity recognition model or an implementation environment of a nested entity recognition method provided in an embodiment of the present application;

[0057] Figure 2 This is a flowchart of a method for training a nested entity recognition model provided by an embodiment of the present application;

[0058] Figure 3 is a schematic diagram of a first nested entity provided in an embodiment of the present application;

[0059] Figure 4 is a schematic diagram of another first nested entity provided in an embodiment of the present application;

[0060] Figure 5 is a schematic diagram of labels of each character in a first nested entity provided in an embodiment of the present application;

[0061] Figure 6 Schematic diagram of a method for training a student model by distilling a teacher model, provided in an embodiment of the present application;

[0062] Figure 7 This is a schematic diagram of identifying a medical nested entity provided in an embodiment of the present application;

[0063] Figure 8 This is another schematic diagram of identifying medical nested entities provided in an embodiment of the present application;

[0064] Figure 9 This is a flowchart of a nested entity recognition method provided by an embodiment of the present application;

[0065] Figure 10 This is a schematic diagram of the entity types of each fine-grained entity in a target nested entity provided by an embodiment of the present application;

[0066] Figure 11 This is a schematic diagram of the recognition of a single-granularity entity recognition model provided in an embodiment of the present application;

[0067] Figure 12 Schematic diagram of a training device for a nested entity recognition model provided in an embodiment of the present application;

[0068] Figure 13Schematic diagram of a nested entity recognition device provided by an embodiment of the present application;

[0069] Figure 14 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0070] Figure 15 This is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0072] Figure 1 This is a schematic diagram of a training method for a nested entity recognition model or an implementation environment of a nested entity recognition method provided in an embodiment of the present application, such as Figure 1 The implementation environment shown includes an electronic device 11, and the nested entity recognition model training method or nested entity recognition method in the embodiment of the present application can be executed by the electronic device 11. Exemplarily, the electronic device 11 can include at least one of a terminal device or a server.

[0073] The terminal device can be at least one of a smart phone, a game console, a desktop computer, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player and a laptop computer.

[0074] The server can be a single server, a server cluster consisting of multiple servers, or any one of a cloud computing platform and a virtualization center, which are not limited in the embodiments of the present application. The server can communicate with the terminal device via a wired network or a wireless network. The server can have functions such as data processing, data storage, and data transmission and reception, which are not limited in the embodiments of the present application.

[0075] The training method of the nested entity recognition model and the nested entity recognition method provided in the embodiments of the present application are implemented based on artificial intelligence technology. Artificial Intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making.

[0076] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, as well as machine learning / deep learning, autonomous driving, and smart transportation.

[0077] Natural language processing (NLP) is a key area of research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to the study of linguistics. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.

[0078] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, drones, robots, smart medical care, intelligent customer service, Internet of Vehicles, autonomous driving, smart transportation, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role. The solution provided in the embodiments of this application involves the training method of the nested entity recognition model of artificial intelligence and the nested entity recognition method, etc., which will be described in detail in the following embodiments.

[0079] Based on the above implementation environment, the present application embodiment provides a training method for a nested entity recognition model. Figure 2Taking the flowchart of a training method of a nested entity recognition model provided by the embodiment of the present application as an example, the method can be performed by Figure 1 The electronic device 11 in the embodiment is executed. Figure 2 As shown, the method includes steps 201 to 204.

[0080] Step 201: Obtain label information of multiple first nested entities.

[0081] Among them, the label information of the first nested entity includes the first label of each character in the first nested entity, the second label of each character in the first nested entity, and the third label of each sub-entity of the first nested entity. The first label of the character indicates whether the character is the starting character of the sub-entity, the second label of the character indicates whether the character is the ending character of the sub-entity, and the third label of the sub-entity indicates the entity type of the sub-entity.

[0082] In the embodiment of the present application, at least one entity is nested inside the first nested entity. The entity nested inside the first nested entity is an internal entity, and the first nested entity is an external entity. Both the internal entity and the external entity are sub-entities of the first nested entity.

[0083] Please refer to Figure 3 , Figure 3 This is a schematic diagram of a first nested entity provided by an embodiment of the present application. The first nested entity is "left lower abdominal pain", where "left lower abdominal pain" has nested entities: "abdomen", "pain", and "left lower abdominal". Therefore, the internal entities of "left lower abdominal pain" include "abdomen", "pain", and "left lower abdominal", and "left lower abdominal pain" is an external entity. In other words, "left lower abdominal pain" has four sub-entities: "abdomen", "pain", "left lower abdominal", and "left lower abdominal pain".

[0084] Please refer to the following Figure 4 , Figure 4 This is a schematic diagram of another first nested entity provided by an embodiment of the present application. The first nested entity is "Chronic Tonsillitis", where "Chronic Tonsillitis" has internal nested entities: "tonsil" and "tonsillitis". Therefore, the internal entity of "Chronic Tonsillitis" includes "tonsil" and "tonsillitis", and "Chronic Tonsillitis" is an external entity. In other words, "Chronic Tonsillitis" has three subentities, namely: "tonsil", "tonsillitis" and "Chronic Tonsillitis".

[0085] It should be noted that any two sub-entities in the first nested entity can be entities of the same granularity or entities of different granularities. For example, in "lower left abdominal pain", the sub-entities "abdomen" and "pain" are entities of the same granularity, and the sub-entities "pain", "lower left abdomen", and "lower left abdominal pain" in "lower left abdominal pain" are entities of different granularities. In "chronic tonsillitis", the sub-entities "tonsil", "tonsillitis", and "chronic tonsillitis" are entities of different granularities.

[0086] For any sub-entity of the first nested entity, the sub-entity includes a start character and an end character, and the start character and the end character can be the same character or different characters. Among them, for any character in the first nested entity, the character may be used as the start character of the sub-entity, may be used as the end character of the sub-entity, or may be used as the middle character of the sub-entity. This relationship between the character and the sub-entity is called the boundary information of the character.

[0087] For example, for the first nested entity "abdominal pain", the first nested entity includes four characters, namely "abdomen", "part", "pain", and "ache". The boundary information of these four characters is shown in Table 1 below.

[0088] Table 1

[0089] character Character boundary information belly The beginning characters of the fruiting body "abdomen" and "abdominal pain" department The ending character of the fruiting body "abdomen" pain The beginning character of the fruiting body "pain" pain The ending characters of the fruiting body "pain" and "abdominal pain"

[0090] In the embodiments of the present application, the first label of each character in the first nested entity and the second label of each character in the first nested entity are obtained. Exemplarily, the first label of any character is 0 or 1, where 0 indicates that any character is not the start character of the sub-entity, and 1 indicates that any character is the start character of the sub-entity. The second label of any character is also 0 or 1. Among them, 0 indicates that any character is not the end character of the sub-entity, and 1 indicates that any character is the end character of the sub-entity.

[0091] Since the characters in the first nested entity itself contain a sequence, therefore, through these two labels, all strings corresponding to the (start character, end character) intervals are enumerated to obtain each sub-entity in the first nested entity. Among them, the start character is before the end character, that is, "start character < end character", or the start character is before the end character, and the start character and the end character can be the same character, that is, ("start character ≤ end character").

[0092] Please refer to Figure 5 , Figure 5This is a schematic diagram of the labels of each character in a first nested entity provided by an embodiment of the present application. The first nested entity is "Neck hurts very much". "Neck hurts very much" includes four characters, namely: "neck", "son", "very", and "pain". The first labels of these four characters are 1, 0, 1, 1, and the second labels of these four characters are 0, 1, 0, 1, respectively. Since these four characters themselves contain a sequence, according to the first labels of these four characters and the second labels of these four characters, by enumerating all the character strings corresponding to the (1, 1) interval, it can be concluded that: "Neck hurts very much" includes three sub-entities, namely: "neck", "very painful", and "neck hurts very much".

[0093] In an embodiment of the present application, any child entity of the first nested entity corresponds to a third label, which can also be called an entity type label. The entity type label of the child entity is used to characterize the entity type of the child entity, wherein the entity type of the child entity is at least one entity type.

[0094] For example, for the first nested entity "abdominal pain", the first nested entity includes three sub-entities, and the entity type labels of the three sub-entities are shown in Table 2 below.

[0095] Table 2

[0096] Fruiting body Entity Type Tags abdomen Part pain symptom abdominal pain symptom

[0097] It should be noted that the first nested entity includes at least two sub-entities, and the entity type labels corresponding to any two sub-entities of the first nested entity may be the same or different.

[0098] like Figure 3 In the example, the entity type label for "abdomen" is "location", the entity type label for "pain" is "symptom", the entity type label for "left lower abdomen" is "location", and the entity type label for "left lower abdomen pain" is "symptom". This shows that "abdomen" and "left lower abdomen" have the same entity type label, "pain" and "left lower abdomen pain" have the same entity type label, and the entity type labels for "abdomen" and "left lower abdomen" are different from the entity type labels for "pain" and "left lower abdomen pain".

[0099] Another example Figure 4 In the example, the entity type label for "tonsil" is "part", the entity type label for "tonsillitis" is "symptom", and the entity type label for "chronic tonsillitis" is "symptom". "Tonsillitis" and "chronic tonsillitis" have the same entity type label, while "tonsil" and "tonsillitis" have different entity type labels.

[0100] Step 202: For any first nested entity, determine first prediction information of any first nested entity according to the first network model.

[0101] Among them, the first prediction information of any first nested entity includes the first probability that each character in any first nested entity is the starting character of a sub-entity, the first probability that each character in any first nested entity is the ending character of a sub-entity, and the first entity type probability of each sub-entity of any first nested entity.

[0102] In an embodiment of the present application, for any first nested entity, the first nested entity is input into the first network model, and the first network model outputs the first prediction information of the first nested entity. The first prediction information of the first nested entity includes three parts, namely the first part, the second part and the third part. Among them, the embodiment of the present application does not limit the model structure and size of the first network model.

[0103] The first part is the first probability of each character in the first nested entity being the starting character of a sub-entity. The first probability of any character being the starting character of a sub-entity is greater than or equal to 0 and less than or equal to 1. The larger the probability value, the higher the probability that this character is the starting character of a sub-entity.

[0104] The second part is the first probability of each character in the first nested entity being the end character of the sub-entity. The first probability of any character being the end character of the sub-entity is greater than or equal to 0 and less than or equal to 1. The larger the probability value, the higher the probability that this character is the end character of the sub-entity.

[0105] The third part is the first entity type probability of each subentity of the first nested entity. The first entity type probability of any subentity is the probability that any subentity belongs to each entity type. The probability of any subentity belonging to a particular entity type is greater than or equal to 0 and less than or equal to 1. A larger probability value indicates a higher probability that the subentity belongs to that entity type.

[0106] In one possible implementation, first prediction information of any first nested entity is determined according to the first network model, including: determining, according to the first network model, a first probability that each character in any first nested entity is the starting character of a sub-entity and a first probability that each character in any first nested entity is the ending character of a sub-entity; determining, according to the first network model, each sub-entity of any first nested entity based on the first probability that each character in any first nested entity is the starting character of a sub-entity and the first probability that each character in any first nested entity is the ending character of a sub-entity; and determining, according to the first network model, a first entity type probability of each sub-entity of any first nested entity.

[0107] In this embodiment of the present application, a first nested entity is input into a first network model, which then extracts character features of each character in the first nested entity. For each character in the first nested entity, the first network model determines and outputs a first probability that the character is the beginning character of a sub-entity and a first probability that the character is the ending character of the sub-entity based on the character features of the character.

[0108] The first probability that any character in the first nested entity is the starting character of the sub-entity is shown in formula (1), and the first probability that any character in the first nested entity is the ending character of the sub-entity is shown in formula (2).

[0109] p start(a) =softmax(emb_a·T start ) Formula (1)

[0110] Among them, p start(a) is the first probability that character a in the first nested entity is the starting character of the sub-entity, softmax is the function name, emb_a is the character feature of character a in the first nested entity, T start is a model parameter of the first network model.

[0111] p end(a) =softmax(emb_a·T end ) Formula (2)

[0112] Among them, p end(a) is the first probability that character a in the first nested entity is the end character of the sub-entity, softmax is the function name, emb_a is the character feature of character a in the first nested entity, T end is another model parameter of the first network model.

[0113] The first network model then determines each subentity of the first nested entity based on a first probability that each character in the first nested entity is the beginning character of the subentity, a first probability that each character in the first nested entity is the ending character of the subentity, a first probability threshold, and a second probability threshold. The first probability threshold and the second probability threshold may be the same or different.

[0114] Optionally, for any character, if the first probability that the character is the beginning character of the sub-entity is greater than a first probability threshold, the character can be used as the beginning character of the sub-entity; if the first probability that the character is the ending character of the sub-entity is greater than a second probability threshold, the character can be used as the ending character of the sub-entity. Because the characters in the first nested entity inherently have a sequence, the sub-entities in the first nested entity are obtained by enumerating all the character strings corresponding to the (beginning character, ending character) interval.

[0115] After that, the first network model determines the sub-entity features of each sub-entity of the first nested entity. For any sub-entity of the first nested entity, the first network model determines and outputs the first entity type probability of the sub-entity based on the sub-entity features of the sub-entity. Among them, the first entity type probability of any sub-entity of the first nested entity determined by the first network model is shown in formula (3).

[0116]

[0117] Among them, is the first entity type probability of the sub-entity e of the first nested entity, softmax is the function name, and emb_e ij is the sub-entity feature of the sub-entity e in the first nested entity, and T ij is another model parameter of the first network model.

[0118] In a possible implementation, determining the first entity type probability of each sub-entity of any first nested entity includes: for any sub-entity of any first nested entity, determining the sub-entity feature of any sub-entity based on the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity; determining the first entity type probability of any sub-entity based on the sub-entity feature of any sub-entity.

[0119] In the embodiments of the present application, for any sub-entity of the first nested entity, the first network model determines the sub-entity feature of the sub-entity based on the character feature of the start character of the sub-entity and the character feature of the end character of the sub-entity.

[0120] For example, for the sub-entity "tonsil", the first network model determines the sub-entity feature of "tonsil" based on the character feature of the start character "bian" of "tonsil" and the character feature of the end character "ti" of "tonsil".

[0121] Optionally, determining the sub-entity feature of any sub-entity based on the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity includes: determining the character relationship feature based on the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity, where the character relationship feature is used to characterize the character relationship between the start character and the end character of any sub-entity; determining the sub-entity feature of any sub-entity based on the character feature of the start character of any sub-entity, the character feature of the end character of any sub-entity, and the character relationship feature.

[0122] ​​​​In the embodiments of the present application, for any sub-entity of the first nested entity, based on the character features of the start character of the sub-entity and the character features of the end character of the sub-entity, the feature of the character relationship between the start character and the end character of the sub-entity is determined, that is, the character relationship feature. Among them, the character relationship feature includes but is not limited to the character difference feature and the character similarity feature. The character difference feature (please refer to Implementation A1) and the character similarity feature (please refer to Implementation A2) are introduced separately below.

[0123] Implementation A1, the character relationship feature includes the character difference feature, and the character difference feature is used to characterize the character difference between the start character and the end character of any sub-entity; based on the character features of the start character of any sub-entity and the character features of the end character of any sub-entity, determining the character relationship feature includes: determining the difference between the character features of the start character of any sub-entity and the character features of the end character of any sub-entity, and obtaining the character difference feature.

[0124] The character difference feature is used to characterize the character difference between the start character and the end character of the sub-entity, and the feature characterizing this character difference is the character difference feature. In the embodiments of the present application, for any sub-entity of the first nested entity, the first network model calculates the difference between the character features of the start character of the sub-entity and the character features of the end character of the sub-entity, and obtains the character difference feature of the sub-entity. In this way, the first network model can determine the character difference features of each sub-entity of the first nested entity.

[0125] For example, for the sub-entity "tonsil", the first network model calculates the difference between the character features of the start character "bian" of "tonsil" and the character features of the end character "ti" of "tonsil", and obtains the character difference feature of "tonsil".

[0126] Implementation A2, the character relationship feature includes the character similarity feature, and the character similarity feature is used to characterize the character similarity between the start character and the end character of any sub-entity; based on the character features of the start character of any sub-entity and the character features of the end character of any sub-entity, determining the character relationship feature includes: determining the dot product between the character features of the start character of any sub-entity and the character features of the end character of any sub-entity, and obtaining the character similarity feature.

[0127] The character similarity feature is used to characterize the character similarity between the start character and the end character of a sub-entity, and the feature characterizing this character similarity is the character similarity feature. In the embodiments of the present application, for any sub-entity of the first nested entity, the first network model calculates the dot product between the character feature of the start character of the sub-entity and the character feature of the end character of the sub-entity, and obtains the character similarity feature of the sub-entity. In this way, the first network model can determine the character similarity features of each sub-entity of the first nested entity.

[0128] For example, for the sub-entity "tonsils", the first network model calculates the dot product between the character feature of the start character "bian" of "tonsils" and the character feature of the end character "ti" of "tonsils", and obtains the character similarity feature of "tonsils".

[0129] It should be noted that in addition to the above-mentioned character difference feature and character similarity feature, the character relationship feature can also be other features. For example, the character relationship feature is a character inclusion feature, and the character inclusion feature is used to characterize the inclusion relationship or the included relationship between the start character and the end character of any sub-entity. The embodiments of the present application do not limit the calculation method of the character inclusion feature.

[0130] After determining the character relationship feature of any sub-entity in the first nested entity, the first network model determines the sub-entity feature of the sub-entity based on the character relationship feature of the sub-entity, the character feature of the start character of the sub-entity, and the character feature of the end character of the sub-entity.

[0131] When the character relationship feature is a character difference feature, the first network model determines the sub-entity feature of the sub-entity according to the character difference feature of the sub-entity, the character feature of the start character of the sub-entity, and the character feature of the end character of the sub-entity. The sub-entity feature of the sub-entity is shown in formula (4).

[0132]

[0133] Among them, e ij is the sub-entity, the start character of the sub-entity is i, and the end character of the sub-entity is j. emb_e ij is the sub-entity feature of the sub-entity, h i is the character feature of the start character of the sub-entity, h j is the character feature of the end character of the sub-entity, h i -h j is the character difference feature of the sub-entity.

[0134] When the character relationship feature is a character similarity feature, the first network model determines the sub-entity feature of the sub-entity based on the character similarity feature of the sub-entity, the character feature of the starting character of the sub-entity, and the character feature of the ending character of the sub-entity. The sub-entity feature of the sub-entity is shown in formula (5).

[0135]

[0136] Among them, e ij For the sub-entity, the starting character of the sub-entity is i and the ending character of the sub-entity is j. ij is the fruiting body characteristic of the fruiting body, h i is the character feature of the start character of the sub-entity, h j The character feature of the end character of the fruiting entity, h i ⊙h j Character similarity features of the fruiting entity.

[0137] When the character relationship feature includes a character difference feature and a character similarity feature, the first network model determines the sub-entity feature of the sub-entity based on the character difference feature of the sub-entity, the character similarity feature of the sub-entity, the character feature of the starting character of the sub-entity, and the character feature of the ending character of the sub-entity. The sub-entity feature of the sub-entity is shown in formula (6).

[0138]

[0139] Among them, e ij For the sub-entity, the starting character of the sub-entity is i and the ending character of the sub-entity is j. ij is the fruiting body characteristic of the fruiting body, h i is the character feature of the start character of the sub-entity, h j The character feature of the end character of the fruiting entity, h i -h j is the character difference feature of the fruiting entity, h i ⊙h j Character similarity features of the fruiting entity.

[0140] It can be understood that when applied, the first network model can determine the sub-entity characteristics of the sub-entity based on the character relationship characteristics of the sub-entity, the character characteristics of the starting character of the sub-entity, the character characteristics of the ending character of the sub-entity, and the character characteristics of each middle character of the sub-entity, that is, the first network model determines the sub-entity characteristics of the sub-entity based on the character relationship characteristics of the sub-entity and the character characteristics of each character of the sub-entity.

[0141] For example, for the fruiting entity "tonsil", the first network model determines the fruiting entity features of "tonsil" based on the character features of the starting character "flat", the character features of the middle character "peach", the character features of the ending character "body" of "tonsil", and the character relationship features between "flat" and "body".

[0142] After determining the sub-entity feature of any sub-entity in the first nested entity, the first entity type probability of the sub-entity is determined based on the sub-entity feature of the sub-entity.

[0143] In summary, the first network model can determine the first probability that each character in any first nested entity is the starting character of a sub-entity, the first probability that each character in the first nested entity is the ending character of a sub-entity, and the first entity type probability of each sub-entity of the first nested entity, that is, determine the first prediction information of any first nested entity. In this way, the first network model can determine the first prediction information of each first nested entity.

[0144] Step 203: Based on the label information of the plurality of first nested entities and the first prediction information, the first network model is trained to obtain a second network model.

[0145] In an embodiment of the present application, based on the label information of multiple first nested entities and the first prediction information of multiple first nested entities, the loss value of the first network model is determined, and the model parameters of the first network model are adjusted according to the loss value of the first network model to achieve one training of the first network model and obtain the second network model.

[0146] In one possible implementation, the first network model is trained based on the label information and first prediction information of multiple first nested entities to obtain a second network model, including: for any first nested entity, based on the label information and first prediction information of any first nested entity, determining the loss value of any first nested entity; based on the loss values of multiple first nested entities, training the first network model to obtain the second network model.

[0147] The embodiment of the present application does not limit the loss function used when training the first network model. Exemplary loss functions include a cross-entropy error (CE) loss function, a focal loss (FL) loss function, etc. For any first nested entity, the embodiment of the present application determines the loss value of the first nested entity according to the loss function formula based on the label information of the first nested entity and the first prediction information of the first nested entity.

[0148] Optionally, based on the label information and first prediction information of any first nested entity, the loss value of any first nested entity is determined, including: determining the first loss value of any first nested entity based on the first label of each character in any first nested entity and the first probability that each character in any first nested entity is the starting character of a sub-entity; determining the second loss value of any first nested entity based on the second label of each character in any first nested entity and the first probability that each character in any first nested entity is the ending character of a sub-entity; determining the third loss value of any first nested entity based on the third label of each sub-entity of any first nested entity and the first entity type probability of each sub-entity of any first nested entity; determining the loss value of any first nested entity based on the first loss value, second loss value and third loss value of any first nested entity.

[0149] In an embodiment of the present application, for any first nested entity, the first loss value of the first nested entity is determined based on the first label of each character in the first nested entity and the first probability that each character in the first nested entity is the starting character of the sub-entity. The method for determining the first loss value of the first nested entity is shown in formula (7).

[0150] L start =CE(P start , Y start ) Formula (7)

[0151] Among them, L start is the first loss value of the first nested entity, CE is the loss function symbol, P start is the first probability that each character in the first nested entity is the starting character of the sub-entity, Y start is the first label for each character in the first nested entity.

[0152] In an embodiment of the present application, for any first nested entity, the second loss value of the first nested entity is determined based on the second label of each character in the first nested entity and the first probability that each character in the first nested entity is the ending character of the sub-entity. The method for determining the second loss value of the first nested entity is shown in formula (8).

[0153] L end =CE(P end , Y end ) Formula (8)

[0154] Among them, L end is the second loss value of the first nested entity, CE is the loss function symbol, P end is the first probability that each character in the first nested entity is the end character of the sub-entity, Y end The second label for each character in the first nested entity.

[0155] In an embodiment of the present application, for any first nested entity, the third loss value of the first nested entity is determined based on the third labels of each sub-entity of the first nested entity and the first entity type probability of each sub-entity of the first nested entity. The method for determining the third loss value of the first nested entity is shown in formula (9).

[0156] L type =CE(P start,end , Y start,end ) Formula (9)

[0157] Among them, L type is the third loss value of the first nested entity, CE is the loss function symbol, P start,end is the first entity type probability of each sub-entity of the first nested entity, Y start,end The third label for each child entity of the first nested entity.

[0158] After determining the first loss value, the second loss value and the third loss value of the first nested entity, the loss value of the first nested entity is determined based on the first loss value of the first nested entity and its weight, the second loss value of the first nested entity and its weight, and the third loss value of the first nested entity and its weight. The method for determining the loss value of the first nested entity is shown in formula (10).

[0159] L=α*L start +β*L end +γ*L type Formula (10)

[0160] Where L is the loss value of the first nested entity, α is the weight of the first loss value of the first nested entity, and L start is the first loss value of the first nested entity, β is the weight of the second loss value of the first nested entity, L end is the second loss value of the first nested entity, γ is the weight of the third loss value of the first nested entity, L type is the third loss value of the first nested entity.

[0161] It should be noted that the weight of the first loss value of the first nested entity, the weight of the second loss value of the first nested entity, and the weight of the third loss value of the first nested entity are all greater than or equal to 0 and less than or equal to 1. For example, in formula (10), α, β, γ ∈ [0, 1]. Optionally, the sum of the weight of the first loss value of the first nested entity, the weight of the second loss value of the first nested entity, and the weight of the third loss value of the first nested entity is 1.

[0162] According to the above method, the loss value of each first nested entity can be determined. Then, the loss value of the first network model is determined based on the loss values of the multiple first nested entities, and the model parameters of the first network model are adjusted based on the loss value of the first network model to achieve a single training of the first network model to obtain the second network model. In this embodiment of the present application, the method of determining the loss value of the first network model based on the loss values of the multiple first nested entities is not limited.

[0163] Step 204: In response to satisfying the first condition, use the second network model as a nested entity recognition model.

[0164] Among them, the nested entity recognition model is used to identify the entity type of the nested entity.

[0165] In response to satisfying the first condition, the second network model is a nested entity recognition model. Satisfying the first condition is not limited. Exemplarily, satisfying the first condition is achieving a target number of training times. The target number of training times is not limited and is flexibly set based on manual experience or scenarios. Exemplarily, the target number of training times is 500.

[0166] In one possible implementation, the method further includes: in response to the first condition not being met, for any first nested entity, determining second prediction information of any first nested entity based on the second network model, the second prediction information of any first nested entity including a second probability that each character in any first nested entity is the start character of a sub-entity, a second probability that each character in any first nested entity is the end character of a sub-entity, and a second entity type probability of each sub-entity of any first nested entity; training the second network model based on the label information and the second prediction information of multiple first nested entities to obtain a third network model; in response to the first condition being met, using the third network model as a nested entity recognition model.

[0167] In response to the first condition not being met, for any first nested entity, the first nested entity is input into the second network model, and the second network model outputs the second prediction information of the first nested entity. In this way, the second prediction information of each first nested entity is obtained, wherein the second prediction information of the first nested entity is similar to the first prediction information of the first nested entity, which will not be repeated here. Afterwards, based on the label information of multiple first nested entities and the second prediction information of multiple first nested entities, the loss value of the second network model is determined, and the model parameters of the second network model are adjusted based on the loss value of the second network model to achieve a third network model by training the second network model once. In response to the first condition being met, the third network model is a nested entity recognition model. In response to the first condition not being met, the third network model is trained in accordance with the embodiment of the present application until the first condition is met, thereby obtaining a nested entity recognition model. For relevant descriptions, see the descriptions of steps 201 to 204. The implementation principles of the two are similar and will not be repeated here.

[0168] It's understandable that training a nested entity recognition model involves multiple iterations of optimizing model parameters. Optionally, the Adam optimizer can be used for optimization. The Adam optimizer is an adaptive learning rate method that dynamically adjusts the learning rate of each parameter using the first- and second-order moments of the gradient. Each iteration maintains a well-defined learning rate range, ensuring smooth changes in model parameters.

[0169] Optionally, the first network model is trained based on the label information and first prediction information of multiple first nested entities to obtain the second network model, which also includes: obtaining the label information of multiple second nested entities, the label information of the second nested entities includes the first label of each character in the second nested entity, the second label of each character in the second nested entity, and the third label of each sub-entity of the second nested entity; for any second nested entity, the first prediction information of any second nested entity is determined according to the first network model, the first prediction information of any second nested entity includes the first probability that each character in any second nested entity is the starting character of the sub-entity, the first probability that each character in any second nested entity is the ending character of the sub-entity, and the first entity type probability of each sub-entity of any second nested entity; based on the label information and first prediction information of multiple first nested entities, the first network model is trained to obtain the second network model, including: based on the label information and first prediction information of multiple first nested entities, the label information and first prediction information of multiple second nested entities, the first network model is trained to obtain the second network model.

[0170] In an embodiment of the present application, multiple second nested entities are obtained. On the one hand, for any second nested entity, the label information of the second nested entity is obtained. The label information of the second nested entity is similar to the label information of the first nested entity. For details, please refer to the relevant description of step 201, which will not be repeated here. On the other hand, for any second nested entity, the second nested entity is input into the first network model, and the first network model outputs the first prediction information of the second nested entity. In this way, the first prediction information of each second nested entity is obtained. The first prediction information of the second nested entity is similar to the first prediction information of the first nested entity. For details, please refer to the relevant description of step 202, which will not be repeated here. Among them, the method for obtaining the label information of any second nested entity is not limited. Exemplarily, the label information of the second nested entity can be obtained by manual annotation or output by the teacher model.

[0171] Afterwards, for any first nested entity, the loss value of the first nested entity is determined based on the label information of the first nested entity and the first prediction information of the first nested entity. For any second nested entity, the loss value of the second nested entity is determined based on the label information of the second nested entity and the first prediction information of the second nested entity. The method for determining the loss value of the second nested entity is similar to the method for determining the loss value of the first nested entity and will not be repeated here.

[0172] In this way, the loss value of each first nested entity and the loss value of each second nested entity can be determined. Afterwards, based on the loss values of multiple first nested entities and the loss values of multiple second nested entities, the loss value of the first network model is determined, and the model parameters of the first network model are adjusted according to the loss value of the first network model to achieve one-time training of the first network model and obtain the second network model. The method of "training the first network model based on the label information and first prediction information of multiple first nested entities and the label information and first prediction information of multiple second nested entities to obtain the second network model" is similar to the method of "training the first network model based on the label information and first prediction information of multiple first nested entities to obtain the second network model". The implementation principles of the two are the same and will not be repeated here.

[0173] In the embodiment of the present application, a first network model is trained using a plurality of first nested entities and a plurality of second nested entities to obtain a second network model. When the second network model satisfies a first condition, the second network model is a nested entity recognition model. When the second network model does not satisfy the first condition, the second network model is trained based on the plurality of first nested entities and the plurality of second nested entities until the first condition is satisfied, thereby obtaining a nested entity recognition model.

[0174] In an embodiment of the present application, in order to improve the operation speed of the nested entity recognition model and the recognition effect of the nested entities, the model distillation technology is used to train the first network model to obtain the nested entity recognition model. The principle of the model distillation technology is to use a simple model to approximate the output of the complex model, reduce the amount of calculation during prediction, and ensure the prediction effect. Among them, the complex model is generally referred to as the teacher model (Teacher Model), and the simple model is generally referred to as the student model (Student Model). The student model is the model obtained after model distillation. In the embodiment of the present application, the student model is a nested entity recognition model, that is, the embodiment of the present application uses the model distillation technology to obtain the nested entity recognition model, so that the output of the nested entity recognition model approaches the output of the teacher model, ensures the recognition effect of the nested entity, and reduces the amount of calculation.

[0175] In one possible implementation, before obtaining the label information of multiple second nested entities, it also includes: for any first nested entity, determining the third prediction information of any first nested entity according to the fourth network model, the third prediction information of any first nested entity including the third probability that each character in any first nested entity is the starting character of a sub-entity, the third probability that each character in any first nested entity is the ending character of a sub-entity, and the third entity type probability of each sub-entity of any first nested entity; based on the label information and the third prediction information of the multiple first nested entities, training the fourth network model to obtain a fifth network model; in response to satisfying the second condition, using the fifth network model as a teacher model; obtaining the label information of multiple second nested entities, including: obtaining the label information of the multiple second nested entities based on the teacher model.

[0176] In the embodiment of the present application, the teacher model is trained using label information of multiple first nested entities. Optionally, for any first nested entity, the first nested entity is input into the fourth network model, and the fourth network model outputs third prediction information of the first nested entity. In this way, the third prediction information of each first nested entity can be obtained, wherein the third prediction information of the first nested entity is similar to the first prediction information of the first nested entity and is not further described here.

[0177] Afterwards, for any first nested entity, based on the label information of the first nested entity and the third prediction information of the first nested entity, the loss value of the first nested entity is determined according to the loss function formula. In this way, the loss value of each first nested entity is obtained. Afterwards, based on the loss value of each first nested entity, the loss value of the fourth network model is obtained. According to the loss value of the fourth network model, the model parameters of the fourth network model are adjusted to obtain the fifth network model. When the second condition is met, the fifth network model is the teacher model. When the second condition is not met, the fifth network model is trained based on the label information of multiple first nested entities until the second condition is met to obtain the teacher model.

[0178] Therein, the method for determining the loss value of the first nested entity based on the label information of the first nested entity and the third prediction information of the first nested entity is not limited. Exemplarily, based on the label information of the first nested entity and the third prediction information of the first nested entity, the loss value of the first nested entity can be determined according to formulas (7) to (10), or the loss value of the first nested entity can be determined according to other loss functions. There is no limitation on whether the second condition is met. Exemplarily, the second condition is met by reaching a certain number of training times. The value of the number of training times is not limited and can be flexibly set according to manual experience or scenarios. Exemplarily, the number of training times is 200 times.

[0179] After training the teacher model, for any second nested entity, the second nested entity is input into the teacher model, and the teacher model outputs prediction information for the second nested entity. The prediction information for the second nested entity includes the probability that each character in the second nested entity is the starting character of a sub-entity, the probability that each character in the second nested entity is the ending character of a sub-entity, and the entity type probability of each sub-entity of the second nested entity.

[0180] Then, based on the probability that each character in the second nested entity is the beginning character of the sub-entity, a first label is determined for each character in the second nested entity. Based on the probability that each character in the second nested entity is the ending character of the sub-entity, a second label is determined for each character in the second nested entity. Based on the entity type probability of each sub-entity of the second nested entity, a third label is determined for each sub-entity of the second nested entity.

[0181] Optionally, for any character in the second nested entity, when the probability that the character is the starting character of the sub-entity in the second nested entity is greater than the probability threshold of the starting character, the first label of the character in the second nested entity is determined to be 1; when the probability that the character is the starting character of the sub-entity in the second nested entity is not greater than the probability threshold of the starting character, the first label of the character in the second nested entity is determined to be 0. Based on the same principle, when the probability that the character is the ending character of the sub-entity in the second nested entity is greater than the probability threshold of the ending character, the second label of the character in the second nested entity is determined to be 1; when the probability that the character is the ending character of the sub-entity in the second nested entity is not greater than the probability threshold of the ending character, the second label of the character in the second nested entity is determined to be 0. In this way, the first label and second label of each character in the second nested entity can be obtained.

[0182] For any sub-entity of the second nested entity, the entity type probability of the sub-entity is the probability that the sub-entity belongs to each entity type. From the probabilities that the sub-entity belongs to each entity type, a probability value greater than the reference probability is determined, and the entity type corresponding to the probability value greater than the reference probability is used as the third label of the sub-entity. The probability value greater than the reference probability can be the maximum probability value, the maximum probability value and the second-largest probability value, or even a probability value greater than a fixed probability (such as 0.75). In this way, the third label of each sub-entity of the second nested entity can be determined.

[0183] Optionally, the teacher model includes a transformer-based bidirectional encoder representation network model, and the nested entity recognition model includes a long short-term memory network model.

[0184] The model complexity of the bidirectional encoder representation from transformers (Bidirectional Encoder Representation From Transformers, BERT) network model is high, resulting in a large amount of computation and slow computing speed, which is not conducive to deployment, but the BERT network model has a better effect and is suitable for teacher model. Although the long short-term memory (LSTM) network model has a poor effect, the LSTM network model is a state of the art (SOTA) model with low model complexity, small amount of computation, and fast computing speed, which is suitable for student model. Therefore, the teacher model of the embodiment of the present application includes the BERT network model, and the student model includes the LSTM network model.

[0185] Optionally, the BERT network model included in the teacher model and the LSTM network model included in the student model are both used to determine the character features of each character in the nested entity and the sub-entity features of each sub-entity of the nested entity.

[0186] In the embodiment of the present application, the student model is trained by distilling the teacher model according to the multiple first nested entities and the multiple second nested entities. Figure 6 , Figure 6 This is a schematic diagram of an embodiment of the present application, providing a method for training a student model using distillation from a teacher model. The teacher model is used for sample expansion, where each second-nested entity is input into the teacher model, which then outputs label information for each second-nested entity. The student model is then trained using distillation using the label information for each second-nested entity and the label information for each first-nested entity.

[0187] In an embodiment of the present application, on the one hand, the first network model includes an LSTM network model, and the first network model is trained according to multiple first nested entities to obtain a nested entity recognition model (denoted as a nested entity recognition model obtained by ordinary training). On the other hand, the fourth network model includes a BERT network model, and the fourth network model is trained according to multiple first nested entities to obtain a teacher model. On the other hand, according to multiple first nested entities and multiple second nested entities, the student model is trained using the teacher model distillation to obtain a nested entity recognition model (denoted as a nested entity recognition model obtained by distillation training). The embodiment of the present application uses accuracy, recall rate and F1 score (F1 Score) to evaluate the recognition effect of these three models on nested entities, as shown in Table 3 below.

[0188] Table 3

[0189] Accuracy Recall F1 score Nested entity recognition model obtained by ordinary training 65.54% 76.87% 70.75% Teacher Model 79.32% 76.45% 77.86% Nested entity recognition model trained by distillation 75.21% 75.86% 75.53%

[0190] Table 3 clearly shows that the recall rate of the nested entity recognition model obtained by distillation training is relatively similar to that of the nested entity recognition model obtained by conventional training, but the precision and F1 score of the nested entity recognition model obtained by distillation training are significantly improved. Therefore, the nested entity recognition model obtained by distillation training has better recognition effect on nested entities. Compared with the teacher model, the difference in precision, recall, and F1 score between the nested entity recognition model obtained by distillation training and the two is relatively small. Therefore, the nested entity recognition model obtained by distillation training not only has better recognition effect on nested entities, but also has faster running speed.

[0191] It is understandable that, in addition to the BERT network model, the teacher model may also include other network models in addition to the BERT network model, and the student model may also include other network models in addition to the LSTM network model. The teacher model and the student model may include the same model, that is, both the teacher model and the student model may include a BERT network model or an LSTM network model, or other network models in addition to the BERT network model and the LSTM network model.

[0192] Since the embodiment of the present application can easily obtain a large number of second nested entities, the embodiment of the present application obtains the label information of each second nested entity based on the teacher model, and trains the first network model according to the label information of each second nested entity. In application, when the number of second nested entities is small, any second nested entity can be input into the teacher model, and the teacher model outputs Logits, and the first network model is trained according to the Logits of each second nested entity. When the number of second nested entities is medium, any second nested entity can be input into the teacher model, and the teacher model outputs the predicted probability distribution, and the first network model is trained according to the predicted probability distribution of each second nested entity.

[0193] It should be noted that for any second nested entity, the output information of the fully connected layer of the teacher model is the Logits of the second nested entity. After the Logits of the second nested entity are processed by a normalization function (such as a Softmax function), the predicted probability distribution of the second nested entity is obtained, that is, the probability that the second nested entity belongs to each entity type is obtained. Based on the predicted probability distribution of the second nested entity, the label information of the second nested entity can be obtained.

[0194] The above method obtains a nested entity recognition model based on the probability that each character in the first nested entity is the starting character of the sub-entity and the first label of each character in the first nested entity, the probability that each character in the first nested entity is the ending character of the sub-entity and the second label of each character in the first nested entity, so that the nested entity recognition model can accurately identify the characters that can serve as the starting characters of the sub-entity and the characters that can serve as the ending characters of the sub-entity from the characters of the nested entity, so as to combine the sub-entities of the nested entity and accurately identify the sub-entities of the nested entity. Since the nested entity recognition model is obtained based on the entity type probabilities and third labels of the sub-entities of the first nested entity, the nested entity recognition model can accurately identify the entity types of the sub-entities of the nested entity, that is, the nested entity recognition model can accurately identify the nested entities.

[0195] The above describes in detail the training method of the nested entity recognition model in the embodiment of the present application from the perspective of method steps. The following will specifically illustrate the training method of the nested entity recognition model with reference to a scenario. In this scenario, the first nested entity is a medical nested entity, and correspondingly, the nested entity recognition model is a medical nested entity recognition model.

[0196] First, obtain label information for multiple nested medical entities. The label information for each nested medical entity includes a first label for each character in the nested medical entity, a second label for each character in the nested medical entity, and a third label for each child entity of the nested medical entity. For details, please refer to the description of step 201 and will not be repeated here.

[0197] Afterwards, the medical nested entity is input into the first network model, which outputs the medical nested entity recognition result (i.e., the first prediction information of the medical nested entity). The first network model is a two-stage model that divides the medical nested entity recognition task into two subtasks: sub-entity boundary recognition and sub-entity type recognition. Sub-entity boundary recognition is to identify the first probability of each character in the medical nested entity being the beginning character of the sub-entity and the first probability of each character in the medical nested entity being the ending character of the sub-entity. Sub-entity type recognition is to identify the first entity type probability of each sub-entity of the medical nested entity.

[0198] like Figure 7 As shown, Figure 7 This is a schematic diagram of the recognition of medical nested entities provided in an embodiment of the present application. For any medical nested entity, when the first network model recognizes the medical nested entity, it first performs sub-entity boundary recognition, identifies the first probability that each character in the medical nested entity is the starting character of the sub-entity and the first probability that each character in the medical nested entity is the ending character of the sub-entity, and then performs sub-entity type recognition to identify the first entity type probability of each sub-entity of the medical nested entity, thereby obtaining the medical nested entity recognition result.

[0199] See Figure 8 , Figure 8 This is another schematic diagram of medical nested entity recognition provided by an embodiment of the present application. The first network model includes a first encoding network, a second encoding network, a sub-entity boundary prediction network, a sub-entity feature determination network, and a sub-entity type prediction network. The first encoding network and sub-entity boundary prediction network are used to perform the sub-task of sub-entity boundary recognition, while the second encoding network, sub-entity feature determination network, and sub-entity type prediction network are used to perform the sub-task of sub-entity type recognition.

[0200] The medical nested entity is input into the first encoding network, which determines the character features of each character in the medical nested entity. Afterwards, the sub-entity boundary prediction network determines the probability that each character is the starting character of the sub-entity (i.e., the first probability) and the probability that each character is the ending character of the sub-entity (i.e., the first probability) based on the character features of each character, thereby realizing sub-entity boundary recognition.

[0201] The medical nested entity is input into the second encoding network, which determines the character features of each character in the medical nested entity. The sub-entity feature determination network then determines each sub-entity of the medical nested entity based on the probability that each character is the start character of the sub-entity and the probability that each character is the end character of the sub-entity. The sub-entity feature of each sub-entity of the medical nested entity is also determined based on the character features of each character. The sub-entity type prediction network then determines the entity type probability (i.e., the first entity type probability) of each sub-entity based on the sub-entity features of each sub-entity.

[0202] Afterwards, the first network model is trained based on the label information of multiple medical nested entities and the medical nested entity recognition results to obtain a second network model. In response to meeting the first condition, the second network model is used as a nested entity recognition model. For details, please see the relevant descriptions of steps 201 to 204, which will not be repeated here.

[0203] Based on the above implementation environment, the embodiment of the present application also provides a nested entity recognition method. Figure 9 As an example, the flowchart of a nested entity recognition method provided by the embodiment of the present application is shown. The method can be performed by Figure 1 The electronic device 11 in the embodiment is executed. Figure 9 As shown, the method includes steps 901 to 903.

[0204] Step 901: Get the target nested entity.

[0205] The embodiments of the present application do not limit the acquisition method and quantity of the target nested entities. For example, the target nested entities are media type tags, titles, words in the text, etc. of the media information, and the number of target nested entities is one or five.

[0206] Step 902: Determine the probability that each character in the target nested entity is the start character of a sub-entity, the probability that each character in the target nested entity is the end character of a sub-entity, and the entity type probability of each sub-entity of the target nested entity based on the nested entity recognition model.

[0207] The nested entity recognition model is trained according to the training method of the nested entity recognition model in each of the above optional embodiments.

[0208] In an embodiment of the present application, the target nested entity is input into a nested entity recognition model, and the nested entity recognition model outputs the probability that each character in the target nested entity is the starting character of a sub-entity, the probability that each character in the target nested entity is the ending character of a sub-entity, and the entity type probability of each sub-entity of the target nested entity.

[0209] Optionally, the probability that each character in the target nested entity is the starting character of a sub-entity, the probability that each character in the target nested entity is the ending character of a sub-entity, and the entity type probability of each sub-entity of the target nested entity are determined according to the nested entity recognition model, including: determining the probability that each character in the target nested entity is the starting character of a sub-entity and the probability that each character in the target nested entity is the ending character of a sub-entity according to the nested entity recognition model; determining each sub-entity of the target nested entity based on the probability that each character in the target nested entity is the starting character of a sub-entity and the probability that each character in the target nested entity is the ending character of a sub-entity according to the nested entity recognition model; and determining the entity type probability of each sub-entity of the target nested entity according to the nested entity recognition model.

[0210] In an embodiment of the present application, the target nested entity is input into a nested entity recognition model, and the nested entity recognition model first extracts the character features of each character in the target nested entity. For any character in the target nested entity, the nested entity recognition model determines and outputs the probability that the character is the starting character of the sub-entity and the probability that the character is the ending character of the sub-entity based on the character features of the character. Afterwards, the nested entity recognition model determines the various sub-entities of the target nested entity based on the probability that each character in the target nested entity is the starting character of the sub-entity, the probability that each character in the target nested entity is the ending character of the sub-entity, the first probability threshold and the second probability threshold. Afterwards, for any sub-entity of the target nested entity, the nested entity recognition model determines and outputs the entity type probability of the sub-entity based on the sub-entity features of the sub-entity, thereby obtaining the entity type probability of each sub-entity of the target nested entity. The relevant description is shown in the description of step 202, which will not be repeated here.

[0211] Step 903: Determine the entity type of each sub-entity of the target nested entity based on the entity type probability of each sub-entity of the target nested entity.

[0212] In an embodiment of the present application, for any child entity of the target nested entity, the entity type probability of the child entity is the probability that the child entity belongs to each entity type. A probability value greater than the reference probability is determined from the probabilities that the child entity belongs to each entity type, and the entity type corresponding to the probability value greater than the reference probability is used as the entity type of the child entity. Among them, the probability value greater than the reference probability can be the maximum probability value, or the maximum probability value and the second largest probability value, or even a probability value greater than a fixed probability (such as 0.75), etc. In this way, the entity type of each child entity can be determined.

[0213] In one possible implementation, the target nested entity is a nested entity in the media information; after determining the entity type of each sub-entity of the target nested entity based on the entity type probability of each sub-entity of the target nested entity, it also includes: in response to the existence of the target entity type in the entity types of each sub-entity of the target nested entity, recommending the media information to the target object; in response to the absence of the target entity type in the entity types of each sub-entity corresponding to the target nested entity, filtering out the media information.

[0214] In an embodiment of the present application, at least one nested entity is extracted from the media type tag, title, body, etc. of the media information to obtain a target nested entity. The target nested entity includes at least two sub-entities, and the entity types of the sub-entities of the target nested entity are obtained in the manner of steps 901 to 903. In response to the existence of the target entity type in the entity types of the sub-entities of the target nested entity, it is indicated that the media information corresponding to the target nested entity is the desired media information, and the media information is recommended to the target object. In response to the absence of the target entity type in the entity types of the sub-entities corresponding to the target nested entity, it is indicated that the media information corresponding to the target nested entity is not the desired media information, and the media information is filtered out.

[0215] In this way, media information can be recommended to the target object or filtered out to achieve the recall of media information. It can be applied in various scenarios such as media information search, intelligent question and answer, and can also be applied in various fields such as medical care and maps.

[0216] During application, the entity type of each sub-entity of the target nested entity can also be determined based on other entity recognition models. Other entity recognition models are not limited here. For example, other entity recognition models can be entity recognition models based on label hierarchy, entity hierarchy, etc.

[0217] The target nested entity is input into a label-hierarchical entity recognition model, which identifies the entity types of each fine-grained entity of the target nested entity and combines the entity types of each fine-grained entity to obtain the entity type of the target nested entity. A fine-grained entity is the finest-grained entity of the target nested entity.

[0218] like Figure 10 As shown, Figure 10 : This is a schematic diagram of the entity types of each fine-grained entity in a target nested entity provided by an embodiment of the present application. The target nested entity "pain in the lower left abdomen" is input into the entity recognition model based on label hierarchy, and the entity recognition model based on label hierarchy outputs the entity types of the three fine-grained entities "lower left", "abdomen", and "pain". Among them, the entity type of "lower left" is "B-part|B-symptom", "B-part" means that "lower left" can be used as the starting entity of a sub-entity (such as "lower left abdomen"), and the entity type of this sub-entity is "part", "B-symptom" means that "lower left" can be used as the starting entity of another sub-entity (such as "pain in the lower left abdomen"), and the entity type of this sub-entity is "symptom". The entity type of "abdomen" is "E-part|B-symptom", "E-part" means that "abdomen" can be used as the ending entity of a sub-entity (such as "lower left abdomen"), and the entity type of this sub-entity is "part", "B-symptom" means that "abdomen" can be used as the starting entity of another sub-entity (such as "abdominal pain"), and the entity type of this sub-entity is "symptom". The entity type for "pain" is "S-Symptom | E-Symptom." "S-Symptom" indicates that "pain" can be a separate sub-entity with the entity type "Symptom." "E-Symptom" indicates that "pain" can be the end entity of a sub-entity (such as "Abdominal Pain" or "Left Lower Abdominal Pain") with the entity type "Symptom." Then, by combining the entity types of "Left Lower Abdominal Pain," "Abdomen," and "Pain," we get the entity type for "Left Lower Abdominal Pain."

[0219] The target nested entity is input into an entity recognition model based on entity hierarchy. The model first determines the entity type probabilities of each fine-grained entity of the target nested entity, then combines at least two fine-grained entities to obtain a first combined entity. Based on the entity type probabilities of each of the at least two fine-grained entities, the entity type probability of the first combined entity is determined. At least two first combined entities can also be combined to obtain a second combined entity. Based on the entity type probabilities of each of the at least two first combined entities, the entity type probability of the second combined entity is determined. In this way, the entity type probabilities of the fine-grained entities, the first combined entity, the second combined entity, the target nested entity, etc. in the target nested entity are determined. That is, the entity type probabilities of the sub-entities of different granularities of the target nested entity from low granularity to high granularity are determined, and ultimately the entity type probability of the target nested entity is obtained. Subsequently, the entity type of the target nested entity is obtained based on the entity type probabilities of the target nested entity. The entity recognition model based on entity hierarchy is a single-granularity entity recognition model that can identify the entity type of the target nested entity.

[0220] like Figure 11 As shown, Figure 11 It is a schematic diagram of the recognition of a single-granularity entity recognition model provided in an embodiment of the present application. The single-granularity entity recognition model is used to identify the entity type probability of the target nested entity "pain in the lower left abdomen". First, "pain in the lower left abdomen" is divided into each fine-grained entity "lower left", "abdomen", and "pain", and the entity type probabilities of the fine-grained entities "abdomen" and "pain" are determined. Then, the fine-grained entities "lower left" and "abdomen" are combined to obtain the first combined entity "lower left abdomen". Based on the entity type probability of the fine-grained entity "abdomen", the entity type probability of the first combined entity "lower left abdomen" is determined; the fine-grained entities "abdomen" and "pain" are combined to obtain the first combined entity "abdominal pain". Based on the entity type probabilities of the fine-grained entities "abdomen" and "pain", the entity type probability of the first combined entity "abdominal pain" is determined. Next, the first composite entities "left lower abdomen" and "abdominal pain" are combined to obtain the second composite entity (i.e., the target nested entity) "left lower abdomen pain." Based on the entity type probabilities of the first composite entities "left lower abdomen" and "abdominal pain," the entity type probability of the second composite entity "left lower abdomen pain" is determined, thereby obtaining the entity type probability of the target nested entity. Next, based on the entity type probability of the target nested entity, the entity type of the target nested entity is obtained.

[0221] In the embodiment of the present application, based on the nested entity recognition model and other entity recognition models, the entity type of each sub-entity of the target nested entity is jointly determined, and based on the entity type of each sub-entity in the target nested entity, media information recommendation is performed. Since each sub-entity is an entity of different granularity, and two models are used to perform entity recognition of the target nested entity, the embodiment of the present application is based on the entity type of multi-granularity entity to realize the recall of media information, which can meet the different needs of recall granularity under different amounts of media information or different types of media information, and improve the recall amount of media information. And based on the nested entity recognition model of the embodiment of the present application and other entity recognition models, the entity type of each sub-entity of the target nested entity is jointly determined, and the increment of its operation time is also small. For example, under the condition of 100 queries per second (QPS), the operation time increases from 1.83 milliseconds to 2.6 milliseconds, and the increment is only 0.77 milliseconds, which is a small increment.

[0222] The nested entity recognition model of the embodiment of the present application is obtained based on the probability that each character in the first nested entity is the starting character of the sub-entity and the first label of each character in the first nested entity, the probability that each character in the first nested entity is the ending character of the sub-entity and the second label of each character in the first nested entity, so that the nested entity recognition model can accurately identify the characters that can serve as the starting characters of the sub-entity and the characters that can serve as the ending characters of the sub-entity from the characters of the nested entity, so as to combine the various sub-entities of the nested entity and accurately identify the various sub-entities of the nested entity. In addition, since the nested entity recognition model is obtained based on the entity type probability and the third label of each sub-entity of the first nested entity, the nested entity recognition model can accurately identify the entity type of each sub-entity of the nested entity, that is, the nested entity recognition model can accurately identify the nested entity.

[0223] Figure 12 FIG. 1 is a schematic diagram of a training device for a nested entity recognition model according to an embodiment of the present application. Figure 12 As shown, the device includes:

[0224] An acquisition module 1201 is configured to acquire label information of a plurality of first nested entities, wherein the label information of the first nested entities includes a first label for each character in the first nested entity, a second label for each character in the first nested entity, and a third label for each sub-entity of the first nested entity, wherein the first label of a character indicates whether the character is the start character of the sub-entity, the second label of the character indicates whether the character is the end character of the sub-entity, and the third label of the sub-entity indicates the entity type of the sub-entity;

[0225] Determining module 1202, configured to determine, for any first nested entity, first prediction information of any first nested entity based on the first network model, the first prediction information of any first nested entity including a first probability that each character in any first nested entity is a start character of a sub-entity, a first probability that each character in any first nested entity is an end character of the sub-entity, and a first entity type probability of each sub-entity of any first nested entity;

[0226] A training module 1203 is configured to train the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain a second network model;

[0227] The determination module 1202 is further configured to, in response to satisfying the first condition, use the second network model as a nested entity recognition model, where the nested entity recognition model is configured to recognize the entity type of the nested entity.

[0228] In one possible implementation, the determination module 1202 is used to determine, based on the first network model, a first probability that each character in any first nested entity is the starting character of a sub-entity and a first probability that each character in any first nested entity is the ending character of a sub-entity; determine, based on the first network model, each sub-entity of any first nested entity based on the first probability that each character in any first nested entity is the starting character of a sub-entity and the first probability that each character in any first nested entity is the ending character of a sub-entity; and determine, based on the first network model, a first entity type probability of each sub-entity of any first nested entity.

[0229] In one possible implementation, determination module 1202 is used to determine, for any sub-entity of any first nested entity, the sub-entity features of any sub-entity based on the character features of the start characters of any sub-entity and the character features of the end characters of any sub-entity; and to determine the first entity type probability of any sub-entity based on the sub-entity features of any sub-entity.

[0230] In one possible implementation, determination module 1202 is used to determine character relationship features based on the character features of the start character of any sub-entity and the character features of the end character of any sub-entity, where the character relationship features are used to characterize the character relationship between the start character of any sub-entity and the end character of any sub-entity; and to determine the sub-entity features of any sub-entity based on the character features of the start character of any sub-entity, the character features of the end character of any sub-entity and the character relationship features.

[0231] In a possible implementation, the character relationship feature includes a character difference feature, which is used to represent the character difference between the start character of any sub-entity and the end character of any sub-entity;

[0232] The determination module 1202 is configured to determine the difference between the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity to obtain a character difference feature.

[0233] In a possible implementation, the character relationship feature includes a character similarity feature, which is used to represent the character similarity between the start character of any sub-entity and the end character of any sub-entity;

[0234] The determination module 1202 is configured to determine a dot product between a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity to obtain a character similarity feature.

[0235] In one possible implementation, the training module 1203 is used to determine the loss value of any first nested entity based on the label information and first prediction information of any first nested entity; and train the first network model based on the loss values of multiple first nested entities to obtain a second network model.

[0236] In one possible implementation, the training module 1203 is used to determine a first loss value of any first nested entity based on a first label of each character in any first nested entity and a first probability that each character in any first nested entity is the starting character of a sub-entity; determine a second loss value of any first nested entity based on a second label of each character in any first nested entity and a first probability that each character in any first nested entity is the ending character of a sub-entity; determine a third loss value of any first nested entity based on a third label of each sub-entity of any first nested entity and a first entity type probability of each sub-entity of any first nested entity; and determine a loss value of any first nested entity based on the first loss value, the second loss value, and the third loss value of any first nested entity.

[0237] In one possible implementation, the determination module 1202 is further configured to, in response to the first condition not being satisfied, determine, for any first nested entity, second prediction information of the first nested entity based on the second network model, the second prediction information of the first nested entity including a second probability that each character in the first nested entity is a start character of a sub-entity, a second probability that each character in the first nested entity is an end character of the sub-entity, and a second entity type probability of each sub-entity of the first nested entity.

[0238] The training module 1203 is further configured to train the second network model based on the label information of the plurality of first nested entities and the second prediction information to obtain a third network model;

[0239] The determination module 1202 is further configured to use the third network model as a nested entity recognition model in response to satisfying the first condition.

[0240] In one possible implementation, the acquisition module 1201 is further configured to acquire label information of a plurality of second nested entities, where the label information of the second nested entities includes a first label of each character in the second nested entity, a second label of each character in the second nested entity, and a third label of each sub-entity of the second nested entity.

[0241] The determination module 1202 is further configured to determine, for any second nested entity, first prediction information of any second nested entity based on the first network model, the first prediction information of any second nested entity including a first probability that each character in any second nested entity is a start character of a sub-entity, a first probability that each character in any second nested entity is an end character of the sub-entity, and a first entity type probability of each sub-entity of any second nested entity;

[0242] The training module 1203 is further configured to train the first network model based on the label information and first prediction information of the plurality of first nested entities and the label information and first prediction information of the plurality of second nested entities to obtain a second network model.

[0243] In one possible implementation, the determination module 1202 is further configured to determine, for any first nested entity, third prediction information of any first nested entity based on the fourth network model, where the third prediction information of any first nested entity includes a third probability that each character in any first nested entity is a start character of a sub-entity, a third probability that each character in any first nested entity is an end character of the sub-entity, and a third entity type probability of each sub-entity of any first nested entity.

[0244] The training module 1203 is further configured to train the fourth network model based on the label information of the plurality of first nested entities and the third prediction information to obtain a fifth network model;

[0245] The determining module 1202 is further configured to use the fifth network model as a teacher model in response to satisfying the second condition;

[0246] The acquisition module 1201 is used to acquire label information of multiple second nested entities based on the teacher model.

[0247] In one possible implementation, the teacher model includes a transformer-based bidirectional encoder representation network model, and the nested entity recognition model includes a long short-term memory network model.

[0248] The above-mentioned device obtains a nested entity recognition model based on the probability that each character in the first nested entity is the starting character of the sub-entity and the first label of each character in the first nested entity, the probability that each character in the first nested entity is the ending character of the sub-entity and the second label of each character in the first nested entity, so that the nested entity recognition model can accurately identify the characters that can serve as the starting characters of the sub-entity and the characters that can serve as the ending characters of the sub-entity from the characters of the nested entity, so as to combine the sub-entities of the nested entity and accurately identify the sub-entities of the nested entity. Since the nested entity recognition model is obtained based on the entity type probabilities of each sub-entity of the first nested entity and the third label, the nested entity recognition model can accurately identify the entity types of each sub-entity of the nested entity, that is, the nested entity recognition model can accurately identify the nested entity.

[0249] It should be understood that the above Figure 12 The provided device is illustrated only by the division of the above-mentioned functional modules when implementing its functions. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0250] Figure 13 FIG. 1 is a schematic diagram of a structure of a nested entity recognition device provided by an embodiment of the present application. Figure 13 As shown, the device includes:

[0251] Acquisition module 1301, used to acquire target nested entity;

[0252] a determination module 1302 for determining, based on a nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity, a probability that each character in the target nested entity is an end character of a sub-entity, and an entity type probability of each sub-entity of the target nested entity, wherein the nested entity recognition model is trained according to any of the aforementioned nested entity recognition model training methods;

[0253] The determination module 1302 is configured to determine the entity type of each sub-entity of the target nested entity based on the entity type probability of each sub-entity of the target nested entity.

[0254] In one possible implementation, the determination module 1302 is configured to determine, based on a nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity and a probability that each character in the target nested entity is an end character of the sub-entity;

[0255] Determine, according to the nested entity recognition model, each sub-entity of the target nested entity based on a probability that each character in the target nested entity is a start character of the sub-entity and a probability that each character in the target nested entity is an end character of the sub-entity;

[0256] According to the nested entity recognition model, the entity type probability of each sub-entity of the target nested entity is determined.

[0257] In one possible implementation, the target nested entity is a nested entity in the media information;

[0258] The device also includes:

[0259] a recommendation module, configured to recommend media information to a target object in response to the presence of a target entity type in the entity types of each sub-entity of the target nested entity;

[0260] The filtering module is configured to filter out the media information in response to the target entity type not existing in the entity types of the sub-entities corresponding to the target nested entity.

[0261] The nested entity recognition model in the above-mentioned device is obtained based on the probability that each character in the first nested entity is the starting character of the sub-entity and the first label of each character in the first nested entity, the probability that each character in the first nested entity is the ending character of the sub-entity and the second label of each character in the first nested entity, so that the nested entity recognition model can accurately identify the characters that can serve as the starting characters of the sub-entity and the characters that can serve as the ending characters of the sub-entity from the characters of the nested entity, so as to combine the sub-entities of the nested entity and accurately identify the sub-entities of the nested entity. In addition, because the nested entity recognition model is obtained based on the entity type probability of each sub-entity of the first nested entity and the third label, the nested entity recognition model can accurately identify the entity type of each sub-entity of the nested entity, that is, the nested entity recognition model can accurately recognize the nested entity.

[0262] It should be understood that the above Figure 13 The provided device is illustrated only by the division of the above-mentioned functional modules when implementing its functions. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0263] Figure 14The following is a block diagram of a terminal device 1400 according to an exemplary embodiment of the present application. Terminal device 1400 may be a portable mobile terminal, such as a smartphone, tablet computer, MP3 (Moving Picture Experts Group Audio Layer III) player, MP4 (Moving Picture Experts Group Audio Layer IV) player, laptop computer, or desktop computer. Terminal device 1400 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other similar names.

[0264] Typically, the terminal device 1400 includes a processor 1401 and a memory 1402 .

[0265] The processor 1401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0266] Memory 1402 may include one or more computer-readable storage media, which may be non-transitory. Memory 1402 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in memory 1402 is used to store at least one instruction, which is used to be executed by processor 1401 to implement the nested entity recognition model training method or nested entity recognition method provided in the method embodiment of the present application.

[0267] In some embodiments, terminal device 1400 may optionally include a peripheral device interface 1403 and at least one peripheral device. Processor 1401, memory 1402, and peripheral device interface 1403 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 1403 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 1404, a display screen 1405, a camera assembly 1406, an audio circuit 1407, and a power supply 1409.

[0268] The peripheral device interface 1403 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 1401 and the memory 1402. In some embodiments, the processor 1401, the memory 1402, and the peripheral device interface 1403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1401, the memory 1402, and the peripheral device interface 1403 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0269] RF circuit 1404 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. RF circuit 1404 communicates with communication networks and other communication devices via electromagnetic signals. RF circuit 1404 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. RF circuit 1404 may optionally include an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. RF circuit 1404 may communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, RF circuit 1404 may also include circuitry related to Near Field Communication (NFC), although this application does not limit this.

[0270] The display screen 1405 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1405 is a touch screen display, the display screen 1405 also has the ability to collect touch signals on the surface or above the surface of the display screen 1405. The touch signal can be input as a control signal to the processor 1401 for processing. At this time, the display screen 1405 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, there can be one display screen 1405, which is set on the front panel of the terminal device 1400; in other embodiments, there can be at least two display screens 1405, which are respectively set on different surfaces of the terminal device 1400 or in a folding design; in other embodiments, the display screen 1405 can be a flexible display screen, which is set on the curved surface or folding surface of the terminal device 1400. Even more, the display screen 1405 can be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1405 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0271] The camera assembly 1406 is used to capture images or videos. Optionally, the camera assembly 1406 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1406 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0272] The audio circuit 1407 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input into the processor 1401 for processing, or input into the radio frequency circuit 1404 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there can be multiple microphones, each located in different parts of the terminal device 1400. The microphone can also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signal from the processor 1401 or the radio frequency circuit 1404 into sound waves. The speaker can be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1407 may also include a headphone jack.

[0273] Power supply 1409 is used to power the various components in terminal device 1400. Power supply 1409 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 1409 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0274] In some embodiments, the terminal device 1400 further includes one or more sensors 1410 , including but not limited to: an acceleration sensor 1411 , a gyroscope sensor 1412 , a pressure sensor 1413 , an optical sensor 1415 , and a proximity sensor 1416 .

[0275] The accelerometer 1411 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal device 1400. For example, the accelerometer 1411 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 1401 can control the display screen 1405 to display the user interface in either a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 1411. The accelerometer 1411 can also be used to collect game or user motion data.

[0276] The gyroscope sensor 1412 can detect the body orientation and rotation angle of the terminal device 1400. The gyroscope sensor 1412 can work with the acceleration sensor 1411 to collect the user's 3D movements of the terminal device 1400. Based on the data collected by the gyroscope sensor 1412, the processor 1401 can implement the following functions: motion sensing (such as changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0277] The pressure sensor 1413 can be set on the side frame of the terminal device 1400 and / or the lower layer of the display screen 1405. When the pressure sensor 1413 is set on the side frame of the terminal device 1400, it can detect the user's grip signal of the terminal device 1400, and the processor 1401 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 1413. When the pressure sensor 1413 is set on the lower layer of the display screen 1405, the processor 1401 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 1405. The operable controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0278] Optical sensor 1415 is used to detect ambient light intensity. In one embodiment, processor 1401 can control the display brightness of display screen 1405 based on the ambient light intensity detected by optical sensor 1415. Specifically, when the ambient light intensity is high, the display brightness of display screen 1405 is increased; when the ambient light intensity is low, the display brightness of display screen 1405 is decreased. In another embodiment, processor 1401 can also dynamically adjust the shooting parameters of camera assembly 1406 based on the ambient light intensity detected by optical sensor 1415.

[0279] Proximity sensor 1416, also known as a distance sensor, is typically located on the front panel of terminal device 1400. Proximity sensor 1416 is used to detect the distance between the user and the front of terminal device 1400. In one embodiment, when proximity sensor 1416 detects that the distance between the user and the front of terminal device 1400 is gradually decreasing, processor 1401 controls display screen 1405 to switch from the screen-on state to the screen-off state. When proximity sensor 1416 detects that the distance between the user and the front of terminal device 1400 is gradually increasing, processor 1401 controls display screen 1405 to switch from the screen-off state to the screen-on state.

[0280] Those skilled in the art will understand that Figure 14 The structure shown in the figure does not constitute a limitation on the terminal device 1400, and the terminal device 1400 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.

[0281] Figure 15 This is a schematic diagram of the structure of the server provided in an embodiment of the present application. The server 1500 may have relatively large differences due to different configurations or performances, and may include one or more processors 1501 and one or more memories 1502, wherein the one or more memories 1502 store at least one program code, and the at least one program code is loaded and executed by the one or more processors 1501 to implement the nested entity recognition model training method or nested entity recognition method provided in the above-mentioned various method embodiments. Exemplarily, the processor 1501 is a CPU. Of course, the server 1500 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1500 may also include other components for implementing device functions, which will not be described in detail here.

[0282] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores at least one program code, and the at least one program code is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned nested entity recognition model training methods or nested entity recognition methods.

[0283] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, or the like.

[0284] In an exemplary embodiment, a computer program or a computer program product is also provided, in which at least one computer instruction is stored, and the at least one computer instruction is loaded and executed by a processor to enable a computer to implement any of the above-mentioned nested entity recognition model training methods or nested entity recognition methods.

[0285] It should be understood that the term "plurality" used herein refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates an "or" relationship between the associated objects.

[0286] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0287] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A training method for a nested entity recognition model, characterized in that: The method comprises: Obtaining label information of multiple first nested entities, the label information of the first nested entities including a first label for each character in the first nested entity, a second label for each character in the first nested entity, and a third label for each sub-entity of the first nested entity, wherein the first label of the character indicates whether the character is the starting character of the sub-entity, the second label of the character indicates whether the character is the ending character of the sub-entity, and the third label of the sub-entity indicates the entity type of the sub-entity; For any first nested entity, determining first prediction information of the any first nested entity according to the first network model, the first prediction information of the any first nested entity including a first probability that each character in the any first nested entity is a starting character of a sub-entity, a first probability that each character in the any first nested entity is an ending character of a sub-entity, and a first entity type probability of each sub-entity of the any first nested entity, the first probability that the character is the starting character of a sub-entity being obtained by mapping based on a model parameter of the first network model, and the first probability that the character is the ending character of a sub-entity being obtained by mapping based on another model parameter of the first network model; Training the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain a second network model; In response to satisfying the first condition, the second network model is used as a nested entity recognition model, where the nested entity recognition model is used to identify entity types of nested entities.

2. The method according to claim 1, characterized in that The determining, according to the first network model, first prediction information of any first nested entity includes: Determining, based on the first network model, a first probability that each character in any one of the first nested entities is a start character of a sub-entity and a first probability that each character in any one of the first nested entities is an end character of a sub-entity; determining, according to the first network model, each subentity of any first nested entity based on a first probability that each character in any first nested entity is a start character of a subentity and a first probability that each character in any first nested entity is an end character of a subentity; Determine a first entity type probability of each sub-entity of any first nested entity according to the first network model.

3. The method according to claim 2, characterized in that The determining of the first entity type probability of each sub-entity of any first nested entity includes: For any sub-entity of any first nested entity, determining a sub-entity feature of the sub-entity based on a character feature of a start character of the sub-entity and a character feature of an end character of the sub-entity; A first entity type probability of the any sub-entity is determined based on the sub-entity feature of the any sub-entity.

4. The method according to claim 3, characterized in that The determining the sub-entity feature of any sub-entity based on the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity includes: Determining a character relationship feature based on a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity, wherein the character relationship feature is used to characterize a character relationship between the start character of any sub-entity and the end character of any sub-entity; The sub-entity feature of the any sub-entity is determined based on the character feature of the start character of the any sub-entity, the character feature of the end character of the any sub-entity, and the character relationship feature.

5. The method according to claim 4, characterized in that The character relationship feature includes a character difference feature, and the character difference feature is used to represent the character difference between the start character of any sub-entity and the end character of any sub-entity; The determining of the character relationship feature based on the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity includes: A difference between a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity is determined to obtain a character difference feature.

6. The method according to claim 4, characterized in that The character relationship feature includes a character similarity feature, and the character similarity feature is used to represent the character similarity between the start character of any sub-entity and the end character of any sub-entity; The determining of the character relationship feature based on the character feature of the start character of any sub-entity and the character feature of the end character of any sub-entity includes: Determine a dot product between a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity to obtain a character similarity feature.

7. The method according to claim 1, characterized in that The training of the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain a second network model includes: For any first nested entity, determining a loss value of the any first nested entity based on the label information and the first prediction information of the any first nested entity; Based on the loss values of the multiple first nested entities, the first network model is trained to obtain a second network model.

8. The method according to claim 7, characterized in that The determining, based on the label information and the first prediction information of the any first nested entity, a loss value of the any first nested entity includes: determining a first loss value of any first nested entity based on a first label of each character in any first nested entity and a first probability that each character in any first nested entity is a start character of a sub-entity; determining a second loss value of any first nested entity based on a second label of each character in any first nested entity and a first probability that each character in any first nested entity is an end character of a sub-entity; Determining a third loss value of any first nested entity based on the third label of each sub-entity of any first nested entity and the first entity type probability of each sub-entity of any first nested entity; The loss value of any first nested entity is determined based on the first loss value, the second loss value, and the third loss value of any first nested entity.

9. The method according to claim 1, characterized in that The method further comprises: In response to the first condition not being satisfied, determining, for any first nested entity, second prediction information for the any first nested entity based on the second network model, the second prediction information for the any first nested entity including a second probability that each character in the any first nested entity is a start character of a sub-entity, a second probability that each character in the any first nested entity is an end character of a sub-entity, and a second entity type probability of each sub-entity of the any first nested entity; Training the second network model based on the label information and the second prediction information of the plurality of first nested entities to obtain a third network model; In response to satisfying the first condition, the third network model is used as the nested entity recognition model.

10. The method according to any one of claims 1 to 9, characterized in that: Before training the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain the second network model, the method further includes: Acquire label information of multiple second nested entities, where the label information of the second nested entities includes a first label for each character in the second nested entity, a second label for each character in the second nested entity, and a third label for each sub-entity of the second nested entity; For any second nested entity, determining first prediction information of the any second nested entity according to the first network model, the first prediction information of the any second nested entity including a first probability that each character in the any second nested entity is a start character of a sub-entity, a first probability that each character in the any second nested entity is an end character of the sub-entity, and a first entity type probability of each sub-entity of the any second nested entity; The training of the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain a second network model includes: Based on the label information and first prediction information of the multiple first nested entities and the label information and first prediction information of the multiple second nested entities, the first network model is trained to obtain a second network model.

11. The method according to claim 10, characterized in that Before obtaining the label information of the plurality of second nested entities, the method further includes: For any first nested entity, determining third prediction information for the any first nested entity according to the fourth network model, the third prediction information for the any first nested entity including a third probability that each character in the any first nested entity is a start character of a sub-entity, a third probability that each character in the any first nested entity is an end character of the sub-entity, and a third entity type probability of each sub-entity of the any first nested entity; Training the fourth network model based on the label information of the plurality of first nested entities and the third prediction information to obtain a fifth network model; In response to satisfying the second condition, using the fifth network model as a teacher model; The obtaining of label information of the plurality of second nested entities includes: Obtain label information of multiple second nested entities based on the teacher model.

12. The method according to claim 11, characterized in that The teacher model includes a transformer-based bidirectional encoder representation network model, and the nested entity recognition model includes a long short-term memory network model.

13. A nested entity recognition method, characterized in that: The method comprises: Get the target nested entity; determining, according to a nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity, a probability that each character in the target nested entity is an end character of a sub-entity, and an entity type probability of each sub-entity of the target nested entity, wherein the nested entity recognition model is trained according to the nested entity recognition model training method according to any one of claims 1 to 12; Based on the entity type probabilities of the sub-entities of the target nested entity, the entity type of each sub-entity of the target nested entity is determined.

14. The method according to claim 13, characterized in that: The determining, based on the nested entity recognition model, the probability that each character in the target nested entity is the start character of a sub-entity, the probability that each character in the target nested entity is the end character of a sub-entity, and the entity type probability of each sub-entity of the target nested entity includes: Determining, based on the nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity and a probability that each character in the target nested entity is an end character of a sub-entity; Determining, according to the nested entity recognition model, each sub-entity of the target nested entity based on a probability that each character in the target nested entity is a start character of a sub-entity and a probability that each character in the target nested entity is an end character of a sub-entity; The entity type probability of each sub-entity of the target nested entity is determined according to the nested entity recognition model.

15. The method according to claim 13, characterized in that The target nested entity is a nested entity in the media information; After determining the entity type of each sub-entity of the target nested entity based on the entity type probability of each sub-entity of the target nested entity, the method further includes: In response to the target entity type existing in the entity types of each child entity of the target nested entity, recommending the media information to the target object; In response to the target entity type not existing in the entity types of each child entity corresponding to the target nested entity, the media information is filtered out.

16. A training device for a nested entity recognition model, characterized in that: The device comprises: an acquisition module, configured to acquire label information of a plurality of first nested entities, the label information of the first nested entities including a first label for each character in the first nested entity, a second label for each character in the first nested entity, and a third label for each sub-entity of the first nested entity, wherein the first label of the character indicates whether the character is the starting character of the sub-entity, the second label of the character indicates whether the character is the ending character of the sub-entity, and the third label of the sub-entity indicates the entity type of the sub-entity; a determination module configured to determine, for any first nested entity, first prediction information of the any first nested entity based on a first network model, the first prediction information of the any first nested entity including a first probability that each character in the any first nested entity is a starting character of a sub-entity, a first probability that each character in the any first nested entity is an ending character of a sub-entity, and a first entity type probability of each sub-entity of the any first nested entity, the first probability that the character is the starting character of a sub-entity being obtained by mapping based on a model parameter of the first network model, and the first probability that the character is the ending character of a sub-entity being obtained by mapping based on another model parameter of the first network model; A training module, configured to train the first network model based on the label information of the plurality of first nested entities and the first prediction information to obtain a second network model; The determining module is further configured to use the second network model as a nested entity recognition model in response to satisfying the first condition, wherein the nested entity recognition model is configured to recognize an entity type of a nested entity.

17. The device according to claim 16, characterized in that The determination module is used to determine, according to the first network model, a first probability that each character in any first nested entity is the starting character of a sub-entity and a first probability that each character in any first nested entity is the ending character of a sub-entity; determine, according to the first network model, each sub-entity of any first nested entity based on the first probability that each character in any first nested entity is the starting character of a sub-entity and the first probability that each character in any first nested entity is the ending character of a sub-entity; and determine, according to the first network model, a first entity type probability of each sub-entity of any first nested entity.

18. The device according to claim 17, characterized in that The determining module is configured to determine, for any sub-entity of any first nested entity, a sub-entity feature of the sub-entity based on a character feature of a start character of the sub-entity and a character feature of an end character of the sub-entity; A first entity type probability of the any sub-entity is determined based on the sub-entity feature of the any sub-entity.

19. The device according to claim 18, characterized in that The determination module is used to determine the character relationship feature based on the character feature of the starting character of any sub-entity and the character feature of the ending character of any sub-entity, and the character relationship feature is used to characterize the character relationship between the starting character of any sub-entity and the ending character of any sub-entity; based on the character feature of the starting character of any sub-entity, the character feature of the ending character of any sub-entity and the character relationship feature, determine the sub-entity feature of any sub-entity.

20. The device according to claim 19, characterized in that The character relationship feature includes a character difference feature, and the character difference feature is used to represent the character difference between the start character of any sub-entity and the end character of any sub-entity; The determining module is configured to determine a difference between a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity to obtain a character difference feature.

21. The device according to claim 19, characterized in that The character relationship feature includes a character similarity feature, and the character similarity feature is used to represent the character similarity between the start character of any sub-entity and the end character of any sub-entity; The determination module is configured to determine a dot product between a character feature of a start character of any sub-entity and a character feature of an end character of any sub-entity to obtain a character similarity feature.

22. The device according to claim 16, characterized in that The training module is configured to determine, for any first nested entity, a loss value of the any first nested entity based on the label information and the first prediction information of the any first nested entity; Based on the loss values of the multiple first nested entities, the first network model is trained to obtain a second network model.

23. The device according to claim 22, characterized in that The training module is configured to determine a first loss value of any first nested entity based on a first label of each character in the any first nested entity and a first probability that each character in the any first nested entity is a starting character of a sub-entity; determining a second loss value of any first nested entity based on a second label of each character in any first nested entity and a first probability that each character in any first nested entity is an end character of a sub-entity; Determining a third loss value of any first nested entity based on the third label of each sub-entity of any first nested entity and the first entity type probability of each sub-entity of any first nested entity; The loss value of any first nested entity is determined based on the first loss value, the second loss value, and the third loss value of any first nested entity.

24. The device according to claim 16, characterized in that The determination module is further configured to, in response to the first condition not being satisfied, determine, for any first nested entity, second prediction information of the any first nested entity based on the second network model, the second prediction information of the any first nested entity including a second probability that each character in the any first nested entity is a start character of a sub-entity, a second probability that each character in the any first nested entity is an end character of a sub-entity, and a second entity type probability of each sub-entity of the any first nested entity; The training module is further configured to train the second network model based on the label information and the second prediction information of the plurality of first nested entities to obtain a third network model; The determination module is further configured to use the third network model as the nested entity recognition model in response to satisfying the first condition.

25. The device according to any one of claims 16 to 24, characterized in that The acquisition module is further configured to acquire label information of a plurality of second nested entities, the label information of the second nested entities including a first label of each character in the second nested entity, a second label of each character in the second nested entity, and a third label of each sub-entity of the second nested entity; The determination module is further configured to determine, for any second nested entity, first prediction information of the any second nested entity based on the first network model, the first prediction information of the any second nested entity including a first probability that each character in the any second nested entity is a start character of a sub-entity, a first probability that each character in the any second nested entity is an end character of a sub-entity, and a first entity type probability of each sub-entity of the any second nested entity; The training module is further configured to train the first network model based on the label information and first prediction information of the multiple first nested entities and the label information and first prediction information of the multiple second nested entities to obtain a second network model.

26. The device according to claim 25, characterized in that The determination module is further configured to determine, for any first nested entity, third prediction information of the any first nested entity based on the fourth network model, the third prediction information of the any first nested entity including a third probability that each character in the any first nested entity is a start character of a sub-entity, a third probability that each character in the any first nested entity is an end character of the sub-entity, and a third entity type probability of each sub-entity of the any first nested entity; The training module is further configured to train the fourth network model based on the label information of the plurality of first nested entities and the third prediction information to obtain a fifth network model; The determining module is further configured to use the fifth network model as a teacher model in response to satisfying a second condition; The acquisition module is used to obtain label information of multiple second nested entities based on the teacher model.

27. The device according to claim 26, characterized in that The teacher model includes a transformer-based bidirectional encoder representation network model, and the nested entity recognition model includes a long short-term memory network model.

28. A nested entity recognition device, characterized in that: The device comprises: Acquisition module, used to obtain the target nested entity; a determination module, configured to determine, based on a nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity, a probability that each character in the target nested entity is an end character of a sub-entity, and an entity type probability of each sub-entity of the target nested entity, wherein the nested entity recognition model is trained according to the nested entity recognition model training method according to any one of claims 1 to 12; The determination module is configured to determine the entity type of each sub-entity of the target nested entity based on the entity type probability of each sub-entity of the target nested entity.

29. The device according to claim 28, characterized in that The determination module is configured to determine, based on the nested entity recognition model, a probability that each character in the target nested entity is a start character of a sub-entity and a probability that each character in the target nested entity is an end character of a sub-entity; Determining, according to the nested entity recognition model, each sub-entity of the target nested entity based on a probability that each character in the target nested entity is a start character of a sub-entity and a probability that each character in the target nested entity is an end character of a sub-entity; The entity type probability of each sub-entity of the target nested entity is determined according to the nested entity recognition model.

30. The device according to claim 28, wherein The target nested entity is a nested entity in the media information; The device further comprises: a recommendation module, configured to recommend the media information to a target object in response to the presence of a target entity type in the entity types of each sub-entity of the target nested entity; The filtering module is configured to filter out the media information in response to the target entity type not existing in the entity types of the sub-entities corresponding to the target nested entity.

31. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein at least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor so that the electronic device implements the training method of the nested entity recognition model as described in any one of claims 1 to 12 or implements the nested entity recognition method as described in any one of claims 13 to 15.

32. A computer-readable storage medium, characterized in that The computer-readable storage medium stores at least one program code, and the at least one program code is loaded and executed by the processor so that the computer implements the training method of the nested entity recognition model as described in any one of claims 1 to 12 or the nested entity recognition method as described in any one of claims 13 to 15.

33. A computer program product, wherein at least one computer instruction is stored in the computer program product, and the at least one computer instruction is loaded and executed by a processor to enable a computer to implement the training method of the nested entity recognition model as described in any one of claims 1 to 12 or the nested entity recognition method as described in any one of claims 13 to 15.