Entity link processing method, device, storage medium and program product
By using a deep bidirectional natural language processing model to build an alias library in the company name entity link, and considering the position constraint relationship of the alias in the standard name, the problem of low recall rate and inaccurate results is solved, and higher recall rate and accuracy are achieved. sex.
Patent Information
- Application Number
- CN202410931780.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-12
AI Technical Summary
In the existing technology, the recall rate of the recall results of the company name entity link is not high, and it is difficult to ensure the accuracy of the results.
An alias library is built based on a deep bidirectional natural language processing model. This model considers the position constraints of the alias head and tail in the standard name during training. By obtaining the entity mentions to be linked, combined with the preset standard name library and aliases The library is used for recall, and text similarity or semantic similarity is used to determine the target recall result.
The recall rate and the accuracy of entity linking results are significantly improved, and the completeness of the recall results is improved by building a more accurate and rich alias library.
Smart Images

Figure CN118467867B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an entity link processing method, device, storage medium and program product. Background Art
[0002] In the financial field, there is a need for company name entity linking. Company name entity linking refers to associating entity information obtained from online information and other channels with the company standard name in the standard company coding table for use in subsequent business. For example, the information containing the entity information is analyzed to obtain relevant analysis results of the company corresponding to the company standard name associated with the entity information. Among them, entity information can also be called entity mention, which can be the company's abbreviation, alias, etc.
[0003] In the prior art, an alias library can be constructed to record the mapping relationship between entity mentions and company standard names, and then the alias library can be used to recall results and return the standard company name corresponding to the entity mention based on the recall results.
[0004] However, the existing methods have the problem of low recall rate of the recall results, and it is difficult to ensure the accuracy of the results of linking the company entity names. Summary of the invention
[0005] The purpose of this application is to provide an entity link processing method, device, storage medium and program product to address the deficiencies in the above-mentioned prior art, so as to solve the problems in the prior art that the recall rate of recall results is low and it is difficult to ensure the accuracy of the results of company entity name linking.
[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0007] In a first aspect, an embodiment of the present application provides an entity link processing method, including:
[0008] Get the entity mentions to be linked;
[0009] Determine a recall result set corresponding to the entity mention according to a preset standard name library and a constructed alias library, wherein the recall result set includes multiple recall results, each recall result is a standard name, and the alias library is constructed based on a pre-trained deep bidirectional natural language processing model, and when the deep bidirectional natural language processing model is trained, the loss information is determined based on a constraint relationship between a position of the head of the alias in the standard name and a position of the tail of the alias in the standard name;
[0010] According to the text similarity or semantic similarity between the entity mention and each recall result in the recall result set, a target recall result in the recall result set is determined, and the target recall result is used as the entity linking result of the entity mention.
[0011] In a second aspect, an embodiment of the present application provides an entity link processing device, including:
[0012] The acquisition module is used to obtain the entity mentions to be linked;
[0013] A determination module, used to determine a recall result set corresponding to the entity mention according to a preset standard name library and a constructed alias library, wherein the recall result set includes multiple recall results, each recall result is a standard name, the alias library is constructed based on a pre-trained deep bidirectional natural language processing model, and when the deep bidirectional natural language processing model is trained, the loss information is determined based on a constraint relationship between a position of the head of the alias in the standard name and a position of the tail of the alias in the standard name;
[0014] The determination module is also used to determine the target recall result in the recall result set according to the text similarity or semantic similarity between the entity mention and each recall result in the recall result set, and use the target recall result as the entity linking result of the entity mention.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of entity link processing as described in the first aspect above.
[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of entity link processing as described in the first aspect above are performed.
[0017] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program code. When the computer program code is executed by a computing device, the computing device performs the steps of entity link processing described in the first aspect above.
[0018] The entity link processing method, device, storage medium and program product provided in the embodiments of the present application can be combined with the alias library and the standard name library for recall after obtaining the entity mention to be linked. Since the alias library is constructed based on a deep bidirectional natural language processing model, and the deep bidirectional natural language processing model takes into account the position constraint relationship between the alias head and the alias tail in the standard name during training, the deep bidirectional natural language processing model can be used to learn the length constraints of the head vector and the tail vector, and then the accurate and rich aliases corresponding to the standard name can be automatically extracted, so that the alias library constructed accordingly has a higher accuracy and integrity, and then the recall rate can be greatly improved when the alias library is used for recall, and the accuracy of the entity linking results can be improved accordingly. At the same time, this embodiment combines the alias library and the standard name library for recall at the same time, which can also further improve the recall rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 This is an example diagram of the company name entity linking scenario;
[0021] Figure 2 A flowchart of an entity link processing method provided in an embodiment of the present application;
[0022] Figure 3 A schematic diagram of a model training process for an entity linking processing method provided in an embodiment of the present application;
[0023] Figure 4 A schematic diagram of a flow chart of generating a training tail vector for an entity linking processing method provided in an embodiment of the present application;
[0024] Figure 5 A schematic diagram of a process for determining loss information of an entity link processing method provided in an embodiment of the present application;
[0025] Figure 6 A schematic diagram of a process for constructing an alias library for an entity link processing method provided in an embodiment of the present application;
[0026] Figure 7 A schematic diagram of a process for determining a recall result set of an entity link processing method provided in an embodiment of the present application;
[0027] Figure 8A schematic diagram of a process for determining a target recall result of an entity link processing method provided in an embodiment of the present application;
[0028] Fig. 9 A flow chart of obtaining a similarity model by training the entity linking processing method provided in an embodiment of the present application;
[0029] Fig.10 A schematic diagram of a flow chart of expanding an alias library of an entity link processing method provided in an embodiment of the present application;
[0030] Fig.11 A schematic diagram of a clustering process of the entity link processing method provided in an embodiment of the present application;
[0031] Fig.12 A module structure diagram of an entity link processing device provided in an embodiment of the present application;
[0032] Fig.13 A schematic diagram of the structure of an electronic device 130 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0034] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0035] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0036] When performing entity linking for company names, the result recall mainly relies on the alias library. However, the current method for constructing the alias library is relatively simple. For example, it constructs the alias library by identifying and reorganizing keywords from known company standard names, or expands the alias library by extracting aliases corresponding to company standard names from publicly available information. The aliases in the alias library constructed in these ways are not rich and comprehensive enough, resulting in a low recall rate for the recall results obtained using this alias library.
[0037] Based on the above problems, the embodiments of this application propose an entity linking processing method, which constructs an alias library based on a deep bidirectional natural language processing model. This deep bidirectional natural language processing model takes into account the position constraint relationship between the alias head and the alias tail in the standard name during training, so that accurate and rich aliases corresponding to the standard name can be automatically extracted using this deep bidirectional natural language processing model. Furthermore, when using these aliases for result recall, the recall rate can be significantly improved, and thus the accuracy of the linking results can be greatly enhanced.
[0038] Before introducing the technical solution of the embodiments of this application, it should be noted that for the entity linking processing method provided by the embodiments of this application, before collecting and generating personal information and important data during the execution process, explicit consent from the user must be obtained in order to be applied to the solution of the embodiments of this application. At the same time, the personal information and important data collected and generated during the execution process of the entity linking processing method provided by the embodiments of this application must follow the principles of legality, legitimacy, and necessity, disclose the collection and use rules, and clearly indicate the purpose, method, and scope of collecting and using information. The relevant data in the above examples do not include personal information unrelated to the relevant services provided in the above examples.
[0039] The embodiments of this application can be applied to any field or scenario that requires entity linking. For example, in the aforementioned company name entity linking scenario, for an entity mention obtained from channels such as network information, the method of the embodiments of this application can be used to determine the company standard name corresponding to this entity mention. Figure 1 For an example diagram of the company name entity linking scenario, as Figure 1 shown, an article of information is obtained from the Internet, and this information contains the entity mention "Example Semiconductor". Then, the method of the embodiments of this application can be used to determine and output the company standard name corresponding to this entity mention, that is, "Shenzhen Example Semiconductor Technology Co., Ltd.". Another example is in the intelligent medical Q&A scenario. For a medical abbreviation input by the user, the method of this application can be used to determine the full medical name corresponding to this medical abbreviation and perform subsequent answer searches based on this full medical name.
[0040] The following elaborates on the entity linking processing method provided by the embodiments of this application in combination with multiple embodiments.
[0041] Figure 2 The flowchart of the entity link processing method provided in the embodiment of the present application is shown in FIG. 1 . The execution subject of the method can be any electronic device with processing capability. Figure 2 As shown, the method includes:
[0042] S201. Obtain entity mentions to be linked.
[0043] Optionally, the above-mentioned entity mentions can be automatically obtained from various channels. For example, for an information downloaded from the Internet, one or more entity mentions can be identified by analyzing and identifying the information. For each entity mention, the entity link result of the entity mention can be determined using the embodiment of the present application. The above-mentioned entity mentions can also be manually entered by the user. For example, the user can enter an entity mention on a graphical user interface.
[0044] Optionally, the above entity mention may be an abbreviation, an alias, etc. For example, the above Figure 1 The example "Example Semiconductor" is used as the abbreviation of the company and is mentioned as an entity.
[0045] S202. Determine a recall result set corresponding to the above-mentioned entity mentions based on a preset standard name library and a constructed alias library, wherein the recall result set includes multiple recall results, each recall result is a standard name, and the above-mentioned alias library is constructed based on a pre-trained deep bidirectional natural language processing model, and when the deep bidirectional natural language processing model is trained, the loss information is determined based on the constraint relationship between the position of the head of the alias in the standard name and the position of the tail of the alias in the standard name.
[0046] Optionally, the standard name library is used to store standard names. For example, in the financial field, the standard names of registered companies can be collected in advance and stored in the standard name library.
[0047] Optionally, the above-mentioned alias library is used to store the correspondence between the standard name and the alias corresponding to the standard name. It is worth noting that the "alias" and "abbreviation" mentioned in the embodiments of the present application can be interchanged, both representing a simplified representation of the standard name. In the above-mentioned alias library, a standard name can correspond to one or more aliases. As an example, for a standard name, the standard name and each corresponding alias can be used as a record in the alias library. The following Table 1 is an example of data records in the alias library. Referring to Table 1, assuming that the standard name "Shenzhen Example Semiconductor Technology Co., Ltd." corresponds to 2 aliases, namely "Shenzhen Example" and "Example Semiconductor", the following two records can be stored in the alias library for "Shenzhen Example Semiconductor Technology Co., Ltd."
[0048] Table 1
[0049]
[0050] Optionally, the above-mentioned standard name library and the above-mentioned alias library may be combined simultaneously to determine a recall result set of entity mentions, thereby breaking the limitation of the recall results and making the recall results richer.
[0051] Optionally, the alias library can be constructed based on the deep bidirectional natural language processing model. Specifically, for a standard name, after the standard name is input into the deep bidirectional natural language processing model, the deep bidirectional natural language processing model can automatically identify and extract one or more aliases corresponding to the standard name. Then, the corresponding relationship between the standard name and each alias corresponding to the standard name is stored in the alias library.
[0052] Optionally, the above-mentioned deep bidirectional natural language processing model is a neural network model with deep bidirectional features. Exemplarily, the deep bidirectional natural language processing model can be a Bert model. Due to the deep bidirectional features, the deep bidirectional natural language processing model can take into account the context of the characters in the text of the input standard name. During the training process, the deep bidirectional natural language processing model uses the above-mentioned deep bidirectional features and determines the loss information of the model based on the constraint relationship between the position of the head of the alias in the standard name and the position of the tail of the alias in the standard name, so that the deep bidirectional natural language processing model has the ability to extract accurate and rich aliases, and then the deep bidirectional natural language processing model can automatically extract accurate and rich aliases corresponding to the standard name.
[0053] Among them, the constraint relationship between the position of the head of the alias in the standard name and the position of the tail of the alias in the standard name can refer to: whether the character at the i-th position is the tail of an alias is related to whether the characters at the iM-iN positions are the head of an alias. Among them, M is an integer greater than or equal to 1, N is an integer greater than M, and i can be any integer greater than N and less than the length of the standard name in the standard name. M can be 2, for example, and N can be 5, for example. Specifically, the greater the probability that the characters at the iM-iN positions are the heads of the alias, the greater the probability that the characters at the i-th position are the tail of the alias.
[0054] The above constraint relationship is explained below in conjunction with Table 2 below.
[0055] Table 2
[0056]
[0057] Referring to Table 2 above, assuming that a standard name is "Shenzhen Example Semiconductor Technology Co., Ltd.", the standard name includes 13 positions, each of which stores a character. Taking position 9 as an example, assuming that M is 2, N is 5, and the positions related to position 9 are position 4 to position 7, then, if the probability that the characters at positions 4 to 7 belong to the head of the alias is greater, the probability that the characters at position 9 belong to the tail of the alias is greater. Since the loss information is calculated based on this constraint relationship during model training, the model can learn the length constraints of the head vector and the tail vector, and the accuracy is improved during prediction.
[0058] S203. Determine a target recall result in the recall result set according to the text similarity or semantic similarity between the entity mention and each recall result in the recall result set, and use the target recall result as the entity linking result of the entity mention.
[0059] Optionally, after obtaining the above recall result set, the text similarity or semantic similarity between the above entity mention and each recall result in the recall result set can be determined respectively, the recall results in the recall result set can be sorted according to the text similarity results or semantic similarity results, and the above target recall result can be determined based on the sorting results. For example, the recall result ranked first, that is, the recall result with the highest text similarity or semantic similarity, can be used as the target recall result.
[0060] In this embodiment, after obtaining the mention of the entity to be linked, the alias library and the standard name library can be combined for recall. Since the alias library is constructed based on a deep bidirectional natural language processing model, and the deep bidirectional natural language processing model takes into account the positional constraints of the alias head and the alias tail in the standard name during training, the deep bidirectional natural language processing model can be used to learn the length constraints of the head vector and the tail vector, and then the accurate and rich aliases corresponding to the standard name can be automatically extracted, so that the alias library constructed accordingly has higher accuracy and integrity, and then the recall rate can be greatly improved when the alias library is used for recall, and the accuracy of the entity linking results can be improved accordingly. At the same time, this embodiment combines the alias library and the standard name library for recall at the same time, which can also further improve the recall rate.
[0061] The following is an explanation of the training process of the above-mentioned deep bidirectional natural language processing model.
[0062] Figure 3 A schematic diagram of a model training process of an entity linking processing method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown in Figure 1, the training process of the deep bidirectional natural language processing model includes:
[0063] S301. Obtain sample data, where the sample data includes: a sample standard name and multiple sample aliases.
[0064] The sample data may be manually constructed by the user in advance. For example, one sample data includes a sample standard name and two sample aliases, wherein the sample standard name is "Shenzhen Example Semiconductor Technology Co., Ltd." and the sample aliases are "Example Semiconductor" and "Shenzhen Example".
[0065] S302. Generate a labeled header vector and a labeled tail vector according to the above-mentioned sample standard name and each sample alias, wherein the labeled header vector is used to represent the position of the head of each sample alias in the above-mentioned sample standard name, and the labeled tail vector is used to represent the position of the tail of each sample alias in the above-mentioned sample standard name.
[0066] Optionally, the above-mentioned header vector can represent the position of the head of each sample alias in the standard name. Exemplarily, if the value at a certain position in the header vector is 1, it means that the character at the corresponding position in the standard name is the head of an alias.
[0067] Optionally, the annotated tail vector can represent the position of the tail of each sample alias in the standard name. Exemplarily, if the value at a position in the annotated tail vector is 1, it means that the character at the corresponding position in the standard name is the tail of an alias.
[0068] S303. Input the sample standard name into an initial language processing model, and generate a training head vector based on the sample standard name by the initial language processing model, and generate a training tail vector according to the constraint relationship between the position of the head of the alias in the standard name and the position of the tail of the alias in the standard name and the training head vector.
[0069] The initial language processing model is trained to become the aforementioned deep bidirectional natural language processing model. Therefore, the initial language processing model is a neural network model with deep bidirectional features, such as a Bert model. After the sample standard name is input into the initial language processing model, the initial language processing model first predicts the position of the head of one or more aliases in the sample standard name, and then for each alias, uses the above-mentioned constraint relationship and other information to calculate the tail of the alias in the sample standard name. Specifically, the position of the head of all aliases in the sample standard name can be represented by the above-mentioned training head vector, and the position of the tail of all aliases in the sample standard name can be represented by the above-mentioned training tail vector.
[0070] S304: Determine loss information of the initial language processing model according to the annotated head vector, the training head vector, the annotated tail vector, and the training tail vector.
[0071] Optionally, the annotated head vector may be compared with the training head vector, and the annotated tail vector may be compared with the training tail vector, and the loss information of the initial language processing model may be determined according to the results of the two comparisons.
[0072] S305. Iteratively correct the initial language processing model according to the loss information, and use the initial language processing model that meets the preset iteration stop condition as the deep bidirectional natural language processing model.
[0073] The above-mentioned iteration stopping condition may be, for example, that the iteration reaches a preset maximum number of times, or that the output result of the initial language processing model after a certain iteration satisfies a preset condition, etc.
[0074] The following Table 3 is the actual verification data of the training model using this embodiment. It can be seen from the following Table 3 that since the constraint relationship between the position of the head of the alias in the standard name and the position of the tail of the alias in the standard name is considered when calculating the loss, the final model has obvious improvements in the accuracy, decoding conditions, and out-of-length range.
[0075] Table 3
[0076]
[0077] In this embodiment, during the model training process, by constructing a labeled head vector, a training head vector, a labeled tail vector, and a training tail vector, the training calculation efficiency is made higher. At the same time, a training tail vector is generated based on constraints and the loss information is calculated accordingly, so that the prediction accuracy of the trained deep bidirectional natural language processing model is higher and the error rate is lower.
[0078] As an optional implementation, the length of the labeled head vector, the length of the labeled tail vector, the length of the training head vector, and the length of the training tail vector are all the same as the length of the sample standard name.
[0079] Among them, the value at the first position in the annotation header vector is used to indicate whether the character at the first position of the sample standard name is the head of an alias, and the first position is any position in the annotation header vector; the value at the second position in the annotation tail vector is used to indicate whether the character at the second position of the sample standard name is the tail of an alias, and the second position is any position in the annotation header vector.
[0080] In addition, the numerical value at any position in the training head vector is used to characterize whether the character at that position of the sample standard name is the head of an alias. The difference from the standard head vector is that the numerical value is actually calculated by the initial language processing model. The numerical value at any position in the annotation tail vector is used to characterize whether the character at that position of the sample standard name is the tail of an alias. The difference from the standard tail vector is that the numerical value is actually calculated by the initial language processing model.
[0081] Continuing with the example of a standard name as shown in the aforementioned Table 2, the length of the standard name is 13, and the length of the labeling head vector, the length of the labeling tail vector, the length of the training head vector, and the length of the training tail vector are all 13.
[0082] Assume that the labeled head vector is Label1 and the labeled tail vector is Label2. Label1 is, for example, as shown in Table 4 below, and Label2 is, for example, as shown in Table 5 below.
[0083] Table 4
[0084]
[0085] Table 5
[0086]
[0087] The value at each position in Table 4 is 1 or 0. A value of 1 indicates that the character at the corresponding position in the standard name is the head of an alias, and a value of 0 indicates that the character at the corresponding position in the standard name is not the head of an alias. The value at each position in Table 5 is 1 or 0. A value of 1 indicates that the character at the corresponding position in the standard name is the tail of an alias, and a value of 0 indicates that the character at the corresponding position in the standard name is not the tail of an alias.
[0088] If the values at positions 1 and 3 in Table 4 are 1, it means that for the standard name "Shenzhen Example Semiconductor Technology Co., Ltd.", 2 aliases are marked, and the heads of the 2 aliases are located at positions 1 and 3 of the standard name respectively, that is, the head of one alias is "Shen" and the head of the other alias is "Ju". If the values at positions 4 and 7 in Table 5 are 1, it means that for the standard name "Shenzhen Example Semiconductor Technology Co., Ltd.", 2 aliases are marked, and the tails of the 2 aliases are located at positions 4 and 7 of the standard name respectively, that is, the tail of one alias is "Li" and the tail of the other alias is "Ti".
[0089] In this embodiment, by setting the lengths of the annotation head vector, the annotation tail vector, the training head vector, and the training tail vector to be the same as the length of the sample standard name and corresponding one by one, the computational complexity can be simplified and the computational efficiency can be improved.
[0090] As an alternative implementation, the training tail vector in step S303 above can be generated as follows.
[0091] Figure 4 It is a schematic flowchart of generating a training tail vector for the entity link processing method provided by the embodiment of the present application. As Figure 4 shown, step S303 above may include:
[0092] S401. Obtain the first interval and the second interval indicated by the constraint relationship.
[0093] Optionally, the first interval refers to M in the foregoing step S202, and the second interval refers to N in the foregoing step S203. For example, M is 2 and N is 5.
[0094] S402. Generate the training tail vector according to the first interval and the second interval.
[0095] After obtaining the first interval and the interval, the elements in the training head vector that affect the training tail vector can be known, and based on this, the training tail vector can be generated.
[0096] In this embodiment, generating the training tail vector according to the first interval and the second interval indicated by the constraint relationship improves the computational accuracy and efficiency.
[0097] As an optional implementation, the above step S402 may include:
[0098] According to the above-mentioned first interval and the above-mentioned second interval, the training head vector is offset to obtain multiple offset vectors; the maximum value among the multiple offset vectors is determined; and the product of the maximum value and a preset value is used as the training tail vector, wherein the preset value is a value greater than 0 and less than 1.
[0099] For example, assuming that the training head vector is h1, the training tail vector is h2, M is 2, and N is 5, h2 can be calculated using the following formula (1).
[0100] (1)
[0101] The shift function in the above formula (1) can be expressed as the following formula (2):
[0102] (2)
[0103] The function of the shift function in the above formula (2) is to shift the elements of vector h to the right by P positions and fill the left side with 0. In the above formulas (1) and (2), taking shift(h1,2) as an example, it means that h1 is shifted to the right by 2 positions and filled with 0 on the left. In the case of M=2 and N=5, h1 is shifted to the right by 2, 3, 4, and 5 positions respectively to obtain 4 offset vectors. The maximum value of these 4 offset vectors is selected and added to the original h2. The original h2 can be, for example, an initial vector of all 0s. After addition, it is multiplied by 1 / 2, that is, multiplied by the above preset value.
[0104] The purpose of multiplying by 1 / 2 is to prevent the calculated value of an element in h2 from exceeding the range and to ensure that the values of the elements in h2 are all within the range of 0 to 1.
[0105] In this instantiation, the training head vector is offset according to the first interval and the second interval, so that the possible correlation value of each element in the training tail vector can be obtained, and then based on these offset vectors, the maximum value is taken and multiplied by the preset value, so that the accurate training tail vector that is related to the training head vector can be obtained.
[0106] Figure 5 A flow chart of determining loss information of the entity link processing method provided in the embodiment of the present application, such as Figure 5 As shown, the above step S304 may include:
[0107] S501 : Determine a first binary classification cross entropy between the labeled head vector and the training head vector.
[0108] Optionally, the first binary cross entropy can be calculated by the crossEntropy function.
[0109] S502: Determine a second binary classification cross entropy between the labeled tail vector and the training tail vector.
[0110] Optionally, the second binary cross entropy can be calculated by the crossEntropy function.
[0111] S503: Determine loss information of the initial language processing model according to the first binary cross entropy and the second binary cross entropy.
[0112] Exemplarily, the loss information of the initial language processing model can be calculated using the following formula (3).
[0113] (3)
[0114] Among them, h1 represents the training head vector, h2 represents the training tail vector, l1 represents the labeled head vector, l2 represents the labeled tail vector, and the loss obtained by adding the binary cross entropy of h1 and l1 and the binary cross entropy of h2 and l2 is used as the loss information of the initial language processing model.
[0115] In this embodiment, accurate loss information can be determined by using the binary cross entropy between the labeled head vector and the training head vector and the binary cross entropy between the labeled tail vector and the training tail vector.
[0116] The following describes the process of building an alias library based on a deep bidirectional natural language processing model.
[0117] Figure 6 A schematic diagram of a process for constructing an alias library for an entity link processing method provided in an embodiment of the present application is shown in FIG. Figure 6 As shown in the figure, the process of building an alias library based on a deep bidirectional natural language processing model includes:
[0118] S601. Input the target standard name into the deep bidirectional natural language processing model, and the deep bidirectional natural language processing model generates a target head vector and a target tail vector.
[0119] Optionally, the target standard name may be, for example, a standard name in the aforementioned standard name library. Using the method steps of this embodiment, one or more aliases corresponding to the target standard name may be automatically determined.
[0120] After the target standard name is input into the deep bidirectional natural language processing model, the deep bidirectional natural language processing model can predict the target head vector and the target tail vector based on the target standard name. The structure and meaning of the target head vector are the same as the structure and meaning of the training head vector involved in the aforementioned model training part, and the structure and meaning of the target tail vector are the same as the structure and meaning of the training tail vector involved in the aforementioned model training part. Please refer to the aforementioned embodiment part and will not be repeated here.
[0121] S602, obtaining at least one head position in the target head vector that belongs to the head and whose position is greater than a first preset value, and obtaining at least one tail position in the target tail vector that belongs to the tail and whose position is greater than a second preset value.
[0122] Exemplarily, assuming that the target standard name is "Shenzhen Example Semiconductor Technology Co., Ltd.", the target head vector is shown in Table 6 below, and the target tail vector is shown in Table 7 below.
[0123] Table 6
[0124]
[0125] Table 7
[0126]
[0127] The first preset value may be the same as the second preset value, or the second preset value may not be equal to the first preset value. For example, the first preset value may be 0, and the second preset value may be 1. When acquiring the at least one head position, it is necessary to acquire the head position in the target head vector that represents the head and whose position is greater than the first preset value, so that the unreasonable head can be eliminated. At the same time, when acquiring the at least one tail position, it is necessary to acquire at least one tail position in the target tail vector that represents the tail and whose position is greater than the second preset value, so that the unreasonable tail can be eliminated.
[0128] For the target head vector shown in Table 6, two head positions, position 1 and position 3, can be obtained, and for the target tail vector shown in Table 7, two tail positions, position 4 and position 7, can be obtained.
[0129] S603: Combine the at least one head position and the at least one tail position in pairs to obtain at least one position combination, and select at least one target position combination whose interval between the head position and the tail position meets a preset condition from the at least one position combination.
[0130] Continuing with the vectors shown in Tables 6 and 7 above, the two head positions of position 1 and position 3 in the target head vector are obtained, and the two tail positions of position 4 and position 7 in the target tail vector are obtained. Then, by combining the head positions and tail positions in pairs, the following four combinations can be obtained:
[0131] Combination 1: Position 1, Position 4
[0132] Combination 2: Position 1, Position 7
[0133] Combination 3: Position 3, Position 4
[0134] Combination 4: Position 3, Position 7
[0135] On this basis, target position combinations whose intervals meet preset conditions are screened out, wherein the preset conditions may be, for example, that the interval is greater than 1 and the interval is less than 4. Based on this preset condition, two target position combinations, namely combination 1 and combination 4, can be screened out from the above four combinations, and the remaining combination 2 and combination 3 are eliminated because the position intervals are too large or too small.
[0136] S604: The text segments corresponding to each target position combination in the target standard name are respectively used as an alias of the target standard name, and the target standard name and each alias are stored in an alias library.
[0137] Continuing with the above example, let combination 1 and combination 4 be the target position combinations. For combination 1, the corresponding text segment in the target standard name "Shenzhen Example Semiconductor Technology Co., Ltd." is the text segment formed by position 1 to position 4, that is, "Shenzhen Example". For combination 4, the corresponding text segment in the target standard name "Shenzhen Example Semiconductor Technology Co., Ltd." is the text segment formed by position 3 to position 7, that is, "Example Semiconductor". Thus, the two aliases "Shenzhen Example" and "Example Semiconductor" are obtained. On this basis, the target standard name and "Shenzhen Example" can be added to the alias library as a record, and the target standard name and "Example Semiconductor" can be added to the alias library as a record.
[0138] In this embodiment, the accuracy of the determined alias can be ensured by combining and screening the head position and the tail position.
[0139] Figure 7 A flow chart of determining a recall result set of the entity link processing method provided in the embodiment of the present application, such as Figure 7 As shown, the above step S202 may include:
[0140] S701. Match the entity mentions with the standard names in the standard name library to obtain a plurality of first matching scores.
[0141] Optionally, a first matching score between the entity mention and the standard name may be obtained based on an inverted index of the entity mention and the standard name.
[0142] S702: Match the entity mention with each alias in the alias library to obtain a plurality of second matching scores.
[0143] Optionally, a second matching score of the entity mention and the alias may be obtained based on an inverted index of the entity mention and the alias.
[0144] S703: Determine the recall result set according to the multiple first matching scores and the multiple second matching scores.
[0145] Optionally, the plurality of first matching scores and the plurality of second matching scores may be uniformly sorted, and the standard names corresponding to a specific number of matching scores that are ranked highest are taken as the recall results to form a recall result set.
[0146] Exemplarily, assuming that the specific number is 100, it is necessary to select the standard names corresponding to the matching scores ranked in the top 100 as the recall results. For example, if one of the matching scores in the top 100 matching scores is the matching score between the entity mention in the above step S701 and a standard name in the standard name library, then the standard name is taken as a recall result. For another example, if one of the matching scores in the top 100 matching scores is the matching score between the entity mention in the above step S702 and an alias in the alias library, then the standard name corresponding to the alias in the alias library is taken as a recall result.
[0147] In this embodiment, the recall rate and the accuracy of the recall can be improved by matching the entity mentions with the standard name library and the alias library respectively and performing sorting and screening.
[0148] Figure 8 A flow chart of determining a target recall result of an entity link processing method provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the process of determining the target recall result in the above step S203 may include:
[0149] S801. Determine the edit distance and edit similarity between the entity mention and each recall result.
[0150] Optionally, the text similarity between the entity mention and the recall result can be represented by the above-mentioned edit distance and edit similarity.
[0151] S802: If there is a first recall result with an edit distance of 0, the recall result with an edit distance of 0 is used as the target recall result.
[0152] If there is a first recall result with an edit distance of 0, it indicates that the first recall result contains the entity mention, so there is no need for subsequent judgment, and the first recall result is directly used as the target recall result.
[0153] S803. If there is a second recall result whose edit distance is not 0, whose edit similarity is greater than a third preset value, and whose number of common consecutive characters mentioned with the entity is greater than a fourth preset value, then the second recall result is used as the target recall result.
[0154] Exemplarily, the third preset value may be 0.95, and the fourth preset value may be 2.
[0155] When the edit distance is not 0, if the edit similarity is greater than 0.95 and the number of common consecutive characters with the entity mention is greater than 2, it indicates that the similarity between the second recall result and the entity mention meets the requirements, and the second recall result is used as the target recall result.
[0156] S804. If the first recall result and the second recall result do not exist, obtain a subset of recall results in the recall result set whose edit similarity is greater than a fifth preset value and whose number of common consecutive characters mentioned with the entity is greater than a fourth preset value.
[0157] Among them, the fifth preset value is smaller than the third preset value.
[0158] Exemplarily, the fifth preset value may be 0.8.
[0159] S805 , filtering out the target recall result from the recall result subset based on the pre-trained similarity model.
[0160] When the first recall result and the second recall result do not exist, a recall result subset may be firstly screened out from the recall result set based on the condition in S804 above, and then the target recall result may be screened based on the similarity model above.
[0161] In this embodiment, the target recall results are first screened according to the edit distance and the edit similarity. If no results can be screened out, the target recall results are further screened according to the pre-trained similarity model, thereby ensuring the accuracy of the final entity linking results.
[0162] As an optional implementation, the similarity model is trained using training samples constructed based on the alias library.
[0163] In a specific implementation process, after the alias library is constructed, the data in the alias library can be used to construct training samples, and the similarity model mentioned above can be obtained by training based on the training samples.
[0164] Fig. 9 A flow chart of obtaining a similarity model by training the entity linking processing method provided in the embodiment of the present application is as follows: Fig. 9 As shown in Figure 2, the training process of the similarity model includes:
[0165] S901. Search the alias library for multiple correct aliases corresponding to the current standard name and multiple incorrect aliases that are aliases that do not belong to the current standard name.
[0166] The current standard name can be any standard name in the alias library.
[0167] For example, if there is a current standard name "Shenzhen Example Semiconductor Technology Co., Ltd." in the alias library, and two aliases of the current standard name are recorded in the alias library, namely "Shenzhen Example" and "Example Semiconductor", then these two aliases can be found from the alias library as correct aliases. At the same time, two wrong aliases that do not belong to the current standard name can also be found, such as "Shenzhen Error" and "Error Semiconductor".
[0168] S902: Take the current standard name and each correct alias as a positive sample respectively.
[0169] For example, for the two correct aliases found, "Shenzhen Example" and "Example Semiconductor", the current standard name "Shenzhen Example Semiconductor Technology Co., Ltd." and the correct alias "Shenzhen Example" can be combined into a positive sample, and the current standard name "Shenzhen Example Semiconductor Technology Co., Ltd." and the correct alias "Example Semiconductor" can be combined into another positive sample.
[0170] S903: Take the current standard name and each incorrect alias as a negative sample respectively.
[0171] For example, for the two error aliases found, "Shenzhen Error" and "Error Semiconductor", the current standard name "Shenzhen Example Semiconductor Technology Co., Ltd." and the error alias "Shenzhen Error" can be combined into a negative sample, and the current standard name "Shenzhen Example Semiconductor Technology Co., Ltd." and the error alias "Error Semiconductor" can be combined into another negative sample.
[0172] S904: construct a sample set according to the positive samples and the negative samples, and obtain the similarity model through training according to the sample set.
[0173] In this embodiment, by using the aliases in the alias library to construct positive samples and negative samples respectively, the similarity detection results of the similarity model trained using these samples can be made more accurate, thereby improving the accuracy of the entity linking results.
[0174] As an optional implementation, before the above step S203, the method further includes:
[0175] According to the preset keywords in the above entity mentions, the above recall results are combined and filtered to obtain a filtered recall result set.
[0176] Accordingly, when executing the above step S203, processing may be performed based on the filtered recall result set.
[0177] Optionally, the preset keywords may be specific keywords in the field or scenario to which the embodiments of the present application are applied. For example, in the field of company name entity linking, the preset keywords may be keywords such as "subsidiary" and "branch". If the entity mention includes "subsidiary" or "branch", and a recall result in the recall result set does not include "subsidiary" or "branch", it means that the recall result does not match the entity mention, and therefore, the recall result can be filtered out.
[0178] In this embodiment, the recall result set is filtered using preset keywords in the entity mention, which can further improve the accuracy of the recall result set.
[0179] As an optional implementation, the embodiment of the present application may also expand the above alias library, which is described in detail below.
[0180] Fig.10 A flow chart of an expanded alias library for an entity link processing method provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the entity link processing method also includes:
[0181] S1001. Obtain a candidate entity mention, and determine a candidate recall set based on a matching result between the candidate entity mention and a standard name in a standard name library and a matching result between the candidate entity mention and each alias in an alias library, wherein the candidate recall set includes multiple standard names.
[0182] Optionally, the entity mention to be selected may be an entity mention that appears frequently. For example, if the entity mention "Shenzhen example" is frequently used by users in a certain period of time, it can be used as a candidate entity mention. In the specific implementation process, the above-mentioned candidate entity mentions can be determined by counting the user input information of certain platforms.
[0183] Optionally, the matching result of the candidate entity mention and the standard name can be obtained by determining the inverted index of the candidate entity mention and the standard name, and the recall result can be obtained based on the matching result. At the same time, the matching result of the candidate entity mention and the alias is obtained by exact matching. Further, the candidate recall set can be determined based on the recall result and the matching result. Specifically, the edit distance and edit distance similarity of the entity mention and each recall result are calculated, and the results with an edit distance of 0 or an edit similarity greater than 99% are returned to form result set 1, and result set 2 is obtained based on the matching result, and result set 1 and result set 2 are merged to obtain the candidate recall set.
[0184] S1002: Determine the text similarity between any two standard names in the above-mentioned candidate recall set, and construct a similarity matrix based on the text similarity.
[0185] The candidate recall set includes multiple standard names, the text similarities between the vectors in these standard names are determined, and a similarity matrix is constructed based on the text similarities.
[0186] Optionally, the editing similarity between each pair of standard names in the candidate recall set may be determined, and a similarity matrix may be constructed based on the text similarity.
[0187] S1003: Clustering is performed according to the similarity matrix, and the names of the candidate standards corresponding to the candidate entity mentions are determined according to the clustering results.
[0188] S1004: Expand the alias library according to the candidate entity mentions and the candidate standard names corresponding to the candidate entity mentions.
[0189] Exemplarily, the mention of the candidate entity and the corresponding candidate standard name are output to the user as a record. If the user confirms the record, the record is added to the alias library.
[0190] In this embodiment, the alias library can be accurately expanded by determining a recall set to be selected, constructing a similarity matrix, and performing clustering.
[0191] Fig.11 A schematic diagram of a clustering process of the entity link processing method provided in an embodiment of the present application is shown in FIG. Fig.11 As shown, the above step S1003 includes:
[0192] S1101 , performing agglomerative hierarchical clustering according to the similarity matrix to obtain a plurality of initial clusters.
[0193] S1102: Determine a target cluster that contains the largest number of results among multiple initial clusters.
[0194] Optionally, assuming that k clusters are obtained after step S1101, where k is an integer greater than 1, the clusters are sorted according to the number of results contained in the clusters, and the initial cluster containing the most results is used as the target cluster.
[0195] Each initial cluster includes one or more standard names.
[0196] S1103: Determine the candidate standard name corresponding to the candidate entity mention according to the standard name corresponding to the target cluster.
[0197] Taking the application embodiment applied to company name entity link as an example, the target cluster includes multiple company standard names. If the head office can be queried through the relationship between branches and headquarters in the target cluster, the head office with the most queries is output as the standard name to be selected. If there is no corresponding head office information in the target cluster, the company name with the highest number of queries is output as the standard name to be selected by sorting according to fields such as establishment date and registered capital.
[0198] In this embodiment, multiple initial clusters are obtained through clustering, and a target cluster is selected based on the size of the initial clusters. Then, the standard names to be selected are determined according to the standard names in the target cluster, thereby achieving disambiguation and ensuring the accuracy of the standard names to be selected.
[0199] Based on the same inventive concept, an entity link processing device corresponding to the entity link processing method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned entity link processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0200] Fig.12 The module structure diagram of the entity link processing device provided in the embodiment of the present application is as follows: Fig.12 As shown, the device comprises:
[0201] The acquisition module 1201 is used to acquire the entity mention to be linked.
[0202] Determination module 1202 is used to determine the recall result set corresponding to the entity mention based on a preset standard name library and a constructed alias library, wherein the recall result set includes multiple recall results, each recall result is a standard name, and the alias library is constructed based on a pre-trained deep bidirectional natural language processing model, and when the deep bidirectional natural language processing model is trained, the loss information is determined based on the constraint relationship between the position of the head of the alias in the standard name and the position of the tail of the alias in the standard name.
[0203] The determination module 1202 is also used to determine the target recall result in the recall result set according to the text similarity or semantic similarity between the entity mention and each recall result in the recall result set, and use the target recall result as the entity linking result of the entity mention.
[0204] As an optional implementation, the determination module 1202 is further configured to:
[0205] Sample data is obtained, where the sample data includes: a sample standard name and a plurality of sample aliases.
[0206] According to the sample standard name and each sample alias, a labeled header vector and a labeled tail vector are generated, wherein the labeled header vector is used to represent the position of the head of each sample alias in the sample standard name, and the labeled tail vector is used to represent the position of the tail of each sample alias in the sample standard name.
[0207] The sample standard name is input into an initial language processing model, and the initial language processing model generates a training head vector based on the sample standard name, and generates a training tail vector according to a constraint relationship between a position of a head of the alias in the standard name and a position of a tail of the alias in the standard name and the training head vector.
[0208] Loss information of the initial language processing model is determined according to the labeled head vector, the training head vector, the labeled tail vector, and the training tail vector.
[0209] The initial language processing model is iteratively corrected according to the loss information, and the initial language processing model that meets a preset iteration stop condition is used as the deep bidirectional natural language processing model.
[0210] As an optional implementation, the length of the annotation head vector, the length of the annotation tail vector, the length of the training head vector, and the length of the training tail vector are all the same as the length of the sample standard name.
[0211] The value at the first position in the annotation header vector is used to indicate whether the character at the first position of the sample standard name is the head of an alias, and the first position is any position in the annotation header vector.
[0212] The value at the second position in the annotation tail vector is used to indicate whether the character at the second position of the sample standard name is the tail of an alias, and the second position is any position in the annotation head vector.
[0213] As an optional implementation, the determination module 1202 is specifically configured to:
[0214] A first interval and a second interval indicated by the constraint relationship are obtained.
[0215] The training tail vector is generated according to the first interval and the second interval.
[0216] As an optional implementation, the determination module 1202 is specifically configured to:
[0217] The training head vector is offset according to the first interval and the second interval to obtain a plurality of offset vectors.
[0218] A maximum value among the plurality of offset vectors is determined.
[0219] The product of the maximum value and a preset value is used as the training tail vector, wherein the preset value is a value greater than 0 and less than 1.
[0220] As an optional implementation, the determination module 1202 is specifically configured to:
[0221] A first binary classification cross entropy of the labeled head vector and the training head vector is determined.
[0222] A second binary cross entropy of the labeled tail vector and the training tail vector is determined.
[0223] Determine loss information of the initial language processing model according to the first binary cross entropy and the second binary cross entropy.
[0224] As an optional implementation, the determination module 1202 is further configured to:
[0225] The target standard name is input into the deep bidirectional natural language processing model, and the deep bidirectional natural language processing model generates a target head vector and a target tail vector.
[0226] At least one head position in the target head vector that indicates that the target head vector belongs to the head and whose position is greater than a first preset value is obtained, and at least one tail position in the target tail vector that indicates that the target tail vector belongs to the tail and whose position is greater than a second preset value is obtained.
[0227] The at least one head position and the at least one tail position are combined in pairs to obtain at least one position combination, and at least one target position combination whose interval between the head position and the tail position meets a preset condition is screened out from the at least one position combination.
[0228] The text segments corresponding to each target position combination in the target standard name are respectively used as an alias of the target standard name, and the target standard name and each alias are stored in the alias library.
[0229] As an optional implementation, the determination module 1202 is specifically configured to:
[0230] The entity mention is matched with standard names in the standard name library to obtain a plurality of first matching scores.
[0231] The entity mention is matched with each alias in the alias library to obtain a plurality of second matching scores.
[0232] The recall result set is determined according to the plurality of first matching scores and the plurality of second matching scores.
[0233] As an optional implementation, the determination module 1202 is specifically configured to:
[0234] The edit distance and edit similarity of the entity mention to each recall result are determined.
[0235] If there is a first recall result with an edit distance of 0, the recall result with an edit distance of 0 is used as the target recall result.
[0236] If there is a second recall result whose edit distance is not 0, whose edit similarity is greater than a third preset value, and whose number of common consecutive characters mentioned with the entity is greater than a fourth preset value, then the second recall result is used as the target recall result.
[0237] If the first recall result and the second recall result do not exist, then obtain a subset of recall results in the recall result set whose editing similarity is greater than a fifth preset value and the number of common consecutive characters mentioned with the entity is greater than a fourth preset value, wherein the fifth preset value is less than the third preset value.
[0238] The target recall result is selected from the recall result subset based on a pre-trained similarity model.
[0239] As an optional implementation, the similarity model is trained using training samples constructed based on the alias library.
[0240] As an optional implementation, the determination module 1202 is specifically configured to:
[0241] A plurality of correct aliases corresponding to the current standard name and a plurality of incorrect aliases that are aliases that do not belong to the current standard name are searched from the alias library.
[0242] The current standard name and each correct alias are respectively regarded as a positive sample.
[0243] The current standard name and each of the erroneous aliases are respectively regarded as a negative sample.
[0244] A sample set is constructed according to the positive samples and the negative samples, and the similarity model is obtained by training according to the sample set.
[0245] As an optional implementation, the determination module 1202 is further configured to:
[0246] The recall results are combined and filtered according to preset keywords in the entity mention to obtain a filtered recall result set.
[0247] As an optional implementation, the determination module 1202 is further configured to:
[0248] Obtain the candidate entity mention, and determine a candidate recall set according to the matching results of the candidate entity mention and the standard names in the standard name library and the matching results of the candidate entity mention and each alias in the alias library, wherein the candidate recall set includes multiple standard names.
[0249] Determine the text similarity between each pair of standard names in the candidate recall set, and construct a similarity matrix based on the text similarity.
[0250] Clustering is performed according to the similarity matrix, and the candidate standard names corresponding to the candidate entity mentions are determined according to the clustering results.
[0251] The alias library is expanded according to the candidate entity mentions and the candidate standard names corresponding to the candidate entity mentions.
[0252] As an optional implementation, the determination module 1202 is specifically configured to: perform agglomerative hierarchical clustering according to the similarity matrix to obtain multiple initial clusters, determine a target cluster containing the largest number of results among the multiple initial clusters, and determine a candidate standard name corresponding to the candidate entity mention according to the standard name corresponding to the target cluster.
[0253] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0254] The present application embodiment also provides an electronic device 130, such as Fig.13 As shown, it is a schematic diagram of the structure of the electronic device 130 provided in the embodiment of the present application, including: a processor 131, a memory 132, and optionally, a bus 133. The memory 132 stores machine-readable instructions executable by the processor 131 (for example, Fig.12When the electronic device 130 is running, the processor 131 communicates with the memory 132 via the bus 133, and when the machine-readable instructions are executed by the processor 131, the method steps in the aforementioned method embodiment are executed.
[0255] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned entity link processing method are executed.
[0256] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0257] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0258] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A method for processing entity links, characterized in that: include: Get the entity mentions to be linked; Determine a recall result set corresponding to the entity mention according to a preset standard name library and a constructed alias library, wherein the recall result set includes multiple recall results, each recall result is a standard name, and the alias library is constructed based on a pre-trained deep bidirectional natural language processing model, and when the deep bidirectional natural language processing model is trained, the loss information is determined based on a constraint relationship between a position of the head of the alias in the standard name and a position of the tail of the alias in the standard name; Determine a target recall result in the recall result set according to the text similarity or semantic similarity between the entity mention and each recall result in the recall result set, and use the target recall result as the entity linking result of the entity mention; The process of constructing the alias library based on the deep bidirectional natural language processing model includes: Inputting the target standard name into the deep bidirectional natural language processing model, and generating a target head vector and a target tail vector by the deep bidirectional natural language processing model; Acquire at least one head position in the target head vector that belongs to the head and whose position is greater than a first preset value, and acquire at least one tail position in the target tail vector that belongs to the tail and whose position is greater than a second preset value; Combining the at least one head position with the at least one tail position in pairs to obtain at least one position combination, and selecting at least one target position combination whose interval between the head position and the tail position meets a preset condition from the at least one position combination; The text segments corresponding to each target position combination in the target standard name are respectively used as an alias of the target standard name, and the target standard name and each alias are stored in the alias library.
2. The entity link processing method according to claim 1, characterized in that: The process of training the deep bidirectional natural language processing model includes: Acquire sample data, the sample data including: a sample standard name and a plurality of sample aliases; Generate a label head vector and a label tail vector according to the sample standard name and each sample alias, wherein the label head vector is used to represent the position of the head of each sample alias in the sample standard name, and the label tail vector is used to represent the position of the tail of each sample alias in the sample standard name; Inputting the sample standard name into an initial language processing model, the initial language processing model generates a training head vector based on the sample standard name, and generates a training tail vector according to a constraint relationship between a position of a head of the alias in the standard name and a position of a tail of the alias in the standard name and the training head vector; Determining loss information of the initial language processing model according to the labeled head vector, the training head vector, the labeled tail vector, and the training tail vector; The initial language processing model is iteratively corrected according to the loss information, and the initial language processing model that meets a preset iteration stop condition is used as the deep bidirectional natural language processing model.
3. The entity link processing method according to claim 2, characterized in that: The length of the annotation head vector, the length of the annotation tail vector, the length of the training head vector, and the length of the training tail vector are all the same as the length of the sample standard name; The value at the first position in the annotation header vector is used to indicate whether the character at the first position of the sample standard name is the head of an alias, and the first position is any position in the annotation header vector; The value at the second position in the annotation tail vector is used to indicate whether the character at the second position of the sample standard name is the tail of an alias, and the second position is any position in the annotation head vector.
4. The entity link processing method according to claim 2, characterized in that: The generating of the training tail vector according to the constraint relationship between the position of the head of the alias in the standard name and the position of the tail of the alias in the standard name and the training head vector comprises: Acquire a first interval and a second interval indicated by the constraint relationship; The training tail vector is generated according to the first interval and the second interval.
5. The entity link processing method according to claim 4, characterized in that: The step of generating the training tail vector according to the first interval and the second interval includes: offsetting the training head vector according to the first interval and the second interval to obtain a plurality of offset vectors; determining a maximum value among the plurality of offset vectors; The product of the maximum value and a preset value is used as the training tail vector, wherein the preset value is a value greater than 0 and less than 1.
6. The entity link processing method according to claim 1, characterized in that: Determining the recall result set corresponding to the entity mention according to the preset standard name library and the constructed alias library includes: Matching the entity mention with standard names in the standard name library to obtain a plurality of first matching scores; Matching the entity mention with each alias in the alias library to obtain a plurality of second matching scores; The recall result set is determined according to the plurality of first matching scores and the plurality of second matching scores.
7. The entity link processing method according to claim 1, characterized in that: The determining, according to the text similarity or semantic similarity between the entity mention and each recall result in the recall result set, a target recall result in the recall result set, comprises: Determining the edit distance and edit similarity between the entity mention and each recall result; If there is a first recall result with an edit distance of 0, the recall result with an edit distance of 0 is used as the target recall result; If there is a second recall result whose edit distance is not 0, whose edit similarity is greater than a third preset value, and whose number of common consecutive characters mentioned with the entity is greater than a fourth preset value, then the second recall result is used as the target recall result; If the first recall result and the second recall result do not exist, obtaining a subset of recall results in the recall result set whose edit similarity is greater than a fifth preset value and whose number of common consecutive characters mentioned with the entity is greater than a fourth preset value, wherein the fifth preset value is less than the third preset value; The target recall result is selected from the recall result subset based on a pre-trained similarity model.
8. The entity link processing method according to claim 7, characterized in that: The similarity model is trained using training samples constructed based on the alias library; The training process of the similarity model includes: Searching the alias library for a plurality of correct aliases corresponding to the current standard name and a plurality of incorrect aliases that are aliases that do not belong to the current standard name; Taking the current standard name and each correct alias as a positive sample respectively; The current standard name and each of the erroneous aliases are respectively used as a negative sample; A sample set is constructed according to the positive samples and the negative samples, and the similarity model is obtained by training according to the sample set.
9. The entity link processing method according to claim 1, characterized in that: Before determining the target recall result in the recall result set according to the text similarity or semantic similarity between the entity mention and each recall result in the recall result set, the method further includes: The recall results are combined and filtered according to preset keywords in the entity mention to obtain a filtered recall result set.
10. The entity link processing method according to any one of claims 1 to 9, characterized in that: The method further comprises: Obtaining the candidate entity mentions, and determining a candidate recall set according to the matching results of the candidate entity mentions with the standard names in the standard name library and the matching results of the candidate entity mentions with each alias in the alias library, wherein the candidate recall set includes multiple standard names; Determine the text similarity between any two standard names in the candidate recall set, and construct a similarity matrix based on the text similarity; Clustering is performed according to the similarity matrix, and the names of the candidate standards corresponding to the candidate entity mentions are determined according to the clustering results; The alias library is expanded according to the candidate entity mentions and the candidate standard names corresponding to the candidate entity mentions.
11. The entity link processing method according to claim 10, characterized in that: The clustering is performed according to the similarity matrix, and the name of the candidate standard corresponding to the candidate entity mention is determined according to the clustering result, including: Performing agglomerative hierarchical clustering according to the similarity matrix to obtain a plurality of initial clusters; Determine a target cluster that contains the largest number of results among the multiple initial clusters; According to the standard name corresponding to the target cluster, the candidate standard name corresponding to the candidate entity mention is determined.
12. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of the entity link processing method as described in any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the entity link processing method according to any one of claims 1 to 11 are executed.
14. A computer program product, characterized in that The computer program product includes computer program code. When the computer program code is executed by a computing device, the computing device executes the steps of the entity link processing method according to any one of claims 1 to 11.
