Training method and device for referential resolution model, and electronic equipment

By filtering and replacing nouns in the corpus in the preset corpus pool, labeling information is automatically generated, which solves the problem of time-consuming and labor-intensive training reference digestion model, improves training efficiency and reduces manual participation.

CN114091468BActive Publication Date: 2024-12-20BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111258623.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-27
Publication Date
2024-12-20
Estimated Expiration
2041-10-27

AI Technical Summary

Technical Problem

In the prior art, the process of training refers to the digestion model is time-consuming and labor-intensive, mainly due to the need for a large number of corpus with labeling information for manual labeling, resulting in inefficiency.

Method used

The preset corpus that meets the target conditions is selected in the preset corpus pool, and the target corpus is generated by replacing the target noun, the first candidate noun and the second candidate noun as the preset noun, and the target corpus is generated, and the label information is automatically generated and model training is trained based on these corpus. , avoid manual annotation.

Benefits of technology

An automated structure is implemented for training the target corpus of the reference digestion model, reducing manual participation, improving training efficiency, and avoiding the reference digestion model's preference for certain nouns.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114091468B_ABST
    Figure CN114091468B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a training method and device for a coreference resolution model, and an electronic device. The method comprises: screening a corpus that meets a target condition in a preset corpus pool; the corpus that meets the target condition contains at least a first candidate noun, a second candidate noun, and a target noun, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun. The target noun in the corpus that meets the target condition is replaced with a preset identifier, the first candidate noun is replaced with a first preset noun, and the second candidate noun is replaced with a second preset noun, to obtain the target corpus. Generate annotation information corresponding to the target corpus, and perform training according to the target corpus and the annotation information corresponding to the target corpus. The embodiment of the present invention constructs a large amount of target corpus for training the coreference resolution model in an automated manner, avoiding the process of manually annotating the corpus, making the entire process of training the coreference resolution model time-saving and labor-saving.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to a training method and device for a coreference resolution model, and electronic equipment. Background Art

[0002] In the field of natural language processing, machines are required to perform semantic analysis and semantic understanding of natural language in order to predict the nouns referred to by pronouns in natural language. The process of determining the nouns referred to by pronouns can be understood as reference resolution. It can also be simply understood that reference resolution refers to predicting the nouns referred to by pronouns in a sentence.

[0003] Usually, in order to ensure the accuracy of the prediction of the coreference resolution model, a large amount of corpus with annotated information is needed to train it. The annotated information is the nouns that the pronouns correctly refer to and the nouns that they incorrectly refer to. The amount of corpus and the annotated information are extremely important in the entire process of training the coreference resolution model.

[0004] However, when annotating a corpus, it is necessary to accurately understand the semantics of the corpus, so currently the corpus can only be annotated manually. In addition, given that the entire process of training a coreference resolution model requires a large amount of annotated corpus, the entire process of training a coreference resolution model is currently very time-consuming and labor-intensive. Summary of the invention

[0005] In view of the above problems, the embodiments of the present invention provide a method and device for training a coreference resolution model, and an electronic device to solve the problem that the entire process of training a coreference resolution model in the prior art is time-consuming and labor-intensive.

[0006] In a first aspect of the present invention, a method for training a coreference resolution model is provided, the method comprising:

[0007] Screening corpora that meet the target conditions in a preset corpus pool; wherein the corpora that meet the target conditions contain at least a first candidate noun, a second candidate noun, and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun;

[0008] The target noun in the corpus meeting the target condition is replaced with a preset identifier, the first candidate noun is replaced with a first preset noun, and the second candidate noun is replaced with a second preset noun, to obtain a target corpus, wherein the first preset noun and the second preset noun are two different nouns in a target vocabulary containing a preset number of nouns;

[0009] Generating annotation information corresponding to the target corpus according to the first preset noun and the second preset noun;

[0010] The coreference resolution model is trained according to the target corpus and the annotation information of the corresponding target corpus.

[0011] Optionally, the target noun in the corpus meeting the target condition is replaced with a preset identifier, the first candidate noun is replaced with a first preset noun, and the second candidate noun is replaced with a second preset noun to obtain the target corpus, including:

[0012] For each corpus meeting the target condition, randomly select a noun in the target vocabulary as a first preset noun, and randomly select a noun different from the first preset noun as a second preset noun;

[0013] For each corpus meeting the target condition, the first candidate noun is replaced by a first preset noun, the second candidate noun is replaced by a second preset noun, and the target noun is replaced by a preset identifier to generate the target corpus.

[0014] Optionally, when the nouns in the target vocabulary, the first candidate noun and the second candidate noun are all names of people, randomly selecting a noun in the target vocabulary as the first preset noun, and randomly selecting a noun different from the first preset noun as the second preset noun, comprises:

[0015] According to the literary works to which the corpus meeting the target condition belongs, determining that the gender corresponding to the first candidate noun is the first gender, and the gender corresponding to the second candidate noun is the second gender;

[0016] Randomly selecting a noun from the nouns corresponding to the first gender in the target vocabulary as a first preset noun;

[0017] A noun different from the first preset noun is randomly selected from nouns corresponding to the second gender in the target vocabulary as a second preset noun.

[0018] Optionally, screening the corpus that meets the target condition in the preset corpus pool includes:

[0019] Determine the nouns contained in each piece of corpus in the preset corpus pool based on named entity recognition;

[0020] According to the nouns contained in each corpus, a corpus containing at least the first candidate noun, the second candidate noun and the target noun is selected.

[0021] Optionally, generating annotation information corresponding to the target corpus according to the first preset noun and the second preset noun includes:

[0022] The first preset noun and the second preset noun are combined into a candidate noun set;

[0023] The target information that the preset identifier refers to the first preset noun in the candidate noun set is recorded.

[0024] Optionally, the training of the coreference resolution model according to the target corpus and the annotation information of the corresponding target corpus includes:

[0025] Adding a first annotation mark to the first preset noun in the target corpus, and adding a second annotation mark to the second preset noun, to obtain an intermediate corpus;

[0026] Inputting the intermediate corpus into the coreference resolution model, generating a first semantic vector indicating the first preset noun, a second semantic vector indicating the second preset noun, and a target semantic vector according to the first annotation identifier and the second annotation identifier, wherein the target semantic vector is a semantic vector determined according to context information of the preset identifier in the intermediate corpus;

[0027] Determine a prediction result according to the similarity between the first semantic vector, the second semantic vector and the target semantic vector, wherein the prediction result includes that the preset identifier refers to the first preset noun or the preset identifier refers to the second preset noun;

[0028] According to the prediction result and the target information, corresponding parameters in the coreference resolution model are adjusted.

[0029] Optionally, determining the prediction result according to the similarities between the first semantic vector, the second semantic vector and the target semantic vector respectively includes:

[0030] Respectively concatenating the first semantic vector and the second semantic vector with the target semantic vector to obtain a first concatenated vector and a second concatenated vector;

[0031] inputting the first splicing vector and the second splicing vector into a similarity calculation model respectively to obtain a first calculated value and a second calculated value;

[0032] Determining, based on the first calculated value and the second calculated value, a probability value that the preset identifier refers to a first preset noun in the candidate noun set;

[0033] The probability value that the preset identifier refers to the first preset noun in the candidate noun set is determined as the prediction result.

[0034] In a second aspect of the present invention, a training device for a reference resolution model is provided, the device comprising:

[0035] A corpus module, used for screening corpus meeting the target condition in a preset corpus pool; wherein the corpus meeting the target condition includes at least a first candidate noun, a second candidate noun and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun;

[0036] a processing module, configured to replace the target noun in the corpus meeting the target condition with a preset identifier, replace the first candidate noun with a first preset noun, and replace the second candidate noun with a second preset noun, to obtain a target corpus, wherein the first preset noun and the second preset noun are two different nouns in a target vocabulary containing a preset number of nouns;

[0037] A tagging module, configured to generate tagging information corresponding to the target corpus according to the first preset noun and the second preset noun;

[0038] The training module is used to train the coreference resolution model according to the target corpus and the annotation information of the corresponding target corpus.

[0039] Optionally, the processing module includes:

[0040] A random selection unit, for each corpus meeting the target condition, randomly selecting a noun in the target vocabulary as a first preset noun, and randomly selecting a noun different from the first preset noun as a second preset noun;

[0041] The replacement unit is used to replace the first candidate noun with the first preset noun, replace the second candidate noun with the second preset noun, and replace the target noun with a preset identifier for each corpus that meets the target condition, so as to generate the target corpus.

[0042] Optionally, when the nouns in the target vocabulary, the first candidate nouns and the second candidate nouns are all names of people, the random selection unit includes:

[0043] A gender subunit, used for determining, based on the literary work to which the corpus meeting the target condition belongs, that the gender corresponding to the first candidate noun is the first gender, and the gender corresponding to the second candidate noun is the second gender;

[0044] A first random selection subunit, configured to randomly select a noun from the nouns corresponding to the first gender in the target vocabulary as a first preset noun;

[0045] The second random selection subunit is used to randomly select a noun different from the first preset noun from the nouns corresponding to the second gender in the target vocabulary as a second preset noun.

[0046] Optionally, the corpus module includes:

[0047] A recognition unit, used for determining the nouns contained in each corpus in the preset corpus pool based on named entity recognition;

[0048] The screening unit is used to screen the corpus containing at least the first candidate noun, the second candidate noun and the target noun according to the nouns contained in each corpus.

[0049] Optionally, the marking module includes:

[0050] A first labeling unit, configured to combine the first candidate noun and the second candidate noun into a candidate noun set;

[0051] The second marking unit is used to record target information that the preset identifier refers to the first preset noun in the candidate noun set.

[0052] Optionally, the training module includes:

[0053] an intermediate processing unit, configured to add a first annotation mark to the first preset noun in the target corpus, and add a second annotation mark to the second preset noun, to obtain an intermediate corpus;

[0054] A semantic vector unit, configured to input the intermediate corpus into the coreference resolution model, and generate a first semantic vector indicating the first preset noun, a second semantic vector indicating the second preset noun, and a target semantic vector according to the first annotation identifier and the second annotation identifier, wherein the target semantic vector is a semantic vector determined according to context information of the preset identifier in the intermediate corpus;

[0055] a similarity unit, configured to determine a prediction result according to the similarities between the first semantic vector, the second semantic vector and the target semantic vector, respectively, wherein the prediction result includes that the preset identifier refers to the first preset noun or that the preset identifier refers to the second preset noun;

[0056] An adjustment unit is used to adjust corresponding parameters in the reference resolution model according to the prediction result and the target information.

[0057] Optionally, the similarity unit is specifically used to respectively splice the first semantic vector and the second semantic vector with the target semantic vector to obtain a first spliced ​​vector and a second spliced ​​vector; respectively input the first spliced ​​vector and the second spliced ​​vector into a similarity calculation model to obtain a first calculated value and a second calculated value; determine the probability value that the preset identifier refers to the first preset noun in the candidate noun set based on the first calculated value and the second calculated value; and determine the probability value that the preset identifier refers to the first preset noun in the candidate noun set as the prediction result.

[0058] In a third aspect of the present invention, there is also provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0059] Memory, used to store computer programs;

[0060] The processor is used to implement the steps of the training method of the reference resolution model when executing the program stored in the memory.

[0061] In a fourth aspect of the implementation of the present invention, a computer-readable storage medium is further provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the training method of the reference resolution model as described in any one of the first aspects are implemented.

[0062] In a fifth aspect of the implementation of the present invention, there is also provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the training method of the above-mentioned reference resolution model.

[0063] Compared with the prior art, the present invention has the following advantages:

[0064] The training method of the reference resolution model provided by the present invention selects corpora that meet the target conditions in a preset corpus pool; wherein, in the corpus that meets the target conditions, there are at least a first candidate noun, a second candidate noun and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun. By enriching the preset corpus pool, a large number of corpora that meet the target conditions can be quickly screened out. At the same time, the target conditions are set based on the corpus used to train the reference resolution model, so that the screened corpus can be processed as the corpus for training the reference resolution model. The target noun in the corpus that meets the target conditions is replaced with a preset identifier, the first candidate noun is replaced with the first preset noun, and the second candidate noun is replaced with the second preset noun, to obtain the target corpus, wherein the first preset noun and the second preset noun are two different nouns in the target vocabulary containing a preset number of nouns. The preset identifier in the target corpus can be regarded as a pronoun in the target corpus, thereby obtaining a large number of corpora that can be used to train the reference resolution model. At the same time, by replacing the first candidate noun and the second candidate noun, the first candidate noun and the second candidate noun can be avoided from being leaked to the reference resolution model. By controlling the number of nouns in the target vocabulary, all corpora after the noun replacement can be realized as corpora involving fewer nouns, thereby realizing the homogeneity of nouns in the corpus. According to the first preset noun and the second preset noun, the annotation information of the corresponding target corpus is generated. According to the objective fact that the same noun refers to the same entity, the annotation of the target corpus is completed without the need for semantic analysis and understanding. Thus, the target corpus is annotated in a non-manual manner. Finally, according to the target corpus and the annotation information of the corresponding target corpus, the reference resolution model is trained. The embodiment of the present invention constructs a large number of target corpora for training the reference resolution model in an automated manner, and based on the objective fact that the same noun refers to the same entity, the annotation of the target corpus is completed without manual participation, thereby avoiding the process of manually annotating the corpus, making the entire process of training the reference resolution model time-saving and labor-saving. At the same time, the first preset noun and the second preset noun are selected from the target vocabulary. By controlling the number of nouns in the target vocabulary, the homogeneity of the nouns in the corpus can be achieved, avoiding the reference resolution model from having a preference for some nouns in the selected corpus. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0066] Figure 1A flowchart of the steps of the training method of the reference resolution model provided by an embodiment of the present invention;

[0067] Figure 2 A schematic diagram of an application of a training method for a coreference resolution model provided by an embodiment of the present invention;

[0068] Figure 3 A schematic diagram of a process for determining a prediction result in an embodiment of the present invention is provided;

[0069] Figure 4 A structural block diagram of a training device for a reference resolution model provided by an embodiment of the present invention;

[0070] Figure 5 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0072] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0073] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0074] See also Figure 1 , an embodiment of the present invention provides a training method for a coreference resolution model, the method comprising:

[0075] Step 101: Filter corpora that meet target conditions in a preset corpus pool.

[0076] It should be noted that a large number of articles, novels, scripts and other literary works can be obtained through the Internet as a preset corpus pool. Preferably, based on the business needs in the process of using the reference resolution model, a large number of corpora that meet the business needs can be obtained as a preset corpus pool. For example, when the reference resolution model is applied to novel analysis, a large number of novels can be obtained as a preset corpus pool, and in order to avoid the poor generalization ability of the reference resolution model due to differences in the writing styles of the novel authors, a large number of novels of different types and different authors can be selected as the preset corpus pool. Specifically, 20 different types of novels can be selected, 20 books of each type, and 400 novels can be used as the preset corpus pool.

[0077] It is understandable that not all corpora can be used to train the reference resolution model. It is required that there are pronouns in the corpus, and there are multiple different nouns before the pronouns. The multiple different nouns should include nouns that the pronouns correctly refer to and nouns that are incorrectly referred to. The purpose of setting the target condition is to screen the corpus from the preset corpus pool and generate the corpus that can be used to train the reference resolution model after processing. Since pronouns and the nouns they refer to can be replaced by the same noun, the corpus before processing may not include pronouns. Based on this, the corpus that meets the target condition obtained by screening at least has the first candidate noun, the second candidate noun and the target noun. The target noun is located after the first candidate noun and the second candidate noun in the corpus. The first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun. For example, a corpus is: "Zhang San bought an apple in the store, but the apple was bad." The corpus includes: "Zhang San", "store", "apple", "apple", four nouns in sequence. The last noun "apple" among the four nouns is the same as the noun "apple" in front of it, and different from the "store" in front of it. Then this corpus meets the target condition. For example, a corpus is: "Zhang San knows that Zhang Si already hates Wang Wu very much, so how can he let Wang Wu leave like this?" This corpus includes four nouns, "Zhang San", "Zhang Si", "Wang Wu", and "Wang Wu" in sequence. The last noun "Wang Wu" among the four nouns is the same as the previous noun "Wang Wu", but different from the previous "Zhang San". Therefore, this corpus also meets the target conditions.

[0078] Step 102: replace the target noun in the corpus that meets the target condition with a preset identifier, replace the first candidate noun with a first preset noun, and replace the second candidate noun with a second preset noun to obtain the target corpus.

[0079] It should be noted that a large amount of corpus is required to train the coreference resolution model. Therefore, a large amount of corpus that meets the target conditions will be screened. For each corpus that meets the target conditions, a target corpus is generated, so that a large amount of target corpus will be obtained. Replacing the target noun with a preset identifier is actually masking the target noun. Similarly, replacing the first candidate noun with the first preset noun is actually masking the first candidate noun; replacing the second candidate noun with the second preset noun is actually masking the second candidate noun. By masking the target noun, the first candidate noun and the second candidate noun, it is avoided that they are leaked to the coreference resolution model. Taking the masking of the target noun as an example, when the target noun is masked, the target noun is masked with a preset arbitrary identifier. Among them, the preset identifier can be any one or more of numbers, letters, and special symbols. Specifically, a masked language model (Masked Language Model, referred to as MLM) can be used to replace the target noun in the corpus that meets the target conditions with [MASK]. The first preset noun and the second preset noun in the process of masking the first candidate noun and the second candidate noun may be two different nouns in the target vocabulary containing a preset number of nouns. For example, there are two different nouns in the target vocabulary. When masking the first candidate noun, one of the nouns is selected as the first preset noun, and the first candidate noun is replaced with the first preset noun. When masking the second candidate noun, another noun is selected as the second preset noun, and the second candidate noun is replaced with the second preset noun. Of course, the number of nouns in the target vocabulary is not limited to two, and can be greater than two.

[0080] Taking the corpus that meets the target condition as follows: "Zhang San knows that Zhang Si already hates Wang Wu very much, so how can he let Wang Wu leave like this?", the target corpus generated for this corpus is: "Xiao Ming knows that Xiao Hong already hates Xiao Li very much, so how can he let [MASK] leave like this?"

[0081] Step 103: Generate annotation information corresponding to the target corpus according to the first preset noun and the second preset noun.

[0082] It should be noted that there are multiple target corpora, and for each target corpus, annotation information corresponding to the target corpus is generated according to its first preset noun and second preset noun. The annotation information here is similar to the annotation information when manually annotating the corpus used to train the reference resolution model. Through the annotation information, it can be determined that [MASK] in the target corpus refers to the first preset noun or the first candidate noun as the correct reference, and [MASK] refers to the second preset noun or the second candidate noun as the incorrect reference. [MASK] is regarded as a pronoun in the corpus used to train the reference resolution model, and the correct reference and incorrect reference are determined by the relationship between the target noun replaced by [MASK] and the first candidate noun and the second candidate noun, thereby eliminating the need for semantic analysis and semantic understanding.

[0083] Step 104: training the coreference resolution model according to the target corpus and the annotation information corresponding to the target corpus.

[0084] It should be noted that the coreference resolution model is a predetermined network model for implementing coreference resolution. Here, an existing coreference resolution model may be trained to improve its accuracy.

[0085] In an embodiment of the present invention, a corpus that meets the target condition is screened in a preset corpus pool; wherein, in the corpus that meets the target condition, there are at least a first candidate noun, a second candidate noun and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun. By enriching the preset corpus pool, a large number of corpora that meet the target condition can be quickly screened out. At the same time, the target condition is set based on the corpus used to train the reference resolution model, so that the screened corpus can be processed as the corpus for training the reference resolution model. The target noun in the corpus that meets the target condition is replaced with a preset identifier, the first candidate noun is replaced with the first preset noun, and the second candidate noun is replaced with the second preset noun, to obtain the target corpus, wherein the first preset noun and the second preset noun are two different nouns in the target vocabulary containing a preset number of nouns. The preset identifier in the target corpus can be regarded as a pronoun in the target corpus, thereby obtaining a large number of corpora that can be used to train the reference resolution model. At the same time, by replacing the first candidate noun and the second candidate noun, the first candidate noun and the second candidate noun can be avoided from being leaked to the reference resolution model. By controlling the number of nouns in the target vocabulary, all corpora after the noun replacement can be realized as corpora involving fewer nouns, thereby realizing the homogeneity of nouns in the corpus. According to the first preset noun and the second preset noun, the annotation information of the corresponding target corpus is generated. According to the objective fact that the same noun refers to the same entity, the annotation of the target corpus is completed without the need for semantic analysis and understanding. Thus, the target corpus is annotated in a non-manual manner. Finally, according to the target corpus and the annotation information of the corresponding target corpus, the reference resolution model is trained. The embodiment of the present invention constructs a large number of target corpora for training the reference resolution model in an automated manner, and based on the objective fact that the same noun refers to the same entity, the annotation of the target corpus is completed without manual participation, thereby avoiding the process of manually annotating the corpus, making the entire process of training the reference resolution model time-saving and labor-saving. At the same time, the first preset noun and the second preset noun are selected from the target vocabulary. By controlling the number of nouns in the target vocabulary, the homogeneity of the nouns in the corpus can be achieved, avoiding the reference resolution model from having a preference for some nouns in the selected corpus.

[0086] Optionally, the first candidate noun, the second candidate noun, the target noun, the first preset noun and the second preset noun all correspond to the same entity type, where the entity type includes: a person's name or a place name.

[0087] It should be noted that the reference resolution model is used to determine the nouns that the pronouns in the corpus correctly refer to. Here, the noun can be a noun corresponding to any entity type. It is understandable that in order to improve the accuracy of the reference resolution model in identifying that the pronoun correctly refers to a noun under a certain entity type, a corpus containing nouns under the entity type can be used for training. For example, personal pronouns only refer to names. In order to improve the accuracy of the reference resolution model in identifying that personal pronouns correctly refer to names, a corpus containing different names is used for training, that is, the first candidate noun, the second candidate noun, the target noun, the first preset noun, and the second preset noun are different names. Preferably, the first preset noun and the second preset noun are different names that are preset. For example, the first preset noun can be "Zhang San" and the second preset noun can be "Li Si". Preferably, different popular names can be selected as the first preset noun and the second preset noun. Here, popular names can be well-known names or names with many duplicate names. For example, according to the census, the top ten names of the number of duplicate names are determined, and any two of them are selected as the first preset noun and the second preset noun.

[0088] See also Figure 2 , which is a schematic diagram of the practical application of the training method of the coreference resolution model provided by an embodiment of the present invention, including:

[0089] Step 201: Obtain unlabeled novel corpus. Obtain corpus from multiple novels of different styles and construct a preset corpus pool.

[0090] Step 202: Generate self-supervised corpus. That is, select corpus that meets the target condition from the preset corpus pool, and use the corpus that meets the target condition as the self-supervised corpus. The process of selecting corpus that meets the target condition here is similar to the above step 101. In the embodiment of the present invention, the first candidate noun, the second candidate noun and the target noun are all names of people.

[0091] Step 203: homogenization of name information. For the self-supervised corpus, different popular names are used to replace the first candidate noun and the second candidate noun, and the target noun is replaced with a preset identifier. The self-supervised corpus after homogenization of name information is annotated to generate annotation information.

[0092] Step 204: vector extraction: extracting vector representations of preset identifiers in the supervised corpus, vector representations of names correctly represented by preset identifiers, and vector representations of names incorrectly represented by preset identifiers.

[0093] Step 205: Model training: The coreference resolution model is trained according to the extracted vector identifiers, and the training effect of the coreference resolution model is monitored based on a loss function.

[0094] It is understandable that, when the entity type includes place names, in order to improve the accuracy of the reference resolution model in identifying the correct pronouns referring to place names, corpora containing different place names are used for training, that is, the first candidate noun, the second candidate noun, the target noun, the first preset noun and the second preset noun are different place names. Of course, entity types can also include: institution names, proper nouns, etc.

[0095] In an embodiment of the present invention, the first candidate noun, the second candidate noun, the target noun, the first preset noun and the second preset noun all correspond to the same entity type, which can improve the accuracy of the reference resolution model in identifying pronouns that correctly refer to nouns under the same entity type.

[0096] Optionally, the target noun in the corpus meeting the target condition is replaced with a preset identifier, the first candidate noun is replaced with a first preset noun, and the second candidate noun is replaced with a second preset noun to obtain the target corpus, including:

[0097] For each corpus meeting the target condition, a noun is randomly selected in the target vocabulary as a first preset noun, and a noun different from the first preset noun is randomly selected again as a second preset noun.

[0098] It should be noted that the first preset noun and the second preset noun selected for different corpora that meet the target conditions can be the same or different. Since the first preset noun and the second preset noun are randomly selected twice, in theory, the number of the first type of corpora and the second type of corpora are almost or completely the same. Among them, the first preset noun in the first type of corpora is the same as the second preset noun in the second type of corpora, and the second preset noun in the first type of corpora is the same as the first preset noun in the second type of corpora. Taking Zhang San and Li Si in the target vocabulary as an example, the probability of randomly selecting Zhang San first and then randomly selecting Li Si from the target vocabulary is the same as the probability of randomly selecting Li Si first and then randomly selecting Zhang San. Therefore, the probability of Zhang San as the first preset noun and Li Si as the second preset noun is the same as the probability of Li Si as the first preset noun and Zhang San as the second preset noun. In the first type of corpus, Zhang San is used as the first preset noun and Li Si is used as the second preset noun, and in the second type of corpus, Li Si is used as the first preset noun and Zhang San is used as the second preset noun.

[0099] For each corpus meeting the target condition, the first candidate noun is replaced by a first preset noun, the second candidate noun is replaced by a second preset noun, and the target noun is replaced by a preset identifier to generate the target corpus.

[0100] It should be noted that each corpus that meets the target condition corresponds to a first preset noun and a second preset noun randomly selected for it. When performing noun replacement, for each corpus, the first preset noun and the second preset noun corresponding to the corpus are used to replace. For example, if the first preset noun randomly selected for the first corpus is Zhang San, and the second preset noun randomly selected is Li Si, then Zhang San is used to replace the first candidate noun in the first corpus, and Li Si is used to replace the second candidate noun in the first corpus.

[0101] In an embodiment of the present invention, for each corpus that meets the target conditions, a first preset noun and a second preset noun are selected from the target vocabulary by random selection, thereby ensuring that the number of target corpora that correctly refer to the first noun and the number of target corpora that correctly refer to the second noun in the target corpus including two pronouns are nearly or completely consistent.

[0102] Optionally, randomly selecting a noun in the target vocabulary as a first preset noun, and randomly selecting a noun different from the first preset noun as a second preset noun, comprises:

[0103] According to the literary works to which the corpus meeting the target conditions belongs, the gender corresponding to the first candidate noun is determined to be the first gender, and the gender corresponding to the second candidate noun is determined to be the second gender.

[0104] It should be noted that the corpus in the preset corpus pool is derived from literary works, so the corpus that meets the target conditions is also derived from literary works. The literary works to which each corpus belongs can be marked in the preset corpus pool, so as to facilitate the determination of the literary works to which each corpus belongs. For example, all corpus derived from literary work M in the preset corpus pool are marked as corpus m, so that the literary work to which the corpus belongs can be determined by marking the corpus. After determining the literary work, the gender corresponding to the first candidate noun and the second candidate noun can be determined based on the analysis of the literary work. The gender here is the gender of the character whose name is the first candidate noun or the second candidate noun in the literary work. For example, the characters in a novel include a male character Zhang San and a female character Li Si. If the corpus that meets the target conditions comes from the novel, and the first candidate noun is Zhang San and the second candidate noun is Li Si, then the first gender is male and the second gender is female. It can be understood that the first gender and the second gender can be the same or different, and the "first" and "second" are used to distinguish the corresponding candidate nouns.

[0105] A noun is randomly selected from the nouns corresponding to the first gender in the target vocabulary as the first preset noun.

[0106] A noun different from the first preset noun is randomly selected from nouns corresponding to the second gender in the target vocabulary as a second preset noun.

[0107] It should be noted that the target word library containing a preset number of names is the preset name library, and a name library storing at least four names can be preset. Each name in the preset name library is marked with gender, and each gender corresponds to at least two names. For example, the preset name library may include: Xiao Ming, male; Xiao Li, male; Xiao Hong, female; Xiao Hua, female. When the first gender and the second gender are both male, one will be randomly selected from Xiao Ming and Xiao Li as the first preset noun. If Xiao Li is randomly selected, then a noun different from Xiao Li will be randomly selected from Xiao Ming and Xiao Li again. If they are the same, reselect until the selected noun is different from Xiao Li. If Xiao Ming is randomly selected for the second time, Xiao Li is the first preset noun and Xiao Ming is the second preset noun. If the first gender is male and the second gender is female, one will be randomly selected from Xiao Ming and Xiao Li as the first preset noun, and one will be randomly selected from Xiao Hong and Xiao Hua as the second preset noun. Preferably, the names in the preset name library can be common names, for example, the top ten names of male persons with the most duplicate names determined according to the population census, at least two of which are selected as names in the preset name library. Similarly, the top ten names of female persons with the most duplicate names determined according to the population census, at least two of which are selected as names in the preset name library.

[0108] In an embodiment of the present invention, the first preset noun and the first candidate noun corresponding to the same gender are replaced, and the second preset noun and the second candidate noun corresponding to the same gender are replaced, so that the target corpus retains the gender information in the corpus that meets the target conditions, which can further improve the accuracy of the coreference resolution model.

[0109] Optionally, the above step 101: screening corpora meeting target conditions in a preset corpus pool may include:

[0110] Based on named entity recognition, the nouns contained in each corpus in the preset corpus pool are determined.

[0111] According to the nouns contained in each corpus, a corpus containing at least a first candidate noun, a second candidate noun and a target noun is selected.

[0112] It should be noted that the noun referred to by the pronoun or anaphora in the anaphora resolution technology can correspond to any entity type, that is, it can be a name, a place name, a building name, a phrase, etc. Based on the business needs in the process of using the anaphora resolution model, the anaphora resolution model can be trained to analyze and process only any one of the names, place names or building names. For example, when the anaphora resolution model is trained to analyze and process the names of people, the trained anaphora resolution model is only applicable to the names referred to by the pronouns or anaphora in the predicted sentence. Correspondingly, in the process of screening the corpus that meets the target conditions, all nouns are names. Therefore, it is sufficient to determine the names contained in each corpus in the preset corpus pool based on named entity recognition. When a corpus is: "Zhang San bought an apple in the store, but the apple was bad", it only contains a name "Zhang San", and the corpus does not meet the target conditions. Another corpus is: "Zhang San knows that Zhang Si already hates Wang Wu very much, so how can he let Wang Wu leave like this?" It contains four names: "Zhang San", "Zhang Si", "Wang Wu", and "Wang Wu". The fourth name is the same as the third name, and the fourth name is different from the first name or the second name, so this corpus meets the target condition. Here, the target condition can be set as: there must be two or more different names in each corpus, there must be a name that appears more than or equal to twice in each corpus, and the repeated name in each corpus must be after all different names in the sentence.

[0113] In the embodiment of the present invention, nouns in the corpus can be identified based on named entity recognition, so as to judge whether the corpus meets the target conditions based on the identified nouns, and then automatically screen out the corpus that meets the target conditions in the preset corpus pool without manual intervention.

[0114] Optionally, the above step 103: generating annotation information corresponding to the target corpus according to the first preset noun and the second preset noun may include:

[0115] The first preset noun and the second preset noun are combined into a candidate noun set.

[0116] It should be noted that the candidate noun set includes: two nouns with correct reference and two nouns with incorrect reference. Pair type can be used here for representation, for example, the candidate noun set can be [Wang Wu, Zhang San]. It can be understood that the target corpus may contain two or more nouns with incorrect references by preset identifiers. For example, based on the corpus: "Zhang San knows that Zhang Si already hates Wang Wu very much, so how can he let Wang Wu leave like this", the generated target corpus is: "Xiao Ming knows that Xiao Hong already hates Xiao Li very much, so how can he let [MASK] leave like this". In the target corpus, the nouns with incorrect references by the preset identifier [MASK] include "Xiao Ming" and "Xiao Hong", and the nouns with correct references by the preset identifier [MASK] include "Xiao Li". At this time, the candidate noun set can be [Xiao Ming, Xiao Li] or [Xiao Hong, Xiao Li].

[0117] Preferably, for each selected corpus that meets the target condition, a target number of target corpora can be generated. The target number is the same as the number of all nouns that are different from the target noun in the corpus that meets the target condition. For example, the corpus that meets the target condition is: "Zhang San knows that Zhang Si originally hates Wang Wu very much, so how can he let Wang Wu leave like this", which contains two nouns "Zhang San" and "Zhang Si" that are different from the target noun "Wang Wu", and two target corpora can be generated accordingly. The first target corpus is: "Xiao Ming knows that Xiao Hong originally hates Xiao Li very much, so how can he let [MASK] leave like this", and the candidate noun set can be [Xiao Ming, Xiao Li]. The second target corpus is: "Xiao Ming knows that Xiao Hong originally hates Xiao Li very much, so how can he let [MASK] leave like this", and the candidate noun set can be [Xiao Hong, Xiao Li]. Although the sentences in the two target corpora are the same, the candidate noun sets are different, so they can be used as two different target corpora.

[0118] The target information that the preset identifier refers to the first preset noun in the candidate noun set is recorded.

[0119] It should be noted that the first preset noun correctly indicated by the preset identifier and the corresponding candidate noun set can be recorded together. For example, in a new line, the first preset noun correctly indicated by the preset identifier is recorded below the candidate noun set.

[0120] In the embodiment of the present invention, based on the fact that the target noun is the same as the first candidate noun, the first preset noun replacing the first candidate noun is used as the noun correctly referred to by the preset identifier replacing the target noun. Based on the fact that the target noun is different from the second candidate noun, the second preset noun replacing the second candidate noun is used as the noun incorrectly referred to by the preset identifier replacing the target noun. The correct reference and incorrect reference of the preset identifier are determined based on the comparison between nouns without the need for semantic analysis.

[0121] Optionally, the above step 104: training the coreference resolution model according to the target corpus and the annotation information corresponding to the target corpus may include:

[0122] A first annotation mark is added to the first preset noun in the target corpus, and a second annotation mark is added to the second preset noun to obtain an intermediate corpus.

[0123] It should be noted that in the process of training the reference resolution model through the target corpus, it is necessary to extract the vector representation of the noun correctly referred to by the preset identifier in the target corpus and the vector representation of the noun incorrectly referred to. The vector representation of the noun in the target corpus can be obtained by the labeling method. Therefore, it is necessary to process the target corpus to obtain the intermediate corpus. The first labeling identifier includes two parts, one part is located in front of the first preset noun, and the other part is located after the first preset noun, and both parts are adjacent to the first preset noun. Similarly, the second labeling identifier includes two parts, one part is located in front of the second preset noun, and the other part is located after the second preset noun, and both parts are adjacent to the second preset noun. Here, the first labeling identifier and the second labeling identifier can be any identifier composed of numbers and / or letters. For example, the target corpus is: "Xiaohong already hates Xiaoli very much, how can she let [MASK] leave like this"; then the intermediate corpus is: "[E1start] Xiaohong [E1end] already hates [E2start] Xiaoli [E2end] very much, how can she let [MASK] leave like this". Among them, [E1start] and [E1end] are the first annotation marks, and [E2start] and [E2end] are the second annotation marks. Of course, when extracting the vector representation of the nouns correctly referred to by the preset marks in the target corpus and the vector representation of the nouns incorrectly referred to, the word vectors (TokenEmbeddings) of the nouns can also be directly extracted based on the BERT (Bidirectional Encoder Representations from Transformers) module in the reference resolution model.

[0124] The intermediate corpus is input into the reference resolution model, and a first semantic vector indicating the first preset noun, a second semantic vector indicating the second preset noun, and a target semantic vector are generated according to the first annotation identifier and the second annotation identifier, wherein the target semantic vector is a semantic vector determined according to the context information of the preset identifier in the intermediate corpus.

[0125] It should be noted that for the intermediate corpus, [E1start] and [E1end] can be extracted as the vector representation of the first preset noun, and [E2start] and [E2end] can be extracted as the vector representation of the second preset noun. Specifically, the first semantic vector is the word vector of the first annotation in the intermediate corpus, which is used as the semantic vector of the first preset noun. Similarly, the second semantic vector is the word vector of the second annotation in the target corpus, which is used as the semantic vector of the second preset noun. The target semantic vector is a semantic vector determined based on the word vector of the context of the preset identifier in the target corpus.

[0126] The prediction result is determined according to the similarities between the first semantic vector, the second semantic vector and the target semantic vector respectively.

[0127] In this step, the prediction result includes that the preset identifier refers to the first preset noun or the preset identifier refers to the second preset noun; specifically, when the similarity between the first semantic vector and the target semantic vector is higher than the similarity between the second semantic vector and the target semantic vector, the prediction result is that the preset identifier refers to the first preset noun, otherwise the prediction result is that the preset identifier refers to the second preset noun. Preferably, the probability value of the preset identifier referring to the first preset noun can be used as the prediction result. When the probability value is greater than 50%, it can be considered that the preset identifier refers to the first preset noun, otherwise it is considered that the preset identifier refers to the second preset noun.

[0128] According to the prediction results and target information, adjust the corresponding parameters in the reference resolution model.

[0129] In this step, the coreference resolution model can be trained once through a target corpus, and the corresponding parameters in the coreference resolution model can be adjusted based on each training result to make the result more accurate. That is, the process of optimizing the model parameters using the loss function during the model training process. Here, the prediction result is the result calculated according to the coreference resolution model, and the target information can be considered as a known true result. In order to improve the accuracy of the prediction result of the coreference resolution model to a higher value, a large number of different target corpora will be continuously used for training. After each training, the corresponding parameters in the coreference resolution model will be adjusted according to the prediction result and the true result to make the prediction result more accurate. When the accuracy of the prediction result of the coreference resolution model reaches a higher value, the training can be stopped. Specifically, the cross entropy loss function is used to optimize the model parameters, and the optimization ends when the cross entropy is minimum. Cross entropy loss function: L = -[ylogy'+(1-y)log(1-y')], where L represents the cross entropy value, y represents the prediction result, and y' represents the true result.

[0130] In the embodiment of the present invention, the target corpus is processed by using the annotation position annotation method to obtain the intermediate corpus. Based on the similarity between the first semantic vector indicating the first preset noun, the second semantic vector indicating the second preset noun and the target semantic vector in the intermediate corpus, the prediction result is determined, and then according to the prediction result and the target information representing the real result, the corresponding parameters in the coreference resolution model are adjusted to realize the training of the coreference resolution model.

[0131] Optionally, determining the prediction result according to the similarity between the first semantic vector, the second semantic vector and the target semantic vector respectively includes:

[0132] The first semantic vector and the second semantic vector are concatenated with the target semantic vector to obtain a first concatenated vector and a second concatenated vector.

[0133] The first splicing vector and the second splicing vector are respectively input into the similarity calculation model to obtain a first calculated value and a second calculated value.

[0134] It should be noted that the first calculated value represents the similarity between the first semantic vector and the target semantic vector, and the second calculated value represents the similarity between the second semantic vector and the target semantic vector.

[0135] Determining a probability value that the preset identifier refers to a first preset noun in the candidate noun set according to the first calculated value and the second calculated value;

[0136] The probability value that the preset identifier refers to the first preset noun in the candidate noun set is determined as the prediction result.

[0137] It should be noted that the first calculated value is greater than the second calculated value, indicating that the similarity between the first semantic vector and the target semantic vector is higher than the similarity between the second semantic vector and the target semantic vector. The first calculated value is less than the second calculated value, indicating that the similarity between the first semantic vector and the target semantic vector is lower than the similarity between the second semantic vector and the target semantic vector. Based on the numerical relationship between the first calculated value and the second calculated value, the probability value of the target semantic vector being the first semantic vector can be determined, that is, the probability value of the preset identifier referring to the first preset noun in the candidate noun set.

[0138] like Figure 3 As shown, it is a schematic diagram of the process of determining the prediction result according to the similarity between the first semantic vector, the second semantic vector and the target semantic vector respectively; wherein, the three semantic vectors of the semantic vector layer are: the first semantic vector, the second semantic vector, and the target semantic vector; the first semantic vector and the target semantic vector are input into the first vector splicing module of the vector splicing layer to obtain the first splicing vector in the above embodiment. The second semantic vector and the target semantic vector are input into the second vector splicing module of the vector splicing layer to obtain the second splicing vector in the above embodiment. The first splicing vector is input into the first similarity calculation module of the score prediction layer to obtain the first calculated value in the above embodiment; the second splicing vector is input into the second similarity calculation module of the score prediction layer to obtain the second calculated value in the above embodiment. The first calculated value and the second calculated value are input into the Softmax layer, and the Softmax operation is performed on them to obtain the prediction result in the above embodiment, and the prediction result is input into the result layer, and the result layer outputs the prediction result for subsequent processing.

[0139] In the embodiment of the present invention, two different vectors are concatenated, and the similarity of the two vectors before the concatenation is calculated from the concatenated vector, thereby facilitating the calculation of the similarity between multiple vectors. Based on the similarity between the first semantic vector and the second semantic vector and the target semantic vector, the probability value of the preset identifier correctly referring to the first preset noun in the candidate noun set is obtained, which is convenient for the subsequent adjustment of the corresponding parameters in the reference resolution model.

[0140] The above describes the training method of the coreference resolution model provided by the embodiment of the present invention. The following describes the training device of the coreference resolution model provided by the embodiment of the present invention in conjunction with the accompanying drawings.

[0141] See also Figure 4 The embodiment of the present invention further provides a training device for a reference resolution model, the device comprising:

[0142] The corpus module 41 is used to screen corpus that meets the target condition in a preset corpus pool; wherein the corpus that meets the target condition contains at least a first candidate noun, a second candidate noun and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun;

[0143] The processing module 42 is used to replace the target noun in the corpus that meets the target condition with a preset identifier, replace the first candidate noun with the first preset noun, and replace the second candidate noun with the second preset noun, to obtain the target corpus, wherein the first preset noun and the second preset noun are two different nouns in the target vocabulary containing a preset number of nouns;

[0144] A labeling module 43, used to generate labeling information corresponding to the target corpus according to the first preset noun and the second preset noun;

[0145] The training module 44 is used to train the coreference resolution model according to the target corpus and the annotation information corresponding to the target corpus.

[0146] Optionally, the first candidate noun, the second candidate noun, the target noun, the first preset noun and the second preset noun all correspond to the same entity type, where the entity type includes: a person's name or a place name.

[0147] Optionally, the processing module 42 includes:

[0148] A random selection unit, for each corpus meeting the target condition, randomly selecting a noun in the target vocabulary as a first preset noun, and randomly selecting a noun different from the first preset noun as a second preset noun;

[0149] The replacement unit is used to replace the first candidate noun with the first preset noun, replace the second candidate noun with the second preset noun, and replace the target noun with a preset identifier for each corpus that meets the target condition, so as to generate the target corpus.

[0150] Optionally, when the nouns in the target vocabulary, the first candidate nouns and the second candidate nouns are all names of people, the random selection unit includes:

[0151] A gender subunit, used for determining, based on the literary work to which the corpus meeting the target condition belongs, that the gender corresponding to the first candidate noun is the first gender, and the gender corresponding to the second candidate noun is the second gender;

[0152] A first random selection subunit, configured to randomly select a noun from the nouns corresponding to the first gender in the target vocabulary as a first preset noun;

[0153] The second random selection subunit is used to randomly select a noun different from the first preset noun from the nouns corresponding to the second gender in the target vocabulary as a second preset noun.

[0154] Optionally, the corpus module 41 includes:

[0155] A recognition unit, used for determining the nouns contained in each corpus in a preset corpus pool based on named entity recognition;

[0156] The screening unit is used to screen the corpus containing at least the first candidate noun, the second candidate noun and the target noun according to the nouns contained in each corpus.

[0157] Optionally, the marking module 43 includes:

[0158] A first labeling unit is used to form a candidate noun set by combining the first candidate noun and the second candidate noun;

[0159] The second marking unit is used to record target information that the preset identifier refers to the first preset noun in the candidate noun set.

[0160] Optionally, the training module 44 includes:

[0161] An intermediate processing unit, configured to add a first annotation mark to a first preset noun in the target corpus, and add a second annotation mark to a second preset noun, to obtain an intermediate corpus;

[0162] A semantic vector unit, used for inputting the intermediate corpus into the coreference resolution model, generating a first semantic vector indicating the first preset noun, a second semantic vector indicating the second preset noun, and a target semantic vector according to the first annotation identifier and the second annotation identifier, wherein the target semantic vector is a semantic vector determined according to the context information of the preset identifier in the intermediate corpus;

[0163] A similarity unit, configured to determine a prediction result according to the similarities between the first semantic vector, the second semantic vector and the target semantic vector, wherein the prediction result includes that the preset identifier refers to the first preset noun or that the preset identifier refers to the second preset noun;

[0164] The adjustment unit is used to adjust the corresponding parameters in the reference resolution model according to the prediction results and target information.

[0165] Optionally, the similarity unit is specifically used to splice the first semantic vector and the second semantic vector with the target semantic vector, respectively, to obtain a first spliced ​​vector and a second spliced ​​vector; input the first spliced ​​vector and the second spliced ​​vector into a similarity calculation model, respectively, to obtain a first calculated value and a second calculated value; determine the probability value that the preset identifier refers to the first preset noun in the candidate noun set based on the first calculated value and the second calculated value; and determine the probability value that the preset identifier refers to the first preset noun in the candidate noun set as a prediction result.

[0166] The training device of the reference resolution model provided by the embodiment of the present invention can achieve Figure 1 The method embodiment refers to the various processes implemented by the training method of the digestion model, and to avoid repetition, they are not repeated here.

[0167] In the embodiment of the present invention, a large amount of target corpus for training the coreference resolution model is constructed in an automated manner, and based on the objective fact that the same noun refers to the same entity, the target corpus is annotated without manual participation, thus avoiding the process of manually annotating the corpus, and making the entire process of training the coreference resolution model time-saving and labor-saving. At the same time, the first preset noun and the second preset noun are selected from the target vocabulary, and the homogeneity of the nouns in the corpus can be achieved by controlling the number of nouns in the target vocabulary, thus avoiding the coreference resolution model from having a preference for some nouns in the screened corpus.

[0168] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504;

[0169] Memory 503, used for storing computer programs;

[0170] The processor 501 is used to execute the program stored in the memory 503, and implements the following steps:

[0171] Screening corpora meeting the target condition in a preset corpus pool; wherein the corpus meeting the target condition contains at least a first candidate noun, a second candidate noun and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun;

[0172] The target noun in the corpus meeting the target condition is replaced with a preset identifier, the first candidate noun is replaced with a first preset noun, and the second candidate noun is replaced with a second preset noun, to obtain the target corpus, wherein the first preset noun and the second preset noun are two different nouns in the target vocabulary containing a preset number of nouns;

[0173] Generate annotation information corresponding to the target corpus according to the first preset noun and the second preset noun;

[0174] The coreference resolution model is trained based on the target corpus and the annotation information of the corresponding target corpus.

[0175] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0176] The communication interface is used for communication between the above terminal and other devices.

[0177] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0178] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0179] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the training method of the reference resolution model described in any of the above embodiments.

[0180] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the training method of the coreference resolution model described in the above embodiment.

[0181] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0182] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0183] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0184] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A training method for a coreference resolution model, characterized in that: The method comprises: Screening corpora that meet the target conditions in a preset corpus pool; wherein the corpora that meet the target conditions contain at least a first candidate noun, a second candidate noun, and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun; The target noun in the corpus that meets the target condition is replaced with a preset identifier, the first candidate noun is replaced with a first preset noun, and the second candidate noun is replaced with a second preset noun, to obtain a target corpus, wherein the first preset noun and the second preset noun are two different nouns randomly selected from a target vocabulary containing a preset number of nouns, the first candidate noun, the second candidate noun, the target noun, the first preset noun and the second preset noun all correspond to the same entity type, and the preset identifier is any one or more of numbers, letters, and special symbols; Generating annotation information corresponding to the target corpus according to the first preset noun and the second preset noun; The coreference resolution model is trained according to the target corpus and the annotation information corresponding to the target corpus.

2. The method according to claim 1, characterized in that The target noun in the corpus meeting the target condition is replaced with a preset identifier, the first candidate noun is replaced with a first preset noun, and the second candidate noun is replaced with a second preset noun, to obtain the target corpus, including: For each corpus meeting the target condition, randomly select a noun in the target vocabulary as a first preset noun, and randomly select a noun different from the first preset noun as a second preset noun; For each corpus meeting the target condition, the first candidate noun is replaced by a first preset noun, the second candidate noun is replaced by a second preset noun, and the target noun is replaced by a preset identifier to generate the target corpus.

3. The method according to claim 2, characterized in that In the case where the nouns in the target vocabulary, the first candidate noun and the second candidate noun are all names of people, randomly selecting a noun in the target vocabulary as the first preset noun, and randomly selecting a noun different from the first preset noun as the second preset noun, comprises: According to the literary works to which the corpus meeting the target condition belongs, determining that the gender corresponding to the first candidate noun is the first gender, and the gender corresponding to the second candidate noun is the second gender; Randomly selecting a noun from the nouns corresponding to the first gender in the target vocabulary as a first preset noun; A noun different from the first preset noun is randomly selected from nouns corresponding to the second gender in the target vocabulary as a second preset noun.

4. The method according to claim 1, characterized in that The step of screening the corpus that meets the target condition in the preset corpus pool includes: Determine the nouns contained in each piece of corpus in the preset corpus pool based on named entity recognition; According to the nouns contained in each corpus, a corpus containing at least the first candidate noun, the second candidate noun and the target noun is selected.

5. The method according to claim 1, characterized in that The step of generating the annotation information corresponding to the target corpus according to the first preset noun and the second preset noun includes: The first preset noun and the second preset noun are combined into a candidate noun set; The target information that the preset identifier refers to the first preset noun in the candidate noun set is recorded.

6. The method according to claim 5, characterized in that The training of the coreference resolution model according to the target corpus and the annotation information corresponding to the target corpus includes: Adding a first annotation mark to the first preset noun in the target corpus, and adding a second annotation mark to the second preset noun, to obtain an intermediate corpus; Inputting the intermediate corpus into the coreference resolution model, generating a first semantic vector indicating the first preset noun, a second semantic vector indicating the second preset noun, and a target semantic vector according to the first annotation identifier and the second annotation identifier, wherein the target semantic vector is a semantic vector determined according to context information of the preset identifier in the intermediate corpus; Determine a prediction result according to the similarity between the first semantic vector, the second semantic vector and the target semantic vector, wherein the prediction result includes that the preset identifier refers to the first preset noun or the preset identifier refers to the second preset noun; According to the prediction result and the target information, corresponding parameters in the coreference resolution model are adjusted.

7. The method according to claim 6, characterized in that The step of determining a prediction result according to the similarities between the first semantic vector, the second semantic vector and the target semantic vector, respectively, includes: Respectively concatenating the first semantic vector and the second semantic vector with the target semantic vector to obtain a first concatenated vector and a second concatenated vector; Inputting the first splicing vector and the second splicing vector into a similarity calculation model respectively to obtain a first calculated value and a second calculated value; Determining, based on the first calculated value and the second calculated value, a probability value that the preset identifier refers to a first preset noun in the candidate noun set; The probability value that the preset identifier refers to the first preset noun in the candidate noun set is determined as the prediction result.

8. A training device for a reference resolution model, characterized in that: The device comprises: A corpus module, used for screening corpus meeting the target condition in a preset corpus pool; wherein the corpus meeting the target condition includes at least a first candidate noun, a second candidate noun and a target noun, the target noun is located after the first candidate noun and the second candidate noun in the corpus, the first candidate noun is the same as the target noun, and the second candidate noun is different from the target noun; A processing module, used for replacing the target noun in the corpus that meets the target condition with a preset identifier, replacing the first candidate noun with a first preset noun, and replacing the second candidate noun with a second preset noun, to obtain a target corpus, wherein the first preset noun and the second preset noun are two different nouns randomly selected from a target vocabulary containing a preset number of nouns, the first candidate noun, the second candidate noun, the target noun, the first preset noun, and the second preset noun all correspond to the same entity type, and the preset identifier is any one or more of numbers, letters, and special symbols; A tagging module, configured to generate tagging information corresponding to the target corpus according to the first preset noun and the second preset noun; The training module is used to train the coreference resolution model according to the target corpus and the annotation information corresponding to the target corpus.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the training method of the reference resolution model as described in any one of claims 1 to 7 when executing the program stored in the memory.

10. 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 training method of the reference resolution model as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Reinforcement learning based anaphora resolution method

    CN110134944A

  • Automatic error correction method and device, terminal equipment and storage medium

    CN110362824A

  • Natural language processing model training method, device and equipment and storage medium

    CN112001190A

  • Text processing method, device and equipment and storage medium

    CN112084789A

  • Generation of text classifier training data

    CN112749547A