Sentence filling method, device, equipment and storage medium based on category keywords

By using a sentence filling method based on category keywords in data information processing, keywords are extracted and clustered, correlation degree is calculated and statement templates are filled, the problem of extracting high-value information from scattered data is solved, and the efficient and rational extraction of information is achieved.

CN116049407BActive Publication Date: 2025-04-25SHENZHEN SKIEER INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310077160.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-12
Publication Date
2025-04-25
Estimated Expiration
2043-01-12

AI Technical Summary

Technical Problem

It is difficult for the prior art to extract information with high effective value and reasonable value from scattered data information, resulting in low or unreasonable valid value of the information.

Method used

By obtaining the pending text, extracting attribute keywords, performing clustering operations to assign category keywords, calculating the correlation degree and selecting target keywords, and filling them into the preset statement template to generate the filled target statement.

Benefits of technology

It realizes the extraction of high-effective value and rational information from data information, and improves the interpretability and rationality of information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116049407B_ABST
    Figure CN116049407B_ABST
Patent Text Reader

Abstract

The present application relates to a sentence filling method, device, equipment and storage medium based on category keywords. The method comprises: obtaining a text to be processed, extracting multiple attribute keywords from the text to be processed, performing a clustering operation on the multiple attribute keywords to obtain at least one clustering cluster, respectively assigning a corresponding category keyword to each of the clustering clusters, calculating the correlation between the attribute keywords between each of the category keywords, selecting a target keyword from the attribute keywords corresponding to each of the category keywords based on the correlation, filling the target keyword into a preset sentence template, and obtaining a filled target sentence. The present application can obtain a target sentence with high effective value and reasonableness from scattered data information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a sentence filling method, device, equipment and storage medium based on category keywords. Background Art

[0002] With the continuous development of Internet technology, users hope to extract and integrate effective and valuable information from various data information, for example, extracting consumer demand information from e-commerce data, extracting public opinion information from news data, etc. However, since data information is often large and scattered, the extracted information is not of high effective value or the extracted information is unreasonable. Therefore, how to obtain effective and reasonable information from scattered data information has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention

[0003] In view of the above, the present application provides a sentence filling method, device, equipment and storage medium based on category keywords, which aims to solve the above technical problems.

[0004] In a first aspect, the present application provides a sentence filling method based on category keywords, the method comprising:

[0005] Acquire a text to be processed, and extract multiple attribute keywords from the text to be processed;

[0006] Performing a clustering operation on the multiple attribute keywords to obtain at least one cluster, and assigning a corresponding category keyword to each of the clusters;

[0007] Calculating the relevance of the attribute keywords between each of the category keywords, and selecting a target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance;

[0008] The target keywords are filled into a preset sentence template to obtain a filled target sentence.

[0009] In a second aspect, the present application provides a sentence filling device based on category keywords, the device comprising:

[0010] Extraction module: used to obtain the text to be processed and extract multiple attribute keywords from the text to be processed;

[0011] Clustering module: used for performing clustering operation on the plurality of attribute keywords to obtain at least one cluster, and assigning corresponding category keywords to each cluster;

[0012] A selection module: used to calculate the relevance of the attribute keywords between each of the category keywords, and select a target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance;

[0013] Filling module: used to fill the target keyword into the preset sentence template to obtain the filled target sentence.

[0014] In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0015] Memory, used to store computer programs;

[0016] The processor is used to implement the sentence filling method based on category keywords described in any embodiment of the first aspect when executing the program stored in the memory.

[0017] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the sentence filling method based on category keywords as described in any embodiment of the first aspect is implemented.

[0018] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0019] The present application extracts multiple attribute keywords from the text to be processed, performs clustering operations on the multiple attribute keywords to obtain cluster clusters, and then assigns corresponding category keywords to each cluster cluster. Since the cluster clusters represent attribute keywords with commonality, the corresponding category keywords assigned to each cluster cluster can be used to classify the attribute keywords, calculate the correlation between the attribute keywords of each category keyword, select the target keyword from the attribute keywords corresponding to each category keyword according to the correlation, and then fill the target keyword into the preset sentence template to obtain the filled target sentence. Since the target keyword is a word with a high correlation among the attribute keywords of different category keywords, the target sentence obtained by filling with the target keyword has high interpretability and rationality, and the effective value of the target sentence is high. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0022] Figure 1This is a flow chart of an embodiment of a sentence filling method based on category keywords of the present application;

[0023] Figure 2 This is a module diagram of a preferred embodiment of a sentence filling device based on category keywords of the present application;

[0024] Figure 3 A schematic diagram of a preferred embodiment of the electronic device of the present application;

[0025] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0027] It should be noted that the descriptions involving "first", "second", etc. in this application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0028] The present application provides a sentence filling method based on category keywords. Figure 1 , which is a method flow chart of an embodiment of the method for completing a sentence based on category keywords of the present application. The method can be executed by an electronic device, and the electronic device can be implemented by software and / or hardware. The method for completing a sentence based on category keywords includes:

[0029] Step S1: obtaining a text to be processed, and extracting a plurality of attribute keywords from the text to be processed;

[0030] Step S2: performing a clustering operation on the plurality of attribute keywords to obtain at least one cluster, and assigning a corresponding category keyword to each cluster;

[0031] Step S3: calculating the relevance of the attribute keywords between each of the category keywords, and selecting a target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance;

[0032] Step S4: Fill the target keyword into a preset sentence template to obtain a filled target sentence.

[0033] In this embodiment, the text to be processed may be text crawled from a third-party data source and / or a local data source. In actual application scenarios, the text to be processed may be text related to commodities. By extracting key information from the text and filling it into a sentence template, consumer demand and market trends corresponding to the commodities can be obtained. The text to be processed may also be a text of current affairs information. By extracting key information from the text and filling it into a sentence template, public opinion trends corresponding to news and current events can be obtained. The scheme of the present application is explained by taking the text to be processed as a text related to commodities as an example. It can be understood that the actual application scenarios of the scheme of the present application are not limited to this. It can also be to extract key information from texts of current affairs information and financial information, and then perform sentence filling. Specifically, obtaining the text to be processed includes:

[0034] The attribute text of the product is obtained from a preset e-commerce platform, and the attribute text is used as the text to be processed, wherein the attribute text includes at least one of the title text, parameter text and evaluation text of the product.

[0035] The attribute text of the commodity can be obtained according to the variety and category of the commodity. The attribute text can refer to at least one of the title text (for example, the commodity title), parameter text (for example, the commodity parameters) and evaluation text (for example, evaluation feedback) of the commodity. The attribute text can also include the title text, parameter text and evaluation text of the commodity associated with the commodity. Among them, the attribute text of the commodity in a fixed time period can also be obtained, for example, the attribute text of the commodity within one year of listing can be obtained. By using the title text, parameter text and evaluation text of the commodity as the text to be processed, the key information of the commodity can be more accurately represented.

[0036] After obtaining the text to be processed, a keyword extraction algorithm (e.g., TextRank algorithm) can be used to extract multiple attribute keywords in the text to be processed. For example, the attribute keywords extracted from the text to be processed corresponding to a certain yogurt may include "vanilla flavor", "strawberry flavor", "yellow peach flavor", "salad", "fruit salad", "mixed fruit", "evening", "weight loss", "breakfast", "appetite", "relieve fullness", "regulate the stomach", etc.

[0037] After extracting multiple attribute keywords from the text to be processed, clustering operations are performed on the multiple attribute keywords to obtain at least one cluster, and attribute keywords with high similarity will be in the same cluster. For example, multiple attribute keywords are clustered using the k-means algorithm to obtain multiple clusters. Since clusters represent attribute keywords with common characteristics, a category keyword of different dimensions can be assigned to each cluster, for example, category keywords such as "scene", "crowd", "efficacy", "taste", "category", "packaging", "additives", and "origin" are assigned to the cluster. Each category keyword has a corresponding attribute keyword. For example, the attribute keywords corresponding to the category keyword "taste" include: "vanilla flavor", "strawberry flavor", and "yellow peach flavor".

[0038] Calculate the relevance of the attribute keywords between each category keyword, and select the target keyword from the attribute keywords corresponding to each category keyword based on the relevance. The relevance can refer to the number of times the attribute keyword appears in the same subtext (for example, the same paragraph of text) in the text to be processed. The more times the attribute keyword appears in the same subtext, the closer the relationship between the two attribute keywords is. Therefore, by counting the frequency of attribute keywords appearing in the same subtext, a co-word network composed of these attribute keywords can be formed. The distance between the nodes in the co-word network can reflect the close relationship between the attribute keywords. For example, there are four category keywords A, B, and C. The attribute keywords corresponding to category keyword A are A1 and A2, the attribute keywords corresponding to category keyword B are B1 and B2, and the attribute keywords corresponding to category keyword C are C1 and C2. Calculate the correlation between each attribute keyword among category keyword A, category keyword B, and category keyword C. Assuming that the calculated correlations have the highest correlations among A1, B2, and C2, select attribute keyword A1 from category keyword A, select attribute keyword B2 from category keyword B, and select attribute keyword C2 from category keyword C as target keywords. Similarly, assuming that the calculated correlations have the highest correlations among A2, B2, and C1, select attribute keyword A2 from category keyword A, select attribute keyword B2 from category keyword B, and select attribute keyword C1 from category keyword C as target keywords.

[0039] After selecting the target keywords, fill the target keywords into the preset sentence template to obtain the filled target sentence. For example, the sentence template is "a product with...effects and...flavors that...likes, added with...", assuming that the target keywords include "children", "calcium supplementation", "strawberry flavor", and "probiotics", then the target sentence is "a product with calcium supplementation and strawberry flavor that children like, added with probiotics", so as to extract the consumer's demand information from the text to be processed.

[0040] Specifically, the calculating the relevance of the attribute keywords between each of the category keywords, and selecting the target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance, includes:

[0041] A1. Select any category keyword, use the attribute keyword corresponding to the category keyword as the initial keyword, and initialize the selected keywords of the empty set, and initialize the sum of the association degrees to zero;

[0042] A2. Calculate the union of the initial keyword and the selected keyword, and the relevance of each attribute keyword corresponding to other category keywords;

[0043] A3. Selecting a preset number of target keywords from the attribute keywords corresponding to the other category keywords based on the relevance;

[0044] A4, updating the sum of the relevance values ​​according to the relevance corresponding to the target keyword, and adding the target keyword into the selected keyword;

[0045] A5. Repeat steps A2 to A4 until the correlations of the attribute keywords corresponding to all category keywords are calculated.

[0046] Select one of the multiple category keywords (for example, "crowd"), take the m attribute keywords (for example, "children", "elderly") corresponding to the category keyword "crowd" as the initial keywords, and initialize the selected keywords to an empty set, initialize the initial relevance sum S0 to zero, the union of the initial keywords and the selected keywords is "children", "elderly", calculate the relevance between each attribute keyword (for example, "appetite", "calcium supplementation", "relieving fullness") corresponding to the union and other category keywords (for example, "efficacy"), that is, calculate the relevance of "children" to "appetite", the relevance of "children" to "calcium supplementation", the relevance of "children" to "relieving fullness", the relevance of "elderly" to "appetite", the relevance of "elderly" to "calcium supplementation", the relevance of "elderly" to "relieving fullness", and assume that among these 6 relevances, the relevance of "children" to "calcium supplementation" is the highest, then select n (assuming n is 1) attribute keywords "calcium supplementation" from the category keyword "efficacy" as target keywords;

[0047] Add the associations of m*n word pairs to the initial association sum value to obtain an updated association sum value S, move the target keyword "calcium supplementation" into the selected keywords, redefine the union of the initial keywords and the selected keywords as "children", "elderly people", and "calcium supplementation", calculate the association of each attribute keyword (for example, "vanilla flavor", "strawberry flavor") corresponding to the union and other category keywords (for example, "taste"), that is, calculate the association of "children", "calcium supplementation", and "vanilla flavor", the association of "children", "calcium supplementation", and "strawberry flavor", the association of "elderly people", "calcium supplementation", and "vanilla flavor", and the association of "elderly people", "calcium supplementation", and "strawberry flavor" respectively. Assuming that among these four associations, the association of "children", "calcium supplementation", and "vanilla flavor" is the highest, select the attribute keyword "vanilla flavor" from the category keyword "taste" as the target keyword, add the association corresponding to the target keyword to the association sum value to update the association sum value, and put the target keyword into the selected keywords, and repeat the above steps until the associations of the attribute keywords corresponding to all category keywords are calculated. Since the target keyword is a word with a high correlation among the attribute keywords of different categories of keywords, the target sentence obtained by filling in the target keyword has a high interpretability.

[0048] It should be noted that when selecting target keywords from category keywords, you can select the highest target keyword from the category keywords, or you can select the highest multiple target keywords from the category keywords. The larger the sum of the correlation values, the greater the effective value of the target sentence obtained by filling the sentence template with these target keywords. For example, the sum of the correlation values ​​of "children", "calcium supplementation", and "vanilla flavor" is 1.5, and the sum of the correlation values ​​of "elderly people", "calcium supplementation", and "vanilla flavor" is 1.2, then the effective value of the target sentence "a product with calcium supplementation and vanilla flavor that children like" is greater.

[0049] The calculation formula of the correlation degree includes:

[0050]

[0051] Wherein, a represents the attribute keyword corresponding to the category keyword, b represents the attribute keyword corresponding to the other category keywords, val(a,b) represents the correlation between a and b, P(a,b) represents the number of times a and b appear in the same subtext of the text to be processed, P(a) represents the number of times a appears in the subtext of the text to be processed, and P(b) represents the number of times b appears in the subtext of the text to be processed. The correlation reflects the relative value of a and b appearing in the same subtext (for example, the same paragraph of evaluation feedback) at the same time. The correlation is calculated relative to the number of times the two attribute keywords a and b appear in the same subtext, so that the correlation between a and b will not be too high due to the excessive number of times one of the attribute keywords appears in the same subtext. The purpose of adding the logarithmic function is to convert multiplication into addition during calculation, thereby increasing the calculation speed.

[0052] Furthermore, assuming that a, b, and c are attribute keywords corresponding to keywords of different categories, the calculation formula for the sum of the associations between a, b, and c, f(a, b, c), is:

[0053] f(a,b,c)=f(a,b)+max[val(a,c),val(b,c)], where f(a,b)=val(a,b).

[0054] Similarly, assuming that a, b, c, and d are attribute keywords corresponding to keywords of different categories, the calculation formula for the sum of the correlations between a, b, c, and d, f(a, b, c, d), is:

[0055] f(a,b,c,d)=f(a,b,c)+max[val(a,d),val(b,d),val(c,d)], and so on, the sum of the correlations between the attribute keywords corresponding to multiple different category keywords can be calculated.

[0056] Furthermore, the selecting a preset number of target keywords from the attribute keywords corresponding to the other category keywords based on the association degree includes:

[0057] Sort the correlations from large to small;

[0058] A preset number of target keywords are selected from the attribute keywords corresponding to the other category keywords according to the ranking result.

[0059] For example, the correlation between "children" and "appetite", the correlation between "children" and "calcium supplementation", the correlation between "children" and "relieving fullness", the correlation between "elderly people" and "appetite", the correlation between "elderly people" and "calcium supplementation", and the correlation between "elderly people" and "relieving fullness" are sorted from large to small. If the preset number n is 1, and the correlation between "children" and "calcium supplementation" is the highest, then the attribute keyword "calcium supplementation" is selected from the category keyword "efficacy" as the target keyword. If the preset number is 2, and the highest correlation is the correlation between "children" and "appetite" and the correlation between "children" and "calcium supplementation", then the attribute keywords "appetite" and "calcium supplementation" are selected from the category keyword "efficacy" as the target keywords.

[0060] In one embodiment, extracting a plurality of attribute keywords from the text to be processed includes:

[0061] Performing a word segmentation operation on the text to be processed to obtain a plurality of word segments;

[0062] The word frequency of each of the segmented words is counted, and the multiple attribute keywords are selected from the multiple segmented words based on the word frequency.

[0063] The word segmentation algorithm is used to perform word segmentation operations on the text to be processed to obtain multiple word segments of the text to be processed. The word segmentation algorithm can be a maximum forward matching algorithm or a maximum reverse matching algorithm, or a bidirectional maximum matching algorithm. The number of times each word segment appears in the text to be processed is counted, and the inverse document frequency value is calculated, and then the word frequency of each word segment in the text to be processed is calculated. Among them, word frequency = (number of times a word segment appears in the text) / (the sum of the number of times each word segment appears in the text), the inverse document frequency value is multiplied by the word frequency, and the TF-IDF value of the word segment is obtained. The TF-IDF value indicates the importance of the word segment to the text. The larger the TF-IDF value, the higher the priority as a keyword. Therefore, the word segment with the highest TF-IDF value is used as the attribute keyword of the text to be processed. For example, the word segment with the top 10 TF-IDF values ​​is selected as the attribute keyword.

[0064] In one embodiment, performing a clustering operation on the plurality of attribute keywords to obtain at least one clustering cluster includes:

[0065] Convert each of the attribute keywords into a word vector, and calculate the distance between any two of the attribute keywords;

[0066] The attribute keywords whose distances fall within a preset value range are classified into the same cluster to obtain at least one cluster.

[0067] The word vector model word2vec model is used to convert each attribute keyword into a word vector. The word2vec model can process the attribute keywords as vector operations in the vector space, which is used to calculate the similarity between the attribute keywords. The distance between the attribute keywords can be the Euclidean distance or the cosine distance. The phrases whose distances fall within a preset range (for example, 80%) are classified into clusters of the same category. For example, the distance between the attribute keyword A1 and the attribute keyword A2, and the distance between the phrase A1 and the phrase A3 all fall within the preset range, then A1, A2 and A3 are classified into the same cluster.

[0068] Reference Figure 2 , which is a schematic diagram of the functional modules of the sentence filling device 100 based on category keywords of the present application.

[0069] The sentence filling device 100 based on category keywords described in the present application can be installed in an electronic device. According to the functions implemented, the sentence filling device 100 based on category keywords may include an extraction module 110, a clustering module 120, a selection module 130 and a filling module 140. The module described in the present application may also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0070] In this embodiment, the functions of each module / unit are as follows:

[0071] Extraction module 110: used to obtain a text to be processed and extract a plurality of attribute keywords from the text to be processed;

[0072] Clustering module 120: used to perform clustering operation on the multiple attribute keywords to obtain at least one cluster, and assign corresponding category keywords to each cluster;

[0073] The selection module 130 is used to calculate the relevance of the attribute keywords between each of the category keywords, and select the target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance;

[0074] Filling module 140: used to fill the target keyword into a preset sentence template to obtain a filled target sentence.

[0075] In one embodiment, extracting a plurality of attribute keywords from the text to be processed includes:

[0076] Performing a word segmentation operation on the text to be processed to obtain a plurality of word segments;

[0077] The word frequency of each of the segmented words is counted, and the multiple attribute keywords are selected from the multiple segmented words based on the word frequency.

[0078] In one embodiment, performing a clustering operation on the plurality of attribute keywords to obtain at least one clustering cluster includes:

[0079] Convert each of the attribute keywords into a word vector, and calculate the distance between any two of the attribute keywords;

[0080] The attribute keywords whose distances fall within a preset value range are classified into the same cluster to obtain at least one cluster.

[0081] In one embodiment, calculating the relevance of the attribute keywords between each of the category keywords, and selecting the target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance includes:

[0082] A1. Select any category keyword, use the attribute keyword corresponding to the category keyword as the initial keyword, and initialize the selected keywords of the empty set, and initialize the sum of the association degrees to zero;

[0083] A2. Calculate the union of the initial keyword and the selected keyword, and the relevance of each attribute keyword corresponding to other category keywords;

[0084] A3. Selecting a preset number of target keywords from the attribute keywords corresponding to the other category keywords based on the relevance;

[0085] A4, updating the sum of the relevance values ​​according to the relevance corresponding to the target keyword, and adding the target keyword into the selected keyword;

[0086] A5. Repeat steps A2 to A4 until the correlations of the attribute keywords corresponding to all category keywords are calculated.

[0087] In one embodiment, the calculation formula of the association degree includes:

[0088]

[0089] Among them, a represents the attribute keyword corresponding to the category keyword, b represents the attribute keyword corresponding to the other category keywords, val(a,b) represents the correlation between a and b, P(a,b) represents the number of times a and b appear in the same subtext of the text to be processed, P(a) represents the number of times a appears in the subtext of the text to be processed, and P(b) represents the number of times b appears in the subtext of the text to be processed.

[0090] In one embodiment, selecting a preset number of target keywords from the attribute keywords corresponding to the other category keywords based on the association degree includes:

[0091] Sort the correlations from large to small;

[0092] A preset number of target keywords are selected from the attribute keywords corresponding to the other category keywords according to the ranking result.

[0093] In one embodiment, obtaining the text to be processed includes:

[0094] The attribute text of the product is obtained from a preset e-commerce platform, and the attribute text is used as the text to be processed, wherein the attribute text includes at least one of the title text, parameter text and evaluation text of the product.

[0095] Reference Figure 3 , which is a schematic diagram of a preferred embodiment of the electronic device 1 of the present application.

[0096] The electronic device 1 includes but is not limited to: a memory 11, a processor 12, a display 13 and a communication interface 14. The electronic device 1 can be connected to a network through the communication interface 14. The network can be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, a call network, etc.

[0097] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a hard disk or memory of the electronic device 1. In other embodiments, the memory 11 can also be an external storage device of the electronic device 1, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped with the electronic device 1. Of course, the memory 11 can also include both the internal storage unit of the electronic device 1 and its external storage device. In this embodiment, the memory 11 is generally used to store the operating system and various computer programs installed on the electronic device 1, such as the program code of the sentence completion program 10 based on category keywords, etc. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.

[0098] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running the program code of the sentence completion program 10 based on category keywords.

[0099] The display 13 may be referred to as a display screen or a display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an organic light-emitting diode (OLED) touch device, etc. The display 13 is used to display information processed in the electronic device 1 and to display a visual working interface.

[0100] The communication interface 14 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the communication interface 14 is generally used to establish a communication connection between the electronic device 1 and other electronic devices.

[0101] Figure 3Only the electronic device 1 having the components 11 - 14 and the category keyword-based sentence completion program 10 is shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.

[0102] In the above embodiment, the processor 12 can implement the following steps when executing the sentence completion program 10 based on category keywords stored in the memory 11:

[0103] Acquire a text to be processed, and extract multiple attribute keywords from the text to be processed;

[0104] Performing a clustering operation on the multiple attribute keywords to obtain at least one cluster, and assigning a corresponding category keyword to each of the clusters;

[0105] Calculating the relevance of the attribute keywords between each of the category keywords, and selecting a target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance;

[0106] The target keywords are filled into a preset sentence template to obtain a filled target sentence.

[0107] The storage device may be the memory 11 of the electronic device 1 , or may be another storage device that is communicatively connected to the electronic device 1 .

[0108] For a detailed description of the above steps, please refer to the above Figure 2 Functional module diagram of the embodiment of the sentence filling device 100 based on category keywords and Figure 1 Description of a flowchart of an embodiment of a sentence completion method based on category keywords.

[0109] In addition, the embodiment of the present application also proposes a computer-readable storage medium, which can be non-volatile or volatile. The computer-readable storage medium can be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, etc. The computer-readable storage medium includes a data storage area and a program storage area, and the program storage area stores a sentence filling program 10 based on category keywords. When the sentence filling program 10 based on category keywords is executed by a processor, the following operations are implemented:

[0110] Acquire a text to be processed, and extract multiple attribute keywords from the text to be processed;

[0111] Performing a clustering operation on the multiple attribute keywords to obtain at least one cluster, and assigning a corresponding category keyword to each of the clusters;

[0112] Calculating the relevance of the attribute keywords between each of the category keywords, and selecting a target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance;

[0113] The target keywords are filled into a preset sentence template to obtain a filled target sentence.

[0114] The specific implementation of the computer-readable storage medium of the present application is roughly the same as the specific implementation of the above-mentioned sentence filling method based on category keywords, and will not be repeated here.

[0115] It should be noted that the serial numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof herein are intended to cover non-exclusive inclusion, so that the process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, device, article or method including the element.

[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware simulation platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, an electronic device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0117] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A sentence filling method based on category keywords, characterized in that: The method comprises: Acquire a text to be processed, and extract multiple attribute keywords from the text to be processed; Performing a clustering operation on the multiple attribute keywords to obtain at least one cluster, and assigning a corresponding category keyword to each of the clusters; Calculating the relevance of the attribute keywords between each of the category keywords, and selecting a target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance, wherein the relevance refers to the number of times the attribute keyword appears in the same subtext in the text to be processed; Filling the target keyword into a preset sentence template to obtain a filled target sentence; The calculating of the relevance of the attribute keywords between each of the category keywords and selecting the target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance includes: A1. Select any category keyword, use the attribute keyword corresponding to the category keyword as the initial keyword, initialize the selected keywords to an empty set, and initialize the sum of the associations to zero; A2. Calculate the association between the union of the initial keyword and the selected keyword and each attribute keyword corresponding to all other category keywords; A3. Selecting a preset number of target keywords from the attribute keywords corresponding to all other category keywords based on the relevance; A4, updating the sum of the relevance values ​​according to the relevance corresponding to the target keyword, and adding the target keyword and the initial keyword into the selected keyword; A5. Repeat steps A2 to A4 until the correlations of the attribute keywords corresponding to all category keywords are calculated.

2. The sentence filling method based on category keywords as claimed in claim 1, characterized in that: The step of extracting a plurality of attribute keywords from the text to be processed includes: Performing a word segmentation operation on the text to be processed to obtain a plurality of word segments; The word frequency of each of the segmented words is counted, and the multiple attribute keywords are selected from the multiple segmented words based on the word frequency.

3. The sentence filling method based on category keywords as claimed in claim 1, characterized in that: The performing a clustering operation on the plurality of attribute keywords to obtain at least one clustering cluster includes: Convert each of the attribute keywords into a word vector, and calculate the distance between any two of the attribute keywords; The attribute keywords whose distances fall within a preset value range are classified into the same cluster to obtain at least one cluster.

4. The sentence filling method based on category keywords as claimed in claim 1, characterized in that: The calculation formula of the correlation degree includes: Wherein, a represents the attribute keyword corresponding to the category keyword, and b represents the attribute keywords corresponding to all other category keywords. represents the correlation between a and b, Indicates the number of times a and b appear in the same subtext of the text to be processed. Indicates the number of times a appears in the subtext of the text to be processed, Indicates the number of times b appears in the subtext of the text to be processed.

5. The sentence filling method based on category keywords as claimed in claim 1, characterized in that: The selecting a preset number of target keywords from the attribute keywords corresponding to all other category keywords based on the association degree includes: Sort the correlations from large to small; A preset number of target keywords are selected from the attribute keywords corresponding to all other category keywords according to the ranking result.

6. The sentence filling method based on category keywords according to any one of claims 1 to 2, characterized in that: The step of obtaining the text to be processed includes: The attribute text of the product is obtained from a preset e-commerce platform, and the attribute text is used as the text to be processed, wherein the attribute text includes at least one of the title text, parameter text and evaluation text of the product.

7. A sentence filling device based on category keywords, characterized in that: The device comprises: Extraction module: used to obtain the text to be processed and extract multiple attribute keywords from the text to be processed; Clustering module: used for performing clustering operation on the plurality of attribute keywords to obtain at least one cluster, and assigning corresponding category keywords to each cluster; A selection module: used to calculate the relevance of the attribute keywords between each of the category keywords, and select a target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance; Filling module: used to fill the target keyword into the preset sentence template to obtain the filled target sentence; The calculating of the relevance of the attribute keywords between each of the category keywords and selecting the target keyword from the attribute keywords corresponding to each of the category keywords based on the relevance includes: A1. Select any category keyword, use the attribute keyword corresponding to the category keyword as the initial keyword, initialize the selected keywords to an empty set, and initialize the sum of the associations to zero; A2. Calculate the association between the union of the initial keyword and the selected keyword and each attribute keyword corresponding to all other category keywords; A3. Selecting a preset number of target keywords from the attribute keywords corresponding to all other category keywords based on the relevance; A4, updating the sum of the relevance values ​​according to the relevance corresponding to the target keyword, and adding the target keyword and the initial keyword into the selected keyword; A5. Repeat steps A2 to A4 until the correlations of the attribute keywords corresponding to all category keywords are calculated.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the sentence completion method based on category keywords described in any one of claims 1 to 6 when executing the program stored in the memory.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the sentence completion method based on category keywords as claimed in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Recommendation information mining method and device

    CN113761349A

  • System and method for automatic generation of knowledge-powered content planning

    US20220084098A1