A method and apparatus for identifying a discourse relationship

CN115809332BActive Publication Date: 2026-10-27BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111082693.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-15
Publication Date
2026-10-27
Estimated Expiration
2041-09-15

AI Technical Summary

Technical Problem

[0003]本公开提供一种篇章关系识别方法和装置,用以解决现有技术中离散化运用类关系词,导致篇章关系分类不准确的缺陷,实现与神经网络模型相结合,准确区分篇章关系分类

Benefits of technology

[0038]本公开提供的一种篇章关系识别方法和装置,通过获取多篇文本片段;然后基于双向编码模型分别对所述多篇文本片段进行编码,获取分别与所述多篇文本片段对应的分类向量;再然后获取每篇所述文本片段的类关系词向量;并根据任意两篇文本片段对应的分类向量和所述两篇文本片段的类关系词向量进行特征融合,得到融合后的特征向量;融合后的特征去除了噪音,具有与篇章关系更高的关联度,然后依据融合的特征向量,获取所述两篇文本片段对应的篇章关系。本公开的方法通过挖掘类关系词的语义向量,并与神经网络模型相结合,提升篇章关系识别性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115809332B_ABST
    Figure CN115809332B_ABST
Patent Text Reader

Abstract

The present disclosure provides a kind of chapter relationship identification method and device, wherein the method comprises: obtaining multiple text segments;Based on bidirectional coding model, the multiple text segments are encoded respectively, and the classification vector corresponding to the multiple text segments is obtained respectively;Obtain the class relationship word vector of each text segment;According to the classification vector corresponding to any two text segments and the class relationship word vector of the two text segments, the fused feature vector is obtained by feature fusion;The fused feature vector is input into the classifier, and the chapter relationship corresponding to the two text segments is obtained.The present disclosure improves the performance of chapter relationship identification by mining the semantic vector of class relationship word and combining with neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method and apparatus for identifying textual relationships. Background Technology

[0002] Textual relationship identification methods refer to the task of identifying the textual relationship between two given text segments. Specifically, given two text segments, such as (The weather was nice today, but it was terrible yesterday), the prediction of the textual relationship between them is "transition". However, existing methods all add the first three and last words of the text as discrete features to the textual relationship classifier, relying solely on relational words to determine the textual relationship. This results in limited information sources for determining the textual relationship, leading to low accuracy in textual relationship identification. Summary of the Invention

[0003] This disclosure provides a method and apparatus for identifying textual relationships, which addresses the shortcomings of existing technologies that use discretized class relation words, leading to inaccurate classification of textual relationships. It achieves accurate differentiation of textual relationship classification by combining with a neural network model.

[0004] Firstly, this disclosure provides a method for identifying textual relationships, including:

[0005] Retrieve multiple text fragments;

[0006] The multiple text segments are encoded using a bidirectional encoding model to obtain classification vectors corresponding to the multiple text segments respectively;

[0007] Obtain the class-related word vectors for each of the aforementioned text fragments;

[0008] The feature vector is obtained by fusing the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments.

[0009] The fused feature vector is input into the classifier to obtain the chapter relationship between the two text fragments.

[0010] According to the text relationship identification method provided in this disclosure, after obtaining the text relationship corresponding to the first text segment and the second text segment, the method further includes:

[0011] The chapter relationships are compared with the corresponding standard category labels to determine the cross-entropy;

[0012] The correctness of the chapter relationship is determined based on the magnitude of the cross-entropy.

[0013] According to the text relation recognition method provided in this disclosure, the step of obtaining the class relation word vector for each text segment specifically includes:

[0014] Obtain the first m words and the last n words of each text segment;

[0015] Obtain the word vector of each word in the first m words and the last n words;

[0016] The sum of the word vectors of the first m words and the last n words is used as the class relation word vector of the corresponding text segment.

[0017] According to the text relation recognition method provided in this disclosure, the feature fusion based on the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments specifically includes:

[0018] Based on the classification vector of each text segment, the class relation word vector corresponding to the text segment is denoised to obtain the denoised class relation word vector of the text segment;

[0019] A fusion model is used to fuse the features of the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments.

[0020] According to the text relationship identification method provided in this disclosure, the fusion model is as follows:

[0021]

[0022] in, Indicates a direct connection, E final Representing the fused features, CLS1 is the class classification vector of the first text segment, CLS2 is the class classification vector of the second text segment, and E 1′ E is the denoised class-relation word vector corresponding to the first text segment. 2′ It is the denoised class relation word vector corresponding to the second text segment.

[0023] Secondly, this disclosure provides a text relationship identification device, comprising:

[0024] The text acquisition module is used to acquire multiple text fragments;

[0025] The encoding module is used to encode the multiple text fragments respectively based on a bidirectional encoding model to obtain classification vectors corresponding to the multiple text fragments respectively;

[0026] The class relation word vector acquisition module is used to obtain the class relation word vectors for each text segment;

[0027] The feature fusion module is used to fuse features based on the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments to obtain the fused feature vector;

[0028] The chapter relationship acquisition module is used to input the fused feature vector into the classifier to obtain the chapter relationship between the two text segments.

[0029] According to the text relationship recognition device provided in this disclosure, it further includes a text relationship judgment module, specifically used for:

[0030] The chapter relationships are compared with the corresponding standard category labels to determine the cross-entropy;

[0031] The correctness of the chapter relationship is determined based on the magnitude of the cross-entropy.

[0032] According to the text relation recognition device provided in this disclosure, the acquisition of class relation word vectors for each text segment in the class relation word vector acquisition module specifically includes:

[0033] Obtain the first m words and the last n words of each text segment;

[0034] Obtain the word vector of each word in the first m words and the last n words;

[0035] The sum of the word vectors of the first m words and the last n words is used as the class relation word vector of the corresponding text segment.

[0036] Thirdly, this disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the above-described text relation identification methods.

[0037] Fourthly, this disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the document relation identification method as described above.

[0038] This disclosure provides a method and apparatus for identifying textual relationships. The method involves acquiring multiple text fragments; encoding each text fragment using a bidirectional coding model to obtain classification vectors corresponding to each fragment; acquiring class-relation word vectors for each text fragment; and fusing features based on the classification vectors of any two text fragments and the class-relation word vectors of those two text fragments to obtain a fused feature vector. The fused feature vector removes noise and has a higher correlation with textual relationships. Finally, based on the fused feature vector, the textual relationship between the two text fragments is obtained. This method improves the performance of textual relationship identification by mining the semantic vectors of class-relation words and combining them with a neural network model. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is one of the flowcharts of the text relationship identification method provided in this publication;

[0041] Figure 2 This is the second flowchart of the document relationship identification method provided in this publication;

[0042] Figure 3 This is a schematic diagram of the structure of the document relationship recognition device provided in this disclosure;

[0043] Figure 4 This is a schematic diagram of the structure of the electronic device provided in this disclosure. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the embodiments of this disclosure.

[0045] The following is combined with Figure 1 This disclosure describes a method for identifying textual relationships, comprising:

[0046] Step 100: Obtain multiple text fragments;

[0047] Specifically, discourse relationship recognition refers to the task of identifying the discourse relationship between two given text segments. For example, the first text segment: "The weather is very nice today"; the second text segment: "Yesterday was very bad." The predicted discourse relationship between these two text segments is: transition. In this embodiment of the disclosure, although the determination of the text discourse relationship is performed on two text segments, the number of input texts is not limited and can be multiple text segments.

[0048] Step 200: Encode the multiple text segments respectively based on the bidirectional encoding model to obtain the classification vectors corresponding to the multiple text segments respectively;

[0049] Specifically, BERT (Bidirectional Encoder Representations from Transformers) is a bidirectional encoding model that serves as an alternative to Word2Vec. It has significantly improved accuracy in 11 directions within the NLP field. Essentially, BERT learns a good feature representation for words by running a self-supervised learning method on massive amounts of corpus data. BERT is built upon the transformer architecture and possesses powerful language representation and feature extraction capabilities. BERT's language input representation comprises three components.

[0050] Word embeddings divide words into a finite set of common sub-words, striking a balance between word effectiveness and character flexibility. Segmentation embeddings encode word positional information into feature vectors; position embeddings are crucial for introducing word positional relationships into the model. Position encoding tensors are used to distinguish between two sentences, such as whether B follows A (in dialogue or question-and-answer scenarios). For a sentence pair, the first sentence has a feature value of 0, and the second sentence has a feature value of 1. The final embedding vector is the sum of these three vectors.

[0051] Step 300: Obtain the class relation word vectors for each of the aforementioned text fragments;

[0052] Specifically, since words preceding and following a passage often resemble passage relation words, they are referred to in this disclosure as "class relation words." Then, the word vector of each of these "class relation words" is obtained, thereby determining the class relation word vector. Word embedding, also known as word embedding, is a collective term for a set of language modeling and feature learning techniques in Natural Language Processing (NLP), in which words or phrases from the vocabulary are mapped to vectors of real numbers. Conceptually, it involves mathematical embedding from a one-dimensional space for each word to a continuous vector space with lower dimensions.

[0053] Step 400: Perform feature fusion based on the classification vectors corresponding to any two text fragments and the class relation word vectors of the two text fragments to obtain the fused feature vector;

[0054] Specifically, since not all words before and after a text can be called "class relation words", this disclosure fuses the classification vectors (i.e., sentence vectors) and "class relation word vectors" in each text segment, thereby removing the vectors of words that do not belong to "class relation words", thus making the judgment of text relations using feature vectors more accurate.

[0055] Step 500: Input the fused feature vector into the classifier to obtain the chapter relationship between the two text fragments.

[0056] Specifically, the fused feature vector is input into a trained classifier, which is then used to obtain the chapter relationship between the two text fragments.

[0057] This disclosure provides a method for identifying textual relationships. The method involves acquiring multiple text fragments; encoding each text fragment using a bidirectional encoding model to obtain classification vectors corresponding to each fragment; acquiring class-relation word vectors for each text fragment; and fusing features based on the classification vectors of any two text fragments and the class-relation word vectors of those two text fragments to obtain a fused feature vector. The fused feature vector removes noise and has a higher correlation with textual relationships. Finally, based on the fused feature vector, the textual relationship between the two text fragments is obtained. This method improves the performance of textual relationship identification by mining the semantic vectors of class-relation words and combining them with a neural network model.

[0058] According to an embodiment of this disclosure, a method for identifying textual relationships includes, after obtaining the textual relationships corresponding to the first text segment and the second text segment, the method further includes:

[0059] The chapter relationships are compared with the corresponding standard category labels to determine the cross-entropy;

[0060] The correctness of the chapter relationship is determined based on the magnitude of the cross-entropy.

[0061] Specifically, for a given event, there are n possibilities, each with a probability p(xi). The information content of a particular possibility can then be calculated. With the definition of information content, entropy is used to represent the expected value of all information. Relative entropy, also known as KL divergence, is used to measure the difference between two separate probability distributions P(x) and Q(x) for the same random variable x. P(x) is often used to represent the true distribution of the sample, i.e., the standard class label as referred to in this disclosure, while Q(x) represents the distribution predicted by the model.

[0062] In machine learning network training, the input data and labels are often already determined, so the true probability distribution P(x) is also determined, and information entropy is a constant here. Since the KL divergence represents the difference between the true probability distribution P(x) and the predicted probability distribution Q(x), a smaller value indicates a better prediction result. Therefore, it is necessary to minimize the KL divergence. Cross-entropy equals KL divergence plus a constant (information entropy), which is also called entropy and is used to represent the expected amount of information. Expectation is the sum of the probabilities of each possible outcome in the experiment multiplied by its result. The amount of information is inversely proportional to the probability of the information occurring. The higher the probability, the less information; the lower the probability, the more information. Because the cross-entropy formula is easier to calculate than the KL divergence formula, the cross-entropy loss function is often used to calculate the loss in machine learning.

[0063] Specifically, the following loss function is used in this disclosure:

[0064]

[0065] in, For standard category labels.

[0066] Cross-entropy measures the difference between two different probability distributions of the same random variable; in machine learning, it represents the difference between the true probability distribution and the predicted probability distribution. The smaller the cross-entropy value, the better the model's prediction performance.

[0067] Therefore, in this disclosure, the classification result obtained is determined based on the value of cross-entropy.

[0068] According to an embodiment of this disclosure, a method for identifying text relationships includes, in which the step of obtaining the class-relation word vectors for each text segment specifically includes:

[0069] Obtain the first m words and the last n words of each text segment;

[0070] Obtain the word vector of each word in the first m words and the last n words;

[0071] The sum of the word vectors of the first m words and the last n words is used as the class relation word vector of the corresponding text segment.

[0072] Specifically, since the first m words and the last n words of each text segment are similar to discourse relation words, they are referred to as "relation words" in this disclosure. In the prior art, it has been proven that in two text segments, the first three words and the last word are often similar to discourse relation words.

[0073] In the present disclosure, by obtaining the first m words and the last n words of each text segment in two chapters, and then obtaining the word vector of each word in the first m words and the last n words. Assume that the two texts in the two chapters are respectively "The weather is fine today, but it was bad yesterday". Take m=3 and n=1 as an example, it can be obtained that:

[0074] The vectors of the class-related words of these two text segments are:

[0075] The word vectors of the first three words and the last word of the first paragraph of text are summed to be used as the class-related word vector E1 of the first paragraph of text. Taking (The weather is fine today, but it was bad yesterday) as an example:

[0076] E1=(e(今)+e(天)+e(天)+e(好)) / 4

[0077] Wherein, e(今) is the word vector corresponding to the word "今", and the word vectors of each word are represented in the formula by analogy.

[0078] Similarly, the word vectors of the first three words and the last word of the second paragraph of text are summed to be used as the class-related word vector E2 of the second paragraph of text. Taking (The weather is fine today, but it was bad yesterday) as an example:

[0079] E2=(e(昨)+e(天)+e(却)+e(糟)) / 4

[0080] In a chapter relation recognition method provided according to an embodiment of the present disclosure, the performing feature fusion according to the classification vectors corresponding to any two text segments and the class-related word vectors of the two text segments specifically includes:

[0081] Performing denoising processing on the class-related word vector corresponding to the text segment according to the classification vector of each text segment, to obtain the denoised class-related word vector of the text segment;

[0082] Performing feature fusion on the classification vectors corresponding to any two text segments and the class-related word vectors of the two text segments by using a fusion model.

[0083] Specifically, it is considered in the present disclosure that not all of the first three words and the last word are class-related words. Therefore, dimension-level max pooling is used in the present disclosure to remove noise. Max-pooling refers to taking the point with the maximum value in the local receptive field, wherein the dimension-level max pooling is to compare the values of the same dimension of the vector. The filtering manner adopted in the present disclosure is:

[0084] E 1′ =max{E1,CLS1}

[0085] E 2′=max{E2,CLS2}

[0086] Specifically, BERT is used to encode the two input texts respectively, to obtain the CLS vector CLS1 of the first text and the CLS vector CLS2 of the second text. Since E and CLS are two vectors, for example, E=[0.1, 0.8] and CLS=[0.7, 0.2], wherein the relatively small value is very likely to be noise, and the result of max pooling is [0.7, 0.8], that is, denoising is completed.

[0087] A discourse relation recognition method provided according to an embodiment of the present disclosure, wherein the fusion model is:

[0088]

[0089] wherein, represents direct feature connection, E final represents the fused feature, CLS1 is the classification vector of the first text segment, CLS2 is the classification vector of the second text segment, E 1′ is the denoised relation word vector corresponding to the first text segment, E 2, is the denoised relation word vector corresponding to the second text segment.

[0090] In summary, in conjunction with Figure 2 shown in the above, according to the method described above, the discourse relation prediction in the present disclosure can be expressed as the following steps:

[0091] BERT is used to encode the two input texts respectively, to obtain the CLS vector CLS1 of the first text and the CLS vector CLS2 of the second text.

[0092] The word vectors of the first three words and the last word of the first text are added together to serve as the relation word vector E1 of the first text. Taking (the weather is very good today, but it was very bad yesterday) as an example:

[0093] E1=(e(今)+e(天)+e(天)+e(好)) / 4

[0094] e(今) is the word vector corresponding to the character "今".

[0095] Similarly, the word vectors of the first three words and the last word of the second text are added together to serve as the relation word vector E2 of the second text. Taking (the weather is very good today, but it was very bad yesterday) as an example:

[0096] E2=(e(昨)+e(天)+e(却)+e(糟)) / 4

[0097] Meanwhile, considering that not all of the first three words and the last word are class-related words, this invention uses dimension-level max pooling to filter out noise:

[0098] E 1′ =max{E1,CLS1}

[0099] E 2′ =max{E2,CLS2}

[0100] Next, it is fused with the original CLS vector for feature integration:

[0101]

[0102] This indicates a direct connection to the feature.

[0103] E final As input, predict the passage y. The specific formula is as follows:

[0104] y = softmax(WE) final )

[0105] Here, W represents importance.

[0106] The loss function is as follows:

[0107]

[0108] For standard category labels.

[0109] Combination Figure 3 This disclosure provides a document relationship identification device, including:

[0110] Text acquisition module 31 is used to acquire multiple text fragments;

[0111] Encoding module 32 is used to encode the multiple text fragments respectively based on a bidirectional encoding model to obtain classification vectors corresponding to the multiple text fragments respectively;

[0112] The class relation word vector acquisition module 33 is used to acquire the class relation word vectors for each text segment;

[0113] The feature fusion module 34 is used to perform feature fusion based on the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments to obtain the fused feature vector;

[0114] The chapter relationship acquisition module 35 is used to input the fused feature vector into the classifier to obtain the chapter relationship between the two text segments.

[0115] Since the apparatus provided in the embodiments of the present invention can be used to perform the methods described in the above embodiments, and its working principle and beneficial effects are similar, it will not be described in detail here. For details, please refer to the description of the above embodiments.

[0116] This disclosure provides a text relation recognition device that acquires multiple text fragments; then, it encodes each text fragment using a bidirectional encoding model to obtain classification vectors corresponding to each text fragment; next, it acquires class relation word vectors for each text fragment; and then, it fuses the classification vectors and class relation word vectors of any two text fragments to obtain a fused feature vector. The fused feature vector removes noise and has a higher correlation with text relations. Finally, based on the fused feature vector, it obtains the text relation corresponding to the two text fragments. This method improves text relation recognition performance by mining the semantic vectors of class relation words and combining them with a neural network model.

[0117] According to an embodiment of this disclosure, a document relationship identification device further includes a document relationship judgment module, specifically used for:

[0118] The chapter relationships are compared with the corresponding standard category labels to determine the cross-entropy;

[0119] The correctness of the chapter relationship is determined based on the magnitude of the cross-entropy.

[0120] According to the text relation recognition device provided in this disclosure, the acquisition of the class relation word vector for each text segment in the class relation word vector acquisition module 33 specifically includes:

[0121] Obtain the first m words and the last n words of each text segment;

[0122] Obtain the word vector of each word in the first m words and the last n words;

[0123] The sum of the word vectors of the first m words and the last n words is used as the class relation word vector of the corresponding text segment.

[0124] According to an embodiment of this disclosure, a text relationship recognition device is provided, wherein the feature fusion module 34 performs feature fusion based on the classification vectors corresponding to any two text segments and the class relationship word vectors of the two text segments, specifically including:

[0125] Based on the classification vector of each text segment, the class relation word vector corresponding to the text segment is denoised to obtain the denoised class relation word vector of the text segment;

[0126] A fusion model is used to fuse the features of the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments.

[0127] According to an embodiment of this disclosure, a document relationship recognition device is provided, wherein the fusion model is:

[0128]

[0129] in, Indicates a direct connection, E final Representing the fused features, CLS1 is the class classification vector of the first text segment, CLS2 is the class classification vector of the second text segment, and E 1′ E is the denoised class-relation word vector corresponding to the first text segment. 2′ It is the denoised class relation word vector corresponding to the second text segment.

[0130] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4 As shown, the electronic device may include a processor 410, a communications interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communications interface 420, and the memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a text relationship recognition method. This method includes: acquiring multiple text fragments; encoding the multiple text fragments respectively based on a bidirectional encoding model to obtain classification vectors corresponding to the multiple text fragments respectively; acquiring class relationship word vectors for each text fragment; performing feature fusion based on the classification vectors corresponding to any two text fragments and the class relationship word vectors of the two text fragments to obtain a fused feature vector; and inputting the fused feature vector into a classifier to obtain the text relationship corresponding to the two text fragments.

[0131] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of this disclosure, essentially, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0132] On the other hand, this disclosure also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer is able to execute the text relationship recognition method provided by the above methods. The method includes: acquiring multiple text fragments; encoding the multiple text fragments respectively based on a bidirectional coding model to obtain classification vectors corresponding to the multiple text fragments respectively; acquiring class relationship word vectors for each of the text fragments; performing feature fusion based on the classification vectors corresponding to any two text fragments and the class relationship word vectors of the two text fragments to obtain a fused feature vector; and inputting the fused feature vector into a classifier to obtain the text relationship corresponding to the two text fragments.

[0133] In another aspect, this disclosure also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described methods for identifying textual relationships. The method includes: acquiring multiple text fragments; encoding the multiple text fragments respectively based on a bidirectional coding model to obtain classification vectors corresponding to the multiple text fragments respectively; acquiring class-relation word vectors for each of the text fragments; performing feature fusion based on the classification vectors corresponding to any two text fragments and the class-relation word vectors of the two text fragments to obtain a fused feature vector; and inputting the fused feature vector into a classifier to obtain the textual relationship corresponding to the two text fragments.

[0134] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0135] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure.

Claims

1. A method for identifying textual relationships, characterized in that, include: Retrieve multiple text fragments; The multiple text segments are encoded using a bidirectional encoding model to obtain classification vectors corresponding to the multiple text segments respectively; Obtain the class relation word vector for each of the text segments, wherein obtaining the class relation word vector for each of the text segments specifically includes: Obtain the first m words and the last n words of each text segment; Obtain the word vector of each word in the first m words and the last n words; The sum of the word vectors of the first m words and the last n words is taken as the class relation word vector of the corresponding text segment; Feature fusion is performed based on the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments to obtain a fused feature vector. Specifically, the feature fusion based on the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments includes: The class relation word vectors corresponding to each text segment are denoised based on the classification vector of each text segment to obtain the denoised class relation word vectors of the text segment. The maximum value of the class relation word vectors and the classification vectors in each dimension is taken to obtain the denoised class relation word vectors. A fusion model is used to fuse the features of the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments; The fused feature vector is input into the classifier to obtain the chapter relationship between the two text fragments.

2. The method for identifying textual relationships according to claim 1, characterized in that, The multiple text fragments include a first text fragment and a second text fragment; after obtaining the multiple text fragments, the process further includes: The cross-entropy is determined by comparing the text relationships with the corresponding standard category labels. Text relationship recognition refers to the task of identifying the text relationships between the first text segment and the second text segment. The correctness of the chapter relationship is determined based on the magnitude of the cross-entropy.

3. The method for identifying textual relationships according to claim 1, characterized in that, The fusion model is as follows: in, Indicates a direct connection of features. Indicates the characteristics after fusion. This is the class classification vector for the first text fragment. This is the class classification vector for the second text fragment. These are the denoised class-relation word vectors corresponding to the first text segment. It is the denoised class relation word vector corresponding to the second text segment.

4. A text relationship recognition device, characterized in that, The apparatus is used to implement the text relationship identification method according to any one of claims 1 to 3, and the apparatus comprises: The text acquisition module is used to acquire multiple text fragments; The encoding module is used to encode the multiple text fragments respectively based on a bidirectional encoding model to obtain classification vectors corresponding to the multiple text fragments respectively; The class relation word vector acquisition module is used to obtain the class relation word vectors for each text segment; The feature fusion module is used to fuse features based on the classification vectors corresponding to any two text segments and the class relation word vectors of the two text segments to obtain the fused feature vector; The chapter relationship acquisition module is used to input the fused feature vector into the classifier to obtain the chapter relationship between the two text segments.

5. The document relationship recognition device according to claim 4, characterized in that, It also includes a chapter relationship determination module, which is specifically used for: The chapter relationships are compared with the corresponding standard category labels to determine the cross-entropy; The correctness of the chapter relationship is determined based on the magnitude of the cross-entropy.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the document relationship identification method as described in any one of claims 1 to 3.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the document relation identification method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Graph convolutional network enhanced implicit discourse text relationship classification method

    CN112487189A

  • Implicit discourse relation automatic recognition method and system

    CN112528642A