Keyword recognition method, device, equipment and medium

By calculating the correlation score between words based on the Transformer-based pre-training model, and combining the keyword probability and importance score to identify keywords, the problem of low keyword recognition accuracy in the existing technology is solved, and a more accurate Text keyword recognition.

CN112528026BActive Publication Date: 2024-09-24BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011498911.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-17
Publication Date
2024-09-24
Estimated Expiration
2040-12-17

AI Technical Summary

Technical Problem

Existing keyword identification methods, including supervised and unsupervised methods, have low accuracy. The former ignores the correlation between texts, and the latter is insufficient in word similarity modeling based on static vectors and cannot accurately characterize the relationship between words. similarity.

Method used

Use a pre-training model based on Transformer to encode the input text, generate hidden layer sequences and semantic vectors, calculate the correlation scores between words through the self-attention mechanism, and combine the keyword probability and importance scores to identify key words. word.

Benefits of technology

The accuracy of keyword identification is improved. It not only takes advantage of keyword tags, but also explores the correlation between words. It combines supervised and unsupervised methods to improve the accuracy of text keyword identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112528026B
    Figure CN112528026B
Patent Text Reader

Abstract

The present disclosure provides a keyword recognition method, including: classifying words in an input text, obtaining a keyword probability of each word, calculating a correlation score between words in the input text, calculating an importance score of each word in the input text according to the correlation score, calculating a keyword score of each word in the input text according to the keyword probability and the importance score, and identifying keywords in the input text according to the keyword score. The present disclosure also provides a keyword recognition device, an electronic device, and a readable storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and more specifically, to a keyword recognition method, device, equipment and medium. Background Art

[0002] The task of text keyword recognition is to identify keywords in the input text. Generally speaking, there are two ways to achieve this task. The first is a supervised method, which trains a sequence labeling task based on the keyword labels in the input text. The second is an unsupervised method, such as a graph-based method, which uses the words in the text as nodes of the graph, and the edges between the nodes are the relationships between words. The importance score of each word is calculated through a graph-based algorithm, and the words with high scores are extracted as keywords.

[0003] However, supervised methods rely on labeled data and tend to mine the correlation between input text and output labels, while ignoring the correlation between input texts, resulting in low accuracy in keyword recognition. Unsupervised methods rely on the accuracy of the graph, that is, the correlation calculation between each word in the graph. Generally speaking, the correlation between words can be represented by the cosine similarity between word vectors or the cosine similarity of tf-idf (a common weighting technique for information retrieval and data mining) vectors. However, these static vector-based methods do not adequately model the similarity between words and cannot accurately represent the similarity between words, resulting in low accuracy in keyword recognition. Summary of the invention

[0004] In view of this, the present disclosure provides a keyword recognition method, device, equipment and medium.

[0005] One aspect of the present disclosure provides a keyword recognition method, comprising: classifying words in an input text to obtain a keyword probability for each word; calculating a correlation score between words in the input text; calculating an importance score for each word in the input text based on the correlation score; calculating a keyword score for each word in the input text based on the keyword probability and the importance score; and identifying keywords in the input text based on the keyword score.

[0006] According to an embodiment of the present disclosure, classifying words in an input text to obtain a keyword probability of each word includes: encoding the input text based on a pre-trained model of Transformer to generate a series of hidden layer sequences, wherein each element in the hidden layer sequence represents a word; and classifying the top hidden layer sequence in the series of hidden layer sequences to obtain a keyword probability of each word.

[0007] According to an embodiment of the present disclosure, the calculation of the correlation score between words in the input text includes: encoding the input text based on a pre-trained model of Transformer to generate a latent semantic vector, wherein the latent semantic vector includes a query vector of the input text and a vector corresponding to a key in a key-value pair; and calculating the correlation score between words in the input text based on the query vector and the vector corresponding to the key.

[0008] According to an embodiment of the present disclosure, the pre-trained model of the Transformer includes at least one Transformer layer, and for each Transformer layer, according to:

[0009]

[0010] Calculate the relevance score, where i and j represent the numbers of the words in the input text, and n represents the number of the Transformer layer. represents the correlation score between the i-th word and the j-th word obtained by the n-th Transformer layer, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, is the scale factor, and soft max() represents the normalized exponential function; according to:

[0011]

[0012] Calculate the final correlation score between the i-th word and the j-th word, where L represents the total number of layers of the Transformer, and D i,j Represents the final correlation score between the i-th word and the j-th word.

[0013] According to an embodiment of the present disclosure, calculating the importance score of each word in the input text according to the relevance score includes: calculating the importance score of each word in the input text according to the relevance score i =∑ i D i,j Calculate the importance score; where i and j represent the numbers of the words in the input text, D i,j represents the final correlation score between the i-th word and the j-th word, s i Represents the importance score of the i-th word.

[0014] According to an embodiment of the present disclosure, the calculating of the keyword score of each word in the input text according to the keyword probability and the importance score includes: according to the formula:

[0015] y i =p i *s i

[0016] Calculate the keyword score, where y i represents the keyword score of the i-th word, s i represents the importance score of the i-th word, p i Represents the keyword probability of the i-th word.

[0017] According to an embodiment of the present disclosure, the classification of words in the input text to obtain the keyword probability of each word includes:

[0018] p i =sigmoid(W h h i )

[0019] Classify the words in the input text, where p i represents the keyword probability of the i-th word, sigmoid() represents the activation function, W h represents the parameter matrix, h i Represents the element corresponding to the i-th word in the hidden layer sequence.

[0020] According to an embodiment of the present disclosure, the keyword recognition method further includes: constructing a Transformer-based pre-training model, wherein the self-attention mechanism of the Transformer-based pre-training model is:

[0021]

[0022] Wherein, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, and K represents the vector corresponding to the value in the key-value pair. is a scaling factor, and soft max() represents a normalized exponential function; obtaining a training input text, and inputting the training input text into the pre-trained model for training until the loss function of the Transformer-based pre-trained model no longer decreases.

[0023] According to an embodiment of the present disclosure, the loss function is: L p =p i ln(y i )+(1-p i )ln(1-y i ), where y i represents the keyword score of the i-th word, p i Represents the keyword probability of the i-th word.

[0024] On the other hand, the present disclosure provides a keyword recognition device, including: a classification module, used to classify words in an input text to obtain a keyword probability of each word; a first calculation module, used to calculate the correlation score between words in the input text; a second calculation module, used to calculate the importance score of each word in the input text according to the correlation score; a third calculation module, used to calculate the keyword score of each word in the input text according to the keyword probability and the importance score; and an identification module, used to identify keywords in the input text according to the keyword score.

[0025] According to an embodiment of the present disclosure, the classification module classifies words in the input text to obtain the keyword probability of each word, including: encoding the input text based on the Transformer pre-training model to generate a series of hidden layer sequences, wherein each element in the hidden layer sequence represents a word; classifying the top hidden layer sequence in the series of hidden layer sequences to obtain the keyword probability of each word.

[0026] According to an embodiment of the present disclosure, the first calculation module calculates the correlation score between words in the input text, including: encoding the input text based on the pre-trained model of Transformer to generate a latent semantic vector, wherein the latent semantic vector includes the query vector of the input text and the vector corresponding to the key in the key-value pair; and calculating the correlation score between words in the input text based on the query vector and the vector corresponding to the key.

[0027] According to an embodiment of the present disclosure, the pre-trained model of the Transformer includes at least one Transformer layer, and for each Transformer layer, according to:

[0028]

[0029] Calculate the relevance score, where i and j represent the numbers of the words in the input text, and n represents the number of the Transformer layer. represents the correlation score between the i-th word and the j-th word obtained by the n-th Transformer layer, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, is the scale factor, and soft max() represents the normalized exponential function; according to:

[0030]

[0031] Calculate the final correlation score between the i-th word and the j-th word, where L represents the total number of layers of the Transformer, and D i,jRepresents the final correlation score between the i-th word and the j-th word.

[0032] According to an embodiment of the present disclosure, the second calculation module calculates the importance score of each word in the input text according to the relevance score, including:

[0033] According to s i =∑ i D i,j Calculate the importance score; where i and j represent the numbers of the words in the input text, D i,j represents the final correlation score between the i-th word and the j-th word, s i Represents the importance score of the i-th word.

[0034] According to an embodiment of the present disclosure, the third calculation module calculates the keyword score of each word in the input text according to the keyword probability and the importance score, including: according to the formula: i =p i *s i Calculate the keyword score, where y i represents the keyword score of the i-th word, s i represents the importance score of the i-th word, p i Represents the keyword probability of the i-th word.

[0035] Another aspect of the present disclosure provides an electronic device, including: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.

[0036] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.

[0037] Another aspect of the present disclosure provides a computer program, which includes computer executable instructions, and the instructions are used to implement the method described above when executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0039] Figure 1 Schematically illustrates an exemplary system architecture 100 that can implement a keyword identification method according to an embodiment of the present disclosure;

[0040] Figure 2A flowchart of a keyword identification method according to an embodiment of the present disclosure is schematically shown;

[0041] Figure 3 A flowchart of a method for classifying words in an input text according to an embodiment of the present disclosure is schematically shown;

[0042] Figure 4 A flowchart of a method for calculating correlation scores between words in an input text according to an embodiment of the present disclosure is schematically shown;

[0043] Figure 5 The flowchart of the Transformer-based pre-training model construction method according to an embodiment of the present disclosure is schematically shown;

[0044] Figure 6 A block diagram of a keyword recognition device according to an embodiment of the present disclosure is schematically shown;

[0045] Figure 7 Schematically shows a block diagram of a classification module according to an embodiment of the present disclosure;

[0046] Figure 8 Schematically shows a block diagram of a first computing module according to an embodiment of the present disclosure;

[0047] Fig. 9 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0048] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0049] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0050] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.

[0051] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0052] The embodiments of the present disclosure provide a keyword identification method and a device capable of applying the method. The method includes classifying words in an input text to obtain a keyword probability of each word. Calculating the correlation score between words in the input text. Calculating the importance score of each word in the input text based on the correlation score. Calculating the keyword score of each word in the input text based on the keyword probability and the importance score. Identifying keywords in the input text based on the keyword score.

[0053] Figure 1 The exemplary system architecture 100 for implementing the keyword identification method according to an embodiment of the present disclosure is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0054] like Figure 1 As shown, the system architecture 100 according to this embodiment may include a database 101, a network 102 and a server 103. The network 102 is used to provide a medium for a communication link between the database 100 and the server 103. The network 102 may include various connection types, such as wired and / or wireless communication links, and the like.

[0055] The database 100 may store input texts that require keyword recognition, and the network 103 may input the input texts that require keyword recognition into the server 103. The server 103 may be a server that provides various services, such as obtaining input texts and performing keyword recognition on the obtained input texts.

[0056] It should be noted that the keyword recognition method provided in the embodiment of the present disclosure can generally be executed by the server 103. Accordingly, the keyword recognition device provided in the embodiment of the present disclosure can generally be set in the server 103. The keyword recognition method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 103 and can communicate with the database 101 and / or the server 103. Accordingly, the keyword recognition device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 103 and can communicate with the database 101 and / or the server 103.

[0057] For example, when performing keyword recognition, the keyword recognition process is not directly executed by server 103, but by a server or server cluster that can communicate with database 101 and server 103. After keyword recognition is completed, the result of keyword recognition is sent to server 103 for further processing.

[0058] It should be understood that Figure 1 The number of databases, networks and servers in the embodiment is only for illustration. Any number of databases, networks and servers may be provided as required.

[0059] Figure 2 The flowchart of the keyword identification method according to the embodiment of the present disclosure is schematically shown.

[0060] like Figure 2 As shown, the method includes operations S201 to S205.

[0061] In operation S201, words in an input text are classified to obtain a keyword probability of each word.

[0062] For example, the input text is selected as the product message description text, recorded as {x1, x2, ..., x n}, where each x i Represents a word, and can be used for each word x i The keyword probability of a selling point word is generally higher than that of a non-selling point word.

[0063] In operation S202 , correlation scores between words in the input text are calculated.

[0064] Continuing with the above example, for the input text {x1, x2, ..., x n}, calculate word x i With word x j In the embodiment of the present disclosure, the correlation between words may refer to the meaning correlation between different words, such as the analysis of synonyms and antonyms.

[0065] In operation S203, the importance score of each word in the input text is calculated according to the relevance score.

[0066] In the embodiment of the present disclosure, the in-degree centrality score may be calculated as the importance score of the word.

[0067] In operation S204, a keyword score of each word in the input text is calculated according to the keyword probability and the importance score.

[0068] In operation S205 , keywords in the input text are identified according to the keyword scores.

[0069] Through the keyword recognition method provided by the embodiment of the present invention, in the keyword recognition process, since the keyword probability of each word is obtained and the importance score of each word is calculated according to the correlation between words, the final keyword probability of each word can be obtained based on the keyword probability and importance score of each word, which not only takes advantage of the keyword label, but also effectively obtains the importance score of the word by mining the correlation between words to guide supervision, thereby organically combining supervised and unsupervised text keyword recognition to improve the accuracy of text keyword recognition.

[0070] The following is a detailed description of the embodiments of the present invention. Figure 2 The method shown is further explained.

[0071] Figure 3 The flowchart of the method for classifying words in input text according to an embodiment of the present disclosure is schematically shown.

[0072] like Figure 3 As shown, the classification method may include, for example, operations S301 to S302.

[0073] In operation S301, based on the pre-trained model of Transformer, the input text is encoded to generate a series of hidden layer sequences, wherein each element in the hidden layer sequence represents a word.

[0074] Continuing with the above example, for the input text {x1, x2, ..., x n}, the disclosed embodiment encodes each word in the text based on the pre-trained model of Transformer. The model generally includes an encoder and a decoder. The encoder can be, for example, stacked up with multiple basic layers, each basic layer contains two sub-layers, the first sub-layer is an attention mechanism, and the second sub-layer is a fully connected forward neural network. Residual edges and layer normalization are introduced to both sub-layers. The decoder can also be stacked up with multiple basic layers. In addition to the two sub-layers in the encoder, each basic layer also adds a layer of self-attention mechanism, and this layer of self-attention mechanism also introduces residual edges and layer normalization.

[0075] Since Transformer-based pre-training models generally contain multiple layers, a series of hidden layer sequences will be generated for the same input text. Each hidden layer sequence represents the input text, and each element in the hidden layer sequence represents a word in the input text. For example, the hidden layer sequence is recorded as {h1, h2, ..., h n}, then h1 represents word x1, h2 represents word x2, ..., h n Representative word x n Among them, the Transformer-based pre-training model attempts to select the BERT (Bidirectional Encoder Representations from Transformers) model. BERT is a language representation model, and BERT stands for Bidirectional Encoder Representations from Transformers. BERT aims to pre-train deep bidirectional representations by jointly adjusting the left and right contexts in all layers.

[0076] In operation S302, the top hidden layer sequence in a series of hidden layer sequences is classified to obtain the keyword probability of each word.

[0077] According to an embodiment of the present disclosure, the top hidden layer sequence in a series of hidden layer sequences is selected to represent the input text for classification. This is because compared with other hidden layer sequences, the top hidden layer sequence can best represent the input text and has a better classification effect.

[0078] According to the embodiment of the present disclosure, the formula:

[0079] p i =sigmoid(W h h i )

[0080] Classify the words in the input text, where p i represents the keyword probability of the i-th word, sigmoid() represents the activation function, W h represents the parameter matrix, h iRepresents the element corresponding to the i-th word in the hidden layer sequence.

[0081] For example, for a product message description text {x1, x2, ..., x n}, p i is x i Selling point score. In classification, when x i When it is a selling point word, its p i is close to 1, otherwise when x i When it is a non-selling word, its p i is close to 0. That is, p i Between 0 and 1.

[0082] Through the classification method provided by the embodiment of the present disclosure, since the input text is encoded based on the Transformer pre-trained model, and the top layer and hidden layer sequences in the encoding results are classified, the advantages of keyword labels can be fully utilized to obtain accurate keyword probabilities, thereby improving the accuracy of subsequent keyword recognition.

[0083] Figure 4 The flowchart schematically shows a method for calculating the correlation scores between words in an input text according to an embodiment of the present disclosure.

[0084] like Figure 4 As shown, the classification method may include, for example, operations S401 to S402.

[0085] In operation S401, based on the pre-trained model of Transformer, the input text is encoded to generate a latent semantic vector, wherein the latent semantic vector includes a query vector of the input text and a vector corresponding to a key in a key-value pair.

[0086] The core module of the pre-trained model of the Transformer provided by the embodiment of the present disclosure is the self-attention mechanism. Among them, the self-attention mechanism refers to the ability to connect the information at different positions on the input sequence corresponding to the input text, and then calculate a certain expression of the entire sequence, and finally identify keywords based on this expression. Specifically, the self-attention mechanism can be, for example, a process of mapping a query to the correct input given a query and a key-value pair. Here, the query, key, value and final output are all vectors. The output is often in the form of a weighted sum, and the weight is determined by the query, key and value. Therefore, in operation S401, a hidden semantic vector including the query vector of the input text and the vector corresponding to the key can be generated based on the self-attention mechanism. Among them, the pre-trained model of the Transformer can also be a BERT model.

[0087] In operation S402, the correlation scores between words in the input text are calculated according to the query vector and the vectors corresponding to the keys.

[0088] Through the method for calculating the correlation score provided in the embodiment of the present disclosure, since the Transformer-based pre-training model can dynamically obtain the correlation between words, that is, the correlation will comprehensively consider the contextual semantics of the two words, rather than the traditional static vector method, this method can fully consider the change of the correlation between the two words according to the context (that is, the correlation between the two words is different in different contexts). Compared with the traditional static vector method, the calculated correlation score is more accurate, thereby improving the accuracy of keyword recognition.

[0089] According to an embodiment of the present disclosure, the pre-trained model of Transformer generally includes at least one Transformer layer, and each Transformer layer can obtain word x i With word x j For each Transformer layer, the correlation score between words can be calculated according to the following specific calculation method.

[0090] Specifically, according to the formula:

[0091]

[0092] Calculate the relevance score, where i and j represent the word numbers in the input text, and n represents the number of the Transformer layer. represents the correlation score between the i-th word and the j-th word obtained by the n-th Transformer layer, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, is the scale factor, and soft max() represents the normalized exponential function.

[0093] Get each layer of word x i With word x j After obtaining a correlation score between the multiple layers, the multi-layer correlation scores can be averaged to obtain the final correlation score. That is:

[0094] According to the formula:

[0095]

[0096] Calculate the final correlation score between the i-th word and the j-th word, where L represents the total number of layers of the Transformer, and D i,j Represents the final correlation score between the i-th word and the j-th word.

[0097] The specific correlation score calculation method provided by the embodiment of the present disclosure can further ensure the accuracy of the correlation score, thereby ensuring the accuracy of keyword recognition.

[0098] According to an embodiment of the present disclosure, by calculating the in-degree centrality score, it is used as the word x i The importance score is as follows:

[0099] According to s i =∑ i D i,j Calculate the i-th word x i The importance score of D i,j represents the final correlation score between the i-th word and the j-th word, s i Represents the importance score of the i-th word.

[0100] The specific importance score calculation method provided by the embodiment of the present disclosure can further ensure the accuracy of the importance score, thereby ensuring the accuracy of keyword recognition.

[0101] According to an embodiment of the present disclosure, according to the formula:

[0102] y i =p i *s i

[0103] Calculate the i-th word x i The keyword score of i represents the keyword score of the i-th word, s i represents the importance score of the i-th word, p i Represents the keyword probability of the i-th word.

[0104] By using the keyword score calculation method provided by the embodiment of the present disclosure, supervised and unsupervised text keyword recognition are organically combined to ensure the accuracy of text keyword recognition.

[0105] Figure 5 The figure schematically shows a flowchart of a method for constructing a pre-training model based on Transformer according to an embodiment of the present disclosure.

[0106] like Figure 5 As shown, the model building method may include, for example, operations S501 to S502.

[0107] In operation S501, a Transformer-based pre-training model is constructed.

[0108] According to an embodiment of the present disclosure, the self-attention mechanism of the Transformer-based pre-training model is configured as follows:

[0109]

[0110] Wherein, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, and K represents the vector corresponding to the value in the key-value pair. is the scale factor, and soft max() represents the normalized exponential function.

[0111] Q, K, and V can be obtained by linearly transforming the input text, for example:

[0112]

[0113] Among them, x represents the input text, W Q represents the linear transformation matrix corresponding to Q, W K represents the linear transformation matrix corresponding to K, W V Represents the linear transformation matrix corresponding to V.

[0114] In operation S502, a training input text is obtained, and the training input text is input into a pre-trained model for training until the loss function of the Transformer-based pre-trained model no longer decreases.

[0115] According to an embodiment of the present disclosure, the loss function may be, for example:

[0116] L p =p i ln(y i )+(1-p i )ln(1-y i )

[0117] Among them, y i represents the keyword score of the i-th word, p i Represents the keyword probability of the i-th word.

[0118] Through the Transformer-based pre-training model construction method provided by the embodiment of the present disclosure, by reasonably designing the training loss function through keyword probability and keyword score, a Transformer-based pre-training model with better performance can be obtained, thereby better performing keyword recognition.

[0119] Figure 6 The block diagram of a keyword identification device according to an embodiment of the present disclosure is schematically shown.

[0120] like Figure 6As shown, the keyword recognition device 600 may include, for example, a classification module 610 , a first calculation module 620 , a second calculation module 630 , a third calculation module 640 and a recognition module 650 .

[0121] The classification module 610 is used to classify the words in the input text to obtain the keyword probability of each word.

[0122] The first calculation module 620 is used to calculate the correlation scores between words in the input text.

[0123] A second calculation module 630, used to calculate the importance score of each word in the input text according to the relevance score;

[0124] A third calculation module 640 is used to calculate the keyword score of each word in the input text according to the keyword probability and the importance score; and

[0125] The recognition module 650 is used to recognize keywords in the input text according to the keyword scores.

[0126] The following is a Figure 6 The keyword recognition device 600 shown is further explained.

[0127] Figure 7 The block diagram of the classification module according to an embodiment of the present disclosure is schematically shown.

[0128] According to the embodiments of the present disclosure, Figure 7 As shown, the classification module 610 may include, for example, a first encoding unit 611 and a classification unit 612 .

[0129] The first encoding unit 611 is used to encode the input text based on the Transformer pre-training model to generate a series of hidden layer sequences.

[0130] The classification unit 612 classifies the top hidden layer sequence in a series of hidden layer sequences to obtain the keyword probability of each word.

[0131] Figure 8 A block diagram of a first computing module according to an embodiment of the present disclosure is schematically shown.

[0132] According to the embodiments of the present disclosure, Figure 8 As shown, the first calculation module 620 may include, for example, a second encoding unit 621 and a calculation unit 622 .

[0133] The second encoding unit 621 is used to encode the input text based on the Transformer pre-training model to generate a latent semantic vector, wherein the latent semantic vector includes a query vector of the input text and a vector corresponding to a key in a key-value pair.

[0134] The calculation unit 622 is used to calculate the correlation scores between words in the input text according to the query vector and the vector corresponding to the key.

[0135] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.

[0136] For example, any of the classification module 610, the first calculation module 620, the second calculation module 630, the third calculation module 640 and the identification module 650 can be combined in one module / unit / subunit for implementation, or any of the modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functions of one or more of these modules / units / subunits can be combined with at least part of the functions of other modules / units / subunits and implemented in one module / unit / subunit. According to an embodiment of the present disclosure, at least one of the classification module 610, the first calculation module 620, the second calculation module 630, the third calculation module 640 and the identification module 650 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware and firmware or by a suitable combination of any of them. Alternatively, at least one of the classification module 610 , the first calculation module 620 , the second calculation module 630 , the third calculation module 640 and the identification module 650 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be performed.

[0137] It should be noted that the keyword recognition device part in the embodiment of the present disclosure corresponds to the keyword recognition method part in the embodiment of the present disclosure, and their specific implementation details and technical effects are also the same, which will not be repeated here.

[0138] Fig. 9 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0139] like Fig. 9 As shown, the electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0140] In RAM 903, various programs and data required for the operation of electronic device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other via bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.

[0141] According to an embodiment of the present disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the I / O interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.

[0142] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0143] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0144] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.

[0145] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 902 and / or the RAM 903 described above and / or one or more memories other than the ROM 902 and the RAM 903 .

[0146] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0147] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.

[0148] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A keyword recognition method, comprising: Classify the words in the input text and get the keyword probability of each word; Calculating correlation scores between words in the input text; Calculate the importance score of each word in the input text according to the relevance score; Calculating a keyword score for each word in the input text according to the keyword probability and the importance score; as well as identifying keywords in the input text according to the keyword scores; The step of calculating the importance score of each word in the input text according to the relevance score includes: calculating the importance score of each word in the input text according to the relevance score. i =∑ i D i,j Calculate the importance score; where i and j represent the numbers of the words in the input text, D i,j represents the final correlation score between the i-th word and the j-th word, s i Represents the importance score of the i-th word; The calculating of the keyword score of each word in the input text according to the keyword probability and the importance score includes: according to the formula: i =p i *s i Calculate the keyword score, where y i represents the keyword score of the i-th word, s i represents the importance score of the i-th word, p i Represents the keyword probability of the i-th word.

2. The keyword identification method according to claim 1, wherein: The word classification in the input text to obtain the keyword probability of each word includes: Based on the pre-trained model of Transformer, the input text is encoded to generate a series of hidden layer sequences, wherein each element in the hidden layer sequence represents a word; The top hidden layer sequence in the series of hidden layer sequences is classified to obtain the keyword probability of each word.

3. The keyword identification method according to claim 1, wherein: The calculating of the correlation scores between words in the input text comprises: Based on the Transformer pre-trained model, the input text is encoded to generate a latent semantic vector, wherein the latent semantic vector includes the query vector of the input text and the vector corresponding to the key in the key-value pair; The correlation scores between words in the input text are calculated according to the query vector and the vector corresponding to the key.

4. The keyword recognition method according to claim 3, wherein: The Transformer pre-training model includes at least one Transformer layer. For each Transformer layer, according to: Calculate the relevance score, where i and j represent the numbers of the words in the input text, and n represents the number of the Transformer layer. represents the correlation score between the i-th word and the j-th word obtained by the n-th Transformer layer, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, is the scale factor, and softmax() represents the normalized exponential function; according to: Calculate the final correlation score between the i-th word and the j-th word, where L represents the total number of layers of the Transformer layer, and D i,j Represents the final correlation score between the i-th word and the j-th word.

5. The keyword recognition method according to claim 2, wherein: The word classification in the input text to obtain the keyword probability of each word includes: according to: p i =sigmoid(W h h i ) Classify the words in the input text, where p i represents the keyword probability of the i-th word, sigmoid() represents the activation function, W h represents the parameter matrix, h i Represents the element corresponding to the i-th word in the hidden layer sequence.

6. The keyword recognition method according to any one of claims 3 to 5, further comprising: A Transformer-based pre-training model is constructed, wherein the self-attention mechanism of the Transformer-based pre-training model is: Wherein, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, and K represents the vector corresponding to the value in the key-value pair. is the scale factor, and softmax() represents the normalized exponential function; A training input text is obtained, and the training input text is input into the pre-trained model for training until the loss function of the Transformer-based pre-trained model no longer decreases.

7. The keyword identification method according to claim 6, wherein: The loss function is: L p =p i ln(y i )+(1-p i )ln(1-y i ) Among them, y i represents the keyword score of the i-th word, p i Represents the keyword probability of the i-th word.

8. A keyword recognition device, comprising: The classification module is used to classify the words in the input text and obtain the keyword probability of each word; A first calculation module, used to calculate the correlation scores between words in the input text; A second calculation module, used for calculating the importance score of each word in the input text according to the relevance score; A third calculation module, used for calculating the keyword score of each word in the input text according to the keyword probability and the importance score; as well as A recognition module, configured to recognize keywords in the input text according to the keyword scores; The second calculation module calculates the importance score of each word in the input text according to the relevance score, including: i =∑ i D i,j Calculate the importance score; where i and j represent the numbers of the words in the input text, D i,j represents the final correlation score between the i-th word and the j-th word, s i Represents the importance score of the i-th word; The third calculation module calculates the keyword score of each word in the input text according to the keyword probability and the importance score, including: according to the formula: i =p i *s i Calculate the keyword score, where y i represents the keyword score of the i-th word, s i represents the importance score of the i-th word, p i Represents the keyword probability of the i-th word.

9. The keyword recognition device according to claim 8, wherein: The classification module classifies the words in the input text, and obtains the keyword probability of each word including: Based on the pre-trained model of Transformer, the input text is encoded to generate a series of hidden layer sequences, wherein each element in the hidden layer sequence represents a word; The top hidden layer sequence in the series of hidden layer sequences is classified to obtain the keyword probability of each word.

10. The keyword recognition device according to claim 8, wherein: The first calculation module calculates the correlation scores between words in the input text, including: Based on the Transformer pre-trained model, the input text is encoded to generate a latent semantic vector, wherein the latent semantic vector includes the query vector of the input text and the vector corresponding to the key in the key-value pair; The correlation scores between words in the input text are calculated according to the query vector and the vector corresponding to the key.

11. The keyword recognition device according to claim 10, wherein: The Transformer pre-training model includes at least one Transformer layer. For each Transformer layer, according to: Calculate the relevance score, where i and j represent the numbers of the words in the input text, and n represents the number of the Transformer layer. represents the correlation score between the i-th word and the j-th word obtained by the n-th Transformer layer, Q represents the query vector, K represents the vector corresponding to the key, T represents the transpose of K, is the scale factor, and softmax() represents the normalized exponential function; according to: Calculate the final correlation score between the i-th word and the j-th word, where L represents the total number of layers of the Transformer, and D i,j Represents the final correlation score between the i-th word and the j-th word.

12. An electronic device comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

13. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 7.