A keyword determination method and apparatus
By acquiring the part-of-speech and positional information of the text to be processed, and combining it with a keyword recognition model, keyword recognition is performed using the embedding information of character vectors and part-of-speech vectors. This solves the problem of insufficient differentiation of semantic sequence features in existing technologies and improves the accuracy and recognition rate of keyword extraction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN LOTUS CARS CO LTD
- Filing Date
- 2022-02-10
- Publication Date
- 2026-04-28
AI Technical Summary
In existing keyword extraction algorithms, the sequence features of text vectors cannot strongly reflect the semantic connections between each character in the text, resulting in low keyword extraction accuracy and recognition rate.
By acquiring the part-of-speech and positional information of the text to be processed, and combining it with a keyword recognition model, keyword recognition is performed using the embedding information of character vectors and part-of-speech vectors, thereby enhancing the differentiation of semantic sequence features.
It improved the accuracy and recognition rate of keyword extraction and enhanced the semantic connection between each character in the text.
Smart Images

Figure CN114637818B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to a method and apparatus for keyword determination. Background Technology
[0002] Keyword extraction algorithms are widely used in technical fields such as information retrieval, text classification, and text clustering, which require the determination of text boundaries.
[0003] In existing technologies, keyword extraction algorithms employ a combination of unsupervised and supervised methods, including entity extraction, part-of-speech tagging, and dictionary matching. However, these algorithms extract keywords using the sequence features of text vectors as input. The sequence features of text vectors cannot strongly reflect the semantic connections between each character in the text; that is, the differentiation of semantic sequence features is weak, resulting in low accuracy and recognition rates for keyword extraction. Summary of the Invention
[0004] This invention provides a method and apparatus for determining basic keywords, which solves the problem of low accuracy and recognition rate of keyword extraction.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides a keyword determination method, the method comprising:
[0007] Get the text to be processed;
[0008] Part-of-speech tagging is performed on each word in the text to be processed to obtain the part-of-speech tag for each word;
[0009] Determine the position information of each character based on the order of the characters in the text to be processed;
[0010] Based on the positional information of each character, determine the part-of-speech information of each word;
[0011] A keyword recognition model is used to identify keywords in the target feature information to obtain the first keyword set. The target feature information includes target embedding information and target position information. The target embedding information includes the character vector of each character and the part-of-speech of each word. The target position information includes the position information of each character and the position information of each part of speech.
[0012] Identify the target keywords for the text to be processed. The target keywords include words from the first set of keywords.
[0013] In one possible implementation, the part-of-speech information of each word is determined based on the position information of each character, including: determining the part-of-speech information of each word based on the position information of the first character in each word; or, determining the part-of-speech information of each word based on the position information of the last character in each word.
[0014] In one possible implementation, determining the target keywords of the text to be processed includes: identifying words in a first set of keywords as target keywords; or, using dictionary matching technology to determine a second set of keywords of the text to be processed; determining the union of the first set of keywords and the second set of keywords as the target keyword set; and using preset rules to determine the target keywords from the words included in the target keyword set.
[0015] In one possible implementation, the target feature information also includes target fragment information. The keyword determination method further includes: acquiring pre-stored target fragment information, which includes first information and second information. The first information is used to indicate the word vector in the target embedding information, and the second information is used to indicate the part-of-speech tag in the target embedding information.
[0016] In one possible implementation, the keyword determination method described above further includes: determining the character vector of each character based on the position of each character in the text to be processed in a pre-stored dictionary.
[0017] In one possible implementation, the keyword determination method further includes: determining each sentence in the text to be processed; concatenating the part-of-speech tags of all words in each sentence after all character vectors in each sentence to obtain target embedding information; or concatenating the part-of-speech tags of all words in the text to be processed after all character vectors in the text to be processed to obtain target embedding information.
[0018] In one possible implementation, the keyword determination method further includes: acquiring multiple text samples and label information for each text sample, where each label information is used to identify keywords in each text sample; performing feature extraction processing on each text sample to obtain target feature information corresponding to each text sample; training the deep neural network model using the target feature information corresponding to each text sample as input and the label information of each text sample as output to obtain a keyword recognition model.
[0019] Secondly, the present invention provides a keyword determination device, comprising:
[0020] The acquisition module is used to acquire the text to be processed;
[0021] The part-of-speech tagging module is used to identify the part of speech of each word in the text to be processed acquired by the acquisition module, and obtain the part of speech of each word.
[0022] The first determining module is used to determine the position information of each character based on the order of each character in the text to be processed obtained by the obtaining module;
[0023] The second determining module is used to determine the part-of-speech information of each word based on the position information of each character determined by the first determining module.
[0024] The keyword recognition module is used to identify keywords in the target feature information using a keyword recognition model to obtain a first keyword set. The target feature information includes target embedding information and target position information. The target embedding information includes the character vector of each character and the part-of-speech tagging of each word identified by the part-of-speech tagging module. The target position information includes the position information of each character determined by the first determination module and the position information of the part-of-speech tagging of each word determined by the second determination module.
[0025] The third determination module is used to determine the target keywords of the text to be processed. The target keywords include words in the first keyword set identified by the keyword recognition module.
[0026] In one possible implementation, the second determining module is specifically used to: determine the position information of the first character in each word as the part-of-speech position information of each word; or, determine the position information of the last character in each word as the part-of-speech position information of each word.
[0027] In one possible implementation, the third determining module is specifically used to: determine the words in the first keyword set as target keywords; or, use dictionary matching technology to determine the second keyword set of the text to be processed; determine the union of the first keyword set and the second keyword set as the target keyword set; and use preset rules to determine the target keywords from the words included in the target keyword set.
[0028] In one possible implementation, the target feature information also includes target fragment information, and the acquisition module is further used to: acquire pre-stored target fragment information, the target fragment information including first information and second information, the first information being used to indicate the word vector in the target embedding information, and the second information being used to indicate the part-of-speech tag in the target embedding information.
[0029] In one possible implementation, the keyword determination device further includes a fourth determination module, which is used to determine the character vector of each character based on the position of each character in the pre-stored dictionary in the text to be processed.
[0030] In one possible implementation, the keyword determination device further includes a fifth determination module, which is used to: determine each sentence included in the text to be processed, and concatenate the part-of-speech tags of all words included in each sentence after all character vectors included in each sentence to obtain target embedding information; or, concatenate the part-of-speech tags of all words included in the text to be processed after all character vectors included in the text to be processed to obtain target embedding information.
[0031] In one possible implementation, the keyword determination device further includes an extraction module and a training module; the acquisition module is further configured to acquire multiple text samples and label information for each text sample, wherein each label information is used to identify keywords in each text sample; the extraction module is configured to perform feature extraction processing on each text sample to obtain target feature information corresponding to each text sample; the training module is configured to train the deep neural network model using the target feature information corresponding to each text sample as input and the label information of each text sample as output, to obtain a keyword recognition model.
[0032] Thirdly, the present invention provides a computer device comprising a processor and a memory. The memory stores computer program code, which includes computer instructions. When the processor executes the computer instructions, the computer device executes a keyword determination method as described in the first aspect and any possible implementation thereof.
[0033] Fourthly, the present invention provides a computer-readable storage medium having computer instructions stored thereon, which, when executed on a computer device, cause the computer device to perform a keyword determination method as described in the first aspect or any of the possible implementations of the first aspect.
[0034] Fifthly, the present invention provides a computer program product comprising computer instructions that, when executed on a computer device, cause the computer device to perform a keyword determination method as described in the first aspect and any possible implementation thereof.
[0035] The keyword determination method provided in this invention involves a computer device acquiring a text to be processed, performing part-of-speech (POS) recognition on each word in the text to obtain the POS of each word, determining the positional information of each character based on the order of the characters in the text, and determining the positional information of the POS of each word based on the positional information of each character. Then, a keyword recognition model is used to identify keywords based on the target feature information to obtain a first keyword set. The target feature information includes target embedding information and target positional information. The target embedding information includes the character vector of each character and the POS of each word, and the target positional information includes the positional information of each character and the positional information of each POS. Finally, the target keywords of the text to be processed are determined, and the target keywords include the words in the first keyword set. This invention introduces the POS features of each word in the text to be processed into the input of the keyword recognition model, enabling the sequence features of the input text vector to strongly reflect the semantic connections between each character in the text, enhancing the differentiation of semantic sequence features, and thus improving the accuracy and recognition rate of keyword extraction. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the embedding layer structure in a traditional BERT model provided by an embodiment of the present invention;
[0037] Figure 2 This is one of the flowcharts for a keyword determination method provided in an embodiment of the present invention;
[0038] Figure 3 This is a schematic diagram of the embedding layer in a keyword recognition model provided in an embodiment of the present invention;
[0039] Figure 4 A second flowchart illustrating a keyword determination method provided in an embodiment of the present invention;
[0040] Figure 5 A flowchart of a keyword determination method provided in an embodiment of the present invention is shown in part three.
[0041] Figure 6 This is a schematic diagram of an "R-drop" training mechanism provided in an embodiment of the present invention;
[0042] Figure 7 This is one of the schematic diagrams of a keyword determination device provided in an embodiment of the present invention;
[0043] Figure 8 This is a second schematic diagram of the composition of a keyword determination device provided in an embodiment of the present invention;
[0044] Figure 9 This is the third schematic diagram of a keyword determination device provided in an embodiment of the present invention;
[0045] Figure 10 This is the fourth schematic diagram of a keyword determination device provided in an embodiment of the present invention. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more. Furthermore, the use of "based on" or "according to" implies openness and inclusiveness, because processes, steps, calculations, or other actions "based on" or "according to" one or more of the stated conditions or values may in practice be based on additional conditions or beyond the stated values.
[0048] To address the issue of low accuracy and recognition rate in keyword extraction, this invention provides a keyword determination method and apparatus. A computer device acquires the text to be processed, performs part-of-speech (POS) identification on each word in the text, obtains the POS of each word, and determines the positional information of each character based on the order of characters in the text. Based on the positional information of each character, the positional information of the POS of each word is determined. Then, a keyword recognition model is used to identify keywords based on the target feature information, resulting in a first keyword set. The target feature information includes target embedding information and target positional information. The target embedding information includes the character vector of each character and the POS of each word. The target positional information includes the positional information of each character and the positional information of each POS. Finally, the target keywords of the text to be processed are determined, and the target keywords include the words in the first keyword set. This invention introduces the POS features of each word in the text into the input of the keyword recognition model, enabling the sequence features of the input text vector to strongly reflect the semantic connections between each character in the text, enhancing the differentiation of semantic sequence features, and thus improving the accuracy and recognition rate of keyword extraction.
[0049] The keyword determination method provided in this embodiment of the invention is executed by a keyword determination device, which can be a computer device. This computer device can be a terminal device, a server, or a server cluster. This embodiment of the invention does not impose any limitations.
[0050] The keyword recognition model used in the keyword extraction method provided in this embodiment of the invention can be an improved bidirectional encoder representation from transformers (BERT) model. This model's structure can include an embedding layer (input layer), an encoder, and a pooling layer. For ease of understanding, a brief introduction to the traditional BERT model is provided below.
[0051] Figure 1 This is a schematic diagram of the embedding layer structure in a traditional BERT model, such as... Figure 1 As shown, the embedding layer information of a traditional BERT model consists of target embedding information (Token Embeddings), target segment embeddings (Segment Embeddings), and target position embeddings (Position Embeddings). For example, assuming a sentence pair "I like cats" and "I like dogs", the target embedding information (Token Embeddings) includes each word in the text converted into a fixed-dimensional vector "Ex", where "x" is a word in the text, and "Ex" can be a number representing the position of "x" in the dictionary of the traditional BERT model. For example, the vector representation of "cats" as "Ecats" could be 666. The target segment embeddings can include vectors that help the traditional BERT model distinguish between the two sentences in the sentence pair. The first sentence is represented as "E". A The second sentence is represented as "E". B “E” A "and "E B "Can be a number, for example, "E" A "E" can be 0. B "Can be 1. Position Embeddings can include the order attribute of each word in the input sentence, such as E0-E10 in the sentence pair above. In addition, special characters [CLS] can be inserted at the beginning of each text and special characters [SEP] can be inserted at the end of each sentence, serving the subsequent classification tasks and sentence pair segmentation of the traditional BERT model.
[0052] It is understandable that the traditional BERT model can implement many functions such as sentence pair matching, text matching, text extraction, etc. by using the above embedding layer information as input.
[0053] Figure 2 This is a flowchart of a keyword determination method provided by an embodiment of the present invention. As Figure 2 shown, the keyword determination method may include the following steps S201 to step S206.
[0054] S201. The computer device obtains the text to be processed.
[0055] Among them, the text to be processed may be a text composed of one or more Chinese sentences.
[0056] Specifically, the computer device may obtain the text to be processed.
[0057] S202. The computer device performs word - type recognition on each word included in the text to be processed to obtain the word type of each word.
[0058] In a possible implementation manner, the computer device may use word - type recognition technology and a word - type recognition tool to determine the word type of each word included in the text to be processed. The word - type recognition tool includes, but is not limited to, third - party tools such as the lexical analysis model LAC or the Chinese word segmentation library jieba. Exemplarily, for a sentence "In summer, one should tighten the belly to lose weight", the computer device can determine through word - type recognition technology that the word type of "summer" is "TIME", that is, a proper noun of the time type, the word types of "should" and "tighten" are "v", that is, verbs, the word type of "lose weight" is "a", that is, an adjective, and the word type of "belly" is "n", that is, a common noun.
[0059] Furthermore, the computer device can also determine the character vector of each character according to the position of each character included in the text to be processed in a pre - stored dictionary in the keyword recognition model. That is to say, the character vector is obtained by mapping with a preset dictionary. Exemplarily, assuming that the position of the character "夏" in the dictionary is 666, then the character vector of "夏" is represented by "666".
[0060] S203. The computer device determines the position information of each character according to the sequence of each character included in the text to be processed.
[0061] Specifically, the computer device can determine the position information of each character according to the sequence of each character included in the text to be processed.
[0062] Exemplarily, for a sentence "In summer, one should tighten the belly to lose weight", the position information of each character can be taken as 1 - 8 in sequence according to the order of each character.
[0063] S204. The computer device determines the position information of the词性 of each word based on the position information of each word.
[0064] In a possible implementation, the computer device can determine the position information of the词性 of each word as the position information of the first word in each word. For example, in the sentence "In summer, you should tighten your belly to lose weight", the position information of the词性 of the word "summer" can be the position information "1" of the word "夏".
[0065] In another possible implementation, the computer device can also determine the position information of the词性 of each word as the position information of the last word in each word. For example, in the sentence "In summer, you should tighten your belly to lose weight", the position information of the词性 of the word "summer" can be the position information "2" of the word "夏".
[0066] S205. The computer device uses a keyword recognition model to recognize keywords in the target feature information, and obtains a first keyword set. The target feature information includes target embedding information and target position information. The target embedding information includes the word vector of each word and the词性 of each word, and the target position information includes the position information of each word and the position information of each词性.
[0067] It can be understood that the target feature information can be the embedding layer information of the keyword recognition model.
[0068] In a possible implementation, the target feature information can include target embedding information and target position information. The target embedding information can include the word vector of each word and the词性 of each word, and the target position information includes the position information of each word and the position information of each词性.
[0069] Exemplarily, for the sentence "In summer, you should tighten your belly to lose weight" in the above embodiment, as Figure 3 shown, the target feature information can be the embedding layer information Input. Among them, two special symbols [CLS] and [SEP] will be inserted into Input, which are used to represent the beginning and end of the word vectors included in the text to be processed respectively. They can serve the subsequent classification tasks and sentence pair division of the model. The embedding layer information Input can be composed of the target embedding information Token Embeddings and the target position information Position Embeddings. The target embedding information Token Embeddings can include the word vector of each word in the sentence and the词性 of each word, and the target position information Position Embeddings is used to enable the keyword recognition model to learn the sequential attributes of the input content.
[0070] Furthermore, the computer device can also acquire pre-stored target fragment information. The target fragment information may include first information and second information. The first information can be used to indicate the word vectors in the target embedding information, and the second information can be used to indicate the part-of-speech tags in the target embedding information. The target fragment information can be used to assist the keyword recognition model in distinguishing between the word vectors and part-of-speech tags in the target embedding information. For example, such as... Figure 3 As shown, the embedding layer information Input can also include target segment information Segment Embeddings. In the target segment information Segment Embeddings, the first information used to indicate the word vector in the target embedding information is all 0, and the second information used to indicate the part-of-speech in the target embedding information is all 1.
[0071] S206. The computer equipment determines the target keywords of the text to be processed. The target keywords include words in the first set of keywords.
[0072] Specifically, computer equipment can determine the target keywords of the text to be processed, where the target keywords include words in the first set of keywords.
[0073] In one possible implementation, the computer device can identify the words in the first set of keywords as the target keywords.
[0074] In another possible implementation, the computer device can employ dictionary matching technology to determine a second set of keywords in the text to be processed. The union of the first and second keyword sets is then used to determine the target keyword set. Pre-defined rules are then used to identify the target keywords from the words included in the target keyword set. Understandably, dictionary matching technology uses a hash table, hashing each word into a key value using a hash function. During a query, the hash function is used directly.
[0075] In this embodiment, the computer device acquires the text to be processed, performs part-of-speech (POS) recognition on each word in the text, obtains the POS of each word, and determines the position information of each character based on the order of the characters in the text. Based on the position information of each character, the position information of the POS of each word is determined. Then, a keyword recognition model is used to identify keywords based on the target feature information to obtain a first keyword set. The target feature information includes target embedding information and target position information. The target embedding information includes the character vector of each character and the POS of each word. The target position information includes the position information of each character and the position information of each POS. Finally, the target keywords of the text to be processed are determined, and the target keywords include the words in the first keyword set. This embodiment introduces the POS features of each word in the text to be processed into the input of the keyword recognition model, so that the sequence features of the input text vector can strongly reflect the semantic relationship between each character in the text, enhance the differentiation of semantic sequence features, and thus improve the accuracy and recognition rate of keyword extraction.
[0076] Optionally, based on the above embodiments, combined with Figure 2 ,like Figure 4 As shown, the above-mentioned keyword determination method also includes:
[0077] S301. The computer device determines each sentence included in the text to be processed.
[0078] Understandably, the text to be processed may include multiple Chinese sentences.
[0079] Specifically, computer devices can use Chinese sentence segmentation technology to determine each sentence in the text to be processed.
[0080] S302. The computer device concatenates the part-of-speech tags of all words in each sentence after all the character vectors in each sentence to obtain the target embedding information; or, it concatenates the part-of-speech tags of all words in the text to be processed after all the character vectors in the text to be processed to obtain the target embedding information.
[0081] Understandably, when extracting keywords from text, computer devices can extract keywords sentence by sentence or directly extract keywords from the entire text.
[0082] In one possible implementation, when a computer device extracts keywords sentence by sentence, it can concatenate the part-of-speech tags of all words in each sentence after all the character vectors included in each sentence, thereby obtaining the target embedding information.
[0083] In another possible implementation, when the computer device directly extracts keywords from the full text of the text to be processed, the computer device can concatenate the part-of-speech tags of all the words in the text to be processed after all the character vectors included in the text to obtain the target embedding information.
[0084] In this embodiment, the computer device determines each sentence in the text to be processed and concatenates the part-of-speech tags of all words in each sentence after all the character vectors in that sentence to obtain the target embedding information; or, it concatenates the part-of-speech tags of all words in the text to be processed after all the character vectors in that text to obtain the target embedding information. This embodiment extends the keyword extraction method by allowing keyword extraction both sentence-by-speech and full-text-by-text, increasing the flexibility of keyword extraction. Furthermore, the interactive verification of the keyword extraction results using these two methods further improves the accuracy and recognition rate of keyword extraction.
[0085] Optionally, based on the above embodiments, combined with Figure 2 ,like Figure 5 As shown, the above-mentioned keyword determination method also includes:
[0086] S401. The computer device acquires multiple text samples and label information for each text sample, whereby each label information is used to identify keywords in each text sample.
[0087] It is understood that this embodiment is the training process of the keyword recognition model in the above embodiments.
[0088] Specifically, the computer device can acquire multiple text samples and the label information for each text sample, with each label information used to identify keywords in each text sample.
[0089] In one possible implementation, the computer device can obtain the tag information after each text sample is annotated using the IOB2 annotation system, which uses XB as the beginning of a word with part of speech X, XI as the continuation of a word with part of speech X, and O to represent words that are not of interest.
[0090] For example, a text sample "spring flowers blooming" can be represented as "spring / TIME-B day / TIME-I of / uB flower / vB blooming / vI" after being annotated using the IOB2 annotation system.
[0091] S402. The computer equipment performs target feature extraction processing on each text sample to obtain the target feature information corresponding to each text sample.
[0092] Specifically, the computer device can perform target feature extraction processing on each text sample to obtain the target feature information corresponding to each text sample. The specific target feature extraction process is described in the above embodiment and will not be repeated here.
[0093] S403. The computer device uses the target feature information corresponding to each text sample as the input of the deep neural network model and the label information of each text sample as the output of the deep neural network model to train the deep neural network model and obtain the keyword recognition model.
[0094] Specifically, the computer device can use the target feature information corresponding to each text sample as the input of the deep neural network model and the label information of each text sample as the output of the deep neural network model to train the deep neural network model and obtain a keyword recognition model.
[0095] In one possible implementation, the computer device can divide multiple text samples and the label information of each text sample into two parts, a training set and a validation set, in a certain ratio (e.g., a 7:3 ratio). For example, the training set is used to train the keyword recognition model, and the validation set is used to check the state and convergence of the keyword recognition model during the training process, thereby improving the performance of the keyword recognition model.
[0096] Furthermore, computer equipment can train the keyword recognition model using the "R-drop" mechanism. The "R-drop" mechanism involves inputting the same processed input into two identical keyword recognition models for training. The loss function L(total) for the training part consists of two parts: the traditional maximum likelihood loss function L(CE) and the KL divergence L(KL), as shown in the following formula:
[0097] L(CE) = -log(P1(y) i |x i )-log(P2(y i |x i )) (1)
[0098] L(KL) = 1 / 2[KL(P1(y)] i |x i )||P2(y i |x i ))+KL(P2(y i |x i )||P1(y i |x i (2)
[0099] L(total)=L(CE)+αL(KL) (3)
[0100] Specifically, such as Figure 6 As shown, given the training data D={xi,yi}_(i=1)^n, for each training sample xi, it will go through the forward propagation of the network twice, thus obtaining two output predictions: P1(yi|xi) and P2(yi|xi). Since "Dropout" randomly discards some neurons each time, P1 and P2 are two different prediction probabilities obtained through two different sub-networks (from the same model). "R-Drop" uses the difference between these two prediction probabilities and adopts the symmetric KL divergence L(KL) to constrain P1 and P2. In addition, the traditional maximum likelihood loss function L(CE) is added, and the final training loss function is as shown in formula (3), where α is the coefficient used to control the KL divergence L(KL), which can be adjusted according to the training task. The core idea of "R-drop" is that the model goes through two "dropouts". After these two "dropouts", the sample can be considered to have passed through two slightly different keyword recognition models, which is superior to almost all data augmentation methods. While ensuring the generalization ability of the keyword recognition model, it can improve the recognition rate and accuracy of keyword extraction.
[0101] This embodiment relates to the training process of a keyword recognition model. A computer device acquires multiple text samples and label information for each text sample. Each label identifies keywords in each text sample. Target feature extraction is performed on each text sample to obtain corresponding target feature information. This target feature information is then used as input to a deep neural network model, and the label information of each text sample is used as the output. The deep neural network model is trained to obtain the keyword recognition model. This embodiment incorporates the part-of-speech features of each word in the text to be processed into the input of the keyword recognition model, enabling the trained keyword recognition model to better focus on the semantic relationships between each character in the text, thereby improving the accuracy and recognition rate of keyword extraction.
[0102] The foregoing primarily describes the solutions provided by the embodiments of the present invention from the perspective of the device. It is understood that, in order to achieve the above functions, the device includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the algorithmic steps of the various examples described in the embodiments disclosed herein, the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0103] Figure 7 A schematic diagram of a possible composition of the keyword determination device involved in the above embodiments is shown, such as... Figure 7 As shown, the keyword determination device may include:
[0104] Module 71 is used to acquire the text to be processed;
[0105] The part-of-speech tagging module 72 is used to perform part-of-speech tagging on each word in the text to be processed, and obtain the part-of-speech tag for each word;
[0106] The first determining module 73 is used to determine the position information of each character based on the order of each character in the text to be processed;
[0107] The second determining module 74 is used to determine the part-of-speech information of each word based on the position information of each character;
[0108] The keyword recognition module 75 is used to perform keyword recognition on the target feature information using a keyword recognition model to obtain a first keyword set. The target feature information includes target embedding information and target position information. The target embedding information includes the character vector of each character and the part-of-speech of each word. The target position information includes the position information of each character and the position information of each part of speech.
[0109] The third determination module 76 is used to determine the target keywords of the text to be processed. The target keywords include words in the first keyword set.
[0110] Optionally, the second determining module 74 is specifically used to: determine the position information of the first character in each word as the position information of the part of speech of each word; or, determine the position information of the last character in each word as the position information of the part of speech of each word.
[0111] Optionally, the third determining module 76 is specifically used to: determine the words in the first keyword set as target keywords; or, use dictionary matching technology to determine the second keyword set of the text to be processed; determine the target keyword set by the union of the first keyword set and the second keyword set; and use preset rules to determine the target keywords from the words included in the target keyword set.
[0112] Optionally, the target feature information also includes target fragment information. The acquisition module 71 is further configured to: acquire pre-stored target fragment information, the target fragment information including first information and second information, the first information being used to indicate the word vector in the target embedding information, and the second information being used to indicate the part-of-speech tag in the target embedding information.
[0113] Optional, such as Figure 8As shown, the keyword determination device further includes a fourth determination module 77, which is used to: determine the character vector of each character based on the position of each character in the pre-stored dictionary in the text to be processed.
[0114] Optional, such as Figure 9 As shown, the keyword determination device further includes a fifth determination module 78, which is used to: determine each sentence included in the text to be processed, and concatenate the part-of-speech tags of all words included in each sentence after all character vectors included in each sentence to obtain target embedding information; or, concatenate the part-of-speech tags of all words included in the text to be processed after all character vectors included in the text to be processed to obtain target embedding information.
[0115] Optional, such as Figure 10 As shown, the keyword determination device further includes a training module 79; the acquisition module 71 is further configured to acquire multiple text samples and label information of each text sample, wherein each label information is used to identify keywords in each text sample; perform feature extraction processing on each text sample to obtain target feature information corresponding to each text sample; the training module 79 is configured to train the deep neural network model using the target feature information corresponding to each text sample as input and the label information of each text sample as output, to obtain a keyword recognition model.
[0116] Of course, the keyword determination device provided in this embodiment of the invention includes, but is not limited to, the modules described above.
[0117] The keyword determination device provided in this embodiment of the invention is used to execute the keyword determination method described above, and thus can achieve the same effect as the keyword determination method described above.
[0118] Another embodiment of the present invention provides a computer device, which includes a processor and a memory. The memory stores computer program code, including computer instructions. When the processor executes the computer instructions, the computer device performs the keyword determination method described in the above-described method embodiments.
[0119] Another embodiment of the present invention provides a computer-readable storage medium storing computer instructions that, when executed on a computer device, cause the computer device to perform each step of the method flow shown in the above method embodiment.
[0120] Another embodiment of the present invention also provides a computer program product, which includes computer instructions that, when executed on a computer device, cause the computer device to perform each step of the method flow shown in the above method embodiment.
[0121] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions 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. A method for determining keywords, characterized in that, include: Get the text to be processed; Part-of-speech tagging is performed on each word in the text to be processed to obtain the part-of-speech tag for each word; Based on the order of each character in the text to be processed, determine the position information of each character; Based on the positional information of each character, determine the part-of-speech information of each word; A keyword recognition model is used to identify keywords in the target feature information to obtain a first keyword set. The target feature information includes target embedding information and target position information. The target embedding information includes the character vector of each character and the part-of-speech tag of each word. The target position information includes the position information of each character and the position information of the part-of-speech tag of each word. Determine the target keywords of the text to be processed, wherein the target keywords include words in the first keyword set; The target feature information also includes target fragment information, and the method further includes: acquiring pre-stored target fragment information, wherein the target fragment information includes first information and second information, the first information is used to indicate the word vector in the target embedding information, and the second information is used to indicate the part-of-speech tag in the target embedding information; The method further includes: determining each sentence included in the text to be processed; concatenating the part-of-speech tags of all words included in each sentence after all character vectors included in each sentence to obtain the target embedding information; or concatenating the part-of-speech tags of all words included in the text to be processed after all character vectors included in the text to be processed to obtain the target feature information, wherein the target feature information further includes the target fragment information.
2. The method according to claim 1, characterized in that, The step of determining the part-of-speech location information of each word based on the location information of each character includes: The positional information of the first character in each word is used to determine the part of speech of each word; or, The position information of the last character in each word is used to determine the part of speech of each word.
3. The method according to claim 1 or 2, characterized in that, The process of determining the target keywords of the text to be processed includes: The words in the first keyword set are identified as the target keywords; or, The second set of keywords for the text to be processed is determined using dictionary matching technology; The union of the first keyword set and the second keyword set is determined as the target keyword set; The target keywords are determined from the words included in the target keyword set using preset rules.
4. The method according to claim 1 or 2, characterized in that, The method further includes: The character vector of each character is determined based on the position of each character in the pre-stored dictionary in the text to be processed.
5. The method according to claim 1 or 2, characterized in that, The method further includes: Obtain multiple text samples and the label information for each text sample. Each label is used to identify the keywords in each text sample. Feature extraction is performed on each text sample to obtain the target feature information corresponding to each text sample; The deep neural network model is trained by using the target feature information corresponding to each text sample as the input and the label information of each text sample as the output, thereby obtaining the keyword recognition model.
6. A keyword determination device, characterized in that, include: The acquisition module is used to acquire the text to be processed; The part-of-speech tagging module is used to perform part-of-speech tagging on each word in the text to be processed acquired by the acquisition module, and to obtain the part-of-speech tag of each word; The first determining module is used to determine the position information of each character based on the order of each character in the text to be processed obtained by the obtaining module. The second determining module is used to determine the part-of-speech location information of each word based on the location information of each character determined by the first determining module. The keyword recognition module is used to perform keyword recognition on the target feature information using a keyword recognition model to obtain a first keyword set. The target feature information includes target embedding information and target position information. The target embedding information includes the character vector of each character and the part-of-speech tagging of each word identified by the part-of-speech tagging module. The target position information includes the position information of each character determined by the first determining module and the position information of the part-of-speech tagging of each word determined by the second determining module. The third determining module is used to determine the target keywords of the text to be processed, wherein the target keywords include words in the first keyword set identified by the keyword recognition module; The target feature information also includes target fragment information. The acquisition module is further configured to: acquire pre-stored target fragment information, wherein the target fragment information includes first information and second information, wherein the first information is used to indicate the word vector in the target embedding information, and the second information is used to indicate the part-of-speech tag in the target embedding information; The fifth determining module is used to determine each sentence included in the text to be processed; concatenate the part-of-speech tags of all words included in each sentence after all character vectors included in each sentence to obtain the target embedding information; or concatenate the part-of-speech tags of all words included in the text to be processed after all character vectors included in the text to be processed to obtain the target feature information, wherein the target feature information also includes the target fragment information.
7. A computer device, characterized in that, The computer device includes a processor and a memory; the memory is used to store computer program code, the computer program code including computer instructions; when the processor executes the computer instructions, the computer device performs the keyword determination method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, It includes computer instructions that, when executed on a computer device, cause the computer device to perform the keyword determination method as described in any one of claims 1-5.
Citation Information
Patent Citations
Keyword extracting method and keyword extracting device
CN104731797A
Keyword extraction method and device
CN106372038A
Information extraction method and device based on few training samples
CN111506696A