A method for automatically selecting keyword combinations to extract text

By automating the method of selecting keyword combinations and using data preprocessing and statistical models to generate high-quality keyword combinations, it solves the problem of manual selection of keyword combinations in the existing technology that is time-consuming and labor-intensive, and achieves a more efficient and complete Search results.

CN114492433BActive Publication Date: 2024-08-30NANJING FIBERHOME STARRYSKY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210100206.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-27
Publication Date
2024-08-30
Estimated Expiration
2042-01-27

AI Technical Summary

Technical Problem

In the existing technology, selecting appropriate keywords and keyword combinations for text search requires a lot of manual time and labor, and the poor quality of the selected phrases leads to many impurities in the search results and cannot be reused, which increases the workload and time cost. .

Method used

Using automated methods, through data preprocessing, TF-IDF algorithm, LDA model and F1-score evaluation, we generate disordered and ordered co-occurring word combinations, select high-quality keyword combinations, and combine multi-threaded operation and code optimization. Reduce time costs.

Benefits of technology

It improves the quality and completeness of keyword combinations, reduces the time and cost of manual selection, achieves more efficient search results, avoids impurities, and improves search efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492433B
    Figure CN114492433B
Patent Text Reader

Abstract

The present invention discloses a method for automatically selecting a suitable keyword combination to extract a text, comprising the following steps: S1, performing data preprocessing on the original text to obtain a high-quality word segmentation result, wherein the data preprocessing includes finding fixed collocation phrases and performing word segmentation on the original text and filtering stop words; S2, selecting candidate keywords; S3, recommending keyword combinations, generating disordered and ordered co-occurrence word combination sets based on the candidate keywords contained in each data in the original text, and using F1-score as an evaluation index to recommend a suitable keyword combination for searching a target text from the disordered and ordered co-occurrence word combination sets. The present invention uses a machine to replace manual selection of keyword combinations for searching a target text, effectively reducing the labor cost and time cost required for the task, and can make the selected keyword combination results have the characteristics of better quality and more complete content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to natural language processing technology in the field of artificial intelligence, and in particular to a method for automatically selecting keyword combinations to extract text. Background Art

[0002] Using keywords and keyword combinations to search for content is a common text search method. The advantage of this method is that it has high search efficiency and can quickly provide search results to users, but it also has high requirements for the keywords and keyword combinations selected by users. Whether or not to find suitable keywords and keyword combinations for text search is the key to whether or not to extract target texts that satisfy users. When the quality of the selected keywords and phrases is poor, there will be a lot of impurities in the search results. Users need to further filter the search results to get the target text, which increases the workload of users.

[0003] At present, the selection of suitable keywords and keyword combinations for searching text mainly relies on manual summary. However, in some tasks, the amount of text data is large and the information contained is chaotic and complex. It is difficult to summarize a keyword combination that can avoid impurities as much as possible while retaining as much target text as possible, which takes a lot of time. Moreover, the fruits of this labor cannot be reused. In new text search tasks, keywords and keyword combinations need to be summarized again based on new search targets. Therefore, inventing a method for automatically selecting suitable keyword combinations for searching text will greatly reduce the manpower input and time cost of such work. Summary of the invention

[0004] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0005] The present invention provides a method for automatically selecting keyword combinations to extract text, comprising the following steps:

[0006] S1. Performing data preprocessing on the original text to obtain a word segmentation result, wherein the data preprocessing includes finding fixed collocation phrases, performing word segmentation on the original text, and filtering stop words;

[0007] S2. Select candidate keywords. Select candidate keywords from the word segmentation results in S1. The specific steps are as follows:

[0008] S2.1. Use the TF-IDF algorithm to assign a weight calculated based on its statistical information to each word contained in the original text;

[0009] S2.2, train the LDA model based on the original text, and use the trained LDA model to calculate the topic prominence of the words contained in each piece of data in the original text;

[0010] S2.3, add the weight of each word calculated based on the TF-IDF algorithm and the topic prominence calculated based on the trained LDA model to obtain the sum of the two, and then modify the sum of the two by considering the part of speech of each word to obtain the final weight of each word;

[0011] S2.4, sort the words contained in each piece of data in the original text from high to low according to their weights, set a minimum threshold for the weights, and use words with weights greater than the set threshold as candidate keywords;

[0012] S3, recommending keyword combinations, based on the candidate keywords contained in each data in the original text, generating unordered and ordered co-occurring word combination sets, and using F1-score as the evaluation index, recommending keyword combinations for searching the target text from the unordered and ordered co-occurring word combination sets;

[0013] The specific steps are as follows:

[0014] S3.1, based on the candidate keywords contained in each data in the original text, generate a set of unordered and ordered co-occurring word combinations with a traversal length of 1 to N;

[0015] S3.2. Extract some data from the original text and label it. Label the data belonging to the target text as positive samples, and label the data not belonging to the target text as negative samples.

[0016] S3.3, search the marked text with various unordered and ordered co-occurring word combinations, calculate the F1-score of each combination based on the search results, set the minimum threshold of the F1-score, and take the co-occurring word combination with an F1-score value greater than the set threshold as the intermediate result;

[0017] S3.4. De-duplicate the intermediate results. When there are unordered co-occurring word combinations and ordered co-occurring word combinations that contain exactly the same words in the intermediate results, set the F1-score value threshold f, retain the co-occurring word combinations with F1-score values ​​greater than the threshold f, and delete the co-occurring word combinations with F1-score values ​​less than the threshold f; when the F1-score values ​​of the two are the same, retain the unordered co-occurring word combinations and delete the ordered co-occurring word combinations. The final set of all co-occurring word combinations is the selected keyword combination for searching the target text.

[0018] As a preferred technical solution of the present invention, the specific steps of discovering fixed collocation phrases in S1 are as follows:

[0019] S1.1. Generate all N-gram word strings based on the original text, calculate the left-right entropy and mutual information of each N-gram word string, set the minimum threshold of the left-right entropy and mutual information, and select the N-gram word strings whose values ​​of the left-right entropy and mutual information are greater than the set threshold as candidate fixed collocation phrases;

[0020] S1.2, remove duplicate candidate fixed collocation phrases. When two candidate fixed collocation phrases are in a containment relationship, retain the longer candidate fixed collocation phrase and delete the shorter one;

[0021] S1.3. Further filter the candidate fixed collocation phrases based on part of speech.

[0022] As a preferred technical solution of the present invention, the segmentation of the original text and filtering of stop words in S1 is to add the obtained fixed collocation phrases to the user dictionary, use the pkuseg segmentation tool to segment the original text to obtain the segmentation results, and then collect common stop words to supplement the stop word dictionary, and further filter the segmentation results based on the stop word dictionary.

[0023] The beneficial effects of the present invention are:

[0024] 1. Compared with the manually selected keyword combinations, the keyword combinations selected by the present invention have better quality and more complete content, which effectively avoids the situation that when manually selecting keyword combinations for searching target texts, considering the labor cost and time cost, the "satisfaction principle" is generally followed, and the keyword combinations with more satisfactory search effects are selected, instead of exhausting all combinations to select the optimal solution. It is possible to exhaust all combinations to select the optimal solution, so that the selected keyword combination results have the characteristics of better quality and more complete content.

[0025] 2. The present invention ensures code efficiency by improving code logic, using multi-threaded operation and other methods, so that the time required for the technical solution is relatively short, thereby reducing the time cost required. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0027] Figure 1 It is an overall flow chart of the present invention for automatically selecting a suitable keyword combination for extracting text. DETAILED DESCRIPTION

[0028] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0029] Example 1

[0030] like Figure 1 As shown, the present invention provides a method for automatically selecting keyword combinations to extract text, comprising the following steps:

[0031] S1. Preprocessing the original text to obtain high-quality word segmentation results, wherein the data preprocessing includes finding fixed collocation phrases, segmenting the original text, and filtering stop words;

[0032] S2: Select candidate keywords. From the word segmentation results in S1, select words with strong topic characteristics as candidate keywords. The specific steps are as follows:

[0033] S2.1. Use the TF-IDF algorithm (TF-IDF is a commonly used weighting technology for information retrieval and data mining in the prior art, and is often used to mine keywords in articles. The algorithm is simple and efficient, and this technical solution will not be described in detail here) to assign a weight calculated based on its statistical information to each word contained in the original text;

[0034] S2.2, train the LDA model based on the original text, and use the trained LDA model to calculate the topic prominence of the words contained in each piece of data in the original text;

[0035] S2.3, add the weight of each word calculated based on the TF-IDF algorithm and the topic prominence calculated based on the trained LDA model to obtain the sum of the two, and then modify the sum of the two by considering the part of speech of each word (for example, when the part of speech is noun or verb, increase the sum of the two by the set ratio; when the part of speech is adverb or adjective, decrease the sum of the two by the set ratio), and obtain the final weight of each word;

[0036] S2.4, sort the words contained in each piece of data in the original text from high to low according to their weights, set a minimum threshold for the weights, and use words with weights greater than the set threshold as candidate keywords;

[0037] S3, recommend keyword combinations, based on the candidate keywords contained in each data in the original text, generate unordered and ordered sets of co-occurring word combinations, and use F1-score as the evaluation indicator to recommend suitable keyword combinations for searching the target text from the unordered and ordered sets of co-occurring word combinations.

[0038] The specific steps for discovering fixed collocation phrases in S1 are as follows:

[0039] S1.1. Generate all N-gram word strings based on the original text (N is set to 1 to 6), calculate the left-right entropy and mutual information of each N-gram word string, set the minimum threshold of the left-right entropy and mutual information, and select the N-gram word strings whose values ​​of the left-right entropy and mutual information are greater than the set threshold as candidate fixed collocation phrases;

[0040] S1.2, remove duplicate candidate fixed collocation phrases. When two candidate fixed collocation phrases are in a containment relationship, retain the longer candidate fixed collocation phrase and delete the shorter one;

[0041] S1.3. Further filter the candidate fixed collocation phrases based on part of speech. Most fixed collocation phrases are noun phrases that conform to certain part of speech patterns. After using the word segmentation tool to obtain the part of speech combination of each candidate fixed collocation phrase, further filter the candidate fixed collocation phrases based on the summarized part of speech pattern to obtain the final set of fixed collocation phrases.

[0042] Among them, the segmentation of the original text and filtering of stop words in S1 is to add the obtained fixed collocation phrases to the user dictionary, use the pkuseg segmentation tool to segment the original text to obtain the segmentation results, and then collect common stop words to supplement the stop word dictionary, and further filter the segmentation results based on the stop word dictionary.

[0043] The specific steps of S3 are as follows:

[0044] S3.1, based on the candidate keywords contained in each data in the original text, generate a set of unordered and ordered co-occurrence word combinations with a traversal length of 1 to 6;

[0045] S3.2. Extract some data from the original text and label it. Label the data belonging to the target text as positive samples, and label the data not belonging to the target text as negative samples.

[0046] S3.3, search the marked text with various unordered and ordered co-occurring word combinations, calculate the F1-score of each combination based on the search results, set the minimum threshold of the F1-score, and take the co-occurring word combination with an F1-score value greater than the set threshold as the intermediate result;

[0047] S3.4. De-duplicate the intermediate results. When there are unordered co-occurring word combinations and ordered co-occurring word combinations that contain exactly the same words in the intermediate results, the co-occurring word combination with a larger F1-score value is retained, and the one with a smaller F1-score value is deleted. When the F1-score values ​​of the two are the same, the unordered co-occurring word combination is retained, and the ordered co-occurring word combination is deleted. The final set of all co-occurring word combinations is the selected appropriate keyword combination for searching the target text.

[0048] Example 2

[0049] like Figure 1As shown, the method of using the present invention is as follows: input a text set T, the present invention will obtain the fixed collocation phrases in the text set T according to the left and right entropies and the mutual information, add them to the pkuseg user dictionary, use pkuseg to segment the text set, and remove stop words to obtain high-quality segmentation results.

[0050] The LDA model is trained based on the text set T. The trained LDA model is used to calculate the topic prominence of words in each category of text. The final topic weight of the words in each category i of text is calculated by combining TF-IDF and word part of speech. After sorting the topic weights, the words with topic weights higher than the threshold v are set as candidate keywords for the i-th category of text.

[0051] Traverse the candidate keywords of the i-th category of text to generate the disordered keyword combinations and ordered keyword combinations of the i-th category of text, and input them into the manually labeled positive and negative samples. Set the F1-score value threshold f, obtain the keyword combinations with F1-score values ​​greater than the set threshold f, and remove duplicates (if the F1-score of the ordered keyword combination is higher than the disordered keyword combination containing the same words, keep the ordered keyword combination, otherwise, keep the disordered keyword combination), and obtain the final keyword combination recommendation results.

[0052] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for automatically selecting keyword combinations to extract text, It is characterized in that The steps include: S1. Performing data preprocessing on the original text to obtain a word segmentation result, wherein the data preprocessing includes finding fixed collocation phrases, performing word segmentation on the original text, and filtering stop words; S2. Select candidate keywords. Select candidate keywords from the word segmentation results in S1. The specific steps are as follows: S2.

1. Use the TF-IDF algorithm to assign a weight calculated based on its statistical information to each word contained in the original text; S2.2, train the LDA model based on the original text, and use the trained LDA model to calculate the topic prominence of the words contained in each piece of data in the original text; S2.3, add the weight of each word calculated based on the TF-IDF algorithm and the topic prominence calculated based on the trained LDA model to obtain the sum of the two, and then modify the sum of the two by considering the part of speech of each word to obtain the final weight of each word; S2.4, sort the words contained in each piece of data in the original text from high to low according to their weights, set a minimum threshold for the weights, and use words with weights greater than the set threshold as candidate keywords; S3, recommending keyword combinations, based on the candidate keywords contained in each data in the original text, generating unordered and ordered co-occurring word combination sets, and using F1-score as the evaluation index, recommending keyword combinations for searching the target text from the unordered and ordered co-occurring word combination sets; The specific steps are as follows: S3.1, based on the candidate keywords contained in each data in the original text, generate a set of unordered and ordered co-occurring word combinations with a traversal length of 1 to N; S3.

2. Extract some data from the original text and label it. Label the data belonging to the target text as positive samples, and label the data not belonging to the target text as negative samples. S3.3, search the marked text with various unordered and ordered co-occurring word combinations, calculate the F1-score of each combination based on the search results, set the minimum threshold of the F1-score, and take the co-occurring word combination with an F1-score value greater than the set threshold as the intermediate result; S3.

4. De-duplicate the intermediate results. When there are unordered co-occurring word combinations and ordered co-occurring word combinations that contain exactly the same words in the intermediate results, set the F1-score value threshold f, retain the co-occurring word combinations with F1-score values ​​greater than the threshold f, and delete the co-occurring word combinations with F1-score values ​​less than the threshold f; when the F1-score values ​​of the two are the same, retain the unordered co-occurring word combinations and delete the ordered co-occurring word combinations. The final set of all co-occurring word combinations is the selected keyword combination for searching the target text.

2. A method for automatically selecting keyword combinations to extract text according to claim 1, It is characterized in that The specific steps for discovering fixed collocation phrases in S1 are as follows: S1.

1. Generate all N-gram word strings based on the original text, calculate the left-right entropy and mutual information of each N-gram word string, set the minimum threshold of the left-right entropy and mutual information, and select the N-gram word strings whose values ​​of the left-right entropy and mutual information are greater than the set threshold as candidate fixed collocation phrases; S1.2, remove duplicate candidate fixed collocation phrases. When two candidate fixed collocation phrases are in a containment relationship, retain the longer candidate fixed collocation phrase and delete the shorter one; S1.

3. Further filter the candidate fixed collocation phrases based on part of speech.

3. The method for automatically selecting keyword combinations to extract text according to claim 1, It is characterized in that The segmentation of the original text and filtering of stop words in S1 is to add the obtained fixed collocation phrases to the user dictionary, use the pkuseg segmentation tool to segment the original text to obtain the segmentation results, then collect common stop words to supplement the stop word dictionary, and further filter the segmentation results based on the stop word dictionary.

Citation Information

Patent Citations

  • Device and method abstracting keywords in text

    CN104063387A

  • Text key information extraction method and device based on semantic analysis

    CN108052500A

  • Short text keyword extraction method combining GPU-DMM and text features

    CN110807326A