Text processing method and apparatus

By combining baseline keywords, text components, and knowledge graphs, a candidate keyword list is constructed and text keywords are filtered, which solves the problem of low accuracy in topic extraction in existing technologies and achieves more efficient keyword extraction and stronger relevance.

CN115774791BActive Publication Date: 2026-08-25BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211663214.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2026-08-25
Estimated Expiration
2042-12-23

AI Technical Summary

Technical Problem

Existing topic extraction methods have low accuracy and require a lot of manual assistance, making it difficult to meet the needs of practical applications.

Method used

By obtaining the baseline keywords and text components of the text to be processed, and combining the keyword extraction model and knowledge graph, a candidate keyword list is constructed, and the text keywords are selected using the baseline keywords and text components.

Benefits of technology

It improves the accuracy and efficiency of keyword extraction, ensuring that the extracted keywords are more relevant to the text to be processed, making it easier for downstream businesses to use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115774791B_ABST
    Figure CN115774791B_ABST
Patent Text Reader

Abstract

The application provides a text processing method and device, wherein the text processing method comprises: obtaining a to-be-processed text, and determining a reference subject word and a text composition element of the to-be-processed text; inputting the to-be-processed text into a subject word extraction model for processing, and determining a candidate subject word according to a processing result; querying a knowledge graph based on the candidate subject word to obtain an associated subject word, and constructing a candidate subject word table corresponding to the to-be-processed text according to the associated subject word and the candidate subject word; and screening a text subject word corresponding to the to-be-processed text in the candidate subject word table according to the reference subject word and the text composition element. The subject word extraction is completed by combining the graph and the model, and the subject word extraction accuracy can be further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine learning technology, and in particular to text processing methods and apparatus. Background Technology

[0002] Artificial intelligence (AI) refers to the ability of an engineered (i.e., designed and manufactured) system to perceive its environment, and to acquire, process, apply, and represent knowledge. Deep learning frameworks encapsulate algorithms. With the development of AI, various deep learning frameworks have emerged; general-purpose deep learning frameworks such as TensorFlow and PyTorch are applied in fields such as natural language processing, computer vision, and speech processing, as well as in industries such as machine translation, smart finance, smart healthcare, and autonomous driving. PyTorch is currently one of the most widely used deep learning frameworks. Natural Language Processing (NLP) is an important area within computer science and artificial intelligence. It studies various theories and methods that enable effective communication between humans and computers using natural language. It encompasses many fields, including machine translation (the process of converting one natural language (source language) into another natural language (target language) using a computer), machine reading comprehension (given a context description and a corresponding query, the machine reads the context and provides the answer to the query), question answering systems (QA, an advanced form of information retrieval system that answers user questions in natural language accurately and concisely), and topic / keyword extraction.

[0003] In existing technologies, topic extraction is increasingly used in various scenarios. Accurate topic extraction can fully represent the content of a document, facilitating document filtering for users. Most existing topic extraction methods employ topic extraction models. These models are primarily divided into two types: unsupervised extraction, which directly learns the probability distribution of topic words in the article through a statistical learning model; and supervised extraction, which uses a softmax classifier to determine document category labels. However, both supervised and unsupervised methods have relatively low accuracy and require significant manual assistance. Therefore, an effective solution is urgently needed to address these issues. Summary of the Invention

[0004] In view of this, embodiments of this application provide a text processing method to address the technical deficiencies existing in the prior art. Embodiments of this application also provide a text processing apparatus, a computing device, and a computer-readable storage medium.

[0005] According to a first aspect of the embodiments of this application, a text processing method is provided, including:

[0006] Obtain the text to be processed, and determine the baseline keywords and text components of the text to be processed;

[0007] The text to be processed is input into the topic word extraction model for processing, and candidate topic words are determined based on the processing results.

[0008] Based on the candidate topic terms, the knowledge graph is queried to obtain related topic terms, and a candidate topic term table corresponding to the text to be processed is constructed according to the related topic terms and the candidate topic terms;

[0009] Based on the baseline keywords and the text components, the text keywords corresponding to the text to be processed are selected from the candidate keyword list.

[0010] According to a second aspect of the embodiments of this application, a text processing apparatus is provided, comprising:

[0011] The acquisition module is configured to acquire the text to be processed and determine the baseline keywords and text components of the text to be processed;

[0012] The processing module is configured to input the text to be processed into the topic word extraction model for processing, and determine candidate topic words based on the processing results;

[0013] The construction module is configured to query a knowledge graph based on the candidate topic terms to obtain related topic terms, and to construct a candidate topic term table corresponding to the text to be processed based on the related topic terms and the candidate topic terms;

[0014] The filtering module is configured to filter the text keywords corresponding to the text to be processed from the candidate keyword list based on the benchmark keywords and the text components.

[0015] According to a third aspect of the embodiments of this application, a computing device is provided, comprising:

[0016] Memory and processor;

[0017] The memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions to implement the steps of the text processing method.

[0018] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer-executable instructions that, when executed by a processor, implement the steps of the text processing method.

[0019] According to a fifth aspect of the present application, a chip is provided that stores a computer program, which, when executed by the chip, implements the steps of the text processing method.

[0020] The text processing method provided in this application, after obtaining the text to be processed, first determines its corresponding baseline keywords and text component elements. Then, it obtains candidate keywords corresponding to the text to be processed through a keyword extraction model, and further determines related keywords corresponding to the text to be processed by combining a knowledge graph. At this point, a candidate keyword list can be constructed by combining the candidate keywords and related keywords, thereby expanding the keyword list from multiple dimensions and ensuring that all candidate keywords in the keyword list are related to the text to be processed. Based on this, the candidate keyword list is then filtered using the baseline keywords and text component elements to obtain the text keywords corresponding to the text to be processed. This method achieves keyword extraction by combining a knowledge graph and a model, which can further improve the accuracy of keyword extraction. Furthermore, the introduction of baseline keywords and text component elements in this process increases the relevance between the extracted keywords and the text to be processed, thus making it more convenient for downstream business applications. Attached Figure Description

[0021] Figure 1 This is a schematic diagram of the structure of a text processing method provided in an embodiment of this application;

[0022] Figure 2 This is a flowchart of a text processing method provided in an embodiment of this application;

[0023] Figure 3 This is a schematic diagram of a knowledge graph in a text processing method provided in an embodiment of this application;

[0024] Figure 4 This is a flowchart illustrating a text processing method provided in one embodiment of this application;

[0025] Figure 5 This is a schematic diagram of the structure of a text processing device provided in an embodiment of this application;

[0026] Figure 6 This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation

[0027] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.

[0028] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first.

[0030] First, the terminology used in one or more embodiments of the present invention will be explained.

[0031] Topic Model: A statistical model that uses unsupervised learning to cluster the latent semantic structure of a collection of documents.

[0032] Neo4J: A graph database, a type of database for storing knowledge graphs.

[0033] LDA: Latent Dirichlet Distribution, is a method based on Bayesian algorithm models that uses prior distributions to perform likelihood estimation on data and finally obtain the posterior distribution.

[0034] Spearman Correlation Coefficient: The Spearman correlation coefficient indicates the direction and degree of change between two variables. Its value ranges from -1 to +1, where 0 indicates that the two variables are not correlated, a positive value indicates a positive correlation, a negative value indicates a negative correlation, and a larger value indicates a stronger correlation.

[0035] Text to be processed: refers to texts that need to have keywords extracted, including but not limited to articles, news, and academic papers.

[0036] Text components: the title and text content of the text to be processed.

[0037] This application provides a text processing method. This application also relates to a text processing apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.

[0038] In practical applications, topic extraction is increasingly used in various scenarios. Accurate topic extraction can effectively represent the content of a document, facilitating document selection for users. Most existing topic extraction methods employ topic extraction models. These models are primarily divided into two types: unsupervised and supervised. Unsupervised methods extract topic words by directly learning the probability distribution of topic words in the article through statistical learning models. This primarily utilizes statistical machine learning models such as LSA, PLSA, LDA, and Topic Models to extract topic words, and combines word vector tools to enhance the lexical relationships between words, thereby better representing the article's topic. Supervised methods extract topic words by using a softmax classifier to incorporate document category labels into the topic model as a complete model. This is achieved through training with pre-trained language models, where category labels effectively constrain model training, improving the model's classification performance for text. Examples include SLDA topic models, supervised latent Dirichlet allocation (L-LDA), and dependency-LDA.

[0039] However, unsupervised methods rely on textual statistical data for probability distribution analysis, and the distribution of document topics is affected by the quality of the document data. Furthermore, many topic models fail to learn interpretable and easily understood topics, and directly obtaining topic words results in low model accuracy. Supervised methods improve model accuracy by leveraging existing annotations and incorporating label constraints to establish a mapping relationship between topics and labels, thus enhancing the expressive and interpretable capabilities of topics. However, this requires significant effort in data annotation, suffers from weak interpretability, and lacks generalization and transfer capabilities.

[0040] See Figure 1The diagram illustrates that the text processing method provided in this application, after obtaining the text to be processed, first determines its corresponding baseline keywords and text components. Then, it uses a keyword extraction model to obtain candidate keywords for the text to be processed, and further combines this with a knowledge graph to determine related keywords. At this point, combining the candidate keywords and related keywords allows for the construction of a candidate keyword list, expanding the list from multiple dimensions and ensuring that all candidate keywords in the list are relevant to the text to be processed. Based on this, the candidate keyword list is then filtered using baseline keywords and text components to obtain the text keywords corresponding to the text to be processed. This method achieves keyword extraction by combining a knowledge graph and a model, further improving the accuracy of keyword extraction. Moreover, the introduction of baseline keywords and text components in this process enhances the relevance between the extracted keywords and the text to be processed, making it more convenient for downstream business applications.

[0041] Figure 2 A flowchart of a text processing method according to an embodiment of this application is shown, which specifically includes the following steps:

[0042] Step S202: Obtain the text to be processed and determine the baseline keywords and text components of the text to be processed.

[0043] The core of this application's embodiments lies in extracting the keywords corresponding to the text. For different text types, such as articles, news, papers, novels, etc., the process of extracting keywords is basically the same. The process of extracting keywords from articles is described in detail below.

[0044] Specifically, the text to be processed refers to the text from which keywords need to be extracted, including but not limited to articles, news articles, academic papers, or novels. For example, in a search engine scenario, it's necessary to extract keywords corresponding to various types of articles so that users can match keywords to their search needs when using the search engine. Correspondingly, the baseline keywords refer to keywords extracted using predefined methods before extracting keywords from the text to be processed. These keywords have a certain relevance to the text to be processed, but are not necessarily the text's core keywords. For instance, when extracting keywords, words within quotation marks in the text might be selected as keywords, but these words may be key terms in the text and not necessarily the core keywords. When extracting keywords from the text to be processed, the keywords can be corrected based on the benchmark keywords. In other words, the benchmark keywords can play a role in making the extracted keywords strongly correlated with the text to be processed during the keyword extraction stage. The preset methods include, but are not limited to, manual annotation and sequence labeling model annotation, which are used to clearly show that the benchmark keywords and the text to be processed are strongly correlated. The strong correlation is reflected in the similarity between the benchmark keywords and the actual keywords of the text to be processed being greater than a set threshold.

[0045] Correspondingly, the text components specifically refer to the title and text content corresponding to the text to be processed. This facilitates the subsequent filtering of candidate keywords based on benchmark keywords, thereby enabling the selection of text keywords that are more closely related to the text to be processed from the semantic perspective of the title and text content.

[0046] It should be noted that the text to be processed can be the text collected locally by the search engine server, or it can be the text actively uploaded by the user for keyword extraction. This embodiment does not impose any limitations on this.

[0047] Based on this, after receiving the text to be processed, in order to accurately extract the corresponding keywords from the text, we can first determine the baseline keywords and text components of the text to be processed. This allows us to combine the baseline keywords and text components to filter the extracted candidate keywords, thereby obtaining text keywords that are highly relevant to the text to be processed.

[0048] Furthermore, in order to achieve more accurate filtering of candidate keywords by combining the baseline keywords when determining the baseline keywords, thereby improving the accuracy of text keyword selection, a sequence labeling model can be used. In this embodiment, the specific implementation method is as shown in steps S2022 to S2028.

[0049] Step S2022: Input the text to be processed into the sequence labeling model for processing to obtain the labeling information corresponding to each character unit in the text to be processed.

[0050] Step S2024: In the annotation information corresponding to each character unit, determine the starting annotation information and the intermediate annotation information.

[0051] Step S2026: Determine the starting character unit and the intermediate character unit in the text to be processed according to the starting annotation information and the intermediate annotation information.

[0052] Step S2028: Generate the reference topic terms based on the starting character unit and the intermediate character unit.

[0053] Specifically, a sequence labeling model refers to a model capable of annotating the attributes of each character unit in the text to be processed. By combining the attribute annotation results of different character units, the baseline topic words in the text can be identified. The sequence labeling model can be a Hidden Markov Model (HMM), a Maximum Entropy HMM, or a Conditional Random Field (CRF) model. Correspondingly, the annotation information refers to the annotation results obtained after the sequence labeling model annotates the attributes of each character unit. Different annotation information represents that each character unit has different attributes, such as O indicating that the character unit is an irrelevant topic word, I indicating that the character unit is a relevant topic word, and B indicating that the starting character unit of the topic word, etc. Correspondingly, the start annotation information refers to the annotation information representing the starting character of the topic word, and the intermediate annotation information refers to the annotation information representing the non-starting character of the topic word.

[0054] Based on this, after obtaining the text to be processed, it can be first input into the sequence labeling model. The sequence labeling model can then perform attribute labeling on each character unit to obtain the labeling information corresponding to each character unit in the text to be processed. Then, based on the different labeling information, the starting labeling information and intermediate labeling information in the labeling information can be determined. Next, the starting character unit and intermediate character unit in the text to be processed can be determined according to the starting labeling information and intermediate labeling information. Finally, the baseline keyword corresponding to the text to be processed can be generated based on the starting character unit and intermediate character unit.

[0055] It should be noted that when generating baseline keywords, the starting and intermediate word units need to be combined according to the order of word units in the text to be processed, so as to ensure that the baseline keywords extracted at the current stage are keywords with strong relevance and correct reading order.

[0056] In addition, before the sequence labeling model is used, it needs to be specifically trained in combination with the scenario of extracting topic words, so that the sequence labeling model can learn to label topic words to achieve the purpose of generating benchmark topic words. That is to say, in the model training stage, the topic words need to be used as the labels of the samples to train the model until a sequence labeling model that meets the training stop condition is obtained.

[0057] In practical applications, when training a sequence labeling model, it can be achieved in the following way: First, obtain the sample text. Secondly, label the topic words in the sample text manually, and determine the sample labels corresponding to the sample text according to the labeling results. Then, input the sample text into the initial sequence labeling model for processing to obtain the text labeling results output by the model. At this time, calculate the loss value based on the sample labels and the text labeling results output by the model, and adjust the parameters of the initial sequence labeling model according to the loss value. If the model after parameter adjustment does not meet the training stop condition, new samples can be extracted and continue to train it until a sequence labeling model that meets the training stop condition is obtained. The training stop condition specifically refers to the loss value comparison condition. In the model training stage, if the loss value corresponding to the training result of any stage is less than or equal to the set loss value threshold, it is determined that the model of the current stage meets the condition and can be used as the sequence labeling model. In addition, in practical applications, other training stop conditions can also be selected to monitor the training of the sequence labeling model, such as the iteration number condition, etc., which can be selected according to actual needs in specific applications.

[0058] For example, take an article from which topic words are to be extracted. The content of the article is “… Nowadays, air pollution is serious, and environmental protection is the unshirkable responsibility of everyone…” (only part of the article content is taken as an example for illustration). Input the article into the sequence labeling model for processing to obtain the labeling results output by the model, that is, {ru-O jin-O da B-I qi I-I wu I-I ran I-I yan-O zhong-O, huan-O jing-O bao-O hu-O shi-O mei-O ge-O ren-O bu-O ke-O tui-O xie-O de-O ze-O ren}, where O indicates that the word unit is not a topic word; B before “-” indicates the beginning word unit of the topic word (Begin), and I before “-” indicates the middle word unit of the topic word (Inside), that is, the label “B-I” indicates that the word unit is the starting word unit of the topic word in the sentence; the label “I-I” indicates that the word unit is the middle word unit of the topic word in the sentence.

[0059] Furthermore, according to the labeling results, it is determined that “da” is the starting word unit, and “qi, wu, ran” are the middle word units. Then, in the order of each word unit in the article, the benchmark topic word corresponding to the article is formed as “air pollution” for subsequent processing.

[0060] In summary, using sequence labeling models to determine baseline keywords can effectively improve the accuracy of baseline keyword extraction and solve the problem of low efficiency in manual labeling, thereby improving the efficiency of text keyword extraction.

[0061] Step S204: Input the text to be processed into the topic word extraction model for processing, and determine candidate topic words based on the processing results.

[0062] Specifically, after obtaining the text to be processed, to ensure the accuracy of keyword extraction, we can first determine the candidate keywords corresponding to the text. Then, by comparing the relevance between each candidate keyword and the text, we determine the candidate keyword with the highest relevance as the text keyword. Therefore, we need to provide multiple candidate keywords for filtering. At this point, we can first input the text to be processed into the keyword extraction model to obtain multiple candidate keywords based on the model's processing results, which will then be used for subsequent text keyword filtering.

[0063] The topic word extraction model specifically refers to a model that can extract topic words from text. The extracted topic words may differ from the actual topic words. Correspondingly, candidate topic words refer to topic words that may be used as topic words for the text to be processed after the topic words output by the topic word extraction model are corrected.

[0064] Furthermore, to ensure that the candidate keywords are all related to the text to be processed, the correction can be completed by combining the model and rules. In this embodiment, the specific implementation is as shown in steps S2042 to S2044.

[0065] Step S2042: Input the text to be processed into the topic word extraction model for processing to obtain initial candidate topic words.

[0066] Specifically, the initial candidate topic words refer to the topic words output by the topic word extraction model. There are multiple initial candidate topic words, which need to be reduced through refinement to ensure high efficiency and accuracy in subsequent text topic word extraction. The topic word extraction model can be a pre-trained BERT model. Based on this, the initial candidate topic word extraction process is as follows:

[0067] The text features corresponding to the text to be processed are constructed and input into the topic word extraction model. The text features are encoded by the encoding unit in the topic word extraction model to obtain an encoding vector. The encoding vector is transformed by the network unit in the topic word extraction model to obtain a hidden state vector. The hidden state vector is labeled by the linear unit in the topic word extraction model to obtain a label corresponding to each character unit in the text to be processed. The initial candidate topic words corresponding to the text to be processed are determined according to the labels corresponding to each character unit, and the topic word extraction model is output.

[0068] Specifically, text features refer to the vector representation obtained after vectorizing the text to be processed. This can be constructed using one-hot encoding, mapping character units in the text to their corresponding positions in the vocabulary space. The vector representation of the text is then generated by combining the positions of these character units in the vocabulary space, where the vocabulary space records the vector representations of each character unit. Correspondingly, the encoding unit refers to the encoding layer in the topic word extraction model that encodes the text; the network unit refers to the Long Short-Term Memory (LSTM) network layer in the topic word extraction model that performs character-by-character transformation of the encoded vectors, obtaining the hidden state representation of the text to be processed; and the linear unit refers to the linear layer that labels the hidden state representation, determining the label of each character unit in the text to be processed, thus outputting initial candidate topic words.

[0069] Based on this, after obtaining the text to be processed, the text can first be vectorized to obtain the text features corresponding to the text. At this point, the text features meet the model input requirements. Then, the text features are input into the topic word extraction model. The text features are encoded by the encoding units in the topic word extraction model to obtain the encoding vector corresponding to the text to be processed. Next, the encoding vector is transformed by the network units in the topic word extraction model to obtain the hidden state vector corresponding to the text to be processed. Then, the hidden state vector is labeled by the linear units in the topic word extraction model to obtain the label corresponding to each character unit in the text to be processed. Finally, the initial candidate topic words corresponding to the text to be processed are determined according to the labels corresponding to each character unit, and the topic word extraction model is output.

[0070] In other words, when extracting initial candidate topic words from the text to be processed, one can first use one-hot encoding to map the character units contained in the text to the vocabulary space to obtain text features. Then, the BERT pre-trained model is used to encode the input text features to obtain the encoding vector corresponding to the text to be processed. The encoding vector is then input into the LSTM network to obtain the hidden layer representation corresponding to the text to be processed. The hidden layer representation is processed by a linear layer to predict the label of each character unit in the text to be processed, thereby obtaining the initial candidate topic words output by the model.

[0071] In summary, by employing a topic word extraction model to initially extract topic words from the text to be processed, multiple initial candidate topic words related to the text can be obtained. Based on this, subsequent text topic word extraction can be carried out, which can effectively improve the accuracy and efficiency of topic word extraction.

[0072] Step S2044: Filter the initial candidate keywords according to the preset subject dictionary and correction rules, and determine the candidate keywords based on the filtering results.

[0073] Specifically, after obtaining the initial candidate keywords, considering the limited extraction accuracy of the keyword extraction model, the obtained initial candidate keywords may have errors with the real keywords. Therefore, in order to accurately determine the candidate keywords and facilitate subsequent in-depth screening, the initial candidate keywords output by the model can be over-filtered by combining a preset topic dictionary and correction rules, so as to obtain the candidate keywords based on the filtering results.

[0074] Specifically, the subject dictionary refers to a dictionary that integrates a large number of subject terms in the field to which the text to be processed belongs, and the subject terms in the dictionary all have standard expressions. For example, "coronary heart disease" is expressed as "coronary artery atherosclerotic heart disease" in the standard expression of the dictionary. Correspondingly, the correction rules refer to the ability to filter out subject terms that do not meet the conditions in the initial candidate subject terms by combining the subject dictionary, and use the remaining subject terms as candidate subject terms. The correction rules include, but are not limited to, restricting the existence form of subject terms in the text to be processed, or the number of characters in subject terms, or the word structure of subject terms, etc.

[0075] Following the previous example, after obtaining the article "...Air pollution is serious nowadays, and environmental protection is everyone's inescapable responsibility...", we can first construct the text features corresponding to the article, and then input them into the keyword extraction model for processing. Based on the processing results, we obtain the initial candidate keywords for the article: {environmental pollution, environmental damage, environmental protection, air pollution, global warming}. Further, by querying the keyword dictionary, we determine that "global warming" does not exist in the dictionary, so we can remove the keyword "global warming". Simultaneously, combined with correction rules, we determine that "environmental damage" does not exist within quotation marks in the article, so we can remove the keyword "environmental damage". Finally, {environmental pollution, environmental protection, air pollution} are selected as the candidate keywords for the article for subsequent use.

[0076] In summary, by combining the model, dictionary, and correction rules to perform preliminary topic word extraction on the text to be processed, it can be ensured that the candidate topic words obtained are all topic words that are highly relevant to the text to be processed, which facilitates the subsequent selection of text topic words based on these, thereby improving the topic word extraction efficiency.

[0077] In practical applications, considering that different fields correspond to different ways of expressing keywords, in order to accurately determine the keywords corresponding to the text to be processed, it is necessary to first construct a subject dictionary for the corresponding field. In this embodiment, the determination of the subject dictionary is as follows:

[0078] The target domain corresponding to the text to be processed is determined, and multiple business texts associated with the target domain are obtained; each business text in the multiple business texts is standardized to obtain multiple target business texts; each target business text in the multiple target business texts is subject-term tagging to obtain business subject terms corresponding to each target business text; the subject dictionary is constructed based on the business subject terms corresponding to each target business text.

[0079] Specifically, the target domain refers to the field to which the text to be processed belongs, such as sports, environmental protection, finance, and electronic technology. Different domains correspond to different business texts. Correspondingly, business text refers to texts related to the target domain, which are numerous and used to construct a dictionary, ensuring the dictionary covers as much of the vocabulary as possible within the domain. These business texts corresponding to the target domain can be obtained from the internet or from a designated text library by setting rules. Standardization processing refers to data cleaning of the business texts, removing content irrelevant to the text's substance, such as attached diagrams and translations. Business terminology refers to the terminology obtained after annotating each target business text. By integrating the business terminology corresponding to all business texts, a subject dictionary for the target domain can be obtained.

[0080] Based on this, in the topic dictionary construction phase, we can first clarify the target domain to which the dictionary belongs, then obtain multiple business texts related to the target domain, and standardize each business text to obtain multiple target business texts. Next, we can tag each target business text with keywords to obtain the corresponding business keywords. Finally, by integrating the business keywords corresponding to all business texts, we can obtain the topic dictionary for the corresponding target domain.

[0081] In practice, when tagging keywords for each target business text, manual tagging, existing model tagging, or preset rules can be used; this embodiment does not impose any limitations. Based on this, the correction rules used when filtering initial candidate keywords can be created in conjunction with the rules used when tagging business keywords. For example, if the tagging of business keywords requires selection within book titles, the correction rule could be a book title association rule, ensuring that when filtering initial candidate keywords, keywords associated with book titles are selected as candidate keywords.

[0082] In summary, by constructing a topic dictionary based on the target domain of the text to be processed, and then using this dictionary as a basis to filter the initial candidate topic words with correction rules, the relevance between the obtained candidate topic words and the text to be processed can be guaranteed, thereby improving the accuracy of topic word extraction.

[0083] Step S206: Based on the candidate topic terms, query the knowledge graph to obtain related topic terms, and construct a candidate topic term table corresponding to the text to be processed according to the related topic terms and the candidate topic terms.

[0084] Specifically, after obtaining multiple candidate keywords corresponding to the text to be processed, further, since the candidate keywords are all directly or indirectly derived from the text to be processed, such as determining candidate keywords through text analysis or directly selecting candidate keywords from the text, i.e., the candidate keywords are composed of the text content in the text to be processed; and the text keywords of the text to be processed can also be obtained through inductive summarization. In this case, the keywords obtained may not come from the original text of the text to be processed, but are obtained after sorting. Therefore, considering the impact of this situation, it is also possible to obtain related keywords by querying the knowledge graph, and then combine the related keywords and candidate keywords to form a candidate keyword list for subsequent screening of text keywords.

[0085] Specifically, the knowledge graph refers to a knowledge graph constructed using subject terms as entities and lexical relationships between subject terms as relations. These lexical relationships include, but are not limited to, hypernyms, types, hyponyms, related words, and synonyms. It is used to obtain associated subject terms by querying the knowledge graph after identifying candidate subject terms, thereby expanding the lexicon to include more candidate subject terms. Correspondingly, associated subject terms are the hypernyms, hyponyms, category words, and synonyms associated with candidate subject terms. The corresponding candidate subject term list is a lexicon integrating all candidate subject terms and associated subject terms, which can be used for subsequent text subject term filtering. The construction of the knowledge graph is described in steps S2062 to S2066.

[0086] Step S2062: Query the thesaurus based on the business thesaurus contained in the thesaurus to obtain the associated business thesaurus.

[0087] Step S2064: Establish the keyword relationship between the business keyword and the associated business keyword.

[0088] Step S2066: Construct the knowledge graph based on the topic word relationships, the business topic words, and the associated business topic words.

[0089] Specifically, a thesaurus refers to a thesaurus corresponding to a specific language's thesaurus, such as a thesaurus corresponding to the Chinese thesaurus. It includes words and their corresponding categories, superordinate terms, hyponyms, related terms, and synonyms, and constructs a knowledge graph through the correspondences between words. Correspondingly, related business thesaurus refers to other words in the thesaurus that have a corresponding relationship with the business thesaurus. Correspondingly, the thesaurus relationships are the correspondences between words, such as categories, superordinate terms, hyponyms, related terms, and synonyms.

[0090] Based on this, after obtaining the business topic words, the topic word database can be queried based on the business topic words to obtain the related business topic words. Then, based on the correspondence between the business topic words and related business topic words reflected in the topic word database, topic word relationships can be established. Finally, the relationships and topic words can be integrated to construct a knowledge graph for the corresponding target domain.

[0091] For example, see Figure 3 The schematic diagram shown in Figure (a) uses "monoaldehyde" as the business keyword. Based on "monoaldehyde", the keyword database is queried, such as the Chinese keyword database. The superordinate words of "monoaldehyde" include {butyraldehyde, octaldehyde, benzaldehyde, furanaldehyde...butenaldehyde}. At this point, a knowledge graph can be constructed by combining "monoaldehyde", the relationship between superordinate words and the superordinate words {butyraldehyde, octaldehyde, benzaldehyde, furanaldehyde...butenaldehyde}, so as to facilitate its use in the subsequent keyword extraction stage.

[0092] In summary, by combining a thesaurus to construct a knowledge graph, it is possible to cover the relationships between keywords from multiple dimensions, ensuring that the constructed knowledge graph can comprehensively reflect the relationships between words, so that the thesaurus can be expanded accurately and efficiently in the application stage.

[0093] Furthermore, when querying the knowledge graph based on candidate keywords, the nodes of the candidate keywords in the graph are first determined, and then words that have a direct mapping relationship with the nodes are selected as associated keywords. In this embodiment, the specific implementation is as shown in steps S2122 to S2124.

[0094] Step S2122: Determine the target node corresponding to the candidate topic in the knowledge graph, and determine the associated node that has a direct mapping relationship with the target node.

[0095] Step S2124: Select the topic word corresponding to the associated node as the associated topic word corresponding to the candidate topic word.

[0096] Specifically, the target node refers to the node in the knowledge graph that the candidate topic words are mapped to. Correspondingly, the associated node refers to the node in the knowledge graph that has a direct mapping relationship with the target node. The topic words corresponding to the associated nodes are the associated topic words that have a relationship with the candidate topic words.

[0097] Based on this, we first determine the target nodes of the candidate keywords in the knowledge graph, then identify the associated nodes that have a direct mapping relationship with the target nodes, and finally select the keywords corresponding to the associated nodes as the associated keywords corresponding to the candidate keywords.

[0098] Following the previous example, after determining the candidate keywords {air pollution, environmental pollution, environmental protection}, we can query the knowledge graph based on each candidate keyword. Since the knowledge graph is constructed using keywords as nodes and the relationships between keywords (category, superordinate terms, subordinate terms, related terms, and / or synonyms) as edges, forming multiple triples, when querying the knowledge graph, we can select the keywords corresponding to nodes connected by edges as associated keywords. That is, we determine the node corresponding to each candidate keyword in the knowledge graph as the target node, and then select nodes in the knowledge graph that have a direct mapping relationship with the target node as associated nodes. These associated nodes correspond to other keywords, which are categories, superordinate terms, subordinate terms, related terms, and / or synonyms of the candidate keywords. Therefore, after determining the associated nodes, we can determine the category, superordinate terms, subordinate terms, related terms, and / or synonyms corresponding to each candidate keyword. See [link to query results] for further information. Figure 3The diagram shown in Figure (b) identifies the related keywords for "air pollution" using dimensions including related words, hyponyms, hypernyms, synonyms, English terms, and allocation. The corresponding related keywords are also identified as {atmospheric environment, atmospheric visibility, carbon dioxide, pollution…total air pollution}. Similarly, the knowledge graph is queried for the candidate keywords "environmental pollution" and "environmental protection" to obtain the related keywords for each candidate keyword. Finally, by integrating the candidate keywords and their corresponding related keywords, a candidate keyword list containing n keywords is obtained, facilitating the subsequent determination of text keywords from these n keywords.

[0099] In summary, by combining the knowledge graph with an expanded thesaurus to obtain a candidate thesaurus, we can ensure that the candidate thesaurus not only includes the keywords generated based on the original text content, but also the keywords summarized from related content. Based on this, the determination of text keywords can be further guaranteed to ensure the accuracy of keyword determination.

[0100] Step S208: Based on the baseline keyword and the text components, filter the text keyword corresponding to the text to be processed in the candidate keyword list.

[0101] Specifically, after obtaining the candidate thesaurus, further considering that the candidate thesaurus contains a large number of thesaurus terms, and that different thesaurus terms have different degrees of relevance to the text to be processed, in order to improve the extraction accuracy of the text thesaurus terms, the candidate thesaurus terms can be filtered by combining the baseline thesaurus terms and the text components, so as to select the thesaurus terms in the candidate thesaurus terms that have a sufficiently high relevance to the text to be processed as the text thesaurus terms based on the filtering results.

[0102] Furthermore, when filtering text keywords by combining benchmark keywords and text component elements, considering that benchmark keywords and text component elements belong to two different parts of the text to be processed and have different attributes, the candidate keyword list can be filtered first according to the benchmark keywords, and then deep filtering can be performed using text component elements. In this embodiment, the specific implementation is as shown in steps S2082 to S2084.

[0103] Step S2082: Calculate the similarity between the baseline topic words and the topic words contained in the candidate topic word list, and generate an intermediate candidate topic word list based on the similarity calculation results.

[0104] Specifically, similarity refers to the similarity between the baseline subject terms and the subject terms contained in the candidate subject term list. Similarity reflects the degree of similarity between subject terms; the higher the similarity, the closer their meanings, and vice versa. Correspondingly, the intermediate candidate subject term list refers to the list obtained after removing subject terms with low similarity from the candidate subject term list based on similarity.

[0105] Therefore, after obtaining the candidate thesaurus, in order to improve the accuracy of thesaurus selection, the candidate thesaurus can be initially filtered by combining it with the baseline thesaurus. Based on the filtering results, an intermediate candidate thesaurus can be obtained, allowing for the subsequent determination of text keywords from the intermediate candidate thesaurus, thus reducing the impact of redundant keywords. The process of determining the intermediate candidate thesaurus based on similarity is as follows:

[0106] Determine the benchmark topic word vector corresponding to the benchmark topic word, and the candidate topic word vector corresponding to the topic words included in the candidate topic word list; calculate the word vector similarity between the benchmark topic word vector and each candidate topic word vector; compare the word vector similarity with a preset similarity threshold, and select intermediate candidate topic words from the candidate topic word list according to the comparison result to form the intermediate candidate topic word list.

[0107] Specifically, the baseline topic word vector refers to the vector representation obtained after vectorizing the baseline topic words; correspondingly, the candidate topic word vector refers to the vector representation obtained after vectorizing the topic words contained in the candidate topic word list; and correspondingly, the word vector similarity refers to the value obtained by calculating the Spearman correlation coefficient between vectors.

[0108] Therefore, after obtaining the candidate topic vocabulary and the baseline topic vocabulary, in order to reduce the impact of redundant topic words, we can first construct the baseline topic word vectors corresponding to the baseline topic words, and the candidate topic word vectors corresponding to the topic words included in the candidate topic vocabulary. Then, by calculating the Spearman correlation coefficient between the baseline topic word vectors and each candidate topic word vector, we can obtain the word vector similarity. At this point, we can compare the word vector similarity with a preset similarity threshold, and select the candidate topic words with similarity greater than the threshold as intermediate candidate topic words, forming an intermediate candidate topic vocabulary.

[0109] In summary, by calculating the similarity between topic words based on word vectors, we can more accurately determine the degree of similarity between topic words. Based on this, we can select intermediate candidate topic words to form an intermediate candidate topic word list, which can ensure accuracy and reduce the impact of redundant topic words.

[0110] Step S2084: Filter the intermediate candidate thesaurus according to the text components, and determine the text thesaurus corresponding to the text to be processed based on the filtering results.

[0111] Specifically, after obtaining the intermediate candidate thesaurus as described above, the intermediate candidate thesaurus can be further filtered by combining text component elements. This allows for the determination of the text keywords corresponding to the text to be processed from the intermediate candidate thesaurus based on the filtering results. The process of determining the text keywords corresponding to the text to be processed by combining text component elements is shown in steps S21842 to S21846.

[0112] Step S20842: Determine the text title and text sentence unit in the text constituent elements.

[0113] Step S20844: Calculate the first similarity between the text title and the intermediate candidate keywords contained in the intermediate candidate keyword list, and calculate the second similarity between the text sentence unit and the intermediate candidate keywords contained in the intermediate candidate keyword list.

[0114] Specifically, the text title refers to the title of the text to be processed, and the text sentence unit refers to the text content of the text to be processed. Correspondingly, the first similarity refers to the similarity between the text title and the intermediate candidate keywords, and the second similarity refers to the similarity between the text sentence unit and the intermediate candidate keywords. The similarity can reflect the semantic similarity between the intermediate candidate keywords and the text to be processed.

[0115] In practical applications, similarity calculations can be performed using methods such as cosine similarity, Euclidean distance, Minkowski distance, or Pearson correlation coefficient. This embodiment does not impose any limitations on these methods.

[0116] Based on this, after determining the constituent elements of the text, it can be split into text titles and text sentence units. Then, by calculating the first similarity between the text titles and each intermediate candidate keyword, and the second similarity between the text sentence units and each intermediate candidate keyword, the first and second similarities can be combined to select keywords with higher relevance to the text from the intermediate candidate keyword list. These keywords can then be used as the text keywords to ensure the accuracy of keyword extraction. The calculation process for the first and second similarities is as follows:

[0117] Determine the first sentence vector corresponding to the text title, and the intermediate candidate topic word vectors corresponding to the intermediate candidate topic words included in the intermediate candidate topic word list, and calculate the first similarity between the first sentence vector and each intermediate candidate topic word vector; determine the second sentence vector corresponding to the text sentence unit, and calculate the second similarity between the second sentence vector and each intermediate candidate topic word vector.

[0118] Specifically, the first sentence vector refers to the vector expression obtained after vectorizing the text title; correspondingly, the intermediate candidate keyword vector refers to the vector expression obtained after vectorizing the intermediate candidate keywords; and correspondingly, the second sentence vector refers to the vector expression obtained after vectorizing the text sentence units.

[0119] Based on this, after obtaining the intermediate candidate thesaurus through baseline keyword filtering, deep filtering can be performed using text component elements. This involves first determining the first sentence vector corresponding to the text title, the second sentence vector corresponding to the text sentence unit, and the intermediate candidate thesaurus vectors corresponding to the intermediate candidate thesaurus terms included in the intermediate candidate thesaurus. At this point, the first similarity between the first sentence vector and each intermediate candidate thesaurus vector can be calculated, followed by the second similarity between the second sentence vector and each intermediate candidate thesaurus vector. This facilitates the subsequent combination of the first and second similarities to select text keywords from the intermediate candidate thesaurus.

[0120] It should be noted that when constructing the first and second sentence vectors, the text title or text sentence unit can be input into the BERT pre-trained language model to obtain their respective semantic representations. The [cls] vector in the semantic representation is averaged with the sentence vector, and the first sentence vector corresponding to the text title and the second sentence vector corresponding to the text sentence unit are constructed based on the value result. Then, the similarity is calculated. This embodiment uses cosine similarity as an example to describe the similarity calculation process. The formula for calculating cosine similarity is as follows:

[0121]

[0122] Similarity represents cosine similarity; A represents the intermediate candidate topic word vector; B represents the first sentence vector or the second sentence vector; and N represents the dimension of the vector.

[0123] In summary, by calculating similarity, the degree of similarity between each intermediate candidate keyword and the text sentence unit and text title is determined. This facilitates the subsequent joint determination of the similarity between each intermediate candidate keyword and the text to be processed, and then the determination of the text keyword can be carried out.

[0124] Step S20846: Based on the first similarity and the second similarity, filter the text keywords in the intermediate candidate keyword list.

[0125] Specifically, after obtaining the first and second similarities as described above, the degree of similarity between each intermediate candidate keyword and the text's constituent elements can be determined by integrating the two. Then, based on the integrated similarity results, the text's keyword can be determined from the intermediate candidate keyword list. The process for determining the text's keyword is as follows:

[0126] The first similarity and the second similarity are weighted and averaged to obtain the candidate word score corresponding to each intermediate candidate word in the intermediate candidate word list; the intermediate candidate words in the intermediate candidate word list are sorted according to the candidate word scores to obtain an intermediate candidate word sequence; at least one intermediate candidate word is selected from the intermediate candidate word sequence according to a preset word selection strategy as the text word.

[0127] Specifically, the candidate word score refers to the score corresponding to each intermediate candidate keyword in the intermediate candidate keyword list. This score characterizes the relevance between the intermediate candidate keyword and the text to be processed; the higher the candidate word score, the greater the relevance to the text. Correspondingly, the intermediate candidate keyword sequence refers to the sequence obtained by sorting according to the scores, where the sorting order is either from largest to smallest or from smallest to largest. Correspondingly, the keyword selection strategy refers to the strategy for selecting text keywords based on actual needs, including but not limited to the number of keywords selected and keyword threshold comparison.

[0128] Based on this, after obtaining the first and second similarities, the degree of similarity between each intermediate candidate keyword and the text title and text sentence unit can be determined. At this point, the first and second similarities can be weighted and averaged to obtain the candidate word score corresponding to each intermediate candidate keyword. Then, the intermediate candidate keywords are sorted according to the candidate word scores to obtain the intermediate candidate keyword sequence. Finally, according to the keyword selection strategy, at least one intermediate candidate keyword is selected from the intermediate candidate keyword sequence as the text keyword.

[0129] Following the previous example, after obtaining a vocabulary containing n candidate keywords, and the baseline keyword, title, and text content corresponding to the text to be processed, vector representations can be constructed for each candidate keyword, baseline keyword, title, and text content. The vector representation corresponding to the baseline keyword is w1, the vector representation corresponding to the title is w2, the vector representation corresponding to the text content is w3, and the vector representations of each candidate keyword in the vocabulary are wn1, wn2, ..., wnn.

[0130] Furthermore, the Spearman correlation coefficients between w1 corresponding to the baseline topic term and wn1, wn2...wnn of the candidate topic terms in the terminology are calculated. Based on the calculation results, n correlation coefficients are obtained. Then, the n correlation coefficients are compared with a preset threshold, and candidate topic terms that do not exceed the threshold are removed. At this point, it is determined that the candidate topic terminology contains p candidate topic terms, where p≤n.

[0131] Furthermore, taking cosine similarity as an example, firstly, the first cosine similarity (w2) between the title and the vector representations of the p candidate keywords in the vocabulary is calculated. Then, the second cosine similarity (w3) between the text content and the vector representations of the p candidate keywords in the vocabulary is calculated. Next, a weighted average of the first and second cosine similarities is taken. Based on the calculation results, candidate scores are obtained between the p candidate keywords and the text to be processed. Finally, the p candidate keywords are sorted according to their candidate scores to obtain a candidate keyword sequence. Then, according to the keyword selection rules, the x keywords with the highest candidate scores are selected as the text keywords corresponding to the article, where x ≤ p. For example, if x = 2, the final keywords corresponding to the text to be processed include {air pollution, air purification}.

[0132] In summary, by combining cosine similarity for text keyword selection, the similarity between the selected text keywords and the text to be processed can be guaranteed, thereby ensuring the accuracy of text keyword selection.

[0133] Furthermore, when determining text keywords, the candidate keyword list can be filtered first using text component elements, and then deep filtering can be performed according to the baseline keywords to obtain the text keywords corresponding to the text to be processed. The specific implementation is as follows:

[0134] The candidate topic word list is filtered according to the text components, and an intermediate candidate topic word list is determined based on the filtering results. Then, the similarity between the baseline topic word and the topic words contained in the intermediate candidate topic word list is calculated, and the topic word with the highest similarity is selected as the text topic word corresponding to the text to be processed based on the similarity calculation results.

[0135] In other words, candidate keywords can be filtered according to the text's constituent elements to obtain an intermediate candidate keyword list containing keywords highly relevant to the text to be processed. To ensure the accuracy of the determined text keywords, the similarity between the baseline keywords and the keywords in the intermediate candidate keyword list can be calculated. Based on the similarity calculation results, the keyword with the highest similarity is selected as the text keyword corresponding to the text to be processed. It should be noted that any parts not described in detail in this embodiment can be referred to the similar descriptions in the above embodiments, and will not be elaborated further in this embodiment.

[0136] Furthermore, when determining text keywords, in addition to calculating cosine similarity as mentioned above, Euclidean distance, Minkowski distance, or Pearson correlation coefficient can also be used to calculate the semantic similarity between intermediate candidate keywords and the text to be processed, so as to select the corresponding text keywords for the text to be processed based on the calculation results. In practical applications, the appropriate method can be selected according to actual needs, and this embodiment does not impose any limitations.

[0137] The text processing method provided in this application, after obtaining the text to be processed, first determines its corresponding baseline keywords and text component elements. Then, it obtains candidate keywords corresponding to the text to be processed through a keyword extraction model, and further determines related keywords corresponding to the text to be processed by combining a knowledge graph. At this point, a candidate keyword list can be constructed by combining the candidate keywords and related keywords, thereby expanding the keyword list from multiple dimensions and ensuring that all candidate keywords in the keyword list are related to the text to be processed. Based on this, the candidate keyword list is then filtered using the baseline keywords and text component elements to obtain the text keywords corresponding to the text to be processed. This method achieves keyword extraction by combining a knowledge graph and a model, which can further improve the accuracy of keyword extraction. Furthermore, the introduction of baseline keywords and text component elements in this process increases the relevance between the extracted keywords and the text to be processed, thus making it more convenient for downstream business applications.

[0138] The following is in conjunction with the appendix Figure 4 Taking the application of the text processing method provided in this application in a news topic extraction scenario as an example, the information processing method will be further explained. Among other things, Figure 4 A flowchart of a text processing method provided in an embodiment of this application is shown.

[0139] Step S402: Obtain multiple news documents and perform data cleaning on each news document to obtain multiple target news documents.

[0140] To accurately extract keywords from news topics, multiple news documents can be downloaded locally from the internet. Furthermore, to support subsequent use, the downloaded news documents can be cleaned according to a preset data cleaning strategy, such as removing images. The result is then used to obtain multiple target news documents.

[0141] Step S404: Annotate each target news document to obtain the target news keywords corresponding to each target news document.

[0142] Step S406: Construct a news keyword dictionary based on the target news keywords, and determine the keyword selection rules.

[0143] After obtaining multiple standardized target news documents, the keywords in each news document can be manually annotated to obtain the target news keywords. Then, a news keyword dictionary can be constructed by combining the target news keywords corresponding to all news documents. Furthermore, to accurately select the keywords corresponding to documents in subsequent steps, keyword selection rules can be developed based on the manual annotation process.

[0144] When manually tagging target news keywords, most keywords correspond to book titles 《》 and quotation marks “”. In this case, the keyword filtering rule is: the text content within the book titles and quotation marks is the keyword, which will be used for subsequent keyword extraction processing.

[0145] Step S408: Obtain the thesaurus corresponding to the thesaurus, and obtain the thesaurus relationship between each thesaurus in the thesaurus by reading the thesaurus.

[0146] Step S410: Construct a subject term knowledge graph based on each subject term in the subject term list and its corresponding subject term relationships.

[0147] This embodiment uses Chinese news documents as an example for illustration. Based on this, a thesaurus corresponding to the Chinese thesaurus is first obtained. Then, according to the thesaurus's relationships (such as category, superordinate terms, subordinate terms, related terms, and synonyms), the relationships between various thesaurus are determined. Finally, each thesaurus is used as a node, and combined with the thesaurus relationships, a knowledge graph covering all thesaurus terms in the thesaurus is constructed for subsequent expansion of candidate news thesaurus terms.

[0148] Step S412: Obtain the news document to be processed.

[0149] Step S414: Obtain initial news keywords by performing keyword tagging on the news document to be processed.

[0150] For example, the content of the news document to be processed is “… What problems still exist in the business environment of our country …”. In actual applications, the news document to be processed contains a large amount of text content. For the convenience of description, only part of the content is taken as an example for illustration. At this time, the sequence annotation method is used to perform annotation processing on the word units in the news document to be processed, and the annotation result is {I O, O O, O O, B-I O, I-I O, I-I O, I-I O, O O, O O, O O, O O, O O}; where, O indicates that the word unit is not a topic word; B before “-” indicates the start word unit of the topic word (Begin), and I before “-” indicates the middle word unit of the topic word (Inside), that is, the label “B-I” indicates that the word unit is the starting word unit of the topic word in the sentence; the label “I-I” indicates that the word unit is the middle word unit of the topic word in the sentence.

[0151] Based on this, by performing annotation processing on the news document to be processed, the corresponding initial news topic word is obtained as “business environment”.

[0152] Step S416, input the news document to be processed into a pre-trained topic word extraction model for processing to obtain initial candidate topic words.

[0153] Step S418, correct the initial candidate topic words according to the topic word dictionary and the topic word screening rules to obtain intermediate candidate topic words.

[0154] The word units involved in the sentence in the news document to be processed are mapped to the corresponding positions in the vocabulary through one-hot encoding to obtain the news features corresponding to the sentence; then the news features to be processed are input into the BERT pre-trained model to encode the input features, and the feature vector corresponding to the sentence “What problems still exist in the business environment of our country” in the document is obtained; then the feature vector is input into the LSTM network in the model to obtain the hidden layer representation corresponding to the sentence in the document; and then the label corresponding to each word unit in the sentence is predicted through the linear layer, so as to realize the prediction result of each word unit in the sentence by the topic word extraction model, that is, the topic word prediction result corresponding to each word unit in “… What problems still exist in the business environment of our country …”.

[0155] Furthermore, since the content contained in the news document to be processed is relatively large, after the topic word extraction operation is completed, a large number of initial candidate topic words will be obtained. In order to improve the accuracy and efficiency of topic word extraction, the initial candidate topic words can be preliminarily corrected through the topic word dictionary, that is, the initial candidate topic words that do not exist in the topic word dictionary are removed; and then the secondary correction is performed through the topic word screening rule “the text content in the book title marks and double quotation marks is the topic word”, that is, the initial candidate topic words that are not related to the book title marks and double quotation marks are removed, and finally the intermediate candidate topic words can be obtained according to the correction result.

[0156] Step S420: Query the keyword knowledge graph based on the intermediate candidate keywords to obtain the associated keywords corresponding to the intermediate candidate keywords.

[0157] Step S422: Construct a candidate thesaurus based on intermediate candidate keywords and related keywords.

[0158] Considering that a subject term knowledge graph is constructed by combining the relationships between the subject term's corresponding category, hypernym, hyponym, related words, and synonyms, combining a subject term knowledge graph can expand candidate subject terms from multiple dimensions.

[0159] Based on this, by selecting intermediate subject terms with relationships such as category, superordinate term, subordinate term, related term, and synonym in the subject term knowledge graph, associated subject terms are obtained. That is, the initial candidate subject term is "business environment". By querying the subject term knowledge graph through this subject term, the associated subject terms {human environment, market environment} can be determined. Then, the candidate subject term table {human environment, market environment, business environment} is constructed by combining the intermediate candidate subject terms and associated subject terms.

[0160] Step S424: By querying the preset word vector set, determine the initial news word vector corresponding to the initial news topic word, and the candidate word vector corresponding to each topic word contained in the candidate topic word list.

[0161] By querying the tx word vector set, we can obtain the word vector w1 corresponding to the initial news topic "business environment", the word vector w2 corresponding to the candidate topic "humanistic environment", the word vector w3 corresponding to the candidate topic "market environment", and the word vector w4 corresponding to the candidate topic "business environment".

[0162] Step S426: Calculate the similarity between the initial news word vector and each candidate word vector, and determine the target candidate topic words based on the similarity calculation results.

[0163] The Spearman correlation coefficients were calculated between the word vectors w2, w3, and w4 corresponding to the candidate topic terms and the word vector w1 of the initial news topic terms. Based on the calculation results, the similarity between the initial news topic term "business environment" and the candidate topic term "humanistic environment" was determined to be 0.728, the similarity between the initial news topic term "business environment" and the candidate topic term "market environment" was determined to be 0.878, and the similarity between the initial news topic term "business environment" and the candidate topic term "business environment" was determined to be 1.

[0164] Furthermore, the similarity is compared with the preset similarity threshold of 0.8, and candidate keywords with low relevance are removed from the candidate keyword list. Based on the comparison results, the target candidate keywords are determined to be "market environment" and "business environment".

[0165] Step S428: Determine the document title and document content corresponding to the news document to be processed.

[0166] Step S430: The language model is used to process the document title and document content of the news document to be processed to obtain the first vector corresponding to the document title and the second vector corresponding to the document content.

[0167] Step S432: Calculate the cosine similarity based on the word vectors, the first vector, and the second word vectors corresponding to the target candidate topic words, and determine the target topic words based on the cosine similarity calculation results.

[0168] First, the document title and content of the document to be processed are determined. Then, the document title and content are processed separately using a BERT pre-trained language model to obtain their respective semantic representations, namely the first vector and the second vector. Specifically, the vector corresponding to [CLS] and the average of the sentence vectors are used as the sentence vectors corresponding to the title and the article, respectively.

[0169] Secondly, taking cosine similarity as an example, the cosine similarity between the target candidate word vector and the first and second vectors is calculated using the following formula. This determines that the cosine similarity between the target candidate word "market environment" and the document title of the news document to be processed is S11, and the cosine similarity with the document content is S12. Similarly, the cosine similarity between the target candidate word "business environment" and the document title of the news document to be processed is S21, and the cosine similarity with the document content is S22.

[0170]

[0171] Where similarity represents cosine similarity; A represents the word vector corresponding to the target candidate topic word; B represents the first vector or the second vector; and N represents the dimension of the vector.

[0172] Next, after obtaining the cosine similarity, the similarity score corresponding to each target candidate keyword is determined by weighted summation. That is, the similarity score of the target candidate keyword "market environment" is (S11*a+S12*b)=D1, and the similarity score of the target candidate keyword "business environment" is (S21*a+S22*b)=D2.

[0173] Finally, the target candidate keywords are sorted according to their similarity scores. Based on the sorting results, if D2 > D1, then the target candidate keyword "business environment" can be selected as the target keyword for the news document to be processed.

[0174] In summary, by using a small amount of labeled data and combining the BERT language model, rules, and a dictionary, we extract article keywords through sequence labeling, construct a knowledge graph using a vocabulary found online to expand the keyword pool, and calculate relevant scores based on candidate keywords, titles, and article content during the final topic selection process to increase the model's accuracy and thus improve the precision of keyword extraction.

[0175] Corresponding to the above method embodiments, this application also provides text processing apparatus embodiments. Figure 5 A schematic diagram of the structure of a text processing apparatus according to an embodiment of this application is shown. Figure 5 As shown, the device includes:

[0176] The acquisition module 502 is configured to acquire the text to be processed and determine the baseline keywords and text components of the text to be processed;

[0177] Processing module 504 is configured to input the text to be processed into a topic word extraction model for processing, and determine candidate topic words based on the processing results;

[0178] The construction module 506 is configured to query the knowledge graph based on the candidate topic words to obtain related topic words, and to construct a candidate topic word table corresponding to the text to be processed based on the related topic words and the candidate topic words;

[0179] The filtering module 508 is configured to filter the text keywords corresponding to the text to be processed from the candidate keyword list based on the benchmark keywords and the text components.

[0180] In an optional embodiment, the acquisition module 502 is further configured to:

[0181] The text to be processed is input into a sequence labeling model for processing to obtain the labeling information corresponding to each character unit in the text to be processed; in the labeling information corresponding to each character unit, the starting labeling information and the intermediate labeling information are determined; according to the starting labeling information and the intermediate labeling information, the starting character unit and the intermediate character unit are determined in the text to be processed; the baseline keyword is generated based on the starting character unit and the intermediate character unit.

[0182] In an optional embodiment, the processing module 504 is further configured to:

[0183] The text to be processed is input into the topic word extraction model for processing to obtain initial candidate topic words; the initial candidate topic words are filtered according to a preset topic dictionary and correction rules, and the candidate topic words are determined based on the filtering results.

[0184] In an optional embodiment, the processing module 504 is further configured to:

[0185] The target domain corresponding to the text to be processed is determined, and multiple business texts associated with the target domain are obtained; each business text in the multiple business texts is standardized to obtain multiple target business texts; each target business text in the multiple target business texts is subject-term tagging to obtain business subject terms corresponding to each target business text; the subject dictionary is constructed based on the business subject terms corresponding to each target business text.

[0186] In one optional embodiment, the construction of the knowledge graph includes:

[0187] The topic dictionary contains business topic terms, which are then queried in the topic term database to obtain associated business topic terms. The topic term relationships between the business topic terms and the associated business topic terms are established. Based on the topic term relationships, the business topic terms, and the associated business topic terms, the knowledge graph is constructed.

[0188] In an optional embodiment, the building module 506 is further configured to:

[0189] In the knowledge graph, the target node corresponding to the candidate topic word is determined, and the associated node that has a direct mapping relationship with the target node is determined; the topic word corresponding to the associated node is selected as the associated topic word corresponding to the candidate topic word.

[0190] In an optional embodiment, the filtering module 508 is further configured to:

[0191] Calculate the similarity between the baseline topic terms and the topic terms contained in the candidate topic term list, and generate an intermediate candidate topic term list based on the similarity calculation results; filter the intermediate candidate topic term list according to the text component elements, and determine the text topic terms corresponding to the text to be processed based on the filtering results.

[0192] In an optional embodiment, the filtering module 508 is further configured to:

[0193] The text title and text sentence unit in the text components are determined; a first similarity is calculated between the text title and the intermediate candidate keywords contained in the intermediate candidate keyword list, and a second similarity is calculated between the text sentence unit and the intermediate candidate keywords contained in the intermediate candidate keyword list; based on the first similarity and the second similarity, the text keywords are selected from the intermediate candidate keyword list.

[0194] In an optional embodiment, the filtering module 508 is further configured to:

[0195] The first similarity and the second similarity are weighted and averaged to obtain the candidate word score corresponding to each intermediate candidate word in the intermediate candidate word list; the intermediate candidate words in the intermediate candidate word list are sorted according to the candidate word scores to obtain an intermediate candidate word sequence; at least one intermediate candidate word is selected from the intermediate candidate word sequence according to a preset word selection strategy as the text word.

[0196] In an optional embodiment, the filtering module 508 is further configured to:

[0197] Determine the benchmark topic word vector corresponding to the benchmark topic word, and the candidate topic word vector corresponding to the topic words included in the candidate topic word list; calculate the word vector similarity between the benchmark topic word vector and each candidate topic word vector; compare the word vector similarity with a preset similarity threshold, and select intermediate candidate topic words from the candidate topic word list according to the comparison result to form the intermediate candidate topic word list.

[0198] In an optional embodiment, the filtering module 508 is further configured to:

[0199] Determine the first sentence vector corresponding to the text title, and the intermediate candidate topic word vectors corresponding to the intermediate candidate topic words contained in the intermediate candidate topic word list, and calculate the first similarity between the first sentence vector and each intermediate candidate topic word vector; correspondingly, calculating the second similarity between the text sentence unit and the intermediate candidate topic words contained in the intermediate candidate topic word list includes: determining the second sentence vector corresponding to the text sentence unit, and calculating the second similarity between the second sentence vector and each intermediate candidate topic word vector.

[0200] In an optional embodiment, the processing module 504 is further configured to:

[0201] The text features corresponding to the text to be processed are constructed and input into the topic word extraction model. The text features are encoded by the encoding unit in the topic word extraction model to obtain an encoding vector. The encoding vector is transformed by the network unit in the topic word extraction model to obtain a hidden state vector. The hidden state vector is labeled by the linear unit in the topic word extraction model to obtain a label corresponding to each character unit in the text to be processed. The initial candidate topic words corresponding to the text to be processed are determined according to the labels corresponding to each character unit, and the topic word extraction model is output.

[0202] The text processing apparatus provided in this application, after acquiring the text to be processed, can first determine its corresponding baseline keywords and text component elements. Then, it obtains candidate keywords corresponding to the text to be processed through a keyword extraction model, and further determines related keywords corresponding to the text to be processed by combining a knowledge graph. At this point, a candidate keyword list can be constructed by combining the candidate keywords and related keywords, expanding the keyword list from multiple dimensions so that all candidate keywords in the keyword list are related to the text to be processed. Based on this, the candidate keyword list is then filtered using baseline keywords and text component elements to obtain the text keywords corresponding to the text to be processed. This achieves keyword extraction by combining a knowledge graph and a model, which can further improve the accuracy of keyword extraction. Furthermore, the introduction of baseline keywords and text component elements in this process increases the correlation between the extracted keywords and the text to be processed, thus making it more convenient for downstream business use.

[0203] The above is an illustrative scheme of a text processing device according to this embodiment. It should be noted that the technical solution of this text processing device and the technical solution of the aforementioned text processing method belong to the same concept. Details not described in detail in the technical solution of the text processing device can be found in the description of the technical solution of the aforementioned text processing method. Furthermore, the components in the device embodiment should be understood as functional modules necessary to implement each step of the program flow or each step of the method; these functional modules are not actual functional divisions or separations. A device claim defined by such a set of functional modules should be understood as a functional module architecture that primarily implements the solution through the computer program described in the specification, and not as a physical device that primarily implements the solution through hardware.

[0204] Figure 6 A structural block diagram of a computing device 600 according to an embodiment of this application is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.

[0205] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0206] In one embodiment of this application, the aforementioned components of the computing device 600 and Figure 6 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.

[0207] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 600 can also be a mobile or stationary server.

[0208] The processor 620 is used to execute computer-executable instructions for the text processing method.

[0209] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above-described text processing method belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the above-described text processing method.

[0210] One embodiment of this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used for a text processing method.

[0211] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above-described text processing method belong to the same concept, and all details not described in detail in the technical solution of the storage medium can be found in the description of the technical solution of the above-described text processing method.

[0212] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0213] An embodiment of this application also provides a chip that stores a computer program, which, when executed by the chip, implements the steps of the **** method.

[0214] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0215] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0216] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.

Claims

1. A text processing method, characterized in that, include: Obtain the text to be processed, and determine the baseline keywords and text components of the text to be processed; The text to be processed is input into the topic word extraction model for processing, and candidate topic words are determined based on the processing results. Based on the candidate topic terms, the knowledge graph is queried to obtain related topic terms, and a candidate topic term table corresponding to the text to be processed is constructed according to the related topic terms and the candidate topic terms; Calculate the similarity between the baseline topic terms and the topic terms contained in the candidate topic term list. Generate an intermediate candidate topic term list based on the similarity calculation results. Determine the text title and text sentence units in the text components. Calculate the first similarity between the text title and the intermediate candidate topic terms contained in the intermediate candidate topic term list, and calculate the second similarity between the text sentence units and the intermediate candidate topic terms contained in the intermediate candidate topic term list. Based on the first similarity and the second similarity, select the text topic terms corresponding to the text to be processed from the intermediate candidate topic term list.

2. The method according to claim 1, characterized in that, The determination of the baseline keyword for the text to be processed includes: The text to be processed is input into a sequence labeling model for processing to obtain the labeling information corresponding to each word unit in the text to be processed. In the annotation information corresponding to each character unit, determine the starting annotation information and the intermediate annotation information; Based on the initial annotation information and the intermediate annotation information, determine the starting character unit and the intermediate character unit in the text to be processed; The baseline keyword is generated based on the starting character unit and the intermediate character unit.

3. The method according to claim 1, characterized in that, The process of inputting the text to be processed into a topic word extraction model for processing, and determining candidate topic words based on the processing results, includes: The text to be processed is input into the topic word extraction model for processing to obtain initial candidate topic words; The initial candidate keywords are filtered according to a preset subject dictionary and correction rules, and the candidate keywords are determined based on the filtering results.

4. The method according to claim 3, characterized in that, The determination of the subject dictionary includes: Determine the target domain corresponding to the text to be processed, and obtain multiple business texts associated with the target domain; The various business texts are standardized to obtain multiple target business texts. Each of the multiple target business texts is labeled with a keyword to obtain the business keyword corresponding to each target business text. The topic dictionary is constructed based on the business topic words corresponding to each target business text.

5. The method according to claim 4, characterized in that, The construction of the knowledge graph includes: The related business topic terms associated with the business topic terms are obtained by querying the topic term database based on the business topic terms contained in the topic dictionary. Establish the keyword relationship between the business keyword and the related business keyword; The knowledge graph is constructed based on the topic word relationships, the business topic words, and the related business topic words.

6. The method according to claim 1, characterized in that, The process of obtaining related topic terms by querying the knowledge graph based on the candidate topic terms includes: In the knowledge graph, the target node corresponding to the candidate topic term is determined, and the associated node that has a direct mapping relationship with the target node is determined; Select the topic words corresponding to the associated nodes as the associated topic words corresponding to the candidate topic words.

7. The method according to claim 1, characterized in that, The step of filtering text topic terms corresponding to the text to be processed from the intermediate candidate topic term list based on the first similarity and the second similarity includes: The first similarity and the second similarity are weighted and averaged to obtain the candidate word score corresponding to each intermediate candidate topic word in the intermediate candidate topic word list; The intermediate candidate keywords contained in the intermediate candidate keyword list are sorted according to the candidate keyword scores to obtain an intermediate candidate keyword sequence; According to the preset keyword selection strategy, at least one intermediate candidate keyword is selected from the intermediate candidate keyword sequence as the text keyword.

8. The method according to claim 1, characterized in that, The step of calculating the similarity between the baseline topic terms and the topic terms contained in the candidate topic term list, and generating an intermediate candidate topic term list based on the similarity calculation results, includes: Determine the benchmark topic word vector corresponding to the benchmark topic word, and the candidate topic word vector corresponding to the topic words contained in the candidate topic word list; Calculate the word vector similarity between the baseline topic word vector and each candidate topic word vector; The word vector similarity is compared with a preset similarity threshold, and intermediate candidate topic words are selected from the candidate topic word list based on the comparison results to form the intermediate candidate topic word list.

9. The method according to claim 1, characterized in that, The calculation of the first similarity between the text title and the intermediate candidate topic terms contained in the intermediate candidate topic term list includes: Determine the first sentence vector corresponding to the text title, and the intermediate candidate topic word vectors corresponding to the intermediate candidate topic words contained in the intermediate candidate topic word list, and calculate the first similarity between the first sentence vector and each intermediate candidate topic word vector; Accordingly, calculating the second similarity between the text sentence unit and the intermediate candidate topic terms included in the intermediate candidate topic term list includes: Determine the second sentence vector corresponding to the text sentence unit, and calculate the second similarity between the second sentence vector and each intermediate candidate topic word vector.

10. The method according to claim 3, characterized in that, The step of inputting the text to be processed into the topic word extraction model for processing to obtain initial candidate topic words includes: Construct the text features corresponding to the text to be processed, and input the text features into the topic word extraction model; The text features are encoded using the encoding units in the topic word extraction model to obtain an encoding vector; The encoding vector is transformed by the network units in the topic word extraction model to obtain the hidden state vector; The hidden state vector is labeled by the linear unit in the topic word extraction model to obtain the label corresponding to each character unit in the text to be processed. The initial candidate topic words corresponding to the text to be processed are determined based on the label corresponding to each character unit, and the topic word extraction model is output.

11. A text processing device, characterized in that, include: The acquisition module is configured to acquire the text to be processed and determine the baseline keywords and text components of the text to be processed; The processing module is configured to input the text to be processed into the topic word extraction model for processing, and determine candidate topic words based on the processing results; The construction module is configured to query a knowledge graph based on the candidate topic terms to obtain related topic terms, and to construct a candidate topic term table corresponding to the text to be processed based on the related topic terms and the candidate topic terms; The filtering module is configured to calculate the similarity between the baseline topic terms and the topic terms contained in the candidate topic term list, generate an intermediate candidate topic term list based on the similarity calculation results, determine the text title and text sentence units in the text components, calculate the first similarity between the text title and the intermediate candidate topic terms contained in the intermediate candidate topic term list, and calculate the second similarity between the text sentence units and the intermediate candidate topic terms contained in the intermediate candidate topic term list, and filter the text topic terms corresponding to the text to be processed from the intermediate candidate topic term list based on the first similarity and the second similarity.

12. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the method according to any one of claims 1 to 10.

13. A computer-readable storage medium storing computer instructions, characterized in that, When executed by a processor, this instruction implements the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Question answering method and device based on knowledge graph

    CN113282729A

  • Short text classification method fusing knowledge graph and topic model

    CN114491062A