Target sentence recognition method, device, equipment, storage medium and program product

By using a combination of word vectors and grammar trees in document-level relationship extraction, identifying target sentences is solved, the problem of existing methods ignoring long dependencies between sentences is improved, recognition accuracy and interpretability are reduced, and computational complexity is reduced.

CN114358003BActive Publication Date: 2025-05-02SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111580298.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2025-05-02
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

The existing document-level relationship extraction method based on convolutional neural networks and graph convolutional neural networks ignores the long dependence between sentences when identifying target sentences, and cannot fully utilize the structural information of entities and relationships. The model calculation is complex, the operation needs are large, and the explanation is poor.

Method used

By obtaining the pending document and target entity, performing word segmentation processing and generating word vectors, constructing a sentence grammar tree, combining word vectors and grammar trees for judgment, and identifying the target sentences corresponding to the target entity.

Benefits of technology

It improves the accuracy of target sentence recognition, combines the characteristics of words and sentence characteristics, enhances the interpretability of recognition, and reduces the computational complexity of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114358003B_ABST
    Figure CN114358003B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, equipment, storage medium and program product for identifying a target sentence. The method comprises: obtaining a document to be processed and a target entity; performing word segmentation processing on the document to be processed to obtain a number of word segments; generating a word vector for each word segment according to a preset rule; generating a target sentence syntax tree corresponding to each sentence in the document to be processed according to the word segmentation; judging each sentence according to the word vector and the target sentence syntax tree to obtain a target sentence corresponding to the target entity. The method can accurately identify the target sentence corresponding to the entity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a target sentence recognition method, device, equipment, storage medium and program product. Background Art

[0002] With the development of artificial intelligence technology, document parsing technology has emerged to extract specific relationships from documents.

[0003] In traditional technology, there are mainly two methods. One is document-level relationship extraction based on convolutional neural networks. This technology uses the entire document as context, first uses a convolutional layer to obtain vocabulary-level features, then uses a convolutional layer to extract sentence-level features, and finally obtains sentence representations through pooling layers and nonlinear layers. Finally, the relationship between entities is judged through a fully connected layer combined with softmax. The other is document-level relationship extraction based on graph convolutional neural networks. This technology applies a graph convolutional neural network model on a document-level graph, constructs dependency relationships within sentences through dependency grammar trees, establishes connections between sentences, and establishes different graphs for different associations between sentences. Perform separate graph convolution operations, and then add the results of each graph to obtain the final relationship result of the entity pair.

[0004] However, in the current document-level relation extraction based on convolutional neural networks, convolutional neural networks have a relatively good ability to extract local information. However, in the document-level relation extraction task, the long dependency relationship between sentences is ignored, and the structural information of entities and relations cannot be fully utilized. The extracted relations between entities do not have strong supporting evidence sentences, and the interpretability is poor. The training model of document-level relation extraction based on graph convolutional neural networks takes a long time, and the model needs to calculate many parameters and requires a lot of computing power. Moreover, in the process of extracting the relationship between entity pairs, the supporting evidence sentences between the relationships are relatively vague, and the final conclusion is not interpretable. Summary of the invention

[0005] Based on this, it is necessary to provide a target sentence recognition method, device, equipment, storage medium and program product that can accurately identify the target sentence corresponding to the entity in response to the above technical problems.

[0006] In a first aspect, the present application provides a target sentence recognition method, the method comprising:

[0007] Get the document to be processed and the target entity;

[0008] Performing word segmentation processing on the document to be processed to obtain a number of word segments;

[0009] Generate a word vector for each of the word segments according to a preset rule;

[0010] Generate a target sentence grammar tree corresponding to each sentence in the document to be processed according to the word segmentation;

[0011] Each of the sentences is judged according to the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity.

[0012] In one embodiment, generating a word vector for each word segment according to a preset rule includes:

[0013] Inputting the word segmentation into a word vector generation model to obtain a term vector corresponding to the word segmentation;

[0014] Calculate the relative distance between each word segment and the target entity, and obtain the target position vector according to the relative distance;

[0015] Obtaining the entity type corresponding to the word segmentation, and obtaining the type vector corresponding to the entity type;

[0016] The term vector, the target position vector and the type vector are combined to obtain a term vector.

[0017] In one embodiment, calculating the relative distance between each word segment and the target entity, and obtaining the target position vector according to the relative distance calculation includes:

[0018] Calculate the relative distance between each word segment and the target entity, and select the shortest distance;

[0019] Mapping the shortest distance to obtain an initial position vector;

[0020] The word segmentation and the initial position vector corresponding to each of the target entities are combined to obtain a target position vector.

[0021] In one embodiment, generating a sentence grammar tree corresponding to each sentence in the to-be-processed document according to the word segmentation includes:

[0022] Extracting sentences from the document to be processed;

[0023] Generate a corresponding initial sentence grammar tree for each word segment in the sentence;

[0024] The initial sentence syntax tree is pruned to obtain a target sentence syntax tree.

[0025] In one embodiment, the pruning of the initial sentence grammar tree to obtain a target sentence grammar tree includes:

[0026] The shortest dependency path in the initial sentence syntax tree is calculated according to the target entity, and the shortest dependency path includes at least one of the following: in a sentence where the target entity exists, the path between the target entities is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence that only includes one target entity, the path between the target entity and the root node participle is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence that does not include the target entity, the initial sentence syntax tree is the shortest dependency path;

[0027] The initial sentence syntax tree is pruned according to the shortest dependency path to obtain a target sentence syntax tree.

[0028] In one embodiment, judging each of the sentences according to the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity includes:

[0029] Inputting the word vector and the target sentence grammar tree into a pre-trained recursive neural network to calculate an encoding vector containing syntactic information related to the target entity;

[0030] A judgment is made according to the encoding vector to obtain a target sentence corresponding to the target entity.

[0031] In a second aspect, the present application further provides a target sentence recognition method, the method comprising:

[0032] Get the document to be processed and the target entity;

[0033] Processing the document to be processed and the target entity according to the target sentence recognition method to obtain a target sentence corresponding to the target entity;

[0034] Obtaining a first score corresponding to the target sentence;

[0035] Determine a second score corresponding to the target sentence according to the target entity;

[0036] Determining a target score for the target sentence according to the first score and the second score;

[0037] An output sentence is determined from the target sentence according to the target score.

[0038] In a third aspect, the present application further provides a target sentence recognition device, the device comprising:

[0039] A first acquisition module is used to acquire the document to be processed and the target entity;

[0040] A word segmentation module, used for performing word segmentation processing on the document to be processed to obtain a number of word segments;

[0041] A word vector generation module, used to generate a word vector for each of the word segments according to a preset rule;

[0042] A sentence grammar tree generation module, used for generating a target sentence grammar tree corresponding to each sentence in the document to be processed according to the word segmentation;

[0043] The first target sentence determination module is used to judge each of the sentences according to the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity.

[0044] In a fourth aspect, the present application further provides a target sentence recognition device, the device comprising:

[0045] The second acquisition module is used to acquire the document to be processed and the target entity;

[0046] A second target sentence determination module, configured to process the document to be processed and the target entity according to the target sentence recognition device to obtain a target sentence corresponding to the target entity;

[0047] A first score calculation module, used to obtain a first score corresponding to the target sentence;

[0048] A second score calculation module, used to determine a second score corresponding to the target sentence according to the target entity;

[0049] a target score calculation module, configured to determine a target score of the target sentence according to the first score and the second score;

[0050] The output sentence determination module is used to determine the output sentence from the target sentence according to the target score.

[0051] In a fifth aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the above embodiments when executing the computer program.

[0052] In a sixth aspect, the present application further 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 the method described in any one of the above embodiments are implemented.

[0053] In a seventh aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in any one of the above embodiments.

[0054] The above-mentioned target sentence recognition method, device, equipment, storage medium and program product first calculate the word vector corresponding to each word segment and the sentence grammar tree of each sentence, so that the sentence grammar tree is obtained at the sentence level with high accuracy. Finally, each sentence is judged according to the word vector and the target sentence grammar tree to obtain the target sentence corresponding to the target entity. In this way, the characteristics of the word and the characteristics of the sentence are combined to ensure the accuracy of the judgment of the target sentence. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 An application environment diagram of a target sentence recognition method in one embodiment;

[0056] Figure 2 is a flow chart of a target sentence recognition method in one embodiment;

[0057] Figure 3 A flowchart of a word vector generation step in one embodiment;

[0058] Figure 4 is a flow chart of a target sentence recognition method in another embodiment;

[0059] Figure 5 A schematic diagram of a target sentence recognition method in another embodiment;

[0060] Figure 6 is a structural block diagram of a target sentence recognition device in one embodiment;

[0061] Figure 7 is a structural block diagram of a target sentence recognition device in another embodiment;

[0062] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0064] The target sentence recognition method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can send the document to be processed and the target entity to the server 104, so that the server 104 performs word segmentation processing on the document to be processed to obtain a number of word segments; a word vector for each word segment is generated according to a preset rule; a target sentence grammar tree corresponding to each sentence in the document to be processed is generated according to the word segmentation; each sentence is judged according to the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity. In this way, the word vector corresponding to each word segment and the sentence grammar tree of each sentence are first calculated, so that the sentence grammar tree is obtained at the sentence level, and the accuracy is high, and finally, each sentence is judged according to the word vector and the target sentence grammar tree to obtain the target sentence corresponding to the target entity, which combines the characteristics of the word and the characteristics of the sentence to ensure the accuracy of the judgment of the target sentence.

[0065] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0066] In one embodiment, Figure 2 As shown, a target sentence recognition method is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0067] S202: Obtain the document to be processed and the target entity.

[0068] Specifically, the document to be processed may be a document selected by the user, wherein the document to be processed may be one or more documents. The target entity is given by the user, and may be an entity pair, such as "Li Si", "Company A", etc., whose entity relationship is that Li Si works at Company A, or some sentences state that Li Si is an employee of Company A. The purpose of this application is to obtain target sentences that support the entity relationship of "Li Si" and "Company A" as an employee from the document to be processed. In other embodiments, the server also obtains the entity relationship of the target entity pair, wherein the entity relationship may include at least one, so that in subsequent processing, the target sentences supporting the entity relationship are processed in parallel to obtain the target sentences respectively, that is, through the given entity pair and entity relationship, predict which sentences are used to infer this entity relationship. Such accurate prediction of the evidence sentences for document-level relationship extraction can provide accurate and effective document information when performing document-level relationship extraction tasks, and reduce the impact of redundant information on the results.

[0069] S204: Perform word segmentation processing on the document to be processed to obtain a number of word segments.

[0070] Specifically, the word segmentation processing of the document to be processed may be performed according to the existing word segmentation logic, which is not specifically limited here.

[0071] S206: Generate a word vector for each word segment according to preset rules.

[0072] Specifically, a word vector refers to converting a document to be processed from text into a vector that can be processed by a computer. In order to enrich the vector information, in this embodiment, the term vector is combined with the position vector and the named entity recognition vector (also referred to as the type vector below) to form the word vector for each word segment.

[0073] S208: Generate a target sentence syntax tree corresponding to each sentence in the document to be processed according to the word segmentation.

[0074] Specifically, the target sentence syntax tree is at the sentence level, because the document is long, contains a large number of vocabulary, and the result of dependency analysis based on the document level is less accurate than the result of dependency analysis based on the sentence level, so this application chooses to perform dependency analysis on the sentence. That is to say, a target sentence syntax tree is generated for each sentence.

[0075] Optionally, Stanford Core NLP is used for dependency syntactic analysis in this embodiment. The Stanford Core NLP parser contains 49 dependency relationships, which can basically cover all categories that may appear in general domain texts, thereby ensuring the accuracy of the results. In other embodiments, other models may be used to calculate the grammatical tree of the target sentence, which is not specifically limited here.

[0076] In addition, it should be noted that the dependency relationship is analyzed for each sentence, that is, for a complete sentence. This is because in the document-level relationship extraction, there are two entities that are contained in two different sentences. In this case, the relationship between the two input entities cannot be obtained in one sentence. Therefore, the above text uses a unified word segmentation logic to calculate the word segmentation. On the one hand, the word segmentation is processed to obtain the word vector, and on the other hand, the target sentence syntax tree is calculated at the sentence level.

[0077] One thing that needs to be explained is that each word segment has only one dependent object, and punctuation marks are also taken into consideration during the analysis process. After obtaining the dependency relationship, the head entity of the dependency relationship is used as the parent node and the tail entity as the child node to construct the dependency tree. In other words, a child node has only one parent node, a parent node can have multiple child nodes, but a child node cannot have multiple parent nodes.

[0078] Among them, for the convenience of understanding, the following example is used for explanation: Using the tool stanfordcorenlp, we can get the dependency relationship between words in each sentence. For example, for the sentence "2020 Auspicious Culture Gold and Silver Coins are officially issued.", [the word segmentation result is 2020 / auspicious / culture / gold / silver coins / officially / issued / . ] Through stanfordcorenlp, we can get ('root', 0, 7), ('nsubj', 7, 5)... (the number is the word order of the word segmentation result). It means that the root node of this sentence is the word "issue", "issue" and "silver coin" are in the relationship of nsubj (noun subject), in which "issue" is the head entity and "silver coin" is the tail entity. In the tree, the parent node corresponds to the head entity and the child node corresponds to the tail entity.

[0079] S210: Each sentence is judged according to the word vector and the target sentence syntax tree to obtain a target sentence corresponding to the target entity.

[0080] Specifically, after obtaining the word vector and the target sentence grammar tree, each sentence is judged to determine whether the sentence is a target sentence that supports the entity relationship between target entities.

[0081] Among them, in order to ensure that the entire text is taken into consideration, a recursive neural network is used in this application to obtain the encoding vector corresponding to the word vector and the target sentence grammar tree, and then a judgment is made based on the encoding vector.

[0082] The above-mentioned target sentence recognition method first calculates the word vector corresponding to each word segment and the sentence grammar tree of each sentence, so that the sentence grammar tree is obtained at the sentence level with high accuracy. Finally, each sentence is judged according to the word vector and the target sentence grammar tree to obtain the target sentence corresponding to the target entity. In this way, the characteristics of the word and the characteristics of the sentence are combined to ensure the accuracy of the judgment of the target sentence.

[0083] In one embodiment, see Figure 3 As shown, Figure 3 The flowchart of the word vector generation step in one embodiment is as follows. The word vector generation step, i.e., generating a word vector for each word segment according to a preset rule, includes:

[0084] S302: Input the word segmentation into the word vector generation model to obtain the term vector corresponding to the word segmentation.

[0085] Specifically, in this embodiment, the word vector is trained using the GloVe pre-trained model with word embedding representation of 400,000 words obtained by training the Wikipedia2014+Gigaword5 dataset containing 6 billion words as the training corpus, and finally a 100-dimensional word vector is obtained, denoted as w e .

[0086] S304: Calculate the relative distance between each word segment and the target entity, and obtain the target position vector based on the relative distance calculation.

[0087] Optionally, the relative distance between each word segment and the target entity is calculated, and a target position vector is obtained based on the relative distance calculation, including: calculating the relative distance between each word segment and the target entity, and selecting the shortest distance; mapping the shortest distance to obtain an initial position vector; combining the word segment and the initial position vector corresponding to each target entity to obtain a target position vector.

[0088] Specifically, the relative distance between each word and the two target entities is calculated. When the target entity appears multiple times, the target entity with the shortest distance is selected for relative distance calculation. The relative distance is mapped to a d p dimensional space as the position vector, mapping matrix w p In the process of calculating the position vector, in order to distinguish the directionality of the head entity and the tail entity, the relative distances between the word and the two entities are calculated and concatenated, that is, 2*d is finally obtained. p In the present invention, d p =10, that is, the final output position vector is 20-dimensional, denoted as p e =[d1;d2].

[0089] It should be noted that the relative distance is calculated according to the physical distance, for example, according to the number of segmentations.

[0090] S306: Obtain the entity type corresponding to the word segmentation, and obtain the type vector corresponding to the entity type.

[0091] Specifically, in this embodiment, a d n The vector of dimension 1 distinguishes the named entity recognition type of each word, that is, the type vector, where the named entity recognition type is defined as 7 categories in the present invention, namely, person, organization, place, time, number, other (event, art, law, etc.) and no special type, denoted as n e , where the vector dimension is d n =30.

[0092] S308: Combine the term vector, the target position vector and the type vector to obtain a term vector.

[0093] Specifically, the word vector, position vector and named entity recognition vector are concatenated to form the vector representation of the word. It is denoted as Embs = [w e ;p e ;n e ] T , the dimension d of Embs e =d w +2*d p +d n .

[0094] In the above embodiment, multi-dimensional word vectors are used to comprehensively represent words, not only considering the information of the words themselves, but also the position information and category information of the words. In the judgment task of document-level relation extraction evidence sentences, in terms of vector representation, by introducing position vectors and named entity recognition vectors, vector information is enriched, and the position and dependency of the context are increased, which solves the problem of missing vector semantics when using a single word vector representation and difficulty in distinguishing multiple meanings of a word.

[0095] In one embodiment, a sentence syntax tree corresponding to each sentence in a document to be processed is generated based on word segmentation, including: extracting sentences in the document to be processed; generating a corresponding initial sentence syntax tree for each word segmentation in the sentence; and pruning the initial sentence syntax tree to obtain a target sentence syntax tree.

[0096] Specifically, here we mainly extract the common features of sentences based on the vector representation of words and the dependency relationship between words. In this application, we first use dependency analysis to obtain the dependency relationship between words, then use the dependency tree pruning method to retain only the key information and remove irrelevant information, and finally use a recursive neural network to obtain the structural representation.

[0097] Specifically, for dependency analysis, StanfordCoreNLP is mainly used to perform dependency syntactic analysis. The StanfordCoreNLP parser contains 49 dependencies, which can basically cover all categories that appear in general field texts, ensuring the accuracy of the results. Because the document is long, the vocabulary contained is large, and the result of dependency analysis based on the document level is less accurate than the result of dependency analysis based on the sentence level, so the present invention chooses to perform dependency analysis on the sentence. In practical applications, the StanfordCoreNLP tool is first used to perform word segmentation on the sentence. Based on the result of word segmentation, the vocabulary is subjected to dependency analysis. Generally, each word has only one dependent object, and punctuation marks are also taken into consideration during the analysis. After obtaining the dependency, the head entity of the dependency is used as the parent node, and the tail entity is used as the child node to construct the dependency tree. After the dependency tree is constructed, the pruning process of the dependency tree in the next step is carried out.

[0098] Specifically, for dependency tree pruning, there is usually more than one relationship pair in a sentence, so the dependency tree nodes obtained based on the dependency relationship analysis of the sentence will be more and the relationship will be more complex. In order to reduce the interference of redundant information on the model, this application uses a dependency tree pruning method to filter out useless information. In this application, the shortest dependency path method is used to find the key information in the dependency tree.

[0099] In one embodiment, pruning an initial sentence grammar tree to obtain a target sentence grammar tree includes: calculating the shortest dependency path in the initial sentence grammar tree according to the target entity, the shortest dependency path includes at least one of the following: in a sentence where the target entity exists, the path between the target entities is the initial sentence grammar tree, which is pruned to obtain the target sentence grammar tree; in a sentence including only one target entity, the path between the target entity and the root node participle is the initial sentence grammar tree, which is pruned to obtain the target sentence grammar tree; in a sentence that does not include the target entity, the initial sentence grammar tree is the shortest dependency path; and pruning the initial sentence grammar tree according to the shortest dependency path to obtain the target sentence grammar tree.

[0100] Specifically, in the process of building a dependency tree, sentence-level dependencies are used. However, in the document-level entity relationship extraction task, the distribution of entities may be cross-sentence, so it cannot be assumed that there is a target entity in every sentence. In view of this situation, the construction of the shortest dependency path is based on the following three situations:

[0101] i) The sentence contains two target entities: the path between the two target entities is the shortest path.

[0102] ii) The sentence contains only one target entity: the path between the entity and the root node vocabulary is taken as the shortest path.

[0103] iii) The sentence does not contain the target entity: the original dependency tree is retained without any processing.

[0104] The pruned dependency tree serves as the input of the next submodule recursive neural network.

[0105] In the above embodiment, three dependency tree pruning methods are used to effectively retain the shortest dependency path between entities, solve the impact of redundant information on the model, and make the model pay more attention to the content that needs to be learned.

[0106] In one of the embodiments, each sentence is judged according to the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity, including: inputting the word vector and the target sentence grammar tree into a pre-trained recursive neural network to calculate an encoding vector containing syntactic information related to the target entity; and judging according to the encoding vector to obtain a target sentence corresponding to the target entity.

[0107] For the process of recurrent neural network to obtain representation structure:

[0108] The recurrent neural network update formula is as follows:

[0109]

[0110] Where X is the word vector and W is the weight matrix used to map the word vector to a new dimensional space. T It is used to integrate the outputs of child nodes in the target sentence dependency tree and continuously learn during the training process after initialization. is the fusion representation of all child nodes of the i-th node, that is, Where k represents the number of child nodes. (i) represents the calculated semantic encoding vector. Because the number of child nodes of each node is not fixed, the number of words in different sentences is different after word segmentation, and after the above dependency pruning operation, the number of nodes in each tree is different. Therefore, in this application, each child node is mapped and calculated separately, and then the results are accumulated. At this time, the initial dimension of U is [d h ,d h]. During the training process, U is not only shared between each layer, but also between subnodes. In this embodiment, each subnode is calculated first and then accumulated, so the parameter U is calculated with each subnode, which is the parameter sharing mentioned in the text. Because most nodes have only one or two subnodes, sharing the parameter U reduces the number of parameters and can also prevent overfitting to a certain extent. One thing that needs to be explained is that both W and U are determined after model training.

[0111] Specifically, after the above processing, each sentence obtains an encoding vector X containing entity-related syntactic information s (It also refers to the h in the above text (i) ), it is given as input to a fully connected layer, followed by a softmax layer to map the score of each category to between 0 and 1.

[0112] S1=softmax(FC c (X s ))

[0113] Among them, FC c represents the fully connected layer, and c represents the number of categories. Because the goal of the present invention is to assume that there is a certain relationship between given entities and predict supporting evidence sentences, and does not specifically distinguish the types of relationships, c = 2 here. The fully connected layer mainly maps the encoding vector to the dimension of the category, that is, it implements a binary classification function in this application. It is followed by a softmax function, which is mainly used to normalize the scores to facilitate subsequent operations.

[0114] Specifically, combined Figure 4 As shown, Figure 4 This is a framework diagram of a target sentence recognition method in another embodiment. In this embodiment, after obtaining the document to be processed and the target entity, they are first input into the vector representation module to obtain the word vector, and then the word segmentation is input into the semantic coding module. After dependency syntactic analysis and dependency syntactic tree pruning, they are input into the recursive neural network to obtain the semantic coding, and finally the semantic coding is input into the output module to obtain the judgment results of each sentence.

[0115] In one embodiment, Figure 5 As shown, a target sentence recognition method is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0116] S502: Obtain the document to be processed and the target entity.

[0117] Specifically, the document to be processed may be a document selected by the user, wherein the document to be processed may be one or more documents. The target entity is given by the user, and may be an entity pair, such as "Li Si", "Company A", etc., whose entity relationship is that Li Si works at Company A, or some sentences state that Li Si is an employee of Company A. The purpose of this application is to obtain target sentences that support the entity relationship of "Li Si" and "Company A" as an employee from the document to be processed. In other embodiments, the server also obtains the entity relationship of the target entity pair, wherein the entity relationship may include at least one, so that in subsequent processing, the target sentences supporting the entity relationship are processed in parallel to obtain the target sentences respectively, that is, through the given entity pair and entity relationship, predict which sentences are used to infer this entity relationship. Such accurate prediction of the evidence sentences for document-level relationship extraction can provide accurate and effective document information when performing document-level relationship extraction tasks, and reduce the impact of redundant information on the results.

[0118] S504: Process the document to be processed and the target entity according to the target sentence recognition method in any of the above embodiments to obtain a target sentence corresponding to the target entity.

[0119] Specifically, the method for obtaining the target sentence can be found above and will not be described in detail here.

[0120] S506: Obtain a first score corresponding to the target sentence.

[0121] S508: Determine a second score corresponding to the target sentence according to the target entity.

[0122] In this embodiment, it is considered that a sentence can be used as a supporting evidence sentence for the relationship between two entities if it meets one of the following two conditions: first, whether the relevant information reflecting the relationship between the two target entities has appeared in the sentence, and second, whether the target entity has appeared in the sentence. The formula for calculating the score of condition 1 is as described above:

[0123] S1=softmax(FC c (X s ))

[0124] The formula for calculating the score for condition 2 is as follows:

[0125] S2=I(occur(e1))+I(occur(e2))

[0126] Where I(·) means that when the condition in the brackets is true, the value is 1; otherwise, the value is 0. That is, if both entities have appeared, S2=2.

[0127] S510: Determine a target score for the target sentence according to the first score and the second score.

[0128] S512: Determine an output sentence from the target sentences according to the target score.

[0129] The final score calculation formula for whether a sentence is an evidence sentence is as follows:

[0130] S=2*S1+αS2

[0131] Among them, α is a learnable parameter greater than 0, with a maximum value of 1, which is used to adjust the weight of the entity appearance score. In the early stage of the experiment, the value of a is close to 1. As the model gradually converges, the value of α gradually decreases and tends to be stable. The present invention believes that the "whether the relationship between two entities has appeared in this sentence" reflected by condition 1 is more important than the "whether the entity itself has appeared in this sentence" reflected by condition 2. Therefore, in the calculation of S, the coefficient of the S1 parameter is 2, and the maximum value of the coefficient α of S2 is 1.

[0132] The scores of all sentences in the document are sorted, and those with scores higher than the threshold are judged as evidence sentences, and those below the threshold are discarded. When the number of evidence sentences for a pair of entities exceeds six, only the six sentences with the highest scores are retained. The training set uses the labels of the real supporting evidence sentences in the data, and the loss function is as follows:

[0133] Loss evi =1-len(true∩predict) / len(true)

[0134] Loss1=Loss evi +λ∑ θ ||θ|| 2

[0135] Because this model focuses more on the recall rate, the goal in the loss function setting is to improve the recall rate. At the same time, in order to reduce the overfitting phenomenon, an L2 regularization term is added to the basic loss function so that the value of α can be determined by training.

[0136] In the above embodiment, word vectors of multiple dimensions are used to comprehensively represent words, not only considering the information of the words themselves, but also considering the position information and category information of the words. When constructing the dependency tree, by pruning the dependency tree, important information is effectively retained and redundant noise information is filtered out. The recursive neural network learns the context dependency relationship better by learning the tree-like relationship. It is an effective extension of the recurrent neural network and can better recurse complex deep learning networks. Finally, this embodiment can give evidence sentences whether there is a relationship between entities. The evidence sentences have a supporting role and explainability for the conclusions obtained in the subsequent document-level entity relationship extraction task.

[0137] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0138] Based on the same inventive concept, the embodiment of the present application also provides a target sentence recognition device for implementing the target sentence recognition method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more target sentence recognition device embodiments provided below can refer to the limitations of the target sentence recognition method above, and will not be repeated here.

[0139] In one embodiment, Figure 6 As shown, a target sentence recognition device is provided, comprising: a first acquisition module 601, a word segmentation module 602, a word vector generation module 603, a sentence syntax tree generation module 604 and a first target sentence determination module 605, wherein:

[0140] The first acquisition module 601 is used to acquire the document to be processed and the target entity;

[0141] A word segmentation module 602, used for performing word segmentation processing on the document to be processed to obtain a plurality of word segments;

[0142] A word vector generation module 603, used to generate a word vector for each of the word segments according to a preset rule;

[0143] A sentence syntax tree generation module 604 is used to generate a target sentence syntax tree corresponding to each sentence in the document to be processed according to the word segmentation;

[0144] The first target sentence determination module 605 is used to judge each of the sentences according to the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity.

[0145] In one embodiment, the word vector generation module 603 includes:

[0146] A term vector generation unit, used to input the segmented words into the term vector generation model to obtain the term vector corresponding to the segmented words;

[0147] A position vector generating unit, used to calculate the relative distance between each word segment and the target entity, and obtain the target position vector according to the relative distance calculation;

[0148] A type vector generating unit, used to obtain the entity type corresponding to the word segmentation, and obtain the type vector corresponding to the entity type;

[0149] The combination unit is used to combine the term vector, the target position vector and the type vector to obtain the word vector.

[0150] In one embodiment, the position vector generating unit comprises:

[0151] The distance calculation subunit is used to calculate the relative distance between each word segment and the target entity and select the shortest distance;

[0152] A mapping subunit, used for mapping the shortest distance to obtain an initial position vector;

[0153] The combining subunit is used to combine the word segmentation with the initial position vector corresponding to each target entity to obtain a target position vector.

[0154] In one embodiment, the sentence syntax tree generation module 604 includes:

[0155] A sentence extraction unit, used for extracting sentences from the document to be processed;

[0156] An initial sentence syntax tree generating unit, used for generating a corresponding initial sentence syntax tree for each word in the sentence;

[0157] The pruning unit is used to prune the initial sentence syntax tree to obtain the target sentence syntax tree.

[0158] In one of the embodiments, the pruning unit is used to calculate the shortest dependency path in the initial sentence syntax tree according to the target entity, and the shortest dependency path includes at least one of the following: in a sentence where the target entity exists, the path between the target entities is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence including only one target entity, the path between the target entity and the root node participle is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence that does not include the target entity, the initial sentence syntax tree is the shortest dependency path; the initial sentence syntax tree is pruned according to the shortest dependency path to obtain the target sentence syntax tree.

[0159] In one embodiment, the first target sentence determination module 605 includes:

[0160] An encoding vector calculation unit, used to input the word vector and the target sentence syntax tree into a pre-trained recursive neural network to calculate an encoding vector containing syntactic information related to the target entity;

[0161] The judgment unit is used to make a judgment based on the encoding vector to obtain a target sentence corresponding to the target entity.

[0162] In one embodiment, Figure 7 As shown, a target sentence recognition device is provided, comprising: a second acquisition module 701, a second target sentence determination module 702, a first score calculation module 703, a second score calculation module 704, a target score calculation module 705 and an output sentence determination module 706, wherein:

[0163] The second acquisition module 701 is used to acquire the document to be processed and the target entity;

[0164] A second target sentence determination module 702, configured to process the document to be processed and the target entity according to the target sentence recognition device described in any one of the above embodiments to obtain a target sentence corresponding to the target entity;

[0165] A first score calculation module 703, used to obtain a first score corresponding to the target sentence;

[0166] A second score calculation module 704, configured to determine a second score corresponding to the target sentence according to the target entity;

[0167] A target score calculation module 705, configured to determine a target score of the target sentence according to the first score and the second score;

[0168] The output sentence determination module 706 is used to determine the output sentence from the target sentences according to the target score.

[0169] Each module in the above-mentioned target sentence recognition device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0170] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a target sentence recognition method is implemented.

[0171] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0172] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining a document to be processed and a target entity; performing word segmentation on the document to be processed to obtain a plurality of word segments; generating a word vector for each word segment according to a preset rule; generating a target sentence grammar tree corresponding to each sentence in the document to be processed according to the word segmentation; judging each sentence according to the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity.

[0173] In one embodiment, the processor generates a word vector for each word segment according to preset rules when executing a computer program, including: inputting the word segment into a word vector generation model to obtain a term vector corresponding to the word segment; calculating the relative distance between each word segment and the target entity, and obtaining a target position vector based on the relative distance calculation; obtaining the entity type corresponding to the word segment, and obtaining a type vector corresponding to the entity type; combining the term vector, the target position vector and the type vector to obtain a word vector.

[0174] In one embodiment, the processor executes a computer program to calculate the relative distance between each word segment and the target entity, and obtain a target position vector based on the relative distance, including: calculating the relative distance between each word segment and the target entity, and selecting the shortest distance; mapping the shortest distance to obtain an initial position vector; combining the word segment and the initial position vector corresponding to each target entity to obtain a target position vector.

[0175] In one embodiment, the generation of a sentence grammar tree corresponding to each sentence in a document to be processed based on word segmentation implemented by a processor when executing a computer program includes: extracting sentences in the document to be processed; generating a corresponding initial sentence grammar tree for each word segmentation in the sentence; and pruning the initial sentence grammar tree to obtain a target sentence grammar tree.

[0176] In one embodiment, the pruning of an initial sentence grammar tree to obtain a target sentence grammar tree is implemented when a processor executes a computer program, including: calculating the shortest dependency path in the initial sentence grammar tree according to a target entity, the shortest dependency path including at least one of the following: in a sentence where a target entity exists, the path between target entities is the initial sentence grammar tree, which is pruned to obtain the target sentence grammar tree; in a sentence including only one target entity, the path between the target entity and a root node participle is the initial sentence grammar tree, which is pruned to obtain the target sentence grammar tree; in a sentence that does not include a target entity, the initial sentence grammar tree is the shortest dependency path; and the initial sentence grammar tree is pruned according to the shortest dependency path to obtain the target sentence grammar tree.

[0177] In one embodiment, the processor executes a computer program to judge each sentence based on the word vector and the target sentence grammar tree to obtain a target sentence corresponding to the target entity, including: inputting the word vector and the target sentence grammar tree into a pre-trained recursive neural network to calculate an encoding vector containing syntactic information related to the target entity; and judging based on the encoding vector to obtain a target sentence corresponding to the target entity.

[0178] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining a document to be processed and a target entity; processing the document to be processed and the target entity according to a target sentence recognition method in any one of the above embodiments to obtain a target sentence corresponding to the target entity; obtaining a first score corresponding to the target sentence; determining a second score corresponding to the target sentence according to the target entity; determining a target score for the target sentence according to the first score and the second score; and determining an output sentence from the target sentence according to the target score.

[0179] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining a document to be processed and a target entity; performing word segmentation on the document to be processed to obtain a number of word segments; generating a word vector for each word segment according to a preset rule; generating a target sentence syntax tree corresponding to each sentence in the document to be processed according to the word segmentation; judging each sentence according to the word vector and the target sentence syntax tree to obtain a target sentence corresponding to the target entity.

[0180] In one embodiment, the computer program generated according to preset rules for each word segmentation when executed by the processor includes: inputting the word segmentation into the word vector generation model to obtain the entry vector corresponding to the word segmentation; calculating the relative distance between each word segmentation and the target entity, and obtaining the target position vector based on the relative distance calculation; obtaining the entity type corresponding to the word segmentation, and obtaining the type vector corresponding to the entity type; combining the entry vector, the target position vector and the type vector to obtain the word vector.

[0181] In one embodiment, the computer program implemented when executed by a processor calculates the relative distance between each word segment and the target entity, and obtains a target position vector based on the relative distance calculation, including: calculating the relative distance between each word segment and the target entity, and selecting the shortest distance; mapping the shortest distance to obtain an initial position vector; combining the word segment and the initial position vector corresponding to each target entity to obtain a target position vector.

[0182] In one embodiment, the computer program, when executed by a processor, generates a sentence syntax tree corresponding to each sentence in a document to be processed based on word segmentation, including: extracting sentences in the document to be processed; generating a corresponding initial sentence syntax tree for each word segmentation in the sentence; and pruning the initial sentence syntax tree to obtain a target sentence syntax tree.

[0183] In one embodiment, the computer program implemented by the processor when executed is pruning the initial sentence syntax tree to obtain the target sentence syntax tree, including: calculating the shortest dependency path in the initial sentence syntax tree according to the target entity, the shortest dependency path includes at least one of the following: in a sentence where the target entity exists, the path between the target entities is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence including only one target entity, the path between the target entity and the root node participle is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence that does not include the target entity, the initial sentence syntax tree is the shortest dependency path; the initial sentence syntax tree is pruned according to the shortest dependency path to obtain the target sentence syntax tree.

[0184] In one embodiment, the computer program implemented when executed by the processor judges each sentence according to the word vector and the target sentence grammar tree to obtain the target sentence corresponding to the target entity, including: inputting the word vector and the target sentence grammar tree into a pre-trained recursive neural network, calculating and obtaining an encoding vector containing syntactic information related to the target entity; and judging according to the encoding vector to obtain the target sentence corresponding to the target entity.

[0185] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining a document to be processed and a target entity; processing the document to be processed and the target entity according to a target sentence recognition method in any one of the above embodiments to obtain a target sentence corresponding to the target entity; obtaining a first score corresponding to the target sentence; determining a second score corresponding to the target sentence according to the target entity; determining a target score for the target sentence according to the first score and the second score; and determining an output sentence from the target sentence according to the target score.

[0186] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the following steps: obtaining a document to be processed and a target entity; performing word segmentation on the document to be processed to obtain a number of word segments; generating a word vector for each word segment according to a preset rule; generating a target sentence syntax tree corresponding to each sentence in the document to be processed based on the word segmentation; judging each sentence based on the word vector and the target sentence syntax tree to obtain a target sentence corresponding to the target entity.

[0187] In one embodiment, the computer program generated according to preset rules for each word segmentation when executed by the processor includes: inputting the word segmentation into the word vector generation model to obtain the entry vector corresponding to the word segmentation; calculating the relative distance between each word segmentation and the target entity, and obtaining the target position vector based on the relative distance calculation; obtaining the entity type corresponding to the word segmentation, and obtaining the type vector corresponding to the entity type; combining the entry vector, the target position vector and the type vector to obtain the word vector.

[0188] In one embodiment, the computer program implemented when executed by a processor calculates the relative distance between each word segment and the target entity, and obtains a target position vector based on the relative distance calculation, including: calculating the relative distance between each word segment and the target entity, and selecting the shortest distance; mapping the shortest distance to obtain an initial position vector; combining the word segment and the initial position vector corresponding to each target entity to obtain a target position vector.

[0189] In one embodiment, the computer program, when executed by a processor, generates a sentence syntax tree corresponding to each sentence in a document to be processed based on word segmentation, including: extracting sentences in the document to be processed; generating a corresponding initial sentence syntax tree for each word segmentation in the sentence; and pruning the initial sentence syntax tree to obtain a target sentence syntax tree.

[0190] In one embodiment, the computer program implemented by the processor when executed is pruning the initial sentence syntax tree to obtain the target sentence syntax tree, including: calculating the shortest dependency path in the initial sentence syntax tree according to the target entity, the shortest dependency path includes at least one of the following: in a sentence where the target entity exists, the path between the target entities is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence including only one target entity, the path between the target entity and the root node participle is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence that does not include the target entity, the initial sentence syntax tree is the shortest dependency path; the initial sentence syntax tree is pruned according to the shortest dependency path to obtain the target sentence syntax tree.

[0191] In one embodiment, the computer program implemented when executed by the processor judges each sentence according to the word vector and the target sentence grammar tree to obtain the target sentence corresponding to the target entity, including: inputting the word vector and the target sentence grammar tree into a pre-trained recursive neural network, calculating and obtaining an encoding vector containing syntactic information related to the target entity; and judging according to the encoding vector to obtain the target sentence corresponding to the target entity.

[0192] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the following steps: obtaining a document to be processed and a target entity; processing the document to be processed and the target entity according to the target sentence recognition method in any one of the above embodiments to obtain a target sentence corresponding to the target entity; obtaining a first score corresponding to the target sentence; determining a second score corresponding to the target sentence according to the target entity; determining a target score for the target sentence according to the first score and the second score; and determining an output sentence from the target sentence according to the target score.

[0193] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0194] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0195] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A target sentence recognition method, characterized in that: The method comprises: Obtaining a document to be processed, a target entity pair, and an entity relationship corresponding to the target entity pair; Performing word segmentation processing on the document to be processed to obtain a number of word segments; Generate a word vector for each of the word segments according to a preset rule; Generate a target sentence grammar tree corresponding to each sentence in the document to be processed according to the word segmentation; Judging each of the sentences according to the word vector and the target sentence grammar tree to obtain a target sentence that supports the entity relationship between the target entity pairs, including: using a recursive neural network to obtain an encoding vector corresponding to the word vector and the target sentence grammar tree, and then judging according to the encoding vector to obtain a target sentence that supports the entity relationship between the target entity pairs; Generating a word vector for each word segment according to a preset rule includes: Inputting the word segmentation into a word vector generation model to obtain a term vector corresponding to the word segmentation; Calculate the relative distance between each word segment and the target entity, and obtain the target position vector according to the relative distance; Obtaining the entity type corresponding to the word segmentation, and obtaining the type vector corresponding to the entity type; The term vector, the target position vector and the type vector are combined to obtain a term vector.

2. The method according to claim 1, characterized in that The calculating the relative distance between each word segment and the target entity, and obtaining the target position vector according to the relative distance calculation, includes: Calculate the relative distance between each word segment and the target entity, and select the shortest distance; Mapping the shortest distance to obtain an initial position vector; The word segmentation and the initial position vector corresponding to each of the target entities are combined to obtain a target position vector.

3. The method according to claim 1, characterized in that The generating a sentence grammar tree corresponding to each sentence in the to-be-processed document according to the word segmentation comprises: Extracting sentences from the document to be processed; Generate a corresponding initial sentence grammar tree for each word segment in the sentence; The initial sentence syntax tree is pruned to obtain a target sentence syntax tree.

4. The method according to claim 3, characterized in that The pruning of the initial sentence grammar tree to obtain a target sentence grammar tree includes: The shortest dependency path in the initial sentence syntax tree is calculated according to the target entity, and the shortest dependency path includes at least one of the following: in a sentence where the target entity exists, the path between the target entities is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence that only includes one target entity, the path between the target entity and the root node participle is the initial sentence syntax tree, which is pruned to obtain the target sentence syntax tree; in a sentence that does not include the target entity, the initial sentence syntax tree is the shortest dependency path; The initial sentence syntax tree is pruned according to the shortest dependency path to obtain a target sentence syntax tree.

5. The method according to claim 1, characterized in that The step of judging each of the sentences according to the word vector and the target sentence grammar tree to obtain a target sentence that supports the entity relationship between the target entity pair includes: Inputting the word vector and the target sentence grammar tree into a pre-trained recursive neural network to calculate an encoding vector containing syntactic information related to the target entity; A judgment is made based on the encoding vector to obtain a target sentence that supports the entity relationship between the target entity pair.

6. A target sentence recognition method, characterized in that: The method comprises: Obtaining a document to be processed, a target entity pair, and an entity relationship corresponding to the target entity pair; Processing the document to be processed and the target entity pair according to the target sentence recognition method according to any one of claims 1 to 5 to obtain a target sentence supporting an entity relationship between the target entity pair; Obtaining a first score corresponding to the target sentence; Determine a second score corresponding to the target sentence according to the target entity; Determining a target score for the target sentence according to the first score and the second score; An output sentence is determined from the target sentence according to the target score.

7. A target sentence recognition device, characterized in that: The device comprises: A first acquisition module is used to acquire a document to be processed, a target entity pair, and an entity relationship corresponding to the target entity pair; A word segmentation module, used for performing word segmentation processing on the document to be processed to obtain a number of word segments; A word vector generation module, used to generate a word vector for each of the word segments according to a preset rule; A sentence grammar tree generation module, used for generating a target sentence grammar tree corresponding to each sentence in the document to be processed according to the word segmentation; A first target sentence determination module is used to judge each of the sentences according to the word vector and the target sentence syntax tree to obtain a target sentence that supports the entity relationship between the target entity pair, including: using a recursive neural network to obtain an encoding vector corresponding to the word vector and the target sentence syntax tree, and then judging according to the encoding vector to obtain a target sentence that supports the entity relationship between the target entity pair; The word vector generation module is specifically used to input the word segmentation into the word vector generation model to obtain the entry vector corresponding to the word segmentation; calculate the relative distance between each word segmentation and the target entity, and obtain the target position vector based on the relative distance calculation; obtain the entity type corresponding to the word segmentation, and obtain the type vector corresponding to the entity type; combine the entry vector, the target position vector and the type vector to obtain the word vector.

8. A target sentence recognition device, characterized in that: The device comprises: A second acquisition module is used to acquire the document to be processed, the target entity pair and the entity relationship corresponding to the target entity pair; A second target sentence determination module, configured to process the document to be processed and the target entity pair according to the target sentence recognition device of claim 7, to obtain a target sentence that supports an entity relationship between the target entity pair; A first score calculation module, used to obtain a first score corresponding to the target sentence; A second score calculation module, used to determine a second score corresponding to the target sentence according to the target entity; a target score calculation module, configured to determine a target score of the target sentence according to the first score and the second score; The output sentence determination module is used to determine the output sentence from the target sentence according to the target score.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 or 6 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 or 6 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 or 6 are implemented.

Citation Information

Patent Citations

  • Method and device for extracting entity relationships in news events

    CN111444713A

  • Semantic recognition method and device based on dependency syntax and readable storage medium

    CN112084793A