Keyword extraction method and device, equipment, medium and product
By combining the keyword extraction methods of the first language model and the second language model, the problem of keyword extraction errors and difficulty in extracting new keywords in the prior art is solved, and the improvement of high precision and generalization capabilities is achieved.
Patent Information
- Application Number
- CN202510045300.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-04-18
AI Technical Summary
The prior art is prone to errors in the keyword extraction process and it is difficult to extract new keywords outside the keyword collection, resulting in poor overall results.
Keyword extraction is performed using a combination of two language models: the first language model extracts keywords directly from the text, without being limited to pre-configured keyword collections, and the second language model combines keyword collections to ensure the accuracy of the extraction.
It not only ensures high-precision extraction of existing keywords, but also improves the ability to generalize new keywords and enhances the overall effect of keyword extraction.
Smart Images

Figure CN119849495A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a keyword extraction method, device, electronic device, computer-readable storage medium, and computer program product. Background Art
[0002] With the continuous development of computer technology, more and more businesses involve keyword extraction processes. In related technologies, keywords in original texts are usually extracted by matching based on a pre-configured keyword set.
[0003] However, the above method is prone to keyword extraction errors, and it is difficult to extract new keywords outside the keyword set, and the overall effect of keyword extraction is not good. Summary of the invention
[0004] The present application provides a keyword extraction method. The method not only ensures high-precision extraction of existing keywords in the first keyword set, but also improves the generalization ability of the language model for new keywords. The present application also provides a device, an electronic device, a computer-readable storage medium, and a computer program product corresponding to the above method.
[0005] In a first aspect, the present application provides a keyword extraction method, the method comprising:
[0006] Get the first text;
[0007] Extracting keywords from the first text using a first language model to obtain first keywords; and extracting keywords from the first text using a second language model in combination with a preconfigured first keyword set to obtain second keywords; wherein the first keyword set is used to indicate a plurality of third keywords belonging to the keyword;
[0008] A target keyword of the first text is determined according to the first keyword and the second keyword.
[0009] In some possible implementations, extracting keywords from the first text using a first language model to obtain first keywords includes:
[0010] Generate a first prompt word; wherein the first prompt word includes the first text and information indicating that keywords are extracted from the first text;
[0011] The first prompt word is sent to a first language model, and a first keyword returned by the first language model is received.
[0012] In some possible implementations, extracting keywords from the first text using a second language model in combination with a preconfigured first keyword set to obtain second keywords includes:
[0013] Generate a second prompt word; wherein the second prompt word includes a pre-configured first keyword set, the first text, and information indicating that keywords are extracted from the first text based on the first keyword set;
[0014] The second prompt word is sent to a second language model, and a second keyword returned by the second language model is received.
[0015] In some possible implementations, the first keyword set includes multiple third keywords and business information associated with each of the third keywords.
[0016] In some possible implementations, determining a target keyword of the first text according to the first keyword and the second keyword includes:
[0017] In response to the first keyword being not empty and the second keyword being empty, determining the first keyword as a target keyword of the first text;
[0018] Otherwise, the second keyword is determined as the target keyword of the first text.
[0019] In some possible implementations, obtaining the first text includes:
[0020] In response to a text input operation triggered on a document page, obtaining a first text;
[0021] The method further comprises:
[0022] In the document page, target keywords of the first text are presented in a target presentation manner.
[0023] In some possible implementations, the first language model is trained in the following manner:
[0024] Obtaining training text and annotation results of the training text in different fields;
[0025] Determining a target annotation result of the training text according to the annotation results of the training text in different fields;
[0026] The first language model is fine-tuned using the training text and the target annotation result of the training text.
[0027] In some possible implementations, the method further includes:
[0028] Determine a second keyword set; wherein the second keyword set is used to indicate a plurality of fourth keywords that are not keywords;
[0029] After extracting keywords from the first text using the first language model to obtain the first keyword, the method further includes:
[0030] In response to the first keyword being the same as any fourth keyword in the second keyword set, the first keyword is filtered out.
[0031] In a second aspect, the present application provides a keyword extraction device, the device comprising:
[0032] An acquisition module, used for acquiring a first text;
[0033] an extraction module, configured to extract keywords from the first text using a first language model to obtain first keywords; and, in combination with a pre-configured first keyword set, extract keywords from the first text using a second language model to obtain second keywords; wherein the first keyword set is used to indicate a plurality of third keywords belonging to the keyword;
[0034] A determination module is used to determine a target keyword of the first text according to the first keyword and the second keyword.
[0035] In some possible implementations, the extraction module is specifically used to:
[0036] Generate a first prompt word; wherein the first prompt word includes the first text and information indicating that keywords are extracted from the first text;
[0037] The first prompt word is sent to a first language model, and a first keyword returned by the first language model is received.
[0038] In some possible implementations, the extraction module is specifically used to:
[0039] Generate a second prompt word; wherein the second prompt word includes a pre-configured first keyword set, the first text, and information indicating that keywords are extracted from the first text based on the first keyword set;
[0040] The second prompt word is sent to a second language model, and a second keyword returned by the second language model is received.
[0041] In some possible implementations, the first keyword set includes multiple third keywords and business information associated with each of the third keywords.
[0042] In some possible implementations, the determining module is specifically configured to:
[0043] In response to the first keyword being not empty and the second keyword being empty, determining the first keyword as a target keyword of the first text;
[0044] Otherwise, the second keyword is determined as the target keyword of the first text.
[0045] In some possible implementations, the acquisition module is specifically used to:
[0046] In response to a text input operation triggered on a document page, obtaining a first text;
[0047] The device further comprises a presentation module, wherein the presentation module is configured to:
[0048] In the document page, target keywords of the first text are presented in a target presentation manner.
[0049] In some possible implementations, the first language model is trained in the following manner:
[0050] Obtaining training text and annotation results of the training text in different fields;
[0051] Determining a target annotation result of the training text according to the annotation results of the training text in different fields;
[0052] The first language model is fine-tuned using the training text and the target annotation result of the training text.
[0053] In some possible implementations, the determining module is further configured to:
[0054] Determine a second keyword set; wherein the second keyword set is used to indicate a plurality of fourth keywords that are not keywords;
[0055] The extraction module is also used for:
[0056] In response to the first keyword being the same as any fourth keyword in the second keyword set, the first keyword is filtered out.
[0057] In a third aspect, the present application provides an electronic device, the electronic device comprising a processor and a memory. The processor and the memory communicate with each other. The processor is used to execute instructions stored in the memory so that the electronic device performs the keyword extraction method in the first aspect or any implementation of the first aspect.
[0058] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, wherein the instructions instruct an electronic device to execute the keyword extraction method described in the first aspect or any one of the implementations of the first aspect.
[0059] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the keyword extraction method described in the first aspect or any one of the implementations of the first aspect.
[0060] Based on the implementations provided in the above aspects, the present application can also be further combined to provide more implementations.
[0061] It can be seen from the above technical solutions that this application has the following advantages:
[0062] The present application provides a keyword extraction method, which first obtains a first text, extracts keywords from the first text using a first language model to obtain first keywords, and, in combination with a preconfigured first keyword set, extracts keywords from the first text using a second language model to obtain second keywords, wherein the first keyword set is used to indicate multiple third keywords belonging to the keyword, and a target keyword of the first text is determined based on the first keyword and the second keyword.
[0063] In this method, for the scenario of extracting keywords from text, a combination of two extraction methods is used to extract keywords. Keywords are directly extracted from the first text through the first language model, which is not limited to the first keyword set and can extract new keywords included in the first text. Keywords are extracted from the first text through the second language model combined with the first keyword set to ensure the accuracy of keyword extraction. In this way, the first keywords and second keywords extracted by the two extraction methods are combined to finally determine the target keywords of the first text, which not only ensures high-precision extraction of existing keywords in the first keyword set, but also improves the generalization ability of the language model for new keywords, thereby enhancing the overall effect of keyword extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.
[0065] Figure 1 A flowchart of a keyword extraction method provided in an embodiment of the present application;
[0066] Figure 2 A schematic diagram of the structure of a keyword extraction device provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0068] The terms "first" and "second" in the embodiments of the present application are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0069] First, some technical terms and application scenarios involved in the embodiments of this application are introduced.
[0070] Keyword extraction usually refers to the process of extracting keywords from the original text. In the related art, keywords in the original text are usually extracted by matching based on a pre-configured keyword set. In specific implementation, the user (for example, a business person) maintains a keyword set, which stores keywords that have appeared in historical business. In the process of keyword extraction, a string matching method is used to determine whether there are words in the original text that are the same as those in the keyword set. If so, the keywords are extracted from the original text.
[0071] However, the above method has the following defects: First, the string matching method is prone to keyword extraction errors. For example, the original text is "release new products to the outside", and the pre-configured keyword set contains the keyword "external", and the string matching method is used to extract the keyword "external". However, in the above original text, "external" is part of "external release" and does not belong to the keywords that should be extracted, resulting in keyword extraction errors. In addition, the string matching method is limited to the pre-configured keyword set. It is difficult to effectively extract newly emerging keywords outside the keyword set, and the overall effect of keyword extraction is not good.
[0072] In view of this, the present application provides a keyword extraction method, which first obtains a first text, extracts keywords from the first text using a first language model to obtain first keywords, and, in combination with a preconfigured first keyword set, extracts keywords from the first text using a second language model to obtain second keywords, wherein the first keyword set is used to indicate multiple third keywords belonging to the keyword, and the target keyword of the first text is determined based on the first keyword and the second keyword.
[0073] In this method, for the scenario of extracting keywords from text, a combination of two extraction methods is used to extract keywords. Keywords are directly extracted from the first text through the first language model, which is not limited to the first keyword set and can extract new keywords included in the first text. Keywords are extracted from the first text through the second language model combined with the first keyword set to ensure the accuracy of keyword extraction. In this way, the first keywords and second keywords extracted by the two extraction methods are combined to finally determine the target keywords of the first text, which not only ensures high-precision extraction of existing keywords in the first keyword set, but also improves the generalization ability of the language model for new keywords, thereby enhancing the overall effect of keyword extraction.
[0074] To facilitate understanding of the technical solution provided by the embodiments of the present application, the following will be described in conjunction with the accompanying drawings. Figure 1 The flowchart of a keyword extraction method shown in FIG. 1 is a flowchart of a keyword extraction method, the method specifically includes:
[0075] S101: Obtain a first text.
[0076] In the embodiment of the present application, the first text can be understood as any text that has a keyword extraction requirement.
[0077] The source of the first text may be different. For example, in a document scenario, the first text may be text in a document or text entered by a user in a document page. For another example, in a video conference scenario, the first text may be text in a conference record or text in a conference minutes. For another example, in an instant messaging (IM) scenario, the first text may be text in an IM message (e.g., a single chat message or a group chat message) or text entered by a user in an IM page.
[0078] Taking the first text as an example, the application scenario of the keyword extraction method provided in the embodiment of the present application is described. When a user (for example, a professional in a certain field) edits a document, the user's professional knowledge in the field is often used in the input text, such as proper nouns (such as the "transformers model" in the field of artificial intelligence), idiomatic formulas, abbreviations, abbreviations (such as abbreviating "open platform" to "Kaiping"), etc. These words related to the professional knowledge in the user's field will increase the difficulty of understanding the content of the document for the document readers, especially readers in different fields. Therefore, it is necessary to perform keyword extraction on the text entered by the user in the document page during the user's editing of the document, that is, to obtain the first text in response to the text input operation triggered on the document page.
[0079] S102: extracting keywords from the first text using the first language model to obtain first keywords, and extracting keywords from the first text using the second language model in combination with a preconfigured first keyword set to obtain second keywords.
[0080] The process of extracting keywords from the first text can be understood as the process of determining whether the keywords exist in the first text. Under different extraction requirements, keywords can have different types, for example, keywords can be difficult to understand words, entity words, words related to names, etc., which are not limited in the embodiments of the present application.
[0081] In the embodiment of the present application, two extraction methods are used to extract keywords from the first text respectively to obtain the first keyword and the second keyword. In other words, the first keyword and the second keyword are keywords extracted from the first text, and the first keyword and the second keyword are both partial texts in the first text.
[0082] In the first extraction method, the first language model is used to directly extract keywords from the first text. The first language model has natural language processing capabilities, can understand the meaning of natural language, and process different types of natural language tasks. For example, the first language model can be a deep learning model trained using text data.
[0083] In some embodiments, the first language model may be a language model specifically used for extracting keywords. That is, the first language model may be used to perform a keyword extraction task, and by sending the first text to the first language model, the first language model may return the extracted first keyword.
[0084] In other embodiments, the first language model extracts keywords from the first text based on prompt learning. Among them, prompt words can be used to guide the language model to perform specific outputs in generative tasks (such as text generation tasks, question-answering tasks, and dialogue tasks). By configuring prompt words, the language model is helped to understand the background and requirements of the task, so that the language model can handle different types of natural language processing tasks without retraining the language model, thereby increasing the scalability and flexibility of the language model.
[0085] In a specific implementation, a first prompt word is generated, the first prompt word is sent to a first language model, and a first keyword returned by the first language model is received.
[0086] The first prompt word includes the first text and information indicating that keywords are extracted from the first text. That is, by configuring the first text and information for instructing the first language model to extract keywords in the first prompt word, the first language model can determine whether there are keywords in the first text (for example, whether there are difficult-to-understand words, entity words, words involving names, etc.) based on the prompting ability of the first prompt word, and output the extracted first keywords, thereby improving the applicability of keyword extraction.
[0087] In some possible implementations, considering that the first text may be related to a specific business, there may be certain differences in extracting keywords in different businesses. Therefore, the information in the first prompt word indicating that keywords are extracted from the first text may also specifically indicate that keywords are extracted from the first text in a specific business. For example, the first prompt word may include information indicating that keywords are extracted from the first text in a product sales business, or the first prompt word may also include information indicating that keywords are extracted from the first text in a demand review business.
[0088] Taking the keyword as an incomprehensible word as an example, the first prompt word is exemplified and described. The first prompt word may be:
[0089] “Your task is to identify and extract difficult-to-understand words from a given text. These words may include professional terms in the Internet industry, overly abstract words, or rare English abbreviations.
[0090] The text is as follows: [First text]
[0091] Please return the extracted incomprehensible words. "
[0092] Since the first language model can directly extract keywords from the first text without any other restrictions, the process of extracting keywords from the first text by the first language model has good generalization performance, which helps to discover new keywords that have not been encountered during business operations.
[0093] Since the first language model directly extracts keywords from the first text, considering the keyword extraction performance of the first language model, the first language model can be fine-tuned in the following ways: obtaining a training text and annotation results of the training text in different fields, determining a target annotation result of the training text according to the annotation results of the training text in different fields, and fine-tuning the first language model using the training text and the target annotation result of the training text.
[0094] The annotation results of the training text in different fields can be understood as the annotation results after the training text is annotated by users in different fields (for example, annotators), and the annotation results can be words that belong to keywords in the training text. That is to say, in the embodiment of the present application, users in different fields annotate the same training text, so that users in different fields annotate words that they believe belong to keywords in the training text, and obtain the annotation results of the training text in different fields.
[0095] Next, the annotation results of the training text in different fields are integrated to obtain the target annotation results of the training text, so that the annotation results in different fields are consistent with each other under the same training text and similar context, such as the consistency of the vocabulary itself and the consistency between words. For example, the annotation results of the training text in field A show that the vocabulary belonging to the keywords in the training text is vocabulary A and vocabulary B, and the annotation results of the training text in field B show that the vocabulary belonging to the keywords in the training text is vocabulary B and vocabulary C. By integrating the annotation results of the training text in different fields, the target annotation results of the training text can show that the vocabulary belonging to the keywords in the training text is vocabulary A, vocabulary B and vocabulary C, that is, the target annotation result is the union of the annotation results of the training text in different fields.
[0096] In this way, the first language model is fine-tuned using the training text and the target annotation results of the training text, so that the first language model can learn keywords in different fields and expand the recall rate of the first language model, so that the first language model can better discover new keywords existing in the first text.
[0097] Furthermore, considering possible erroneous recall situations, a second keyword set may also be determined, wherein the second keyword set is used to indicate a plurality of fourth keywords that are not keywords.
[0098] In other words, the second keyword set can be understood as "white list words" that are not keywords. The embodiment of the present application does not limit the source of multiple fourth keywords in the second keyword set. For example, the fourth keyword can be manually added to the second keyword set by the user. For another example, the fourth keyword can be related to the business, and different businesses correspond to different second keyword sets. For another example, the fourth keyword can also be determined based on word frequency, and the words whose appearance frequency in historical documents meets the set conditions (such as the appearance frequency is greater than the set threshold) are added as fourth keywords to the second keyword set.
[0099] In this case, after the first keyword is obtained by extracting keywords from the first text using the first language model, the first keyword is filtered out in response to the first keyword being the same as any fourth keyword in the second keyword set.
[0100] In other words, when the first keyword extracted from the first text by the first language model belongs to the "white list vocabulary", the first keyword is automatically filtered out. In this way, too many first keywords that are not keywords are prevented from being extracted, and the accuracy of the first language model directly extracting keywords from the first text is improved, thereby ensuring the keyword extraction effect.
[0101] In the second extraction method, the second language model is used in combination with the pre-configured first keyword set to extract keywords from the first text. Similarly, the second language model has natural language processing capabilities, can understand the meaning of natural language, and process different types of natural language tasks. For example, the second language model can be a deep learning model trained using text data.
[0102] The first keyword set can be used to indicate multiple third keywords belonging to the keyword. In other words, the first keyword set stores multiple known third keywords. The embodiment of the present application does not limit the source of the third keyword. For example, the third keyword can be a keyword extracted during the historical keyword extraction process, or the third keyword can also be manually added to the first keyword set by the user.
[0103] The first keyword set may have different forms. For example, the first keyword set may be in a word list form.
[0104] That is, the process of extracting keywords from the first text in combination with the preconfigured first keyword set can be understood as a process of determining whether multiple third keywords in the first keyword set exist in the first text. The second keyword extracted by the second extraction method is the same as a third keyword in the first keyword set.
[0105] Similar to the first language model, in some embodiments, the second language model may be a language model specifically used for extracting keywords. That is, the second language model may be used to perform a keyword extraction task, and by sending the first text and the first keyword set to the second language model, the second language model may return the extracted second keywords.
[0106] In some other embodiments, the second language model extracts keywords from the first text based on prompt learning. In specific implementation, a second prompt word is generated, the second prompt word is sent to the second language model, and a second keyword returned by the second language model is received.
[0107] The second prompt word includes a pre-configured first keyword set, a first text, and information indicating that keywords are extracted from the first text based on the first keyword set. That is, by configuring the first text and the first keyword set in the first prompt word, the first language model can determine whether there is a third keyword in the first keyword set in the first text based on the prompt capability of the first prompt word, and when the third keyword in the first keyword set exists in the first text, the extracted second keyword is output.
[0108] Taking the case where the keywords are difficult-to-understand words and the first keyword set is a word list as an example, the second prompt word is exemplified and described. The second prompt word may be:
[0109] “Your task is to determine whether a word from a given vocabulary exists in a given text, and if so, extract the word from the text.
[0110] The text is as follows: [First text]
[0111] The vocabulary is as follows: [First keyword set]
[0112] Please return the extracted vocabulary."
[0113] Since the second language model extracts keywords from the first text in combination with the first keyword set, the second keywords extracted by the second language model are more credible and accurate.
[0114] In some possible implementations, the first keyword set may include multiple third keywords and business information associated with each third keyword.
[0115] That is to say, the first keyword set not only stores the third keyword, but also stores the business information associated with the third keyword, such as information about in what business the third keyword is a keyword and in what business it is not a keyword. In this way, by additionally configuring the business information associated with each third keyword in the first keyword set, during the keyword extraction process, the second language model can combine the first text and the business information associated with each third keyword in the first keyword set to make a comprehensive judgment on whether the second keyword exists in the first text. For example, the second language model determines that the third keyword in the first keyword set exists in the first text, and then the second language model can also determine the business information corresponding to the first text, determine whether the business information corresponding to the first text satisfies the business information associated with the third keyword in the first keyword set, and then determine whether to output the third keyword as the extracted second keyword.
[0116] In this way, the keyword extraction process is more closely related to the business, and targeted keyword extraction can be performed for different businesses to meet the personalized needs of keyword extraction under different businesses.
[0117] In addition, multiple third keywords in the first keyword set can also be gradually updated as the business runs. For example, the keywords encountered during the business operation are added to the first keyword set to enrich the content of the first keyword set and ensure that the same keywords can be accurately extracted when encountered again during subsequent keyword extraction.
[0118] S103: Determine a target keyword of the first text according to the first keyword and the second keyword.
[0119] The target keyword can be understood as the extraction result of keyword extraction from the first text. In the embodiment of the present application, the first keyword and the second keyword extracted by the two extraction methods are combined to determine the extraction result of keyword extraction from the first text.
[0120] In some possible implementations, the first keyword and the second keyword are analyzed using a determination model to determine a target keyword for the first text. In a specific implementation, the first keyword and the second keyword are input into the determination model, a determination result output by the determination model is received, and the keyword indicated by the determination result output by the determination model is determined as the target keyword for the first text.
[0121] In some other possible implementations, the target keyword of the first text may also be determined based on a set determination rule. Specifically, in response to the first keyword being not empty and the second keyword being empty, the first keyword is determined as the target keyword of the first text, otherwise, the second keyword is determined as the target keyword of the first text.
[0122] That is to say, when the first extraction method extracts keywords, but the second extraction method does not extract keywords, it indicates that there are new keywords that have not been encountered in the first text. In this case, the first extraction method is used as the basis, and the first keyword extracted by the first extraction method is determined as the target keyword, thereby realizing the ability to discover new keywords from the first text.
[0123] In other cases, such as when neither the first extraction method nor the second extraction method extracts a keyword (i.e., both the first keyword and the second keyword are empty), the first extraction method does not extract a keyword but the second extraction method extracts a keyword (i.e., the first keyword is empty and the second keyword is not empty), or both the first extraction method and the second extraction method extract a keyword (i.e., both the first keyword and the second keyword are not empty), the second extraction method shall prevail, and the second keyword extracted by the second extraction method shall be determined as the target keyword. Since the second extraction method extracts keywords in combination with the first keyword set, the extraction accuracy is relatively high, ensuring the credibility of keyword extraction for the first text.
[0124] Furthermore, the user may be reminded that the target keyword exists in the first text, that is, the user is informed of the extraction result of the first text. In specific implementation, when the first text is derived from the text input by the user in the document page, the target keyword of the first text is presented in the document page in a target presentation manner.
[0125] The target presentation method can be understood as a presentation method that is different from the presentation method of other texts in the first text except the target keyword. In other words, by presenting the target keyword of the first text in the target presentation method, the target keyword in the first text is distinguished from other texts except the target keyword, so as to achieve the purpose of reminding the user that the target keyword exists in the first text.
[0126] The embodiment of the present application does not limit the target presentation method, for example, the target presentation method can be underlined, highlighted, etc. In this way, when the user is editing a document, if a text containing a target keyword is entered, the target keyword is presented in the target presentation method to remind the user, so that the user can modify the first text in time, thereby improving the readability of the document.
[0127] In this method, for the scenario of extracting keywords from text, a combination of two extraction methods is used to extract keywords. Keywords are directly extracted from the first text through the first language model, which is not limited to the first keyword set and can extract new keywords included in the first text. Keywords are extracted from the first text through the second language model combined with the first keyword set to ensure the accuracy of keyword extraction. In this way, the first keywords and second keywords extracted by the two extraction methods are combined to finally determine the target keywords of the first text, which not only ensures high-precision extraction of existing keywords in the first keyword set, but also improves the generalization ability of the language model for new keywords, thereby enhancing the overall effect of keyword extraction.
[0128] Combination of the above Figure 1The keyword extraction method provided in the embodiment of the present application is introduced in detail. The device and equipment provided in the embodiment of the present application will be introduced in conjunction with the accompanying drawings.
[0129] See also Figure 2 The structure diagram of the keyword extraction device shown in FIG. 20 includes:
[0130] An acquisition module 201 is used to acquire a first text;
[0131] An extraction module 202 is configured to extract keywords from the first text using a first language model to obtain first keywords; and extract keywords from the first text using a second language model in combination with a pre-configured first keyword set to obtain second keywords; wherein the first keyword set is used to indicate a plurality of third keywords belonging to the keyword;
[0132] The determination module 203 is used to determine a target keyword of the first text according to the first keyword and the second keyword.
[0133] In some possible implementations, the extraction module 202 is specifically configured to:
[0134] Generate a first prompt word; wherein the first prompt word includes the first text and information indicating that keywords are extracted from the first text;
[0135] The first prompt word is sent to a first language model, and a first keyword returned by the first language model is received.
[0136] In some possible implementations, the extraction module 202 is specifically configured to:
[0137] Generate a second prompt word; wherein the second prompt word includes a pre-configured first keyword set, the first text, and information indicating that keywords are extracted from the first text based on the first keyword set;
[0138] The second prompt word is sent to a second language model, and a second keyword returned by the second language model is received.
[0139] In some possible implementations, the first keyword set includes multiple third keywords and business information associated with each of the third keywords.
[0140] In some possible implementations, the determining module 203 is specifically configured to:
[0141] In response to the first keyword being not empty and the second keyword being empty, determining the first keyword as a target keyword of the first text;
[0142] Otherwise, the second keyword is determined as the target keyword of the first text.
[0143] In some possible implementations, the acquisition module 201 is specifically used to:
[0144] In response to a text input operation triggered on a document page, obtaining a first text;
[0145] The device further comprises a presentation module, wherein the presentation module is configured to:
[0146] In the document page, target keywords of the first text are presented in a target presentation manner.
[0147] In some possible implementations, the first language model is trained in the following manner:
[0148] Obtaining training text and annotation results of the training text in different fields;
[0149] Determining a target annotation result of the training text according to the annotation results of the training text in different fields;
[0150] The first language model is fine-tuned using the training text and the target annotation result of the training text.
[0151] In some possible implementations, the determining module 203 is further configured to:
[0152] Determine a second keyword set; wherein the second keyword set is used to indicate a plurality of fourth keywords that are not keywords;
[0153] The extraction module 202 is also used for:
[0154] In response to the first keyword being the same as any fourth keyword in the second keyword set, the first keyword is filtered out.
[0155] The keyword extraction device 20 according to the embodiment of the present application may correspond to the method described in the embodiment of the present application, and the above and other operations and / or functions of each module / unit of the keyword extraction device 20 are respectively to implement Figure 1 For the sake of brevity, the corresponding processes of each method in the illustrated embodiment are not described in detail here.
[0156] The present application also provides an electronic device. The electronic device is specifically used to implement Figure 2 The functions of the keyword extraction device 20 in the illustrated embodiment.
[0157] Figure 3 A schematic diagram of the structure of an electronic device 300 is provided. Figure 3As shown, the electronic device 300 includes a bus 301, a processor 302, a communication interface 303 and a memory 304. The processor 302, the memory 304 and the communication interface 303 communicate with each other via the bus 301.
[0158] The bus 301 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0159] The processor 302 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0160] The communication interface 303 is used for communicating with the outside. For example, the communication interface 303 can be used for communicating with a terminal.
[0161] The memory 304 may include a volatile memory, such as a random access memory (RAM). The memory 304 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0162] The memory 304 stores executable codes, and the processor 302 executes the executable codes to perform the aforementioned keyword extraction method.
[0163] Specifically, in implementing Figure 2 In the case of the embodiment shown, and Figure 2 When each module or unit of the keyword extraction device 20 described in the embodiment is implemented by software, the execution Figure 2The software or program code required for the functions of each module / unit in the system may be partially or completely stored in the memory 304. The processor 302 executes the program code corresponding to each unit stored in the memory 304 to perform the aforementioned keyword extraction method.
[0164] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the keyword extraction method applied to the keyword extraction device 20.
[0165] The embodiment of the present application further provides a computer program product, which includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in the embodiment of the present application is generated in whole or in part.
[0166] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer or data center to another website, computer or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0167] When the computer program product is executed by a computer, the computer executes any of the aforementioned keyword extraction methods. The computer program product may be a software installation package, and when any of the aforementioned keyword extraction methods is needed, the computer program product may be downloaded and executed on a computer.
[0168] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to each embodiment of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0169] The units involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the unit / module does not, in some cases, constitute a limitation on the unit itself.
[0170] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0171] In the context of the present application embodiment, machine-readable medium can be a tangible medium that can contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable medium can include but is not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0172] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0173] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0174] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0175] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0176] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A keyword extraction method, characterized in that: The method comprises: Get the first text; Extracting keywords from the first text using a first language model to obtain first keywords; and extracting keywords from the first text using a second language model in combination with a preconfigured first keyword set to obtain second keywords; wherein the first keyword set is used to indicate a plurality of third keywords belonging to the keyword; A target keyword of the first text is determined according to the first keyword and the second keyword.
2. The method according to claim 1, characterized in that The step of extracting a keyword from the first text using a first language model to obtain a first keyword includes: Generate a first prompt word; wherein the first prompt word includes the first text and information indicating that keywords are extracted from the first text; The first prompt word is sent to a first language model, and a first keyword returned by the first language model is received.
3. The method according to claim 1, characterized in that: The step of extracting keywords from the first text using a second language model in combination with a preconfigured first keyword set to obtain second keywords includes: Generate a second prompt word; wherein the second prompt word includes a pre-configured first keyword set, the first text, and information indicating that keywords are extracted from the first text based on the first keyword set; The second prompt word is sent to a second language model, and a second keyword returned by the second language model is received.
4. The method according to claim 1, characterized in that: The first keyword set includes a plurality of third keywords and business information associated with each of the third keywords.
5. The method according to claim 1, characterized in that: The step of determining a target keyword of the first text according to the first keyword and the second keyword includes: In response to the first keyword being not empty and the second keyword being empty, determining the first keyword as a target keyword of the first text; Otherwise, the second keyword is determined as the target keyword of the first text.
6. The method according to claim 1, characterized in that The obtaining of the first text comprises: In response to a text input operation triggered on a document page, obtaining a first text; The method further comprises: In the document page, target keywords of the first text are presented in a target presentation manner.
7. The method according to claim 1, characterized in that The first language model is trained in the following way: Obtaining training text and annotation results of the training text in different fields; Determining a target annotation result of the training text according to the annotation results of the training text in different fields; The first language model is fine-tuned using the training text and the target annotation result of the training text.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Determine a second keyword set; wherein the second keyword set is used to indicate a plurality of fourth keywords that are not keywords; After extracting keywords from the first text using the first language model to obtain the first keyword, the method further includes: In response to the first keyword being the same as any fourth keyword in the second keyword set, the first keyword is filtered out.
9. A keyword extraction device, characterized in that: The device comprises: An acquisition module, used for acquiring a first text; an extraction module, configured to extract keywords from the first text using a first language model to obtain first keywords; and, in combination with a pre-configured first keyword set, extract keywords from the first text using a second language model to obtain second keywords; wherein the first keyword set is used to indicate a plurality of third keywords belonging to the keyword; A determination module is used to determine a target keyword of the first text according to the first keyword and the second keyword.
10. An electronic device, characterized in that: The electronic device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the electronic device performs the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The method comprises instructions, wherein the instructions instruct an electronic device to execute the method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises computer readable instructions for implementing the method according to any one of claims 1 to 8.