| CPC G06F 40/279 (2020.01) [G06F 40/166 (2020.01); G06F 40/30 (2020.01)] | 20 Claims |

|
1. A method for training a relationship extraction model performed by a computer device, the method comprising:
acquiring sample text sentences, the sample text sentences comprising entity pairs and relationship labels of the entity pairs;
extracting positive example sentence pairs and negative example sentence pairs from the sample text sentences according to the relationship labels, and performing positive-negative example sampling on the positive example sentence pairs and the negative example sentence pairs, to obtain a training set;
inputting the training set into a relationship extraction model to generate loss values, the loss values comprising a contrastive loss value, the contrastive loss value being used for representing a difference between a similarity of sentences in the positive example sentence pairs and a similarity of sentences in the negative example sentence pairs; and
adjusting parameters of the relationship extraction model according to the loss values, and returning to the operation of extracting positive example sentence pairs and negative example sentence pairs from the sample text sentences according to the relationship labels to perform iterative training until a training end condition is met, to obtain an updated relationship extraction model, the updated relationship extraction model being configured to identify an entity relationship of an entity pair in a text sentence.
|