Entity recognition method, device and computer equipment
The trained entity recognition model is used to correct errors and identify entities in the text to be recognized, which solves the problem of inaccurate entity recognition caused by errors in the text and improves the accuracy and overall effect of entity recognition.
Patent Information
- Application Number
- CN202111654665.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing technologies fail to effectively handle errors in text during entity recognition, resulting in inaccurate entity recognition.
The trained entity recognition model is used to perform error correction on the text to be recognized. The accuracy of entity recognition is improved through a two-stage approach of error correction preprocessing and entity recognition or a multi-target end-to-end approach of text error correction and entity recognition.
Improved the accuracy of entity recognition when there are errors in the text, and improved the overall effect of entity recognition.
Smart Images

Figure CN114358010B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an entity recognition method, device and computer equipment. Background Art
[0002] With the development of natural language processing (NLP) technology, its applications are becoming increasingly widespread. Named entity recognition (NER), also known as proper name recognition, is one of these NLP technologies. It identifies entities with specific meanings in text, primarily including names of people, places, organizations, and proper nouns. NER is applied to various texts. While simple and crude, NER directly performs entity recognition on the text to be identified, which can lead to inaccurate entity recognition. Summary of the Invention
[0003] Embodiments of the present invention provide an entity recognition method, apparatus, and computer device, which can improve the accuracy of entity recognition.
[0004] In one aspect, an embodiment of the present application provides an entity recognition method, the method comprising:
[0005] Determining first media data, and obtaining a text to be recognized corresponding to the first media data;
[0006] Calling the trained entity recognition model to perform target recognition processing on the text to be recognized and determine the entity of the text to be recognized; wherein the trained entity recognition model is used to perform error correction processing on the text to be recognized, obtain a corrected text corresponding to the text to be recognized, and perform entity recognition on the corrected text to obtain a reference entity of the corrected text; determining the reference entity of the corrected text as the entity of the text to be recognized; the entity of the text to be recognized is used to make recommendations associated with the first media data.
[0007] In one aspect, an embodiment of the present application provides an entity recognition device, comprising:
[0008] an acquiring unit, configured to determine first media data and acquire a text to be recognized corresponding to the first media data;
[0009] A processing unit is used to call a trained entity recognition model to perform target recognition processing on the text to be recognized and determine the entity of the text to be recognized; wherein the trained entity recognition model is used to perform error correction processing on the text to be recognized to obtain a corrected text, and to perform entity recognition on the corrected text to obtain a reference entity of the corrected text; the reference entity of the corrected text is determined as the entity of the text to be recognized; and the entity of the text to be recognized is used to make recommendations associated with the first media data.
[0010] On the one hand, an embodiment of the present application provides a computer device, which includes an input device, an output device, a processor and a computer storage medium, wherein the processor and the computer storage medium are interconnected, wherein the computer storage medium is used to store a computer program, and the processor is configured to call the computer program to execute the above-mentioned entity recognition method.
[0011] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it is used to implement the above-mentioned entity recognition method.
[0012] On the one hand, an embodiment of the present application provides a computer program product or computer program, the computer program product includes a computer program; the computer program is stored in a computer-readable storage medium, and when the computer program is executed by a processor of a computer device, the above-mentioned entity recognition method is executed.
[0013] In an embodiment of the present application, first media data can be determined, and the text to be recognized corresponding to the first media data can be obtained. Then, a trained entity recognition model can be called to perform target recognition processing on the text to be recognized, and the entity of the text to be recognized can be determined. The trained entity recognition model is used to perform error correction processing on the text to be recognized to obtain corrected text, and entity recognition is performed on the corrected text to obtain a reference entity of the corrected text; and the reference entity of the corrected text is determined as the entity of the text to be recognized. By calling the trained entity recognition model to perform error correction and entity recognition on the text to be recognized, the problem of not considering errors in the text during entity recognition, resulting in the inability to effectively recognize the corresponding entity, is solved, and the accuracy of entity recognition when errors in the text are present is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0015] Figure 1a This is a flow chart of an entity recognition solution provided by an embodiment of the present invention;
[0016] Figure 1b This is a schematic diagram of the architecture of an information recommendation system provided by an embodiment of the present invention;
[0017] Figure 2 1 is a flow chart of an entity recognition method provided by an embodiment of the present invention;
[0018] Figure 3 is a schematic diagram of a video including text provided by an embodiment of the present invention;
[0019] Figure 4a is a schematic diagram of an error correction model provided by an embodiment of the present invention;
[0020] Figure 4b is a schematic diagram of an entity prediction model provided by an embodiment of the present invention;
[0021] Figure 5 1 is a flow chart of another entity recognition method provided by an embodiment of the present invention;
[0022] Figure 6 is a schematic diagram of an entity recognition model provided by an embodiment of the present invention;
[0023] Figure 7 1 is a schematic structural diagram of an entity recognition device provided by an embodiment of the present invention;
[0024] Figure 8 It is a structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0026] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0027] 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, and machine learning / deep learning.
[0028] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0029] The entity recognition solution provided in the embodiments of the present application involves technologies such as machine learning in artificial intelligence. This entity recognition solution integrates text error correction capabilities and uses a two-stage approach of error correction preprocessing and entity recognition to implement error correction and entity recognition of the text to be recognized. In one embodiment, an entity recognition model can be trained to implement the two-stage approach of error correction preprocessing and entity recognition for the text to be recognized. For the text to be recognized corresponding to the first media data requiring entity recognition, the trained entity recognition model can be called to perform target recognition processing on the text to be recognized to obtain the entity of the text to be recognized. The target recognition processing mentioned in the embodiments of the present application may include: performing error correction processing on the text to be recognized to obtain corrected text; and performing entity recognition on the corrected text to obtain a reference entity of the corrected text. The reference entity of the corrected text is then directly determined as the entity of the text to be recognized, which can improve the entity recognition effect when errors occur in the text to be recognized. The first media data can be media data to be recommended or the first media data can be media data that has been browsed within a period of time and obtained with user authorization.
[0030] In one embodiment, to further improve the entity recognition effect, see Figure 1a, the embodiment of the present application can also introduce a multi-target end-to-end method for text error correction and entity recognition, and combine the two error correction enhanced entity recognition methods of error correction preprocessing-entity recognition two-stage recognition method and text error correction and video entity recognition multi-target end-to-end method, which can further improve the overall level of entity recognition and the accuracy of entity recognition. Among them, the multi-target end-to-end method for text error correction and entity recognition can be achieved by training an entity prediction end-to-end model. That is, the above-mentioned entity recognition model can include a trained entity prediction end-to-end model. After obtaining the entity of the corrected text, the trained entity prediction end-to-end model can be called to perform entity recognition on the text to be recognized based on the text to be recognized, the corrected text and the reference entity of the corrected text to obtain the candidate entity of the text to be recognized, and then the candidate entity of the text to be recognized can be determined as the entity of the text to be recognized. Optionally, the trained entity prediction end-to-end model provided by the present application can also perform error correction processing on the text to be recognized based on the text to be recognized, the corrected text and the reference entity of the corrected text to obtain the correct text corresponding to the text to be recognized. In the embodiments of the present application, the entities obtained by text recognition can provide a basis for subsequent recommendation distribution based on media data such as video, especially improving the performance of video entity recognition when errors exist in video text, and empowering downstream business applications based on video entities.
[0031] The entity recognition solution provided by the embodiments of the present application has the following beneficial effects: the use of the trained entity recognition model can solve the problem of not considering errors in the text during entity recognition, resulting in the inability to effectively identify the corresponding entities; at the same time, the use of a two-stage recognition method of error correction preprocessing-entity recognition and a multi-target end-to-end method of text error correction and video entity recognition can construct a more complete error-enhanced entity recognition model, which can further improve the entity recognition effect when errors exist in the text, thereby improving the overall effect and accuracy of entity recognition.
[0032] Based on the above entity recognition solution, this embodiment of the application provides an information recommendation system, see Figure 1b, the information recommendation system may include at least one terminal device 101, a server 102 and at least one information recommendation device 103. Among them, the terminal device 101 can run a variety of clients (Application, APP), such as a video playback client, a content sharing client, etc. The terminal device 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, and the server 102 and the information recommendation device 103 can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of this application. The information recommendation device 103 can be a terminal device or a server. The above-mentioned terminal device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms, etc. Optionally, the information recommendation device 103 may be integrated into the terminal device 101 , or the information recommendation device may be integrated into the server 102 .
[0033] In one embodiment, when the information recommendation device 103 is an independent device, the user can browse text or watch videos through the client running in the terminal device 101. The texts and videos viewed by the user can be stored in the server 102. The information recommendation device 103 can send a data acquisition request to the server 102. The server 102 receives the data acquisition request, obtains the media data (i.e., first media data) that the user has browsed within a period of time, and sends the first media data to the information recommendation device 103. The information recommendation device 103 can then receive the first media data sent by the server 102 and process the first media data to obtain the text to be recognized. When the first media data is obtained from the server 102, it is obtained with the user's authorization. Next, the information recommendation device 103 can call the trained entity recognition model to perform error correction processing on the text to be recognized, and perform entity recognition on the text to be recognized after error correction processing to obtain a reference entity of the text to be recognized after error correction, and then determine the reference entity of the text to be recognized after error correction as the entity of the text to be recognized. By correcting errors in the text to be recognized, the entity recognition effect can be improved when there are errors in the text, further improving the overall effect of video entity recognition. The information recommendation device 103 can then obtain media data associated with the entity in the text to be recognized and send the media data associated with the entity in the text to be recognized to the terminal device 101. After receiving the media data associated with the entity in the text to be recognized, the terminal device 101 displays the media data associated with the entity in the text to be recognized. The media data can be text data, video data, audio data, etc.
[0034] In one embodiment, when the information recommendation device 103 is integrated into the terminal device 101, the user can browse text or watch videos through the client running on the terminal device 101. The text and videos viewed by the user can be stored in the server 102. The information recommendation device 103 can then send a data acquisition request to the server 102. The server 102 receives the data acquisition request, obtains the media data (i.e., first media data) that the user has browsed within a period of time, and sends the first media data to the information recommendation device 103. The information recommendation device 103 can then process the first media data to obtain the text to be recognized. The first media data is obtained from the server 102 with the user's authorization. The information recommendation device 103 can then call the trained entity recognition model to perform error correction on the text to be recognized, perform entity recognition on the corrected text to be recognized, obtain a reference entity for the corrected text to be recognized, and then determine the reference entity for the corrected text to be recognized as the entity of the text to be recognized. By correcting the text to be recognized, the entity recognition effect can be improved when errors exist in the text, further improving the overall effect of video entity recognition. Then, the information recommendation device 103 may obtain media data associated with the entity of the text to be recognized, and output the media data associated with the entity of the text to be recognized via the terminal device 101. The media data may be text data, video data, audio data, etc.
[0035] In one embodiment, when the information recommendation device 103 is integrated into the server 102, the information recommendation device 103 directly obtains the media data (i.e., the first media data) that the user has browsed within a period of time from the server 102, and then the information recommendation device 103 can process the first media data to obtain the text to be recognized. When the media data that the user has browsed within a period of time is obtained from the server 102, it is obtained with the authorization of the user. Then, the information recommendation device 103 can call the trained entity recognition model to perform error correction processing on the text to be recognized, and perform entity recognition on the text to be recognized after the error correction processing, obtain the reference entity of the text to be recognized after the error correction, and then determine the reference entity of the text to be recognized after the error correction as the entity of the text to be recognized. By correcting the text to be recognized, the entity recognition effect when there are errors in the text can be improved, and the overall effect of video entity recognition can be further improved. The information recommendation device 103 can then obtain the media data associated with the entity of the text to be recognized, and send the media data associated with the entity of the text to be recognized to the terminal device 101. After receiving the media data associated with the entity of the text to be recognized, the terminal device 101 displays the media data associated with the entity of the text to be recognized.
[0036] Based on the entity recognition scheme provided above, please refer to Figure 2 , Figure 2 A flowchart of an entity recognition method provided in an embodiment of the present invention. The entity recognition method can be executed by a computer device, which can be an information recommendation device in the above-mentioned information recommendation system, or when the information recommendation device is integrated into a terminal device, the computer device can be a terminal device in the above-mentioned information recommendation system, or when the information recommendation device is integrated into a server, the computer device can be a server in the above-mentioned information recommendation system. The entity recognition method described in this embodiment can include the following steps S201-S202:
[0037] S201: Determine first media data, and obtain text to be recognized corresponding to the first media data.
[0038] The number of the first media data may be one or more, and the first media data may be text data, video data, audio data, etc. The first media data may be media data browsed by a user, or the first media data may be media data to be recommended.
[0039] In one embodiment, when the first media data is media data that has been browsed by the user, the method for determining the first media data is as follows: the computer device can obtain a media data browsed by the user within a historical time period from various clients under the condition of user authorization / permission. The historical time period can be set according to demand. For example, the historical time period can be 1 hour, 30 minutes, etc. before the current time. In another embodiment, when the first media data is media data to be recommended, the computer device can directly obtain one or more media data to be recommended from various clients. Among them, the first media data can be determined from various clients, and the client can be a video playback client, a content sharing client, etc. After determining the first media data, the computer device can obtain the text to be identified corresponding to the first media data for processing to obtain the text to be identified.
[0040] In one embodiment, when the media data is video data and the video data includes text, for example, Figure 3 In the example, the video data is a video of the TV series "Three Defeats," and the video data includes the text "The plot of 'Three Defeats' is truly exciting." A specific implementation method for obtaining the text to be recognized corresponding to the first media data is as follows: the computer device can directly extract the text from the video data as the text to be recognized, i.e., the text to be recognized is "The plot of 'Three Defeats' is truly exciting."
[0041] In another embodiment, when the media data is video data and the video data does not include text, the specific implementation of obtaining the text to be recognized corresponding to the first media data for processing may be as follows: The computer device can perform denoising processing on the video data, and perform speech recognition on the denoised video data to obtain the recognized text corresponding to the video data, and use the recognized text corresponding to the video data as the text to be recognized. It should be understood that the specific implementation of obtaining the text to be recognized from audio data is similar to that of obtaining the text to be recognized from video data, and will not be elaborated here.
[0042] In yet another embodiment, when the media data is text data, the specific implementation of obtaining the text to be recognized corresponding to the first media data for processing may be as follows: Special characters in the text data can be removed to obtain the text to be recognized. Among them, the special characters can be set according to requirements. For example, the special characters can be commas, periods, etc.
[0043] In one embodiment, when the target object is the target user, user authorization / permission is required to obtain the media data. At this time, the specific implementation of determining the first media data can be to display a media data collection interface, which includes a prompt message, a confirmation button, and a cancel button. The prompt message can be used to prompt the target user that the media data browsed by the target user during the historical period needs to be collected, and / or prompt the relevant processing that will be performed after the media data is collected. If the target user agrees to collect the media data browsed during the historical period, the confirmation button can be triggered to achieve authorization for media data collection. Then the computer device can collect the media data browsed by the target user during the historical period and display the specifically collected media data; if the target user does not agree to collect the media data browsed during the historical period, the cancel button can be triggered. At this time, the computer device cannot collect the media data browsed during the historical period.
[0044] S202. Call the trained entity recognition model to perform target recognition processing on the text to be recognized, and determine the entity of the text to be recognized. The trained entity recognition model is used to perform error correction processing on the text to be recognized to obtain the corrected text corresponding to the text to be recognized, and perform entity recognition on the corrected text to obtain the reference entity of the corrected text, and determine the reference entity of the corrected text as the entity of the text to be recognized; the entity of the text to be recognized can be used for recommendations associated with the first media data. Among them, the entity can be one or more. The entity can be a play name, a person name, a game name, a location, etc. For example, in Figure 3 "兵败如三倒" is a play name entity.
[0045] In a specific implementation, the text to be recognized obtained by performing speech recognition on speech or video or processing text may contain errors. Such errors are likely to appear in the entities of the text to be recognized, which results in the inability to recognize the entity when performing entity recognition on the text to be recognized. Therefore, in order to solve this problem, the computer device can use the trained entity recognition model to perform error correction processing on the text to be recognized, obtain the corrected text corresponding to the text to be recognized, and then perform entity recognition on the corrected text to obtain the reference entity of the corrected text. The computer device can directly determine the reference entity of the corrected text as the entity of the text to be recognized. Alternatively, since there may be duplicate reference entities in the reference entities of the corrected text, the computer device can deduplicate the reference entities of the corrected text and use the deduplicated reference entities as the entities to be recognized.
[0046] In one embodiment, error correction of the text to be recognized reduces errors in the text to be recognized to a certain extent, thereby improving the accuracy of entity recognition. To further improve the accuracy of entity recognition, a trained entity recognition model can be used to perform entity recognition on the text to be recognized based on the text to be recognized, the corrected text, and the reference entities of the corrected text. Candidate entities for the text to be recognized are obtained, and the candidate entities are used as the entities of the text to be recognized. In this way, the entity recognition effect can be further improved.
[0047] The process of training the entity recognition model may include: obtaining a first training text and an entity label corresponding to the first training text; then calling the entity recognition model to perform error correction on the first training text to obtain a corrected text corresponding to the first training text, and performing entity recognition on the corrected text corresponding to the first training text to obtain a predicted entity for the first training text; and training the entity recognition model based on the predicted entities and corresponding entity labels of the first training text to obtain a trained entity recognition model. The number of first training texts may be one or more. The computer device may determine a model loss value for the entity recognition model based on the predicted entities and corresponding entity labels of the first training text, and use the model loss value to adjust parameters in the entity recognition model to obtain a trained entity recognition model. The first training text may be extracted from training media data. The method for extracting the first training text from training media data can refer to the specific implementation method for obtaining the text to be recognized corresponding to the first media data from the first media data, which will not be repeated here.
[0048] In one embodiment, the trained entity recognition model may include a trained error correction model and a trained entity prediction model. The specific implementation of determining the entity of the text to be recognized by invoking the trained entity recognition model for target recognition processing on the text to be recognized may be: the computer device invokes the trained error correction model to perform error correction processing on the text to be recognized, and obtains the corrected text corresponding to the text to be recognized. Then, the trained entity prediction model is invoked to perform entity recognition on the corrected text, and the reference entity of the corrected text is obtained. For example, if the text to be recognized is "兵败如三倒" (defeat is like three falls), the computer device can use the trained error correction model to perform error correction processing on "兵败如三倒", and obtain the corrected text "兵败如山倒" (defeat is like a landslide).
[0049] Among them, the trained error correction model may be a bert (Bidirectional Encoder Representation from Transformers, the Encoder of Bidirectional Transformer) model. The model structure of the trained error correction model may be as Figure 4a shown. The specific implementation of training the error correction model to obtain the trained error correction model may be: obtaining the second training text and the corrected text label corresponding to the second training text. The computer device can invoke the error correction model to perform error correction processing on the second training text, and obtain the predicted corrected text corresponding to the second training text. Then, based on the corrected text label and the predicted corrected text corresponding to the second training text, the error correction model is trained to obtain the trained error correction model. The trained error correction model obtained in this way has the ability to input the original text and output the corrected text. Among them, the number of the second training texts may be one or more. The computer device can determine the model loss value of the entity recognition model based on the corrected text label and the predicted corrected text corresponding to the second training text, and use the model loss value to adjust the parameters in the error correction model to obtain the trained error correction model. The second training text can be extracted from the training media data. The extraction method of extracting the second training text from the training media data can refer to the specific implementation of obtaining the text to be recognized corresponding to the first media data from the first media data, which will not be elaborated here.
[0050] In one embodiment, the above-mentioned trained entity prediction model may be a bert model. The trained entity prediction model may be as Figure 4bAs shown. The specific implementation of using the trained entity prediction model to perform entity recognition on the corrected text and obtaining the reference entities of the corrected text can be as follows: The computer device can use the trained entity prediction model to perform entity recognition on the corrected text to obtain the entity category corresponding to each character in the corrected text. Among them, the entity category can be any one of the entity start class, entity middle class, entity end class, and non-entity class. Then, the computer device can combine the characters in the corrected text according to the entity category corresponding to each character in the above-mentioned corrected text to obtain the reference entities of the corrected text.
[0051] In one embodiment, generally speaking, the character category corresponding to a character is the entity start class, and the characters following this character are likely to be the entity middle class or entity end class. Therefore, the specific implementation of combining the characters in the corrected text according to the entity category corresponding to each character in the corrected text to obtain the reference entities of the corrected text can be: taking the character corresponding to any entity start class as the reference character, and based on this reference character in the corrected text, obtaining at least one associated character of this reference character backward, and generating the reference entities of the corrected text according to the combination of this reference character and at least one associated character. Among them, at least one associated character of the reference character satisfies the following conditions: at least one associated character and the reference character can form a continuous string, and the category of any associated character is a non-entity start class.
[0052] For example, for the text to be recognized "《兵败如山倒》马上上映", the computer device uses the trained entity prediction model to perform entity recognition on "《兵败如山倒》马上上映", and obtains that the character category corresponding to the character "兵" is the entity start class, the character category corresponding to the character "败" is the entity middle class, the character category corresponding to the character "如" is the entity middle class, the character category corresponding to the character "山" is the entity middle class, the character category corresponding to the character "倒" is the entity end class, and the character category corresponding to the character "马" is the non-entity class. The computer device can determine that the character "兵" is the reference character, and then obtain at least one associated character of this reference character backward, which are the characters "败", "如", "山", "倒", respectively. Then, the reference entity "兵败如山倒" is generated according to the combination of this reference character and at least one associated character.
[0053] Among them, the entity prediction model can be pre-trained. In one embodiment, the third training text and the entity label corresponding to the third training text are obtained, and then the trained error correction model is called to perform error correction processing on the third training text to obtain the corrected text corresponding to the third training text; entity recognition is performed on the corrected text corresponding to the third training text to obtain the predicted entity of the third training text; the entity prediction model is trained based on the predicted entity of the third training text and the corresponding entity label to obtain the trained entity prediction model. Among them, the number of third training texts can be one or more. The third training text and the second training text can be the same training text or different training texts.
[0054] In one embodiment, the entity of the finally obtained text to be recognized can provide higher-quality video entity basic data for video recommendation and distribution, enhancing the overall experience of users in various clients. When the first media data is the media data to be recommended, the number of the first media data is multiple, and each first media data corresponds to a text to be recognized. The computer device can obtain the reference media data. At this time, the reference media data can be the media data browsed in the historical time period under the authorization / permission of the target user. The computer device can determine the target media data from the multiple first media data according to the reference media data. The entity of the text corresponding to the target media data matches the entity of the text corresponding to the reference media data, indicating that the user is more concerned about this type of media data. Then the computer device can output the target media data.
[0055] In another embodiment, when the first media data is the media data browsed in the historical time period under the authorization / permission of the target user, the computer device can perform entity matching based on the entity of the text to be recognized to determine the second media data. The entity of the text corresponding to the second media data matches the entity of the text to be recognized. It can be understood that the entity of the text to be recognized is included in the text corresponding to the target media data. The second media data can be video data, text data, audio data, etc. For example, for the drama name entity "A rout is like a landslide" of the text to be recognized, video data, text data or audio data related to the drama name entity "A rout is like a landslide" can be obtained. That is, the second media data can be the TV drama "A rout is like a landslide", the introduction of "A rout is like a landslide", etc. Then the computer device outputs the second media data. In one embodiment, after obtaining the entity of the text to be recognized, the entity of the text to be recognized can be used as the object identifier of the target object and added to the object identifier set of the target object. Subsequently, the target media data can be pushed to the target object according to the object identifier set of the target object. The entity of the text corresponding to the target media data matches the entity included in the object identifier set of the target object.
[0056] In an embodiment of the present application, a computer device can determine first media data and obtain a text to be recognized corresponding to the first media data, call a trained entity recognition model to perform target recognition processing on the text to be recognized, determine the entity of the text to be recognized, and use the trained entity recognition model to perform error correction processing on the text to be recognized to obtain a corrected text; then, entity recognition is performed on the corrected text to obtain a reference entity of the corrected text; and then, the reference entity of the corrected text is determined as the entity of the text to be recognized. Calling the trained entity recognition model can solve the problem of not considering errors in the text during entity recognition, resulting in the inability to effectively recognize the corresponding entity, and improve the accuracy of entity recognition when errors exist in the text.
[0057] Based on the entity recognition scheme provided above, please refer to Figure 5 , Figure 5 A flowchart of an entity recognition method provided by an embodiment of the present invention. The entity recognition method can be executed by a computer device in the above-mentioned information recommendation system, and the computer device can be an information recommendation device in the above-mentioned information recommendation system, or when the information recommendation device is integrated in a terminal device, the computer device can be a terminal device in the above-mentioned information recommendation system, or when the information recommendation device is integrated in a server, the computer device can be a server in the above-mentioned information recommendation system. The trained entity model in the entity recognition method described in this embodiment can include a trained error correction model, a trained entity prediction model, and a trained entity prediction end-to-end model. The entity recognition method can include the following steps S501-S509:
[0058] S501: Determine first media data, and obtain text to be recognized corresponding to the first media data.
[0059] S502: Call the trained error correction model to perform error correction on the text to be recognized, and obtain a corrected text corresponding to the text to be recognized.
[0060] S503: Call the trained entity prediction model to perform entity recognition on the corrected text to obtain a reference entity of the corrected text.
[0061] S504: Call the trained entity prediction end-to-end model to perform feature extraction on the text to be recognized, and obtain a text vector corresponding to the text to be recognized.
[0062] In one embodiment, the computer device can use the feature extraction module in the trained entity prediction end-to-end model to extract features from the text to be recognized, and obtain a text vector corresponding to the text to be recognized. The text vector may include the position information of each character in the text to be recognized, and the character information of each character. The trained entity prediction end-to-end model may be a BERT model. The trained entity prediction end-to-end model may be as follows: Figure 6 As shown. The input of the trained entity prediction end-to-end model may include the text to be recognized obtained in step S501, the corrected text obtained in step S502, and the reference entity of the corrected text obtained in step S503. By inputting the text to be recognized, the corrected text, and the reference entity of the corrected text into the trained entity prediction end-to-end model, the feature richness of the model can be improved, the representation ability of the model can be enhanced, and the entity recognition accuracy of the trained entity prediction end-to-end model can be improved.
[0063] S505: Perform feature extraction on the corrected text to obtain a text vector corresponding to the corrected text. The computer device may use a feature extraction module in the trained entity prediction end-to-end model to perform feature extraction on the corrected text to obtain a text vector corresponding to the corrected text. The text vector may include position information of each character in the corrected text and character information of each character.
[0064] S506: Perform feature extraction on the reference entity of the corrected text to obtain an entity vector corresponding to the reference entity of the corrected text.
[0065] In a specific implementation, the computer device can use the feature extraction module in the trained entity prediction end-to-end model to extract features of the reference entity of the corrected text to obtain the entity vector corresponding to the reference entity of the corrected text.
[0066] In one embodiment, a feature extraction module in a trained end-to-end entity prediction model is used to extract features from a reference entity in a corrected text to obtain an entity vector corresponding to the reference entity in the corrected text. A specific implementation method may be: a computer device may perform entity tagging on each character in the corrected text based on the reference entity in the corrected text. The entity tagging can be used to indicate the entity status of each character's location. In a specific implementation, characters corresponding to the reference entity in the corrected text may be tagged with a first numerical value, and characters corresponding to non-entities in the corrected text other than the reference entity may be tagged with a second numerical value. The first and second numerical values can be set as desired. This embodiment of the present application is not limited in this regard. For example, the first numerical value may be 0, indicating that the character is a non-entity, and the second numerical value may be 1, indicating that the character is part of the reference entity. For another example, the first numerical value may be 2, indicating that the character is a non-entity, and the second numerical value may be 3, indicating that the character is part of the reference entity. Entity tagging of characters corresponding to the reference entity can instruct the entity recognition model to prioritize analysis of the reference entity in the corrected text. The computer device can then invoke the feature extraction module to process the tagged reference entity to obtain an entity vector corresponding to the reference entity. Optionally, the input of the trained entity prediction end-to-end model includes not only the reference entities after entity labeling, but also the non-entities after entity labeling. During step S507, since entity recognition is ultimately performed on the text to be recognized, the trained entity prediction end-to-end model will focus on the reference entities after entity labeling.
[0067] S507 , performing entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain candidate entities of the text to be recognized.
[0068] In one embodiment, the trained entity prediction end-to-end model, in addition to including a feature extraction module, may also include a first attention module and a second attention module. The first attention module and the second attention module may be self-attention mechanisms. The first attention module may be used to perform difference analysis between the text to be recognized and the corrected text to achieve focused analysis of locations where differences exist. The second attention module may be used to perform attention analysis on the predicted entities and reference entities in the text to be recognized to achieve focused processing of the predicted entities in the text to be recognized. The computer device performs entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized. The specific implementation method may be: calling the first attention module to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized to obtain the entity vector of the entity of the text to be recognized. Then, for the reference entity of the input corrected text, in order to ultimately obtain a more accurate entity, the second attention module may be used to perform focused analysis on the reference entity of the corrected text and the predicted entity of the text to be recognized. The second attention module in the entity recognition model is called to perform attention analysis on the entity vector of the predicted entity of the text to be recognized and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized.
[0069] Among them, since there may be entities in the places where problems occur in the text to be recognized, it is necessary to focus on analyzing these places. The computer device can call the first attention module to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized. The specific implementation method for obtaining the entity vector of the entity in the text to be recognized is as follows: perform difference analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized to obtain the error correction position corresponding to the corrected text. The error correction position is used to indicate the position of the target character in the corrected text that is different from the corresponding character contained in the text to be recognized. For example, if the corrected text is "兵败如山倒" and the text to be recognized is "兵败如三倒", the computer device can perform difference analysis on the text vector corresponding to the corrected text "兵败如山倒" and the text vector corresponding to the text to be recognized "兵败如三倒" to obtain that the error correction position corresponding to the corrected text is the position where "山" is located, that is, "山" in the corrected text is different from "三" in the text to be recognized. Then the computer device can call the first attention module to perform attention analysis on the error correction position and the corrected text to obtain the entity vector of the predicted entity in the text to be recognized. In the above example, the computer device can call the first attention module to perform attention analysis on the position where the character "山" is located and the corrected text "兵败如山倒" to obtain the entity vector of the predicted entity "兵败如山倒" in the text to be recognized. It should be understood that performing attention analysis on the position where the character "山" is located and the corrected text "兵败如山倒" can replace "三" in the text to be recognized with "山" in the corrected text, so that the predicted entity of the final text to be recognized is the entity vector of "兵败如山倒", rather than the entity vector of "兵败如三倒". Through the first attention module, error correction of the text to be recognized can be achieved.
[0070] In one embodiment, the specific implementation method for the computer device to call the second attention module in the trained entity prediction end-to-end model to perform attention analysis on the entity vector of the predicted entity in the text to be recognized and the entity vector corresponding to the reference entity to obtain the candidate entity in the text to be recognized is as follows: based on the entity vector corresponding to the reference entity, determine the target position of the reference entity in the corrected text; determine the entity vector of the predicted entity corresponding to the target position in the text to be recognized; then call the second attention module in the trained entity prediction end-to-end model to perform attention analysis on the entity vector of the predicted entity corresponding to the target position to obtain the candidate entity in the text to be recognized. Among them, the entity vector is used to indicate the position of the reference entity in the corrected text. The computer device can perform alignment processing on the text to be recognized and the corrected text and input them into the trained entity prediction end-to-end model. Therefore, the computer device can determine the target position of the reference entity in the corrected text according to the entity vector corresponding to the reference entity, and then find the entity vector of the predicted entity at this target position in the text to be recognized.
[0071] For example, the text to be recognized is "Zhang San is recently watching "The King's Dance Enemy", the corrected text is "Zhang San is recently watching "The King is Invincible", and the reference entity of the corrected text is "The King is Invincible". The first attention module performs attention analysis on the text vector corresponding to the text to be recognized and the text vector corresponding to the corrected text to obtain the entity vector of the predicted entity "The King is Invincible" of the text to be recognized. The computer device can determine the target position of the reference entity "The King is Invincible" in the corrected text based on the entity vector corresponding to the reference entity "The King is Invincible", and then determine the entity vector of the predicted entity "The King is Invincible" corresponding to the target position in the text to be recognized, and call the second attention module in the trained entity prediction end-to-end model to perform attention analysis on the entity vector of the predicted entity "The King is Invincible" to obtain the candidate entity corresponding to the text to be recognized.
[0072] In one embodiment, entity recognition is performed on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain the entity category of each character in the text to be recognized, and the text to be recognized is combined based on the entity category of each character to obtain candidate entities of the text to be recognized. The specific implementation method of combining the text to be recognized based on the entity category of each character to obtain candidate entities of the text to be recognized can be referred to the specific implementation method of combining the characters in the corrected text according to the entity category corresponding to each character in the corrected text to obtain the reference entity of the corrected text, which will not be repeated here.
[0073] Before executing step S507, the entity prediction end-to-end model can be pre-trained. The computer device can obtain a fourth training text, a training correction text corresponding to the fourth training text, a training entity of the training correction text, and an entity label corresponding to the fourth training text; use the entity prediction end-to-end model to extract features from the fourth training text to obtain a text vector corresponding to the fourth training text; perform feature extraction on the training correction text to obtain a text vector corresponding to the training correction text; perform feature extraction on the training entity of the training correction text to obtain an entity vector corresponding to the training entity of the training correction text; perform entity recognition on the fourth training text based on the text vector corresponding to the fourth training text, the text vector corresponding to the training correction text, and the entity vector corresponding to the training entity of the training correction text to obtain a predicted entity of the fourth training text; train the entity prediction end-to-end model based on the predicted entity of the fourth training text and the corresponding entity label to obtain a trained entity prediction end-to-end model. The number of the fourth training text is one or more, and can be obtained from media data.
[0074] In one embodiment, since the corrected text obtained after step S502 is not necessarily completely corrected to the correct text, the trained entity prediction end-to-end model can not only perform entity recognition, but also correct errors in the text to be recognized to obtain the correct text corresponding to the text to be recognized. The computer device can perform entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain candidate entities of the text to be recognized. In addition, the computer device can correct errors in the text to be recognized. Finally, the output of the entity prediction end-to-end model may include the correct text corresponding to the text to be recognized and the entity of the text to be recognized.
[0075] In one embodiment, when the output of the trained entity prediction end-to-end model includes the correct text corresponding to the text to be recognized and the entity of the text to be recognized, the entity prediction end-to-end model can be subjected to multi-objective joint learning to obtain the trained entity prediction end-to-end model. The entity prediction end-to-end model can also be called a multi-objective end-to-end model, that is, it can realize error correction of the text to be recognized and can also realize entity recognition of the text to be recognized. During specific training, the trained entity prediction end-to-end model is trained on training texts with labeled entities and errors. The computer device can obtain a fourth training text, a corrected training text corresponding to the fourth training text, a training entity of the corrected training text, and an entity label and a correct text label corresponding to the fourth training text; perform feature extraction on the fourth training text using an entity prediction end-to-end model to obtain a text vector corresponding to the fourth training text; perform feature extraction on the corrected training text to obtain a text vector corresponding to the corrected training text; perform feature extraction on the training entity of the corrected training text to obtain an entity vector corresponding to the training entity of the corrected training text; perform entity recognition on the fourth training text based on the text vector corresponding to the fourth training text, the text vector corresponding to the corrected training text, and the entity vector corresponding to the training entity of the corrected training text to obtain a predicted entity of the fourth training text and a predicted correct text of the fourth training text; train the entity prediction end-to-end model based on the predicted entity and the corresponding entity label of the fourth training text, and the predicted correct text and the corresponding correct text label of the fourth training text to obtain a trained entity prediction end-to-end model. In a specific implementation, a first model loss value of the entity prediction end-to-end model is calculated based on the predicted entity and the corresponding entity label of the fourth training text; and a second model loss value of the entity prediction end-to-end model is calculated based on the predicted correct text and the corresponding correct text label of the fourth training text. The first and second model loss values are then weighted averaged to obtain the model loss value. Based on this model loss value, the model parameters of the entity prediction end-to-end model are adjusted to obtain the trained entity prediction end-to-end model. The trained entity prediction end-to-end model can correct errors in the text to be recognized and predict entities. This optimizes the entity recognition model and further improves its tolerance for text errors.
[0076] S508: Determine the candidate entity of the text to be recognized as the entity of the text to be recognized.
[0077] In a specific implementation, the computer device may directly determine the candidate entity of the text to be recognized as the entity of the text to be recognized.
[0078] In one embodiment, since there may be the same or different candidate entities of the text to be recognized and reference entities of the corrected text, the embodiments of the present application can perform entity fusion on the candidate entities of the text to be recognized and the reference entities of the corrected text to obtain the entities of the text to be recognized. The entity fusion here can include two types: removing duplicate entities in the candidate entities of the text to be recognized and the reference entities of the corrected text; retaining different entities in the candidate entities of the text to be recognized and the reference entities of the corrected text. The entities of the text to be recognized finally obtained through entity fusion can include candidate entities and reference entities. For example, the candidate entities of the text to be recognized are "Zhang San" and "Li Si", and the reference entities of the corrected text are "Zhang San" and "Xiao Wu". The computer device can perform entity fusion on the candidate entities of the text to be recognized and the reference entities of the corrected text to obtain the entities of the text to be recognized as "Zhang San", "Li Si", and "Xiao Wu".
[0079] S509. Determine the reference entity of the corrected text as the entity of the text to be recognized.
[0080] In one embodiment, the entities of the text to be recognized finally obtained can be used as the object identifier of the object or provide higher-quality video entity basic data for video recommendation distribution, enhancing the overall user experience of various clients. When the first media data is the media data to be recommended and the number of the first media data is multiple, each first media data corresponds to a text to be recognized. The computer device can obtain the reference media data. At this time, the reference media data can be the media data browsed in the historical time period under the authorization / permission of the target user. The computer device can determine the target media data from the multiple first media data according to the reference media data. The entity of the text to be recognized corresponding to the target media data matches the entity of the text corresponding to the reference media data, indicating that the user is more concerned about this type of media data. Then the computer device can output the target media data.
[0081] In another embodiment, when the first media data is media data browsed within a historical period under the authorization / permission of the target user, the computer device may perform entity matching based on the entity of the text to be recognized to determine the second media data, and the entity of the text corresponding to the second media data matches the entity of the text to be recognized. It can be understood that the entity of the text to be recognized is included in the text corresponding to the target media data. The target media data may be video data, text data, audio data, etc. For example, for the entity of the drama name "A Crushing Defeat" in the text to be recognized, video data, text data, or audio data related to "A Crushing Defeat" can be obtained. That is, the target media data may be the TV drama "A Crushing Defeat", the introduction of "A Crushing Defeat", etc. Then the computer device may push the target media data to the target object. In one embodiment, after obtaining the entity of the text to be recognized, the entity of the text to be recognized may be used as the object identifier of the target object and added to the object identifier set of the target object. Subsequently, the target media data may be pushed to the target object according to the entities included in the object identifier set, and the entity of the text corresponding to the target media data matches the entities included in the object identifier set, so that the target media data pushed to the target object matches the needs of the target object.
[0082] In the embodiment of the present application, after the computer device determines the first media data and obtains the text to be recognized corresponding to the first media data, on the one hand, the trained error correction model may be called to perform error correction processing on the text to be recognized to obtain the corrected text; then the trained entity prediction model may be called to perform entity recognition on the corrected text to obtain the reference entity of the corrected text; and the reference entity of the corrected text may be determined as the entity of the text to be recognized. This can solve the problem that errors in the text are not considered during entity recognition, resulting in ineffective recognition of corresponding entities, and improve the accuracy of entity recognition when there are errors in the text. On the other hand, after obtaining the entity of the corrected text, the computer device may also call the trained entity prediction end-to-end model to extract features from the text to be recognized to obtain the text vector corresponding to the text to be recognized; extract features from the corrected text to obtain the text vector corresponding to the corrected text; extract features from the reference entity of the corrected text to obtain the entity vector corresponding to the reference entity of the corrected text; perform entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized; and determine the candidate entity of the text to be recognized as the entity of the text to be recognized, which can enhance the entity recognition effect and further improve the accuracy of entity recognition when there are errors in the text.
[0083] Based on the entity recognition method provided above, please refer to Figure 7 , which is a schematic structural diagram of an entity recognition device provided in the embodiment of the present application. As Figure 7 As shown, the entity recognition device 70 can be applied to the above Figure 2 or Figure 5 The computer device in the corresponding embodiment; specifically, the entity recognition device can be a computer program (including program code) running in the computer device, for example, the entity recognition device is an application software; the entity recognition device can be used to execute the corresponding steps in the method provided in the embodiment of the present application.
[0084] An acquiring unit 701 is configured to determine first media data and acquire a text to be recognized corresponding to the first media data;
[0085] The processing unit 702 is used to call the trained entity recognition model to perform target recognition processing on the text to be recognized and determine the entity of the text to be recognized; wherein the trained entity recognition model is used to perform error correction processing on the text to be recognized, obtain the corrected text corresponding to the text to be recognized, and perform entity recognition on the corrected text to obtain the reference entity of the corrected text; the reference entity of the corrected text is determined as the entity of the text to be recognized; the entity of the text to be recognized is used to make recommendations associated with the first media data.
[0086] In one embodiment, the number of the first media data is multiple, and each first media data corresponds to a text to be recognized; the acquisition unit 701 is further used to: acquire reference media data;
[0087] The processing unit 702 is further configured to determine target media data from a plurality of first media data based on the reference media data; match an entity of the text to be identified corresponding to the target media data with an entity of the text corresponding to the reference media data; and output the target media data.
[0088] In one embodiment, the processing unit 702 is further configured to:
[0089] Performing entity matching based on the entity of the text to be recognized, determining second media data, wherein the entity of the text corresponding to the second media data matches the entity of the text to be recognized;
[0090] The second media data is output.
[0091] In one embodiment, the trained entity recognition model includes a trained error correction model and a trained entity prediction model; when the processing unit 702 calls the trained entity recognition model to perform target recognition processing on the text to be recognized and determines the entity of the text to be recognized, it can be specifically used to:
[0092] Calling the trained error correction model to perform error correction processing on the text to be recognized to obtain a corrected text corresponding to the text to be recognized;
[0093] Calling the trained entity prediction model to perform entity recognition on the corrected text to obtain a reference entity of the corrected text;
[0094] The reference entity of the corrected text is determined as the entity of the text to be recognized.
[0095] In one embodiment, the trained entity recognition model includes a trained entity prediction end-to-end model, and the processing unit 702 is further configured to:
[0096] Calling the trained entity prediction end-to-end model to perform feature extraction on the text to be recognized, and obtaining a text vector corresponding to the text to be recognized;
[0097] Performing feature extraction on the corrected text to obtain a text vector corresponding to the corrected text;
[0098] Performing feature extraction on the reference entity of the corrected text to obtain an entity vector corresponding to the reference entity of the corrected text;
[0099] Performing entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain candidate entities of the text to be recognized;
[0100] The candidate entity of the text to be recognized is determined as the entity of the text to be recognized.
[0101] In one embodiment, the processing unit 702 is further configured to perform entity fusion on the candidate entities of the text to be recognized and the reference entities of the corrected text to obtain the entities of the text to be recognized.
[0102] In one embodiment, when the processing unit 702 performs entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized, it can be specifically used to:
[0103] Calling the first attention module in the trained entity prediction end-to-end model to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized, to obtain the entity vector of the predicted entity of the text to be recognized;
[0104] The second attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the entity vector of the predicted entity of the text to be recognized and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized.
[0105] In one embodiment, when the processing unit 702 calls the first attention module in the trained entity prediction end-to-end model to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized, and obtains the entity vector of the predicted entity of the text to be recognized, it can be specifically used to:
[0106] performing a difference analysis on a text vector corresponding to the corrected text and a text vector corresponding to the text to be recognized to obtain an error correction position corresponding to the corrected text, the error correction position being used to indicate a position in the corrected text of a target character that is different from a corresponding character contained in the text to be recognized;
[0107] The first attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the error correction position and the corrected text to obtain an entity vector of the predicted entity of the text to be recognized.
[0108] In one embodiment, when the processing unit 702 calls the second attention module in the trained entity prediction end-to-end model to perform attention analysis on the entity vector of the predicted entity of the text to be recognized and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized, it can be specifically used to:
[0109] Determining a target position of the reference entity in the corrected text based on an entity vector corresponding to the reference entity;
[0110] Determining an entity vector of a predicted entity corresponding to the target position in the text to be recognized;
[0111] The second attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the entity vector of the predicted entity corresponding to the target position to obtain the candidate entity of the text to be recognized.
[0112] In one embodiment, the acquisition unit 701 is further configured to: acquire a first training text and an entity label corresponding to the first training text;
[0113] The processing unit 702 is further used to: call the entity recognition model to perform error correction on the first training text to obtain a corrected text corresponding to the first training text, and perform entity recognition on the corrected text corresponding to the first training text to obtain a predicted entity of the first training text; train the entity recognition model based on the predicted entity of the first training text and the corresponding entity label to obtain a trained entity recognition model.
[0114] In one embodiment, the acquisition unit 701 is further configured to: acquire a second training text and a correction text label corresponding to the second training text;
[0115] The processing unit 702 is further configured to: call the error correction model to perform error correction processing on the second training text to obtain a predicted corrected text corresponding to the second training text;
[0116] The error correction model is trained based on the predicted corrected text of the second training text and the corresponding corrected text label to obtain a trained error correction model.
[0117] In one embodiment, the acquiring unit 701 is further configured to: acquire a third training text and an entity label corresponding to the third training text;
[0118] The processing unit 702 is further configured to: call the trained error correction model to perform error correction processing on the third training text to obtain a corrected text corresponding to the third training text;
[0119] Performing entity recognition on the corrected text corresponding to the third training text to obtain predicted entities of the third training text;
[0120] The entity prediction model is trained based on the predicted entities and corresponding entity labels of the third training text to obtain a trained entity prediction model.
[0121] In one embodiment, the acquisition unit 701 is further configured to: acquire a fourth training text, a training correction text corresponding to the fourth training text, a training entity of the training correction text, and an entity label corresponding to the fourth training text;
[0122] The processing unit 702 is further used to: use the entity prediction end-to-end model to perform feature extraction on the fourth training text to obtain a text vector corresponding to the fourth training text; perform feature extraction on the training correction text to obtain a text vector corresponding to the training correction text; perform feature extraction on the training entities of the training correction text to obtain an entity vector corresponding to the training entities of the training correction text; perform entity recognition on the fourth training text based on the text vector corresponding to the fourth training text, the text vector corresponding to the training correction text, and the entity vector corresponding to the training entities of the training correction text to obtain a predicted entity of the fourth training text; train the entity prediction end-to-end model based on the predicted entity of the fourth training text and the corresponding entity label to obtain a trained entity prediction end-to-end model.
[0123] According to one embodiment of the present application, Figure 2 and Figure 5 Each step involved in the method shown can be performed by Figure 7 The entity recognition device shown is performed by each unit. For example, Figure 2Step S201 shown is performed by Figure 7 The acquisition unit 701 shown is executed, and steps S202 to S203 are performed by Figure 7 The processing unit 702 shown is executed. For example, Figure 5 Step S501 shown is performed by Figure 7 The acquisition unit 701 shown is executed, and steps S502 to S509 are performed by Figure 7 The processing unit 702 is shown to execute.
[0124] According to another embodiment of the present application, Figure 7 The various units in the entity recognition device shown can be separately or all combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, other units can also be included based on the entity recognition device. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0125] According to another embodiment of the present application, the system can be implemented by including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM) and other processing elements and storage elements. For example, a general computing device such as a computer can execute the following operations: Figure 2 and Figure 5 A computer program (including program code) for each step of the corresponding method shown in FIG. Figure 7 The entity recognition device shown in the figure and the entity recognition method according to the embodiment of the present application are implemented. The computer program can be recorded on a computer-readable recording medium, for example, and loaded into the computer device through the computer-readable recording medium and run therein.
[0126] In an embodiment of the present application, first media data is determined, and a text to be recognized corresponding to the first media data is obtained; a trained entity recognition model is called to perform target recognition processing on the text to be recognized, and the entity of the text to be recognized is determined; wherein, the trained entity recognition model is used to perform error correction processing on the text to be recognized, obtain a corrected text corresponding to the text to be recognized, and perform entity recognition on the corrected text to obtain a reference entity of the corrected text; the reference entity of the corrected text is determined as the entity of the text to be recognized; the entity of the text to be recognized is used to make recommendations associated with the first media data. This solves the problem of not considering errors in the text during entity recognition, resulting in the inability to effectively recognize the corresponding entity, and improves the accuracy of entity recognition when errors exist in the text.
[0127] Based on the description of the above entity recognition method embodiment, the present application embodiment also discloses a computer device, see Figure 8 The computer device 80 may include at least a processor 801, an input device 802, an output device 803, and a memory 804. The processor 801, the input device 802, the output device 803, and the memory 804 in the computer device may be connected via a bus or other means.
[0128] The memory 804 is a memory device in a computer device, which is used to store programs and data. It is understandable that the memory 804 here can include both the built-in storage medium of the computer device and, of course, the extended storage medium supported by the computer device. The memory 804 provides a storage space, which stores the operating system of the computer device. In addition, the computer program (including program code) is also stored in the storage space. It should be noted that the computer storage medium here can be a high-speed RAM memory; optionally, it can also be at least one computer storage medium away from the aforementioned processor, and the processor can be called a central processing unit (CPU), which is the core and control center of the computer device and is used to run the computer program stored in the memory 804.
[0129] In one embodiment, the processor 801 may load and execute a computer program stored in the memory 804 to implement the corresponding steps of the method in the above-mentioned embodiment of the entity recognition method; specifically, the processor 801 loads and executes the computer program stored in the memory 804 to:
[0130] Determining first media data, and obtaining a text to be recognized corresponding to the first media data;
[0131] The trained entity recognition model is called to perform target recognition processing on the text to be recognized, and the entity of the text to be recognized is determined, wherein the trained entity recognition model performs error correction processing on the text to be recognized to obtain a corrected text, and performs entity recognition on the corrected text to obtain a reference entity of the corrected text; the reference entity of the corrected text is determined as the entity of the text to be recognized; and the entity of the text to be recognized is used to make recommendations associated with the first media data.
[0132] In one embodiment, there are multiple first media data, each of which corresponds to a text to be recognized; the processor 801 loads and executes the computer program stored in the memory 804, and is further configured to:
[0133] Acquire reference media data, and determine target media data from a plurality of first media data based on the reference media data; match an entity of the to-be-identified text corresponding to the target media data with an entity of the text corresponding to the reference media data;
[0134] Output target media data.
[0135] In one embodiment, the processor 801 loads and executes a computer program stored in the memory 804, and is further configured to:
[0136] Performing entity matching based on the entity of the text to be recognized, determining second media data, wherein the entity of the text corresponding to the second media data matches the entity of the text to be recognized;
[0137] The second media data is output.
[0138] In one embodiment, the trained entity recognition model includes a trained error correction model and a trained entity prediction model. When the trained entity recognition model is called to perform target recognition processing on the text to be recognized and determine the entity of the text to be recognized, the processor 801 loads and executes the computer program stored in the memory 804, which can be specifically used to:
[0139] Calling the trained error correction model to perform error correction processing on the text to be recognized to obtain a corrected text corresponding to the text to be recognized;
[0140] Calling the trained entity prediction model to perform entity recognition on the corrected text to obtain a reference entity of the corrected text;
[0141] The reference entity of the corrected text is determined as the entity of the text to be recognized.
[0142] In one embodiment, the trained entity recognition model includes a trained entity prediction end-to-end model, and the processor 801 loads and executes a computer program stored in the memory 804, and is further configured to:
[0143] Calling the trained entity prediction end-to-end model to perform feature extraction on the text to be recognized, and obtaining a text vector corresponding to the text to be recognized;
[0144] Performing feature extraction on the corrected text to obtain a text vector corresponding to the corrected text;
[0145] Performing feature extraction on the reference entity of the corrected text to obtain an entity vector corresponding to the reference entity of the corrected text;
[0146] Performing entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain candidate entities of the text to be recognized;
[0147] The candidate entity of the text to be recognized is determined as the entity of the text to be recognized.
[0148] In one embodiment, the processor 801 loads and executes a computer program stored in the memory 804, and is further configured to:
[0149] The candidate entities of the text to be recognized and the reference entities of the corrected text are fused to obtain the entities of the text to be recognized.
[0150] In one embodiment, when entity recognition is performed on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain a candidate entity of the text to be recognized, the processor 801 loads and executes a computer program stored in the memory 804, specifically configured to:
[0151] Calling the first attention module in the trained entity prediction end-to-end model to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized, to obtain the entity vector of the predicted entity of the text to be recognized;
[0152] The second attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the entity vector of the predicted entity of the text to be recognized and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized.
[0153] In one embodiment, when calling the first attention module in the trained entity prediction end-to-end model to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized to obtain the entity vector of the predicted entity of the text to be recognized, the processor 801 loads and executes the computer program stored in the memory 804, specifically for:
[0154] performing a difference analysis on a text vector corresponding to the corrected text and a text vector corresponding to the text to be recognized to obtain an error correction position corresponding to the corrected text, the error correction position being used to indicate a position in the corrected text of a target character that is different from a corresponding character contained in the text to be recognized;
[0155] The trained entity prediction end-to-end model is called to perform attention analysis on the error correction position and the corrected text to obtain an entity vector of the predicted entity of the text to be recognized.
[0156] In one embodiment, when calling the second attention module in the trained entity prediction end-to-end model to perform attention analysis on the entity vector of the predicted entity of the text to be recognized and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized, the processor 801 loads and executes the computer program stored in the memory 804, which can be specifically used to:
[0157] Determining a target position of the reference entity in the corrected text based on an entity vector corresponding to the reference entity;
[0158] Determining an entity vector of a predicted entity corresponding to the target position in the text to be recognized;
[0159] The second attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the entity vector of the predicted entity corresponding to the target position to obtain the candidate entity of the text to be recognized.
[0160] In one embodiment, the processor 801 loads and executes a computer program stored in the memory 804, and is also used to: obtain a first training text and an entity label corresponding to the first training text; call an entity recognition model to perform error correction on the first training text to obtain a corrected text corresponding to the first training text, and perform entity recognition on the corrected text corresponding to the first training text to obtain a predicted entity of the first training text; train the entity recognition model based on the predicted entity and the corresponding entity label of the first training text to obtain a trained entity recognition model.
[0161] In one embodiment, the processor 801 loads and executes a computer program stored in the memory 804, and is also used to: obtain a second training text and a correction text label corresponding to the second training text; call an error correction model to perform error correction on the second training text to obtain a predicted correction text corresponding to the second training text; train the error correction model based on the predicted correction text and the corresponding correction text label of the second training text to obtain a trained error correction model.
[0162] In one embodiment, the processor 801 loads and executes a computer program stored in the memory 804, and is also used to: obtain a third training text and an entity label corresponding to the third training text; call a trained error correction model to perform error correction on the third training text to obtain a corrected text corresponding to the third training text; perform entity recognition on the corrected text corresponding to the third training text to obtain a predicted entity of the third training text; train the entity prediction model based on the predicted entity of the third training text and the corresponding entity label to obtain a trained entity prediction model.
[0163] In one embodiment, the processor 801 loads and executes a computer program stored in the memory 804, and is also used to: obtain a fourth training text, a training correction text corresponding to the fourth training text, a training entity of the training correction text, and an entity label corresponding to the fourth training text; use an entity prediction end-to-end model to perform feature extraction on the fourth training text to obtain a text vector corresponding to the fourth training text; perform feature extraction on the training correction text to obtain a text vector corresponding to the training correction text; perform feature extraction on the training entity of the training correction text to obtain an entity vector corresponding to the training entity of the training correction text; perform entity recognition on the fourth training text based on the text vector corresponding to the fourth training text, the text vector corresponding to the training correction text, and the entity vector corresponding to the training entity of the training correction text to obtain a predicted entity of the fourth training text; train the entity prediction end-to-end model based on the predicted entity of the fourth training text and the corresponding entity label to obtain a trained entity prediction end-to-end model.
[0164] It should be understood that in the embodiment of the present application, the processor 801 may be a central processing unit (CPU), and the processor 801 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0165] In an embodiment of the present application, first media data is determined, and a text to be recognized corresponding to the first media data is obtained; a trained entity recognition model is called to perform target recognition processing on the text to be recognized, and the entity of the text to be recognized is determined; wherein, the trained entity recognition model is used to perform error correction processing on the text to be recognized, obtain a corrected text corresponding to the text to be recognized, and perform entity recognition on the corrected text to obtain a reference entity of the corrected text; the reference entity of the corrected text is determined as the entity of the text to be recognized; the entity of the text to be recognized is used to make recommendations associated with the first media data. This solves the problem of not considering errors in the text during entity recognition, resulting in the inability to effectively recognize the corresponding entity, and improves the accuracy of entity recognition when errors exist in the text.
[0166] In an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the steps performed in all the above embodiments can be executed.
[0167] An embodiment of the present application also provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. When the computer instructions are executed by a processor of a computer device, the methods in all the above embodiments are executed.
[0168] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0169] The above disclosure is only a preferred embodiment of the present invention, and certainly cannot be used to limit the scope of the rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made in accordance with the claims of the present invention are still within the scope of the invention.
Claims
1. A method for entity recognition, characterized in that: include: Determining first media data, and obtaining a text to be recognized corresponding to the first media data; Calling a trained entity recognition model to perform error correction processing on the text to be recognized to obtain a corrected text corresponding to the text to be recognized, and performing entity recognition on the corrected text to obtain a reference entity of the corrected text; the trained entity recognition model includes a trained entity prediction end-to-end model; Calling the trained entity prediction end-to-end model to perform feature extraction on the text to be recognized, and obtaining a text vector corresponding to the text to be recognized; Performing feature extraction on the corrected text to obtain a text vector corresponding to the corrected text; Performing feature extraction on the reference entity of the corrected text to obtain an entity vector corresponding to the reference entity of the corrected text; Performing entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain candidate entities of the text to be recognized; The candidate entity of the text to be recognized is determined as the entity of the text to be recognized; wherein the entity of the text to be recognized is used for making a recommendation associated with the first media data.
2. The method according to claim 1, wherein There are multiple first media data, each of which corresponds to a text to be recognized; and the method further includes: Acquire reference media data, and determine target media data from a plurality of first media data based on the reference media data; match an entity of the to-be-identified text corresponding to the target media data with an entity of the text corresponding to the reference media data; Output target media data.
3. The method according to claim 1, wherein The method further comprises: Performing entity matching based on the entity of the text to be recognized, determining second media data, wherein the entity of the text corresponding to the second media data matches the entity of the text to be recognized; The second media data is output.
4. The method according to claim 1, wherein The trained entity recognition model includes a trained error correction model and a trained entity prediction model; calling the trained entity recognition model to perform error correction processing on the text to be recognized to obtain a corrected text corresponding to the text to be recognized, and performing entity recognition on the corrected text to obtain a reference entity of the corrected text, including: Calling the trained error correction model to perform error correction processing on the text to be recognized to obtain a corrected text corresponding to the text to be recognized; The trained entity prediction model is called to perform entity recognition on the corrected text to obtain a reference entity of the corrected text.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: The candidate entities of the text to be recognized and the reference entities of the corrected text are fused to obtain the entities of the text to be recognized.
6. The method according to any one of claims 1 to 4, characterized in that The performing entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity to obtain candidate entities of the text to be recognized, including: Calling the first attention module in the trained entity prediction end-to-end model to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized, to obtain the entity vector of the predicted entity of the text to be recognized; The second attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the entity vector of the predicted entity of the text to be recognized and the entity vector corresponding to the reference entity to obtain the candidate entity of the text to be recognized.
7. The method according to claim 6, wherein The calling of the first attention module in the trained entity prediction end-to-end model to perform attention analysis on the text vector corresponding to the corrected text and the text vector corresponding to the text to be recognized to obtain the entity vector of the predicted entity of the text to be recognized includes: performing a difference analysis on a text vector corresponding to the corrected text and a text vector corresponding to the text to be recognized to obtain an error correction position corresponding to the corrected text, the error correction position being used to indicate a position in the corrected text of a target character that is different from a corresponding character contained in the text to be recognized; The first attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the error correction position and the corrected text to obtain an entity vector of the predicted entity of the text to be recognized.
8. The method according to claim 6, wherein The calling of the second attention module in the trained entity prediction end-to-end model to perform attention analysis on the entity vector of the predicted entity of the to-be-recognized text and the entity vector corresponding to the reference entity to obtain a candidate entity of the to-be-recognized text includes: Determining a target position of the reference entity in the corrected text based on an entity vector corresponding to the reference entity; Determining an entity vector of a predicted entity corresponding to the target position in the text to be recognized; The second attention module in the trained entity prediction end-to-end model is called to perform attention analysis on the entity vector of the predicted entity corresponding to the target position to obtain the candidate entity of the text to be recognized.
9. The method according to claim 1, wherein The method further comprises: Obtaining a first training text and an entity label corresponding to the first training text; Calling an entity recognition model to perform error correction processing on the first training text to obtain a corrected text corresponding to the first training text, and performing entity recognition on the corrected text corresponding to the first training text to obtain a predicted entity of the first training text; The entity recognition model is trained based on the predicted entities and corresponding entity labels of the first training text to obtain a trained entity recognition model.
10. The method according to claim 4, wherein The method further comprises: Obtaining a second training text and a corrected text label corresponding to the second training text; Calling the error correction model to perform error correction processing on the second training text to obtain a predicted corrected text corresponding to the second training text; The error correction model is trained based on the predicted corrected text of the second training text and the corresponding corrected text label to obtain a trained error correction model.
11. The method according to claim 4, wherein The method further comprises: Obtaining a third training text and an entity label corresponding to the third training text; Calling the trained error correction model to perform error correction processing on the third training text to obtain a corrected text corresponding to the third training text; Performing entity recognition on the correction text corresponding to the third training text to obtain a predicted entity of the third training text; The entity prediction model is trained based on the predicted entities and corresponding entity labels of the third training text to obtain a trained entity prediction model.
12. The method according to any one of claims 1 to 4, wherein: The method further comprises: Obtaining a fourth training text, a training correction text corresponding to the fourth training text, a training entity of the training correction text, and an entity label corresponding to the fourth training text; Performing feature extraction on the fourth training text using an entity prediction end-to-end model to obtain a text vector corresponding to the fourth training text; Performing feature extraction on the training correction text to obtain a text vector corresponding to the training correction text; Performing feature extraction on the training entity of the training correction text to obtain an entity vector corresponding to the training entity of the training correction text; Performing entity recognition on the fourth training text based on the text vector corresponding to the fourth training text, the text vector corresponding to the training correction text, and the entity vector corresponding to the training entity of the training correction text to obtain a predicted entity of the fourth training text; The entity prediction end-to-end model is trained based on the predicted entities and corresponding entity labels of the fourth training text to obtain a trained entity prediction end-to-end model.
13. An entity recognition device, characterized in that: include: an acquiring unit, configured to determine first media data and acquire a text to be recognized corresponding to the first media data; a processing unit, configured to call a trained entity recognition model to perform error correction processing on the text to be recognized, obtain a corrected text corresponding to the text to be recognized, and perform entity recognition on the corrected text to obtain a reference entity of the corrected text; the trained entity recognition model includes a trained entity prediction end-to-end model; The processing unit is further used to: call the trained entity prediction end-to-end model to perform feature extraction on the text to be recognized, and obtain a text vector corresponding to the text to be recognized; perform feature extraction on the corrected text, and obtain a text vector corresponding to the corrected text; perform feature extraction on the reference entity of the corrected text, and obtain an entity vector corresponding to the reference entity of the corrected text; perform entity recognition on the text to be recognized based on the text vector corresponding to the text to be recognized, the text vector corresponding to the corrected text, and the entity vector corresponding to the reference entity, and obtain a candidate entity of the text to be recognized; determine the candidate entity of the text to be recognized as the entity of the text to be recognized; wherein, the entity of the text to be recognized is used to make recommendations associated with the first media data.
14. A computer device, characterized in that: a processor adapted to implement one or more computer programs; A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by the processor and executing the entity recognition method according to any one of claims 1 to 12.
15. A computer program product or a computer program, characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. When the computer program is executed by a processor of a computer device, the entity recognition method according to any one of claims 1 to 12 is executed.
Citation Information
Patent Citations
Method and device for processing data in application program, electronic equipment and storage medium
CN110647987A
Text error correction method and device
CN113836874A