Training method of entity recognition model, entity recognition method and device of text
By using self-attention processing and label-constrained models to filter target entities, and combining music knowledge graphs and user search data, the entity recognition accuracy of music review texts has been improved, solving the problem of low recognition accuracy of traditional models in diverse texts.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2026-04-07
AI Technical Summary
Traditional entity recognition models have low accuracy in music review texts and struggle to effectively handle diverse and context-lacking song review texts.
By filtering target entities using a self-attention processing model, and combining music knowledge graphs and user search data, the accuracy of entity recognition is improved by using feature processing models and label constraint models.
It improves the accuracy of entity recognition in music text data and enhances the ability to recognize entities with diverse forms.
Smart Images

Figure CN116738228B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method for training an entity recognition model, a method for recognizing entities in text, a computer device, a storage medium, and a computer program product. Background Technology
[0002] Entity recognition methods are widely used in natural language processing tasks across various fields. In the music field, meaningful entity information, such as artist names and album names, can be identified from song comment text. This identified entity information can then be used for natural language processing tasks such as song search, question answering systems, sentiment analysis, and machine translation.
[0003] In traditional technologies, entity recognition models based on machine learning and deep learning are often used to identify entity information in song review texts. However, song review texts are not only diverse, such as varying in length and lacking contextual information, but also contain a large amount of music domain knowledge, such as singer names, song titles, game names, and movie / TV show titles, as well as colloquial entity information such as nicknames and aliases. This makes it difficult to achieve high accuracy when using traditional entity recognition models to identify entities in song review texts. Summary of the Invention
[0004] Therefore, it is necessary to provide an entity recognition model training method, a text entity recognition method, a computer device, a computer-readable storage medium, and a computer program product that can improve the accuracy of entity recognition for music text data, in order to address the above-mentioned technical problems.
[0005] Firstly, this application provides a method for training an entity recognition model. The method includes:
[0006] Target entities are selected from candidate entities in the training text, and target entity information of the target entities is determined; the target entity information includes the target entity location of the target entity.
[0007] The character embedding features of the training text and the word embedding features of the candidate entities are processed by the feature processing model in the entity recognition model to be trained to obtain attention features. Then, the attention features are processed by label prediction to obtain the predicted label information of the training text. The predicted label information includes the predicted entity position of the training text.
[0008] By using the label constraint model in the entity recognition model to be trained, the predicted label information is subjected to label constraint processing to obtain the predicted entity information of the training text.
[0009] Based on the difference between the predicted entity information and the target entity information, the entity recognition model to be trained is trained to obtain the trained entity recognition model.
[0010] In one embodiment, attention features are obtained by performing self-attention processing on the character embedding features of the training text and the word embedding features of the candidate entities through the feature processing model in the entity recognition model to be trained, including:
[0011] The feature processing model uses the word embedding features of the candidate entities associated with the word embedding features as the target word embedding features of the word embedding features;
[0012] Determine the relative position information of the word embedding features;
[0013] Self-attention processing is performed on the relative position information and the target word embedding features to obtain the attention features of the word embedding features.
[0014] In one embodiment, selecting target entities from candidate entities in the training text includes:
[0015] The candidate entity is identified as an associated entity in the music relationship network, and the degree of association between the associated entity and the song corresponding to the training text is determined; the music relationship network is constructed based on entity relationships in a music knowledge graph.
[0016] The confidence level of the candidate entity is determined based on the number of searches and the length of the candidate entity, as well as the degree of association.
[0017] Based on the confidence level, target entities that meet the preset confidence level conditions are selected from the candidate entities. In one embodiment, determining the target entity information of the target entity includes:
[0018] Based on the intent probability distribution of the target entity, determine the target entity type of the target entity;
[0019] The target entity information of the target entity is obtained based on the target entity location and the target entity type.
[0020] In one embodiment, before filtering out target entities from candidate entities in the training text and determining the target entity information of the target entity, the method further includes:
[0021] The search count of the candidate entity is obtained based on the user search data corresponding to the training text;
[0022] The user search data is processed to identify intent, thereby obtaining the intent probability distribution of the target entity.
[0023] In one embodiment, before filtering out target entities from candidate entities in the training text and determining the target entity information of the target entity, the method further includes:
[0024] Based on the music knowledge graph, a music entity dictionary is generated;
[0025] A text matching model is constructed based on the music entity dictionary, and the training text is processed by the text matching model to obtain candidate entities of the training text.
[0026] Secondly, this application provides a method for entity recognition of text. The method includes:
[0027] Obtain the text to be recognized;
[0028] The text to be identified is input into the trained entity recognition model to obtain the predicted entity information of the text to be identified; the predicted entity information includes the predicted entity position of the text to be identified; the trained entity recognition model is trained according to the method described in any embodiment of the first aspect.
[0029] In one embodiment, the text to be identified is input into a trained entity recognition model to obtain predicted entity information of the text to be identified, including:
[0030] By using the trained entity recognition model, self-attention processing is performed on the character embedding features of the text to be recognized and the word embedding features of the candidate entities to obtain the attention features of the text to be recognized.
[0031] The attention features of the text to be identified are subjected to label prediction processing to obtain the predicted label information of the text to be identified;
[0032] The predicted label information of the text to be identified is subjected to label constraint processing to obtain the predicted entity information of the text to be identified.
[0033] In one embodiment, after inputting the text to be recognized into the trained entity recognition model to obtain the predicted entity information of the text to be recognized, the method further includes:
[0034] Obtain the identification information of the text to be identified, and obtain the associated text of the text to be identified based on the identification information;
[0035] The associated text is input into the trained entity recognition model to obtain the predicted entity information of the associated text;
[0036] Based on the predicted entity information of the associated text, the predicted entity information of the text to be identified is updated to obtain the target entity information of the text to be identified.
[0037] In one embodiment, the predicted entity information of the text to be identified is updated based on the predicted entity information of the associated text to obtain the target entity information of the text to be identified, including:
[0038] Based on the frequency of occurrence of the predicted entity information of the associated text, entity information to be updated that meets the preset frequency condition is selected from the predicted entity information of the associated text.
[0039] If the predicted entity information of the text to be identified does not contain the entity information to be updated, then the entity information to be updated is added to the predicted entity information of the text to be identified to obtain the target entity information.
[0040] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0041] Target entities are selected from candidate entities in the training text, and target entity information of the target entities is determined; the target entity information includes the target entity location of the target entity.
[0042] The character embedding features of the training text and the word embedding features of the candidate entities are processed by the feature processing model in the entity recognition model to be trained to obtain attention features. Then, the attention features are processed by label prediction to obtain the predicted label information of the training text. The predicted label information includes the predicted entity position of the training text.
[0043] By using the label constraint model in the entity recognition model to be trained, the predicted label information is processed to obtain the predicted entity information of the training text.
[0044] Based on the difference between the predicted entity information and the target entity information, the entity recognition model to be trained is trained to obtain the trained entity recognition model.
[0045] Fourthly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0046] Obtain the text to be recognized;
[0047] The text to be identified is input into the trained entity recognition model to obtain the predicted entity information of the text to be identified; the predicted entity information includes the predicted entity position of the text to be identified; the trained entity recognition model is trained according to the method described in any embodiment of the first aspect.
[0048] Fifthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0049] Target entities are selected from candidate entities in the training text, and target entity information of the target entities is determined; the target entity information includes the target entity location of the target entity.
[0050] The entity recognition model to be trained performs self-attention processing on the word embedding features of the training text and the word embedding features of the candidate entities to obtain attention features, and performs label prediction processing on the attention features to obtain the predicted label information of the training text; the predicted label information includes the predicted entity position of the training text; the entity recognition model to be trained also includes a label constraint model.
[0051] By using the label constraint model in the entity recognition model to be trained, the predicted label information is processed to obtain the predicted entity information of the training text.
[0052] Based on the difference between the predicted entity information and the target entity information, the entity recognition model to be trained is trained to obtain the trained entity recognition model.
[0053] Sixthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0054] Obtain the text to be recognized;
[0055] The text to be identified is input into the trained entity recognition model to obtain the predicted entity information of the text to be identified; the predicted entity information includes the predicted entity position of the text to be identified; the trained entity recognition model is trained according to the method described in any embodiment of the first aspect.
[0056] Seventhly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0057] Target entities are selected from candidate entities in the training text, and target entity information of the target entities is determined; the target entity information includes the target entity location of the target entity.
[0058] The entity recognition model to be trained performs self-attention processing on the word embedding features of the training text and the word embedding features of the candidate entities to obtain attention features, and performs label prediction processing on the attention features to obtain the predicted label information of the training text; the predicted label information includes the predicted entity position of the training text; the entity recognition model to be trained also includes a label constraint model.
[0059] By using the label constraint model in the entity recognition model to be trained, the predicted label information is processed to obtain the predicted entity information of the training text.
[0060] Based on the difference between the predicted entity information and the target entity information, the entity recognition model to be trained is trained to obtain the trained entity recognition model.
[0061] Eighthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0062] Obtain the text to be recognized;
[0063] The text to be identified is input into the trained entity recognition model to obtain the predicted entity information of the text to be identified; the predicted entity information includes the predicted entity position of the text to be identified; the trained entity recognition model is trained according to the method described in any embodiment of the first aspect.
[0064] The aforementioned entity recognition model training method, text entity recognition method, computer equipment, storage medium, and computer program product select target entities from candidate entities in the training text and determine the target entity information. Through the feature processing model in the entity recognition model to be trained, self-attention processing is performed on the word embedding features of the training text and the word embedding features of the candidate entities to obtain attention features. Label prediction processing is then performed on the attention features to obtain the predicted label information of the training text. Through the label constraint model in the entity recognition model to be trained, label constraint processing is performed on the predicted label information to obtain the predicted entity information of the training text. Based on the difference between the predicted entity information and the target entity information, the entity recognition model to be trained is trained to obtain the trained entity recognition model. By introducing the word embedding features of the candidate entities in the training text into the self-attention processing process of the entity recognition model, the entity recognition model can learn the correlation between the current word embedding features and each candidate entity, thereby improving the recognition ability of diverse entities in the music domain and increasing the entity recognition accuracy of the trained entity recognition model for text data in the music domain. Attached Figure Description
[0065] Figure 1 This is a flowchart illustrating the entity recognition model training method in one embodiment;
[0066] Figure 2 This is a schematic diagram illustrating the principle of an entity recognition model in one embodiment;
[0067] Figure 3 This is a flowchart illustrating the self-attention processing steps for character embedding features of training text and word embedding features of candidate entities in one embodiment.
[0068] Figure 4 This is a flowchart illustrating a text entity recognition method in one embodiment;
[0069] Figure 5 This is a flowchart illustrating the entity recognition model training method and the text entity recognition method in another embodiment;
[0070] Figure 6 This is a flowchart illustrating a text entity recognition method in another embodiment;
[0071] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0072] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0073] In one embodiment, such as Figure 1 As shown, a training method for an entity recognition model is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. The server can be a standalone server or a server cluster consisting of multiple servers. In this embodiment, the method includes the following steps:
[0074] Step S101: Select target entities from candidate entities in the training text and determine the target entity information of the target entities; the target entity information includes the target entity location of the target entity.
[0075] Here, training text refers to the text data used to train the entity recognition model. This training text could be a song review. Candidate entities are entities initially selected from the training text. Target entities are entities selected from the candidate entities that meet pre-set confidence criteria; during the training of the entity recognition model, target entities can serve as labels for the training text.
[0076] The target entity position and the predicted entity position in step S103 below, also known as the entity boundary, are used to indicate the start position, end position, or position that does not belong to any entity, and can also indicate the middle position of the entity; however, the target entity position is for the target entity, while the predicted entity position is for the training text of the input entity recognition model.
[0077] Specifically, the terminal can obtain comment texts of different songs as training text, then perform text matching processing on the training text to obtain candidate entities. To ensure the accuracy of the candidate entities, target entities can be filtered out from the candidate entities, and the target entity information of the target entity can be determined. The target entity information can contain only the target entity location, or it can contain both target entity type and target entity location information. The target entity type and the predicted entity type output by the entity recognition model below both indicate the specific type of the entity; however, the target entity type refers to the target entity, while the predicted entity type refers to the training text input to the entity recognition model. The target entity type can include song type, artist type, IP type, and album type, etc. It is understood that "IP" refers to the collective term for all well-known cultural and creative works (TV series, movies, variety shows, games, radio dramas, animations, novels, etc.), not a network IP address.
[0078] In practical applications, the terminal can first acquire comment texts for different songs, then perform text matching processing on the comment texts to obtain candidate entities. Next, it can filter out target entities from the candidate entities and determine the target entity information. Finally, it can select a portion of the comment texts as training texts and another portion as test texts. Furthermore, if candidate entities cannot be matched from the training texts in subsequent processing, the feature matrix of the candidate entities can be denoted as a matrix of all zeros.
[0079] Step S102: Using the feature processing model in the entity recognition model to be trained, self-attention processing is performed on the word embedding features of the training text and the word embedding features of the candidate entities to obtain attention features, and label prediction processing is performed on the attention features to obtain the predicted label information of the training text; the predicted label information includes the predicted entity position of the training text.
[0080] In this context, an entity recognition model refers to a model used to identify entities in text data (e.g., training text and text to be recognized). Character embedding features are information that characterizes the salient properties of individual characters in text data. Word embedding features are information that characterizes the salient properties of entire words containing candidate entities. A feature processing model is a model used to extract text features from the training text and predict label information. The feature processing model can be a Transformer model.
[0081] In this context, the predicted label information refers to the predicted entity position (or predicted entity type and predicted entity position) obtained by the entity recognition model based on the input text data. It's understood that the predicted label information in this method differs from the predicted labels in traditional techniques, which only describe type probabilities. The predicted label information in this method also needs to indicate the probability of belonging to different positions within an entity and the probability of not belonging to an entity. Taking the BIO annotation method (B, begin, representing the beginning position of the entity; I, inside, representing the middle or end position of the entity; O, outside, representing not belonging to an entity) in the entity recognition field as an example, assuming the entity type includes song type and singer type, the predicted label information could be [B-song: 0.6, I-song: 0.2, B-singer: 0.1, I-singer: 0.08, O: 0.02]; where "B-song: 0.6" in the predicted label information indicates that it belongs to the beginning position of the entity, and the target entity type is song. The probability of the type is 0.6; the "I-song: 0.2" in the prediction label information indicates that it belongs to the middle position of the entity and the probability that the target entity type is song is 0.2; the "B-singer: 0.1" in the prediction label information indicates that it belongs to the beginning position of the entity and the probability that the target entity type is singer is 0.1; the "I-singer: 0.08" in the prediction label information indicates that it belongs to the middle position of the entity and the probability that the target entity type is singer is 0.08; the "O: 0.02" in the prediction label information indicates that the probability that it does not belong to the entity is 0.02.
[0082] Specifically, Figure 2 This is a schematic diagram illustrating the principle of an entity recognition model. (For example...) Figure 2 As shown, the terminal inputs training text into a pre-trained BERT (Bidirectional Encoder Representation from Transformers) model. The pre-trained BERT model performs feature extraction on the training text to obtain character embeddings. Furthermore, the terminal calculates word embeddings for candidate entities based on their intent probability distribution and search frequency. The terminal then inputs these character embeddings into a feature processing model, simultaneously introducing word embeddings into the attention layer of the feature processing model. Self-attention processing is then applied to both the character embeddings of the training text and the word embeddings of the candidate entities to obtain corresponding attention features. Finally, the terminal uses the feature processing model to perform label prediction on the attention features and character embeddings, outputting the predicted label information for the training text.
[0083] Step S103: Through the label constraint model in the entity recognition model to be trained, the predicted label information is processed by label constraint to obtain the predicted entity information of the training text.
[0084] In this context, predicted entity information refers to the entity information of the training text obtained after label constraint processing. Unlike predicted label information, which indicates the probability of multiple locations, predicted entity information directly indicates the entity location (or entity type and entity location); for example, predicted entity information could be B-song.
[0085] The label constraint model refers to a model used to add constraints to the predicted label information. The label constraint model can be constructed based on a Conditional Random Field (CRF).
[0086] Specifically, such as Figure 2 As shown, after obtaining the predicted label information of the training text in step S102, the terminal inputs the predicted label information into the label constraint model in the entity recognition model. The label constraint model performs label constraint processing on the predicted label information, which can add constraints to the predicted label information to ensure the accuracy of the output predicted entity information. It is understandable that, since the feature processing model (such as the transformer) does not explicitly learn the sequential relationship between different predicted label information, the order of the predicted entity positions output by the transformer may be disordered. Therefore, further processing of the predicted label information is required through the label constraint model.
[0087] Taking the BIO annotation method as an example, the constraint can be that the first word of an entity always begins with "B" in the BIO annotation method, instead of "I", and the last word always ends with "I", and "O" will not appear in the entity. For example, after adding constraints to the predicted label information, the output predicted entity information will be in the form of "BII…I", instead of "IIIO" or "OIIIB".
[0088] Step S104: Based on the difference between the predicted entity information and the target entity information, train the entity recognition model to be trained to obtain the trained entity recognition model.
[0089] Specifically, the terminal obtains the loss of the entity recognition model to be trained based on the difference between the predicted entity information and the target entity information corresponding to the training text; then, based on the loss of the entity recognition model to be trained, iteratively trains the entity recognition model to be trained to obtain the trained entity recognition model.
[0090] In the training method of the aforementioned entity recognition model, target entities are selected from candidate entities in the training text, and the target entity information is determined. Through the feature processing model in the entity recognition model to be trained, self-attention processing is performed on the word embedding features of the training text and the word embedding features of the candidate entities to obtain attention features. Label prediction processing is then performed on the attention features to obtain the predicted label information of the training text. Through the label constraint model in the entity recognition model to be trained, label constraint processing is performed on the predicted label information to obtain the predicted entity information of the training text. Based on the difference between the predicted entity information and the target entity information, the entity recognition model to be trained is trained to obtain the trained entity recognition model. By introducing the word embedding features of the candidate entities in the training text into the self-attention processing process of the entity recognition model, the entity recognition model can learn the correlation between the current word embedding features and each candidate entity, thereby improving the recognition ability of diverse entities in the music domain and thus increasing the entity recognition accuracy of the trained entity recognition model for text data in the music domain.
[0091] In one embodiment, such as Figure 3 As shown, step S102 above involves using the feature processing model in the entity recognition model to be trained to perform self-attention processing on the character embedding features of the training text and the word embedding features of the candidate entities to obtain attention features. Specifically, this includes the following:
[0092] Step S301: The feature processing model uses the word embedding features of the candidate entities associated with the word embedding features as the target word embedding features of the word embedding features.
[0093] Specifically, there may be multiple candidate entities in the training text, but when calculating attention features, it is necessary to filter out the word embedding features of candidate entities that are associated with the word embedding features. This can be done by the feature processing model, which filters out candidate entities that are associated with the character positions from the word embedding features of the candidate entities (to distinguish them from other candidate entities, they can be called associated entities), and uses the word embedding features of the associated entities as the target word embedding features of the word embedding features.
[0094] Step S302: Determine the relative position information of the word embedding features.
[0095] The relative position information is used to describe the relative distance between two word embedding features.
[0096] Step S303: Perform self-attention processing on the relative position information and target word embedding features to obtain the attention features of the word embedding features.
[0097] Among them, attention features refer to data that describes the attention of word embedding features; for example, attention features can be the attention values of the characters corresponding to word embedding features.
[0098] Specifically, the terminal performs self-attention processing on the relative position information and the target word embedding features. This can be achieved by inputting the self-attention calculation formula into the formula, which then gives the terminal the attention features of the word embedding features. The self-attention calculation formula is shown in formula (1).
[0099]
[0100] In the formula, Indicates attentional characteristics; This indicates the degree of relevance of each associated entity to the current associated entity; for The general expression, representing the use of all Perform calculations; V represents the value vector; This represents the embedding feature of the t-th character; This represents the embedding feature of the j-th character of the associated entity; This represents the relative positional information between the embedding features of the t-th character and the embedding features of the j-th character; Let represent the target word embedding feature of the t-th character; u, v, and w are learnable model parameters.
[0101] As can be seen from formula (1), the terminal first uses character embedding features to calculate the correlation between characters in the training text. Then, the correlation between the word embedding features and the relative position information is calculated. Then, the correlation between the character embedding features and the target word embedding features is calculated. Finally, combine , , Attention features are obtained by calculating the model parameters (u, v, and w).
[0102] For example, suppose the comment text is "If you like the beginning, I recommend listening to 'Li Jie Cheng Yi'; if you like the opera-style parts, I recommend listening to 'Yuan Fen Yi Dao Qiao'." At the end of the text, the terminal matches two candidate entities of song type, namely "Yuan Fen" and "Yuan Fen Yi Dao Qiao". The terminal can then use the word embedding features of the candidate entities "Yuan Fen" and "Yuan Fen Yi Dao Qiao" as the target word embedding features of the character "Yuan", and add them to the calculation of the attention features of the character "Yuan".
[0103] In this embodiment, the word embedding feature of the candidate entity associated with the word embedding feature is used as the target word embedding feature of the word embedding feature; furthermore, the relative position information of the word embedding feature is determined; the self-attention processing is performed on the relative position information and the target word embedding feature to obtain the attention feature of the word embedding feature, realizing the reasonable acquisition of the attention feature of the word embedding feature, and the target word embedding feature of the associated entity of the character is introduced into the attention feature, enabling the entity recognition model to learn the correlation between the current word embedding feature and each candidate entity, which is beneficial to improving the recognition ability of the entity recognition model.
[0104] In one embodiment, step S101 above, screening out the target entity from the candidate entities of the training text and determining the target entity information of the target entity specifically includes the following content: determining the associated entity of the candidate entity in the music relationship network and determining the degree of association between the associated entity and the song corresponding to the training text; the music relationship network is constructed based on the entity relationships in the music knowledge graph; determining the confidence of the candidate entity according to the search times and entity length of the candidate entity, and the degree of association; screening out the target entity that meets the preset confidence condition from the candidate entities according to the confidence.
[0105] Among them, the search times are used to describe the search popularity of the candidate entity; for example, the candidate entities Jay Chou and Rice Fragrance have relatively high search times.
[0106] Among them, the entity length is used to describe the character length of the candidate entity. It can be understood that since the lengths of some entities are shorter and more colloquial, they are more likely to have a relatively high search times. For example, come on and time, etc., so the entity length can also be added to the calculation of the confidence. In this embodiment, the candidate entity with a high entity length and a large number of search times is more reliable than the candidate entity with a short entity length and a large number of search times.
[0107] After obtaining candidate entities from the training text, the terminal can filter out target entities with higher accuracy. Specifically, it determines the associated entities of the candidate entities in the music relationship network and the degree of association between the associated entities and the songs corresponding to the training text. The music relationship network is constructed based on entity relationships in a music knowledge graph. The terminal can obtain the associated entities of the candidate entities from the music relationship network and then determine whether the associated entities belong to the relevant or secondary relevant entities of the songs corresponding to the training text. This can be done by using the identification information (such as song ID) of the song to which the training text belongs, retrieving all songs, artists, albums, and other entities related to that identification information from the music relationship network, and then determining whether the associated entities belong to the relevant or secondary relevant entities. The degree of association between the associated entities and the songs corresponding to the training text is then determined based on whether the associated entities belong to the relevant or secondary relevant entities. The terminal calculates the confidence level of the candidate entities based on the total number of occurrences of the candidate entities in all training texts, the number of searches for the candidate entities, the entity length, and the degree of association. For example, parameters such as search count, entity length, and relevance can be mapped to obtain corresponding parameters. These parameters are then weighted and summed to obtain the confidence score of the candidate entity. Alternatively, based on the mapping relationship between search count, entity length, relevance, and confidence score (where both increase or decrease simultaneously), the initial value of the confidence score can be increased or decreased to ultimately obtain the confidence score of the candidate entity. The terminal then uses this confidence score to filter target entities from the candidate entities that meet pre-set confidence criteria. For instance, if the pre-set confidence criteria are set to be higher than a pre-set confidence threshold, candidate entities with confidence scores higher than the pre-set threshold can be selected as target entities.
[0108] In this context, relevant entities refer to entities directly related to the current song; secondary relevant entities refer to entities with secondary relationships to the current song. Whether an entity belongs to a relevant entity or a secondary relevant entity can be determined from the music relationship network. In this embodiment, if a candidate entity's associated entities belong to relevant entities of the current song, the candidate entity is considered to have high confidence. Furthermore, secondary relevant entities can be used to further enrich the entity relationships, thereby improving the overall recall rate.
[0109] The music relationship network is constructed based on entity relationships in a music knowledge graph. It can be a two-hop "song-singer-album" music relationship network built from song-singer relationships and song-album relationships. Furthermore, IP types can be introduced into the music relationship network to construct IP-song relationships, IP-album relationships, IP-singer relationships, etc., thereby increasing the richness of entity relationships in the music relationship network and improving the accuracy of identifying target entities.
[0110] In practical applications, some reviews may have a very large number of candidate entities. To ensure the training efficiency of the model, a maximum number of candidate entities can be set. Simultaneously, to avoid the situation where the number of candidate texts with low confidence in the first half of the training text directly reaches the maximum number of candidate entities, causing higher-confidence candidate entities in the second half to fail to be matched, the confidence-based filtering method in this embodiment can be used to solve this problem. To verify the accuracy of the target entities in this method, 500,000 music review texts were prepared. Candidate entities were extracted from 200,000 of these texts and further processed to obtain the target entities. Then, 200 music review texts were selected for experiments to verify the accuracy of the target entities obtained by the above method. The experimental results are shown in Table 1.
[0111] Table 1
[0112]
[0113] As shown in Table 1, the F1 score, precision, and recall of the target entities obtained by the above method are all higher than 80%, indicating that the obtained target entities have high accuracy. Furthermore, the terminal can randomly select 50,000 texts from the remaining 300,000 music review texts as training text for the entity recognition model.
[0114] In this embodiment, the confidence level of candidate entities is first determined based on the number of searches and the length of the candidate entities, as well as the music relationship network. Then, based on the confidence level, target entities that meet the preset confidence level conditions are selected from the candidate entities, thus achieving reasonable selection of target entities. This allows the target entities with higher confidence levels to be directly used in subsequent steps to train the entity recognition model, thereby improving the training effect of the entity recognition model.
[0115] In one embodiment, step S101, determining the target entity information of the target entity, specifically includes the following: filtering target entities that meet the preset confidence conditions from candidate entities based on confidence level; determining the target entity type of the target entity based on the intent probability distribution of the target entity; and obtaining the target entity information of the target entity based on the target entity location and target entity type of the target entity.
[0116] Based on the intent probability distribution of the target entity, the target entity type is determined. This can be achieved by using the entity type corresponding to the highest intent probability in the distribution, or by using the entity types corresponding to multiple intent probabilities exceeding a preset intent probability threshold, thus resolving the issue of duplicate entity names. For example, "Sunny Doll" is both an album title and a song title, so the target entity type for "Sunny Doll" would be [Album Type, Song Type]. Finally, the target entity location and target entity type are used as the target entity information. The preset confidence condition can be set to a confidence level higher than a preset confidence threshold.
[0117] In this embodiment, the target entity information is obtained by utilizing the target entity location and target entity type. The target entity information can then be used as a label to perform subsequent training steps of the entity recognition model.
[0118] In one embodiment, before step S101 above, in which the target entity is selected from the candidate entities of the training text and the target entity information of the target entity is determined, the method further includes: obtaining the search count of the candidate entity based on the user search data corresponding to the training text; and performing intent recognition processing on the user search data to obtain the intent probability distribution of the target entity.
[0119] Among them, the intent probability distribution refers to the intent probability distribution under different entity types obtained from the analysis of user search data.
[0120] Specifically, the terminal can obtain user search data corresponding to each training text from the search engine; then, by statistically analyzing the user search data corresponding to the training text, it can obtain the search frequency of candidate entities. The terminal can also perform intent recognition processing on the user search data to determine the intent probability of the target entity corresponding to different entity types, thereby obtaining the intent probability distribution of the target entity. Furthermore, the terminal can directly query the music entity dictionary to obtain the search frequency and intent probability distribution of each candidate entity. Here, the search engine refers to the terminal used by users when searching for music or posting music-related information.
[0121] For example, a music entity dictionary can contain the following information: entity name (str, string type); entity type (list, list type); intent probability distribution [track_prob (song probability), singer_prob (singer probability), movie_prob (IP probability), album_prob (album probability), hotness (number of searches)].
[0122] In this embodiment, according to the user search data corresponding to the training text, the search times of candidate entities are obtained; the user search data is processed for intent recognition to obtain the intent probability distribution of the target entity. Based on the search times, the intent probability distribution of the target entity is determined, so that in subsequent steps, the entity type of the target entity is processed based on the intent probability, realizing the automatic annotation of the target entity. For the real review texts in the search end, fast automatic annotation can also be achieved without manual annotation, and a large number of training texts and the labels of the training texts can be obtained quickly and conveniently.
[0123] In one embodiment, before screening out the target entity from the candidate entities of the training text and determining the target entity information of the target entity in the above step S101, it further includes: generating a music entity dictionary according to the music knowledge graph; constructing a text matching model based on the music entity dictionary, and performing text matching processing on the training text through the text matching model to obtain the candidate entities of the training text.
[0124] Among them, the text matching model is used to match all entities located in the music entity dictionary from the text data. The text matching model can be an ac automaton (Aho-Corasick).
[0125] Specifically, the terminal generates a music entity dictionary according to the music knowledge graph, which can be to extract the entity names from the music knowledge graph, then obtain the search times and intent distribution probabilities corresponding to the entity names, and determine the entity type of the entity name based on the intent distribution probability. Furthermore, the terminal combines the entity name, search times, intent probability distribution and entity type to obtain the music entity dictionary. In practical applications, the music entity dictionary contains 18 million entity names. For entity names with the same name, multiple entity types can be added to one entity name. For example, "Sunny Doll" is both the name of an album and the name of a song, so the entity type of the entity name "Sunny Doll" is [album type, song type]. Further, the terminal constructs a text matching model based on the music entity dictionary, and performs text matching processing on the training text through the text matching model, which can be to match all entities located in the music entity dictionary from the text data, and then the terminal obtains the candidate entities of the training text.
[0126] In practical applications, considering that the constructed music entity dictionary may not be complete, the candidate entities obtained by text matching based on the music entity dictionary may also be incomplete. Therefore, rule extraction can also be performed on the training text, which can be to extract obvious entities marked by "《》" from the training text, and then the terminal obtains new candidate entities.
[0127] In this embodiment, a music entity dictionary is first generated based on the music knowledge graph; then, a text matching model is constructed based on the music entity dictionary, and the training text is processed by the text matching model to obtain candidate entities of the training text. In addition, the candidate entities of the training text can be further improved by rule extraction, realizing multiple ways to obtain candidate entities and improving the annotation accuracy of the training text.
[0128] In one embodiment, such as Figure 4 As shown, a text entity recognition method is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. The server can be a standalone server or a server cluster consisting of multiple servers. In this embodiment, the method includes the following steps:
[0129] Step S401: Obtain the text to be recognized.
[0130] The text to be identified refers to the text data that needs to be identified as an entity.
[0131] Specifically, the terminal can obtain the text to be recognized from the search engine, or it can obtain the text to be recognized from the server, database, or other means.
[0132] Step S402: Input the text to be recognized into the trained entity recognition model to obtain the predicted entity information of the text to be recognized; the predicted entity information includes the predicted entity position of the text to be recognized; the trained entity recognition model is trained according to the above steps S101 to S104.
[0133] Entity recognition models are models used to identify entities in text data (such as text to be recognized).
[0134] Specifically, after the entity recognition model is trained through the above steps S101 to S104, the terminal can input the text to be recognized into the trained entity recognition model so that the trained entity recognition model can perform entity recognition processing on the text to be recognized, and then the terminal obtains the predicted entity information of the text to be recognized.
[0135] The aforementioned entity recognition method for text obtains predicted entity information of the text by inputting the acquired text to be recognized into a trained entity recognition model. It can accurately recognize entities of diverse texts in the music field through the trained entity recognition model, thereby improving the entity recognition accuracy of the trained entity recognition model for text data in the music field.
[0136] In one embodiment, step S402 above, which inputs the text to be recognized into the trained entity recognition model to obtain the predicted entity information of the text to be recognized, specifically includes the following: using the trained entity recognition model, performing self-attention processing on the word embedding features of the text to be recognized and the word embedding features of the candidate entities to obtain the attention features of the text to be recognized; performing label prediction processing on the attention features of the text to be recognized to obtain the predicted label information of the text to be recognized; and performing label constraint processing on the predicted label information of the text to be recognized to obtain the predicted entity information of the text to be recognized.
[0137] Specifically, the terminal uses a pre-trained BERT model to extract features from the text to be recognized, obtaining the word embedding features. Simultaneously, the terminal uses a text matching model to perform text matching on the text to be recognized, obtaining the first candidate entity; it can also extract rules from the text to obtain the second candidate entity; thus, the first and second candidate entities together constitute the candidate entities of the text to be recognized. Based on the intent probability distribution and search frequency of the candidate entities, the terminal calculates the word embedding features of the candidate entities. Then, the terminal uses a trained entity recognition model to perform self-attention processing on the word embedding features of the text to be recognized and the word embedding features of the candidate entities, obtaining the corresponding attention features. The terminal uses the feature processing model in the trained entity recognition model to perform label prediction processing on the attention features and word embedding features of the text to be recognized, outputting the predicted label information of the text to be recognized. Then, the terminal inputs the predicted label information of the text to be recognized into the label constraint model in the trained entity recognition model. Through the label constraint model, the predicted label information of the text to be recognized is processed for label constraint, thus obtaining the predicted entity information of the text to be recognized.
[0138] In this embodiment, by introducing word embedding features of candidate entities of the text to be identified into the self-attention processing of the trained entity recognition model, the trained entity recognition model can extract the correlation between the word embedding features of the text to be identified and each candidate entity, thereby improving the ability to identify diverse entities in the music field and thus improving the entity recognition accuracy of the trained entity recognition model for the text to be identified in the music field.
[0139] In one embodiment, after step S402 above, where the text to be recognized is input into the trained entity recognition model to obtain the predicted entity information of the text to be recognized, the method further includes: inputting the associated text of the text to be recognized into the trained entity recognition model to obtain the predicted entity information of the associated text; updating the predicted entity information of the text to be recognized based on the predicted entity information of the associated text to obtain the target entity information of the text to be recognized.
[0140] The identification information refers to the identifier of the song to which the text to be identified belongs. For example, the identification information could be the song's ID.
[0141] Specifically, the terminal determines the song to which the text to be identified belongs and obtains the song's identifier information. Then, based on this identifier information, the terminal queries text data belonging to the same identifier information as associated text. For example, it can query text data matching the identifier information from a music entity dictionary, or it can query text data matching the identifier information from a database. The terminal can input the associated text into the trained entity recognition model in real time to obtain predicted entity information for the associated text, or it can pre-process the predicted entity information for the associated text. The terminal updates the predicted entity information for the text to be identified based on the predicted entity information for the associated text, thus obtaining the target entity information for the text to be identified.
[0142] In this embodiment, the associated text of the text to be identified is obtained based on the identification information of the text to be identified; then the associated text is input into the trained entity recognition model to obtain the predicted entity information of the associated text; finally, the predicted entity information of the text to be identified is updated based on the predicted entity information of the associated text to obtain the target entity information of the text to be identified. This realizes the subsequent processing of the predicted entity information of the text to be identified, and can combine the predicted entity information of multiple text data (associated texts) associated with the text to be identified to further improve the predicted entity information of the text to be identified, thereby improving the recall rate of the obtained target entity information.
[0143] In one embodiment, the predicted entity information of the text to be identified is updated based on the predicted entity information of the associated text to obtain the target entity information of the text to be identified. Specifically, this includes: filtering out entity information to be updated that meets a preset frequency condition from the predicted entity information of the associated text based on the frequency of occurrence of the predicted entity information of the associated text; if the predicted entity information of the text to be identified does not contain entity information to be updated, then the entity information to be updated is added to the predicted entity information of the text to be identified to obtain the target entity information.
[0144] The preset frequency condition refers to the judgment condition set for the frequency of occurrence of predicted entity information in the associated text. The preset frequency condition can be set to exceed a preset frequency number of times.
[0145] Specifically, the terminal determines the frequency of occurrence of each predicted entity information in the associated text. Then, based on the frequency of occurrence of the predicted entity information in the associated text, it filters out entity information that meets a preset frequency condition from the predicted entity information of the associated text. This can be done by filtering out predicted entity information that exceeds the preset frequency as entity information to be updated. If the predicted entity information of the text to be recognized does not contain the entity information to be updated, then the entity information to be updated is added to the predicted entity information of the text to be recognized to obtain the target entity information of the text to be recognized. If the predicted entity information of the text to be recognized contains the entity information to be updated, then the terminal continues to determine whether the next entity to be updated is in the predicted entity information of the text to be recognized.
[0146] In this embodiment, based on the frequency of occurrence of predicted entity information in associated text, entity information that meets the preset frequency condition is selected from the predicted entity information of associated text; then, the entity information to be updated is added to the predicted entity information of the text to be identified to obtain the target entity information of the text to be identified. This method can add high-frequency entities that appear in the predicted entity information of associated text to the predicted entity information of the text to be identified, effectively improving the recall rate of target entity information.
[0147] In one embodiment, such as Figure 5 As shown, another method for entity recognition in text is provided. Taking the application of this method to a terminal as an example, the method includes the following steps:
[0148] Step S501: Obtain the text to be recognized.
[0149] Step S502: Using the trained entity recognition model, perform self-attention processing on the character embedding features of the text to be recognized and the word embedding features of the candidate entities to obtain the attention features of the text to be recognized.
[0150] Step S503: Perform label prediction processing on the attention features of the text to be recognized to obtain the predicted label information of the text to be recognized.
[0151] Step S504: Perform label constraint processing on the predicted label information of the text to be identified to obtain the predicted entity information of the text to be identified.
[0152] Step S505: Input the associated text of the text to be identified into the trained entity recognition model to obtain the predicted entity information of the associated text.
[0153] Step S506: Based on the frequency of occurrence of predicted entity information in the associated text, filter out entity information to be updated that meets the preset frequency condition from the predicted entity information in the associated text.
[0154] Step S507: If the predicted entity information of the text to be identified does not contain the entity information to be updated, then the entity information to be updated is added to the predicted entity information of the text to be identified to obtain the target entity information.
[0155] The above-mentioned entity recognition method can achieve the following beneficial effects: it can accurately identify entities of diverse texts in the music field through the trained entity recognition model, thereby improving the entity recognition accuracy of the trained entity recognition model for text data in the music field.
[0156] To more clearly illustrate the text entity recognition method provided in this disclosure, a specific embodiment will be used to describe the above-mentioned text entity recognition method in detail below. For example... Figure 6 As shown, another text entity recognition method is provided, which can be applied to terminals, and specifically includes the following:
[0157] Model training phase: The terminal constructs a music entity dictionary and a music relation network based on the music knowledge graph. Then, it uses the music entity dictionary to perform text matching on the training text, obtaining candidate entities. Based on the music relation network, it selects the target entities from the candidate entities, achieving automatic annotation of the training text and its target entities. The terminal iteratively trains the entity recognition model using the training text and target entities to obtain the trained entity recognition model.
[0158] The terminal acquires the comment text and identifier information of the target song; then, it constructs an AC automaton based on a music entity dictionary. The AC automaton matches all entities in the music entity dictionary within the comment text, thus obtaining candidate entities for the comment text. The terminal performs rule extraction on the comment text to obtain new candidate entities. The candidate entities obtained through AC automaton matching and rule extraction together constitute the candidate entities for the comment text. The terminal uses the attention layer of the Transformer model in the trained entity recognition model to perform self-attention processing on the word embedding features of the comment text and the word embedding features of the candidate entities, obtaining corresponding attention features. Next, the Transformer model performs label prediction processing on the attention features and word embedding features of the comment text, outputting predicted label information for the comment text. Finally, the CRF model in the trained entity recognition model performs label constraint processing on the predicted label information for the comment text, obtaining predicted entity information for the comment text.
[0159] The terminal uses the identifier information of the target song to query the associated text of the comment text. Then, based on the frequency of occurrence of the predicted entity information of the associated text, it filters out the entity information to be updated that appears more than a preset frequency. If the predicted entity information of the text to be identified does not contain the entity information to be updated, the entity information to be updated is added to the predicted entity information of the comment text to obtain the target entity information of the comment text.
[0160] To verify the accuracy of entity recognition of the target entity information, 250 comment texts were selected for testing, and the accuracy of entity recognition was reflected by three indicators: F1 score, precision, and recall. The test results are shown in Table 2.
[0161] Table 2
[0162]
[0163] As shown in Table 2, the target entity information of the comment text in this method exceeds 80% in terms of F1 score, precision and recall. In particular, the accuracy of this method is better when only the entity boundary is predicted and the entity type is not predicted. Furthermore, the entity recognition model incorporating a music knowledge graph was compared with the entity recognition model without it. The comparison results showed that the entity recognition model incorporating the music knowledge graph improved the F1 score by 10.8%. In addition, the entity recognition model incorporating the music knowledge graph (Transformer+CRF) was compared with the existing method (Bi-LSTM+CRF). The comparison results showed that the entity recognition model incorporating the music knowledge graph improved the F1 score by 11.5%. It can be seen that compared with Bi-LSTM, Transformer can better extract contextual information and capture long-distance dependencies. At the lexical information level, Transformer has higher computational performance and less information loss. Therefore, the Transformer model can better learn the relationship between the current character and each candidate entity, thereby improving the entity recognition model's ability to recognize entities in music-related texts. To further demonstrate the difference between the target entity information of the comment texts processed by this method and that processed by existing methods, the target entity information of four comment texts were selected from the above 250 comment texts. The existing method (Bi-LSTM+CRF) and this method were compared and analyzed. The comparison results are shown in Tables 3 to 5.
[0164] Table 3
[0165]
[0166] As can be seen from Table 3, the existing method cannot identify the target entity information of the movie type in the review text, while this method performs entity recognition processing based on the music knowledge graph and can accurately identify the target entity information of the movie type in the review text.
[0167] Table 4
[0168]
[0169] As can be seen from Table 4, the entity names of the song type in the review text are all marked with the "()" symbol. However, the existing method can only identify some of the target entity information. This method uses rule extraction processing in the processing stage of candidate entities, so this method can accurately identify the target entity information within each "()" symbol.
[0170] Table 5
[0171]
[0172] As can be seen from Table 5, "The Rest of My Life" in the review text is an idiom, and this review text expresses blessings for everyone's life, not the name of a song. The existing method misinterprets the semantics of the review text and identifies "The Rest of My Life" as the target entity information of the song type, while the trained entity recognition model in this method accurately analyzes that the review text does not contain target entity information.
[0173] In this embodiment, the trained entity recognition model can accurately identify entities in the review text with diverse forms in the music field, improving the entity recognition accuracy of the trained entity recognition model for the review text in the music field. With the help of a large amount of music information in the music knowledge graph, the entity recognition accuracy of the review text in the music field is further improved.
[0174] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps do not necessarily have to be executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps does not have a strict order limit, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages do not necessarily have to be executed at the same time, but can be executed at different times. The execution order of these steps or stages does not necessarily have to be sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0175] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a training method for an entity recognition model and a text entity recognition method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0176] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0177] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0178] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0179] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0180] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0181] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0182] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0183] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A training method for an entity recognition model, characterized in that, The method includes: Target entities are selected from candidate entities in the training text, and target entity information of the target entities is determined; the target entity information includes the target entity location of the target entity. The character embedding features of the training text and the word embedding features of the candidate entities are processed by the feature processing model in the entity recognition model to be trained to obtain attention features. Then, the attention features are processed by label prediction to obtain the predicted label information of the training text. The predicted label information includes the predicted entity position of the training text. By using the label constraint model in the entity recognition model to be trained, the predicted label information is processed to obtain the predicted entity information of the training text. Based on the difference between the predicted entity information and the target entity information, the entity recognition model to be trained is trained to obtain the trained entity recognition model. The process of performing self-attention processing on the character embedding features of the training text and the word embedding features of the candidate entities to obtain attention features includes: Based on the character embedding features, the first correlation degree between the characters in the training text is obtained; Determine the second degree of correlation between the character embedding feature and the relative position information of the character embedding feature; Determine the third degree of association between the character embedding feature and the target word embedding feature of the character embedding feature; Based on the first correlation degree, the second correlation degree, and the third correlation degree, the attention features of the word embedding feature are obtained.
2. The method according to claim 1, characterized in that, The step of performing self-attention processing on the character embedding features of the training text and the word embedding features of the candidate entities through the feature processing model in the entity recognition model to be trained to obtain attention features includes: The feature processing model uses the word embedding features of the candidate entities associated with the word embedding features as the target word embedding features of the word embedding features; Determine the relative position information of the word embedding features; Self-attention processing is performed on the relative position information and the target word embedding features to obtain the attention features of the word embedding features.
3. The method according to claim 1, characterized in that, The step of filtering target entities from candidate entities in the training text includes: The candidate entity is identified as an associated entity in the music relationship network, and the degree of association between the associated entity and the song corresponding to the training text is determined; the music relationship network is constructed based on entity relationships in a music knowledge graph. The confidence level of the candidate entity is determined based on the number of searches and the length of the candidate entity, as well as the degree of association. Based on the confidence level, target entities that meet the preset confidence level conditions are selected from the candidate entities.
4. The method according to claim 1, characterized in that, The determination of the target entity information of the target entity includes: Based on the intent probability distribution of the target entity, determine the target entity type of the target entity; The target entity information of the target entity is obtained based on the target entity location and the target entity type.
5. The method according to any one of claims 1 to 4, characterized in that, Before filtering out target entities from candidate entities in the training text and determining the target entity information of the target entities, the process further includes: The search count of the candidate entity is obtained based on the user search data corresponding to the training text; The user search data is processed to identify intent, thereby obtaining the intent probability distribution of the target entity.
6. The method according to any one of claims 1 to 4, characterized in that, Before filtering out target entities from candidate entities in the training text and determining the target entity information of the target entities, the process further includes: Based on the music knowledge graph, a music entity dictionary is generated; A text matching model is constructed based on the music entity dictionary, and the training text is processed by the text matching model to obtain candidate entities of the training text.
7. A method for entity recognition in text, characterized in that, The method includes: Obtain the text to be recognized; The text to be identified is input into a trained entity recognition model to obtain predicted entity information of the text to be identified; the predicted entity information includes the predicted entity position of the text to be identified; the trained entity recognition model is trained according to the method of any one of claims 1 to 6.
8. The method according to claim 7, characterized in that, The step of inputting the text to be identified into the trained entity recognition model to obtain the predicted entity information of the text to be identified includes: By using the trained entity recognition model, self-attention processing is performed on the character embedding features of the text to be recognized and the word embedding features of the candidate entities to obtain the attention features of the text to be recognized. The attention features of the text to be identified are subjected to label prediction processing to obtain the predicted label information of the text to be identified; The predicted label information of the text to be identified is subjected to label constraint processing to obtain the predicted entity information of the text to be identified.
9. The method according to claim 7, characterized in that, After inputting the text to be recognized into the trained entity recognition model to obtain the predicted entity information of the text to be recognized, the method further includes: The associated text of the text to be identified is input into the trained entity recognition model to obtain the predicted entity information of the associated text; Based on the predicted entity information of the associated text, the predicted entity information of the text to be identified is updated to obtain the target entity information of the text to be identified.
10. The method according to claim 9, characterized in that, The step of updating the predicted entity information of the text to be identified based on the predicted entity information of the associated text to obtain the target entity information of the text to be identified includes: Based on the frequency of occurrence of the predicted entity information of the associated text, entity information to be updated that meets the preset frequency condition is selected from the predicted entity information of the associated text. If the predicted entity information of the text to be identified does not contain the entity information to be updated, then the entity information to be updated is added to the predicted entity information of the text to be identified to obtain the target entity information.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6 or 7 to 10.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6 or 7 to 10.
Citation Information
Patent Citations
Video labeling method and device based on knowledge graph and computer readable medium
CN110245259A
Entity recognition method and device, equipment and storage medium
CN113536793A
Annotation method and apparatus for use in text data, computer device, and storage medium
WO2022188585A1