An Unsupervised Keyword Extraction Method for Documents
By constructing a document-set scoring function and a subset extraction agent based on reinforcement learning, the problems of over-generation and insufficient coupling in unsupervised keyword extraction are solved, thereby improving the performance and diversity of keyword extraction.
Patent Information
- Application Number
- CN202310831372.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-07-07
AI Technical Summary
Existing unsupervised keyword extraction methods tend to over-generate high-frequency words and ignore the coupling between words when scoring candidate phrases, resulting in poor extraction results and performance.
We employ a document-set scoring function based on encoders and orthogonal optimization regularization, combined with self-attention mechanism and reinforcement learning, to construct a subset extraction agent that selects a subset of keywords from the candidate set through policy gradient optimization.
It effectively alleviates the problems of over-generation and ignoring coupling, improves the performance and diversity of keyword extraction results, and achieves more accurate keyword selection.
Smart Images

Figure CN116796739B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text data processing technology, and in particular to an unsupervised keyword extraction method for documents. Background Technology
[0002] Keywords are single words or phrases that convey significant meaning and are typically used to reflect the main theme and core content of a document. Keywords help readers quickly grasp the topic of a text document; efficient, accurate, and rapid keyword extraction helps meet people's information needs. Therefore, keyword extraction is an important branch of text data mining, widely used in document indexing, summary generation, text classification, and information retrieval.
[0003] Unsupervised keyword extraction methods were first applied to keyword extraction tasks. After years of development, these methods still hold an important position in keyword extraction. A schematic diagram of the processing flow of an existing unsupervised keyword extraction method is shown below. Figure 1 As shown, the processing steps include the following:
[0004] Text preprocessing: The purpose of preprocessing is to segment the input raw text into smaller semantic units and remove words that are not related to the document topic. The main operations include word segmentation and stop word removal.
[0005] Constructing a candidate set: The purpose of constructing a candidate set is to filter out words or phrases that may become keywords from the original text. Common filtering methods fall into three main categories: The first is based on N-grams to select words or phrases with high frequency; the second is based on external resources, such as selecting valuable words or terms from Wikipedia; and the third is based on heuristic metrics, such as Term Frequency-Inverse Document Frequency (TF-IDF), part-of-speech tagging, and the position of the word in the document. It should be noted that in some early works, this step was often omitted, treating all phrases as elements in the candidate set to maintain a high recall value.
[0006] Candidate keyword scoring and ranking: After obtaining a set of candidate words, it is necessary to select phrases that best fit the document's theme or core content as keywords. This is generally done by setting a series of indicators to quantify and rank the importance of candidate phrases, and then using the ranking of candidate phrases as the basis for keyword selection.
[0007] The following section introduces four representative unsupervised keyword extraction methods in the existing technology.
[0008] Frequency statistics-based methods
[0009] Statistical methods involve analyzing specific metrics for candidate words and then ranking them based on the results. These metrics can be divided into two categories. The first category includes metrics such as N-grams, TF-IDF, word co-occurrence, and word frequency, which evaluate the importance of words in a document. However, these metrics ignore the inherent attributes of the words themselves. Therefore, some scholars have proposed assigning different weights to words using metrics such as part-of-speech and their position in the document.
[0010] Graph-based methods
[0011] The most typical example of graph-based unsupervised keyword extraction methods is TextRank. It filters adjectives and nouns from the text using part-of-speech tags, then establishes edges between candidate words appearing in the same text window, assigns the same initial value to each node, and runs the PageRank algorithm until convergence. The drawback of this method is that it assumes a relationship between two candidate words simply because they appear in the same text window, without properly distinguishing the strength of that relationship; that is, the association strength is considered equal between co-occurring once and co-occurring multiple times. The key idea of graph-based methods is that the relationships between candidate words should be differentiated in terms of strength, and they attempt to use various statistical indicators to measure the strength of the relationships between nodes, thereby obtaining better keywords.
[0012] Topic-based approach
[0013] Topic-based methods categorize candidate words according to different topics and then select the core words from each topic as the document's keywords. Some researchers calculate the similarity between candidate words by comparing their co-occurrence frequency with Wikipedia entries and then cluster them, assigning core words to the corresponding topics covered in the document. The drawback of this method is that it assumes equal importance for different topics covered in the document, thus extracting a large number of words weakly related to the document's topic.
[0014] Text embedding-based methods
[0015] Text embedding-based methods consider the semantic relationships between candidate words when calculating edge weights. Some scholars have used word vectors trained on Wikipedia to describe the semantic relevance between candidate words through the Euclidean distance between word vectors, and then considered this when calculating edge weights.
[0016] The disadvantages of the aforementioned unsupervised keyword extraction methods include: Figure 2 This is a schematic diagram illustrating the working mode of an unsupervised keyword extraction method provided in an embodiment of the present invention. Figure 2 middle Represents the input document. Represents the set of candidate keywords, among which Represents the set of the first One keyword. Additionally... A scoring function representing keyword importance. Existing unsupervised keyword extraction methods are all based on... Figure 2 In methods (a) and (b), words in the candidate set are scored, and then sorted according to the scores to extract the final keyword set. This point-wise and pair-wise approach to scoring keywords individually causes two problems:
[0017] Over-generation: Over-generation means that if a document describes "information extraction," then the word "extraction" will appear repeatedly in the document, i.e., it will be a high-frequency word. Therefore, when scoring candidate words one by one, if a candidate word contains "extraction," it is likely to receive a high score, even if it is an incorrect keyword.
[0018] Ignoring coupling: A document typically uses a set of keywords that should cover the core information and theme of the document as much as possible. If you only consider the importance of each keyword, you will ignore the coupling between words.
[0019] The existing unsupervised keyword extraction methods mentioned above fail to consider the interactions between all candidate phrases and the overall semantics of the keyword set. This leads them to tend to select phrases with high-frequency words, thus reducing the diversity of the final extraction results and resulting in suboptimal performance. Summary of the Invention
[0020] Embodiments of the present invention provide an unsupervised keyword extraction method for documents, so as to effectively extract keywords from documents.
[0021] To achieve the above objectives, the present invention adopts the following technical solution.
[0022] An unsupervised keyword extraction method for documents includes:
[0023] Obtain the set of candidate words for the input document;
[0024] A document-set scoring function is constructed based on an encoder and orthogonal optimization regularization. The document-set scoring function is trained using the ranking loss based on the orthogonal optimization regularization. A subset extraction agent is constructed based on the trained document-set scoring function and a self-attention mechanism. The trained document-set scoring function is used as the reward function to optimize and train the subset extraction agent using the policy gradient method in reinforcement learning.
[0025] The candidate word set of the input document is input into a trained subset extraction agent, which then outputs the optimal keyword subset of the input document.
[0026] Preferably, the step of obtaining the candidate word set of the input document includes:
[0027] The input document is processed using natural language processing tools. Perform word segmentation, tag the parts of speech of the words, and then match them according to a specific matching expression. Obtain the input document Candidate word set , Representative adjective, Representative noun.
[0028] Preferably, the construction of the document-set scoring function based on the encoder and orthogonal optimization regularization, and the training of the document-set scoring function based on the ranking loss of orthogonal optimization regularization, includes:
[0029] Document-set scoring function built based on encoder and orthogonal optimization regularization The document-set scoring function This includes the Siamese network-based document word encoder BERT and a representation orthogonal optimization loss based on contrastive learning, the document-set scoring function. The specific processing steps include:
[0030] For input documents and its corresponding candidate word set The corresponding semantic representation is obtained using the BERT encoder:
[0031]
[0032] Indicates the batch size. and Representing the next batch A set of candidate words and a semantic representation of the input document;
[0033] An autoencoder is introduced to compress the semantic representation of the candidate word set and the input document. The specific operation is as follows:
[0034]
[0035]
[0036] in, and Represents the learnable parameter matrix. and This represents the dimension of the learnable parameter matrix. and Representing the next batch The final semantic representation of the candidate word set and the input document in the latent space. and Representing the next batch The reconstructed semantic representation of a set of candidate words and the input document in the latent space;
[0037] Using cosine similarity calculation and The semantic similarity between them is shown in the following formula:
[0038]
[0039] in, For document-collection scoring functions, Representing the next batch The semantic similarity between a candidate word set and a document is used as the importance score of the candidate word set.
[0040] A representation orthogonal optimization loss based on contrastive learning is introduced to optimize the importance score of the candidate word set for input documents in the same batch. The set of candidate words corresponding to the untrunculated input document is considered as the positive sample set. The truncated input document and its corresponding candidate word set are selected as the negative sample set. ;
[0041] The ranking loss function based on orthogonal optimization regularization is designed as shown in the following formula:
[0042]
[0043] in, This represents an adjustable hyperparameter that acts as a weight to control the ranking learning process.
[0044] The document-set scoring function S is trained using the ranking loss based on orthogonal optimization regularization. The semantic similarity is then optimized from multiple perspectives using this ranking loss function. The specific calculation formula is as follows:
[0045]
[0046]
[0047]
[0048] in, This represents the optimization of decorrelation between document and document representations. This represents the optimization of decorrelation between the representations of candidate word sets. It is a regular expression term used to distinguish the semantic similarity between documents and candidate word sets. , and This represents the weighting coefficient, used to balance the degree of influence of different parts in orthogonal optimization;
[0049] Configure settings to optimize the scoring function. Overall loss function As shown below:
[0050]
[0051] in, and This represents the reconstruction loss corresponding to the autoencoder used by the subset extraction agent, as follows:
[0052]
[0053] in, This represents the calculation of the L2 norm.
[0054] Preferably, the step of constructing a subset extraction agent based on a trained document-set scoring function and a self-attention mechanism, and optimizing the training subset extraction agent using the trained document-set scoring function as a reward function through the policy gradient method in reinforcement learning, includes:
[0055] A subset extraction agent is constructed based on a pre-trained document-set scoring function and a self-attention mechanism. The pre-trained document-set scoring function is used as the reward function, and the subset extraction agent is optimized using the policy gradient method in reinforcement learning. The input document... and its corresponding candidate word set The input is fed into the subset extraction agent, and the encoder BERT in the subset extraction agent processes the document. Candidate word set Encode them separately:
[0056]
[0057]
[0058] in, The semantic representation of a document. Indicates the first Semantic representation of candidate words;
[0059] An importance score is calculated based on the representation of each candidate word and document by introducing a self-attention mechanism:
[0060]
[0061] in, This represents the estimated score distribution of candidate words, represents the extraction strategy of the subset agents, and REP represents the copy operation. and It is a learnable parameter matrix;
[0062] The loss function will be utilized Optimized document-collection scoring function Reward function for extracting agents as a subset , reward function As the optimization objective guiding the subset extraction agent's update, the subset extraction is optimized using the idea of policy gradient in reinforcement learning algorithms. The optimization objective of the gradient is as follows:
[0063]
[0064] in, This represents the input document. The extracted subset Importance score This represents the gradient that needs to be updated. This represents the operation of calculating the expected value. The distribution of scores calculated by the subset extractor can also be understood as the distribution of actions taken by the agent.
[0065] The subset extraction agent extracts a keyword subset from the candidate word set C from the perspective of the set, estimates the score of the keyword subset, and uses the score as the importance of the keyword subset. Based on the scores of each keyword subset, the optimal keyword is extracted from the above keyword subset set. After training the subset extraction agent according to the above process for a set number of rounds using existing documents, candidate word sets and keyword subset data, a trained subset extraction agent is obtained.
[0066] Preferably, the step of inputting the candidate word set of the input document into a trained subset extraction agent, and the trained subset extraction agent outputting the optimal keyword subset of the input document, includes:
[0067] Input document and candidate word set The input is fed into a trained subset extraction agent, which then uses the trained policy. For candidate word set Each word in the text is scored, and the word with the highest score is selected. The selected words are the optimal subset of keywords for the input document. .
[0068] As can be seen from the technical solutions provided by the embodiments of the present invention above, the method of the present invention greatly improves the performance of unsupervised keyword extraction by constructing a new reward function and keyword extraction agent, and using reinforcement learning to optimize the agent to efficiently select a subset from the original candidate set.
[0069] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and will become apparent from the description or may be learned by practice of the invention. Attached Figure Description
[0070] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0071] Figure 1 This is a schematic diagram of the processing flow of an unsupervised keyword extraction method in the prior art;
[0072] Figure 2 This is a schematic diagram illustrating the working mode of an unsupervised keyword extraction method provided in an embodiment of the present invention;
[0073] Figure 3 This is a flowchart illustrating an unsupervised keyword extraction method for documents proposed in an embodiment of the present invention.
[0074] Figure 4 A document-set scoring function provided in this embodiment of the invention The structural diagram. Detailed Implementation
[0075] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0076] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or couplings. The term “and / or” as used herein includes any and all combinations of one or more of the associated listed items.
[0077] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless defined as herein.
[0078] To facilitate understanding of the embodiments of the present invention, the following will provide further explanation and description with reference to the accompanying drawings and several specific embodiments. These embodiments do not constitute a limitation on the embodiments of the present invention.
[0079] The working mode of the unsupervised keyword extraction method for documents proposed in this embodiment of the invention is as follows: Figure 2 As shown in (c), keywords are extracted from a set-wise perspective. This method mainly includes two sub-modules: (1) A document-to-set importance evaluation method is designed from the perspective of the global set to achieve the purpose of evaluating the importance of candidate words from the perspective of the set; (2) Selecting a small set from a large set is a classic combinatorial optimization problem. This invention designs a subset extraction agent to realize the function of efficiently sampling candidate subsets from the original set.
[0080] The processing flow of the unsupervised keyword extraction method for documents proposed in this embodiment of the invention is as follows: Figure 3 As shown, the processing steps include the following:
[0081] Step S10: Construct a set of candidate words for the input document.
[0082] The input document was processed using existing natural language processing tools (Stanford CoreNLP Tools). Perform word segmentation, tag the parts of speech of the words, and then match them according to a specific matching expression. Obtain the above input document Candidate word set In the above expression, Representative adjective, Representative noun.
[0083] Step S20: Construct a document-set scoring function based on the encoder and orthogonal optimization regularization. The model is trained using a document-set scoring function based on orthogonal optimization regularization ranking loss. A subset extraction agent is constructed based on a pre-trained document-set scoring function and a self-attention mechanism. The pre-trained document-set scoring function is used as the reward function, and the subset extraction agent is optimized using the policy gradient method in reinforcement learning.
[0084] First, a document-set scoring function is constructed based on the encoder and orthogonal optimization regularization. The model is then used to train the scoring function based on the ranking loss of orthogonal optimization regularization. The above document - set scoring function Structure such as Figure 4 As shown, the document-set scoring function includes the Siamese network-based document word encoder BERT and the representation orthogonality optimization loss based on contrastive learning. The specific processing steps include:
[0085] For input documents in the same batch and its corresponding candidate word set The corresponding semantic representation is obtained using the pre-trained encoder BERT:
[0086]
[0087] in, This indicates the batch size. Additionally, and Representing the next batch The semantic representation of the candidate word set and the input document is used. It's important to note that we use the special character [CLS] from the last layer output of the pre-trained encoder BERT as the semantic representation of the candidate word set and the input document.
[0088] After obtaining the candidate word set and the semantic representation of the input document, considering the inconsistency in semantic level between the document and the candidate word set, an autoencoder is further introduced to compress the semantic representation of the candidate word set and the input document in order to extract high-level semantic concepts. The specific operation is as follows:
[0089]
[0090] in, and Represents the learnable parameter matrix. and This represents the dimension of the learnable parameter matrix. Additionally, and Representing the next batch The final semantic representation of the candidate word set and the input document in the latent space, and and Representing the next batch The semantic representation of the candidate word set and the input document in the latent space is reconstructed. Finally, cosine similarity is calculated based on the above representation. and The semantic similarity between them is shown in the following formula:
[0091]
[0092] in, The semantic similarity between a document and its corresponding candidate word set in the same batch (cosine similarity is used here to measure the similarity between the candidate word set representation and the document representation) is the importance score of the candidate word set.
[0093] After obtaining the importance scores of the candidate word set, this invention introduces a representation orthogonal optimization loss based on contrastive learning to optimize the importance scores of the candidate word set. Specifically, this invention employs a simple method to construct positive and negative candidate sets for input documents in the same batch. The set of candidate words corresponding to the untrunculated input document is considered as the positive sample set. The truncated input document and its corresponding candidate word set are selected as the negative sample set. The truncated input document is processed according to the length requirements of the BERT encoder, retaining only the first 512 tokens (510 tokens excluding the [CLS] and [SEP] special symbols).
[0094] The ranking loss function based on orthogonal optimization regularization is designed as shown in the following formula:
[0095]
[0096] in, The adjustable hyperparameters are used as weights to control the ranking learning process.
[0097] The document-set scoring function is trained using the orthogonal optimization regularization ranking loss described above. The training objective of the aforementioned ranking loss function is to enable a candidate word set with high recall to achieve higher semantic similarity when matching with a document. Furthermore, to ensure that the semantic similarity between the document and the candidate word set is more discriminative, this invention further introduces orthogonal optimization based on contrastive learning. This orthogonal optimization optimizes semantic similarity from multiple perspectives, and the specific calculation formula is as follows:
[0098]
[0099]
[0100]
[0101] in, This represents the optimization of decorrelation between document and document representations. This represents the optimization of decorrelation between the representations of candidate word sets. This is a regularization term used to differentiate the semantic similarity between documents and candidate word sets. Furthermore, , and These represent weight coefficients, used to balance the influence of different parts in the orthogonal optimization. The three contrastive learning losses mentioned above aim to enhance the semantic discriminative power between different document and candidate word sets. Ultimately, they are used to optimize the scoring function. Overall loss function As shown below:
[0102]
[0103] in, and The reconstruction loss corresponding to the autoencoder used in this invention is as follows:
[0104]
[0105] in, This represents the calculation of the L2 norm.
[0106] Then, based on the trained document-set scoring function and self-attention mechanism, a subset extraction agent is constructed to extract the document-set scoring function. Reward function for extracting agents as a subset This is used to estimate the importance score of the candidate word subset. Based on the above subset extraction agent's reward function, utilizing existing document, candidate word set, and keyword subset data, and through the policy gradient algorithm in reinforcement learning, the reward function is used... The subset extraction agent is optimized by using the weighted term of the maximum likelihood estimation loss to further obtain a well-trained subset extraction agent.
[0107] Based on the input document and its corresponding candidate word set C Using a pre-trained subset, the BERT encoder in the agent extracts the document... The candidate word set C is encoded separately:
[0108]
[0109]
[0110] in, The semantic representation of a document. Indicates the first Semantic representation of candidate words;
[0111] Then, an importance score is calculated based on the representation of each candidate word and document by introducing a self-attention mechanism:
[0112]
[0113] in, This represents the estimated score distribution of candidate words, and REP stands for copy operation (for the purpose of altering its tensor dimension). and It is a learnable parameter matrix.
[0114] Obtain the corresponding importance score Subsequently, this invention employs the concept of policy gradient in reinforcement learning, utilizing the previously trained scoring function. As a reward function A reward is constructed and used as an optimization objective to guide the extraction of agent updates from a subset. The specific optimization objective of its gradient is as follows:
[0115]
[0116] in, This represents the input document. The extracted subset Importance score (for ease of understanding, ) Record (As the reward function for the current stage). This represents the gradient that needs to be updated. This represents the operation of calculating the expected value. The score distribution calculated by the subset extractor can also be understood as the distribution of actions taken by the agent. This reward function is used as the optimization objective to optimize the policy. This enables the subset extraction agent to evaluate the importance of candidate words from a set perspective, thereby selecting the optimal keyword subset from the candidate word set C of the input document D. By using this reward function as the optimization objective, the subset extraction agent can evaluate the importance of candidate words from a set perspective, thereby selecting the optimal keyword subset from the candidate word set C of the input document D. .
[0117] By using existing documents, candidate word sets, and keyword subset data, and training the subset extraction agent according to the above processing procedure to reach a set number of rounds, a trained subset extraction agent is obtained.
[0118] Step S30: Input the candidate word set of the input document into the trained subset extraction agent, and the trained subset extraction agent outputs the optimal keyword subset of the input document.
[0119] Input document and candidate word set The input is fed into a trained subset extraction agent, which then uses the trained policy. For candidate word set Each word in the text is scored, and the word with the highest score is selected. The selected words are the optimal subset of keywords for the input document. .
[0120] In summary, this invention constructs a document-to-set scoring function as a reward function in reinforcement learning, allowing the model to score the candidate keyword set from the perspective of the set, thereby achieving accurate estimation of keyword importance. To solve the classic combinatorial optimization problem—selecting a small subset from a large set—this invention uses a reinforcement learning-based keyword extraction agent guided by the reward function to extract keywords from the perspective of the set.
[0121] Unsupervised keyword extraction methods based on pairwise ranking consider the comparison between pairs of candidates in the candidate set, alleviating the problems of over-generation and insufficient coupling between the keyword set compared to point-wise methods. However, since the keywords corresponding to a document constitute a set, the importance of all candidates should be considered from the perspective of the set. The method based on neural set functions proposed in this invention improves this problem, effectively considering the issues of over-generation and insufficient word coupling between the keyword set. By constructing a new reward function and keyword extraction agent, reinforcement learning is used to optimize the agent to efficiently select a subset from the original candidate set, greatly improving the performance of unsupervised keyword extraction and providing new ideas and references for the field of keyword extraction research.
[0122] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of one embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing the present invention.
[0123] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of the present invention, 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 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 various embodiments or some parts of the embodiments of the present invention.
[0124] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for apparatus or system embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. The apparatus and system 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 creative effort.
[0125] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An unsupervised keyword extraction method for documents, characterized in that, include: Obtain the set of candidate words for the input document; A document-set scoring function is constructed based on an encoder and orthogonal optimization regularization. The document-set scoring function is trained using the ranking loss based on the orthogonal optimization regularization. A subset extraction agent is constructed based on the trained document-set scoring function and a self-attention mechanism. The trained document-set scoring function is used as the reward function to optimize and train the subset extraction agent using the policy gradient method in reinforcement learning. The candidate word set of the input document is input into a trained subset extraction agent, and the trained subset extraction agent outputs the optimal keyword subset of the input document. The document-set scoring function constructed based on the encoder and orthogonal optimization regularization, and the document-set scoring function trained based on the ranking loss of orthogonal optimization regularization, include: Document-set scoring function built based on encoder and orthogonal optimization regularization The document-set scoring function This includes the Siamese network-based document word encoder BERT and a representation orthogonal optimization loss based on contrastive learning, the document-set scoring function. The specific processing steps include: For input documents and its corresponding candidate word set The corresponding semantic representation is obtained using the BERT encoder: Indicates the batch size. Representing the next batch Semantic representation of a set of candidate words Representing the next batch Each set of candidate words corresponds to a semantic representation of the input document; An autoencoder is introduced to compress the semantic representation of the candidate word set and the input document. The specific operation is as follows: in, and Represents the learnable parameter matrix. and This represents the dimension of the learnable parameter matrix. Representing the next batch Each set of candidate words corresponds to the final semantic representation of the input document in the latent space. This represents the same batch. The final semantic representation of the candidate word set in the latent space, This represents the same batch. Each set of candidate words corresponds to the reconstructed semantic representation of the input document in the latent space. Representing the next batch The reconstructed semantic representation of a set of candidate words in the latent space; Using cosine similarity calculation and The semantic similarity between them is shown in the following formula: in, For document-collection scoring functions, Representing the next batch The semantic similarity between a candidate word set and a document is used as the importance score of the candidate word set. A representation orthogonal optimization loss based on contrastive learning is introduced to optimize the importance score of the candidate word set for input documents in the same batch. The set of candidate words corresponding to the untrunculated input document is considered as the positive sample set. The truncated input document and its corresponding candidate word set are selected as the negative sample set. ; The ranking loss function based on orthogonal optimization regularization is designed as shown in the following formula: in, This represents an adjustable hyperparameter that serves as the weights controlling the ranking learning process. The document-set scoring function S is trained using the ranking loss based on orthogonal optimization regularization. The semantic similarity is then optimized from multiple perspectives using this ranking loss function, with the specific calculation formula as follows: in, This represents the optimization of decorrelation between document and document representations. This represents the optimization of decorrelation between the representations of candidate word sets. It is a regular expression term used to distinguish the semantic similarity between documents and candidate word sets. , and This represents the weighting coefficient, used to balance the degree of influence of different parts in orthogonal optimization; Configure functions to optimize document-collection scoring. Overall loss function As shown below: in, and This represents the reconstruction loss corresponding to the autoencoder used by the subset extraction agent, as follows: in, This represents the calculation of the L2 norm.
2. The method according to claim 1, characterized in that, The process of obtaining the candidate word set for the input document includes: The input document is processed using natural language processing tools. Perform word segmentation, tag the parts of speech of the words, and then match them according to a specific matching expression. Obtain the input document Candidate word set , Representative adjective, Representative noun.
3. The method according to claim 1, characterized in that, The method described above involves constructing a subset extraction agent based on a pre-trained document-set scoring function and a self-attention mechanism, using the pre-trained document-set scoring function as the reward function, and optimizing the training subset extraction agent through a policy gradient method in reinforcement learning. This includes: A subset extraction agent is constructed based on a pre-trained document-set scoring function and a self-attention mechanism. The pre-trained document-set scoring function is used as the reward function, and the subset extraction agent is optimized using the policy gradient method in reinforcement learning. The input document... and its corresponding candidate word set The input is fed into the subset extraction agent, and the encoder BERT in the subset extraction agent processes the document. Candidate word set Encode them separately: in, The semantic representation of a document. Indicates the first Semantic representation of candidate words; An importance score is calculated based on the representation of each candidate word and document by introducing a self-attention mechanism: in, This represents the estimated score distribution of candidate words, represents the extraction strategy of the subset agents, and REP represents the copy operation. and It is a learnable parameter matrix; The loss function will be utilized Optimized document-collection scoring function Reward function for extracting agents as a subset , reward function As the optimization objective guiding the subset extraction agent's update, the subset extraction is optimized using the idea of policy gradient in reinforcement learning algorithms. The optimization objective of the gradient is as follows: in, This represents the input document. The extracted subset Importance score This represents the gradient that needs to be updated. This represents the operation of calculating the expected value. The distribution of scores calculated by the subset extractor can also be understood as the distribution of actions taken by the agent. The subset extraction agent extracts candidate words from a set-based perspective. Extract a subset of keywords and estimate the score of each keyword subset. Use this score as the importance of the keyword subset. Extract the optimal keyword from the set of keyword subsets based on the scores of each keyword subset. Train the subset extraction agent using the existing documents, candidate word set and keyword subset data according to the above process for a set number of rounds to obtain the trained subset extraction agent.
4. The method according to claim 3, characterized in that, The process of inputting the candidate word set of the input document into a trained subset extraction agent, and the trained subset extraction agent outputting the optimal keyword subset of the input document, includes: Input document and candidate word set The input is fed into a trained subset extraction agent, which then uses the trained policy. For candidate word set Each word in the text is scored, and the word with the highest score is selected. The selected words are the optimal subset of keywords for the input document. .
Citation Information
Patent Citations
Chinese patent abstract rewriting method
CN112417853A
Chinese academic keyword extraction method and device and storage medium
CN113268995A
