Theme generation method and device, equipment and storage medium
Through the theme generation model, the embedding vector is generated to improve the efficiency and accuracy of document topic generation, and the problem of cumbersome and susceptible to manual intervention in the existing technology is solved, and the rapid and accurate document topic generation is achieved. .
Patent Information
- Application Number
- CN202411095139.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-08-09
AI Technical Summary
The document topic generation process for existing pending documents is cumbersome, resulting in inefficient generation and susceptible to manual intervention, making it impossible to quickly and accurately generate clear document topics.
The topic generation model is adopted, by obtaining preset document data and preset topics, training the topic generation model, decomposing the pending documents into semantic units, generating embedded vectors using encoder and attention mechanisms, inputting the model to generate document topics, reducing manual intervention and Improve efficiency.
No manual summary is required, which significantly reduces the time for document topic generation, improves generation efficiency and reliability, and ensures the accuracy and focus of document topics.
Smart Images

Figure CN119066191A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence and financial technology, and in particular to a topic generation method, device, equipment and storage medium. Background Art
[0002] The document theme provides a clear direction and framework for information transmission and understanding, ensuring the focus and depth of the content. A clear document theme can quickly attract readers' attention, guide them to focus on core issues, and avoid redundant and scattered information. In academic research and writing, a clear document theme is conducive to ensuring the pertinence and innovation of research and promoting the development and progress of the discipline.
[0003] However, the existing process of generating the document topic of the document to be processed is cumbersome, which is not conducive to improving the efficiency of generating the document topic. The reason is that the existing technology mainly adopts the method of manual induction and summarization to obtain the document topic of the document to be processed, and the method of manual induction and summarization consumes a lot of human resources and time resources, increases the generation time of the document topic of the document to be processed, and is easily affected by manual intervention, so it is not conducive to improving the efficiency of generating the document topic. Summary of the invention
[0004] The present invention provides a topic generation method, device, computer equipment and storage medium to solve the technical problem that the generation process of the document topic of the existing document to be processed is complicated and is not conducive to improving the generation efficiency of the document topic.
[0005] In a first aspect, a topic generation method is provided, comprising:
[0006] Acquire multiple samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data;
[0007] Obtain a predicted topic output by a preset topic generation model based on the preset document data, and obtain a loss value between the preset topic and the predicted topic;
[0008] Determine the trained topic generation model according to a predefined training method and the loss value;
[0009] Obtaining a document to be processed corresponding to the topic generation model, and decomposing the document to be processed into multiple semantic units;
[0010] Inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder;
[0011] According to a predefined merging method and the second embedding vector corresponding to the semantic unit, a third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
[0012] Further, the obtaining of the predicted topic output by the preset topic generation model based on the preset document data, and obtaining the loss value between the preset topic and the predicted topic, includes:
[0013] Inputting the preset document data into a preset topic generation model, and obtaining a predicted topic output by the topic generation model based on the preset document data;
[0014] The loss value between the preset document data and the predicted topic is obtained through a preset loss function, wherein the loss function includes a cross entropy loss function, an absolute loss function, or a combination thereof.
[0015] Furthermore, determining the trained topic generation model according to the predefined training method and the loss value includes:
[0016] Performing multiple rounds of training on the topic generation model according to the sample set, and determining whether the loss value is less than a preset value during the multiple rounds of training on the topic generation model;
[0017] When the loss value is less than the preset value, stop training the topic generation model and save the trained topic generation model.
[0018] Furthermore, the obtaining of the to-be-processed document corresponding to the topic generation model and decomposing the to-be-processed document into a plurality of semantic units includes:
[0019] Obtaining sentences, paragraphs or articles to be processed by the topic generation model;
[0020] The sentence, the paragraph or the article is used as the document to be processed, and the document to be processed is decomposed into a plurality of the semantic units.
[0021] Furthermore, the step of inputting the first embedding vector corresponding to the semantic unit into an encoder and generating a second embedding vector corresponding to the semantic unit through the encoder includes:
[0022] Extracting features of the semantic unit using a preset word embedding model to obtain a first embedding vector corresponding to the semantic unit;
[0023] The first embedding vector is input into an encoder, an attention score of the first embedding vector in a context is calculated using an attention mechanism of the encoder, the first embedding vector is reconstructed according to the attention score, and a second embedding vector corresponding to the semantic unit is generated.
[0024] Further, determining a third embedding vector according to a predefined merging mode and the second embedding vector corresponding to the semantic unit, inputting the third embedding vector into the trained topic generation model, and obtaining a document topic generated by the trained topic generation model based on the third embedding vector includes:
[0025] Inputting the second embedding vector corresponding to the semantic unit into an average pooling layer, and using the average pooling layer to merge the second embedding vectors corresponding to each of the semantic units to generate a third embedding vector;
[0026] The third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
[0027] Further, after determining a third embedding vector according to the predefined merging mode and the second embedding vector corresponding to the semantic unit, inputting the third embedding vector into the trained topic generation model, and obtaining the document topic generated by the trained topic generation model based on the third embedding vector, the topic generation method includes:
[0028] A display page corresponding to the document subject is obtained, a display window of the display page is obtained, and the document subject is displayed through the display window.
[0029] In a second aspect, a theme generation device is provided, comprising:
[0030] A first acquisition module, configured to acquire a plurality of samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data;
[0031] A second acquisition module is used to obtain a predicted topic output by a preset topic generation model based on the preset document data, and obtain a loss value between the preset topic and the predicted topic;
[0032] A training module, used for determining the trained topic generation model according to a predefined training method and the loss value;
[0033] A third acquisition module is used to acquire a document to be processed corresponding to the topic generation model, and decompose the document to be processed into multiple semantic units;
[0034] An input module, used for inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder;
[0035] A generation module is used to determine a third embedding vector according to a predefined merging method and the second embedding vector corresponding to the semantic unit, input the third embedding vector into the trained topic generation model, and obtain the document topic generated by the trained topic generation model based on the third embedding vector.
[0036] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned topic generation method when executing the computer program.
[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned topic generation method are implemented.
[0038] The present application provides a topic generation method, apparatus, computer equipment and storage medium, which obtain multiple samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data; obtain a predicted topic output by a preset topic generation model based on the preset document data, and obtain a loss value between the preset topic and the predicted topic; determine the trained topic generation model according to a predefined training method and the loss value; obtain a to-be-processed document corresponding to the topic generation model, and decompose the to-be-processed document into multiple semantic units; input a first embedding vector corresponding to the semantic unit into an encoder, and generate a second embedding vector corresponding to the semantic unit through the encoder; determine a third embedding vector according to a predefined merging method and the second embedding vector corresponding to the semantic unit. The third embedding vector is input into the trained topic generation model to obtain the document topic generated by the trained topic generation model based on the third embedding vector. The beneficial effects are in two aspects. On the one hand, according to the predefined merging method and the second embedding vector corresponding to the semantic unit, the third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain the document topic generated by the trained topic generation model based on the third embedding vector. Since manual induction and summary are not required, the generation time of the document topic of the document to be processed is reduced, which is conducive to improving the generation efficiency of the document topic of the document to be processed. On the other hand, since the topic generation model will not be affected by manual intervention, it is conducive to improving the reliability of the generated document topic. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1 is a schematic diagram of an application environment of a theme generation method in one embodiment of the present invention;
[0041] Figure 2 A flowchart of a method for generating a topic according to an embodiment of the present invention;
[0042] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S23;
[0043] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step S25;
[0044] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S26;
[0045] Figure 6 is a structural schematic diagram of a theme generating device in one embodiment of the present invention;
[0046] Figure 7 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0047] Figure 8 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] See also Figure 1 , Figure 1 is a schematic diagram of an application environment of a theme generation method in an embodiment of the present invention. The theme generation method provided by the embodiment of the present invention can be applied in Figure 1 In an application environment, a client communicates with a server through a network.
[0050] The server obtains a plurality of samples of the sample set through the client, wherein the samples include preset document data and preset topics corresponding to the preset document data;
[0051] Obtain a predicted topic output by a preset topic generation model based on the preset document data, and obtain a loss value between the preset topic and the predicted topic;
[0052] Determine the trained topic generation model according to a predefined training method and the loss value;
[0053] Obtaining a document to be processed corresponding to the topic generation model, and decomposing the document to be processed into multiple semantic units;
[0054] Inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder;
[0055] According to a predefined merging method and the second embedding vector corresponding to the semantic unit, a third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
[0056] In the scheme implemented by the above-mentioned topic generation method, device, equipment and medium, the beneficial effects of the scheme lie in two aspects. On the one hand, according to the predefined merging method and the second embedding vector corresponding to the semantic unit, a third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain the document topic generated by the trained topic generation model based on the third embedding vector. Since no manual induction and summary is required, the generation time of the document topic of the document to be processed is reduced, which is conducive to improving the generation efficiency of the document topic of the document to be processed. On the other hand, since the topic generation model will not be affected by manual intervention, it is conducive to improving the reliability of the generated document topic.
[0057] The client may include but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0058] The server can be implemented with an independent task database or a task database cluster composed of multiple task databases. The present invention is described in detail below through specific embodiments.
[0059] See also Figure 2 , Figure 2 A flowchart of a topic generation method provided by an embodiment of the present invention includes the following steps:
[0060] S21, obtaining a plurality of samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data;
[0061] Exemplarily, obtaining a plurality of samples of a sample set includes:
[0062] Connect to a target platform and obtain a sample set corresponding to the target platform, where the target platform includes one or a combination of an insurance platform, a financial platform, and a technology platform.
[0063] Among them, insurance platforms refer to online or offline platforms that provide a series of insurance-related businesses such as insurance product sales, consulting, and services. These platforms can be divided into two categories: online sales platforms built by insurance companies themselves and third-party online insurance platforms.
[0064] Among them, financial platforms cover a variety of financial services including insurance, such as banking, securities, funds, payments, etc. Financial platforms can be divided into online platforms of traditional financial institutions and emerging Internet financial platforms.
[0065] Among them, the technology platform refers to a platform that uses modern information technology, especially the Internet, big data, artificial intelligence and other technical means, to provide users with technology services and promote technological innovation and application.
[0066] S22, obtaining a predicted topic output by a preset topic generation model based on the preset document data, and obtaining a loss value between the preset topic and the predicted topic;
[0067] Among them, the preset topic generation model is a pre-trained model. This not only avoids the repetitive learning of generally applicable knowledge, but also enables the topic generation model to adapt to new tasks more quickly, which is conducive to reducing the time and amount of data required for training and improving the efficiency and effectiveness of topic generation model development.
[0068] The step of obtaining a predicted topic output by a preset topic generation model based on the preset document data and obtaining a loss value between the preset topic and the predicted topic includes:
[0069] Inputting the preset document data into a preset topic generation model, and obtaining a predicted topic output by the topic generation model based on the preset document data;
[0070] The loss value between the preset document data and the predicted topic is obtained through a preset loss function, wherein the loss function includes a cross entropy loss function, an absolute loss function, or a combination thereof.
[0071] S23, determining the trained topic generation model according to the predefined training method and the loss value;
[0072] Among them, the loss value is imported through a preset path, and the trained topic generation model is determined according to a predefined training method and the loss value.
[0073] S24, obtaining a document to be processed corresponding to the topic generation model, and decomposing the document to be processed into multiple semantic units;
[0074] The step of obtaining the document to be processed corresponding to the topic generation model and decomposing the document to be processed into a plurality of semantic units includes:
[0075] Obtaining sentences, paragraphs or articles to be processed by the topic generation model;
[0076] The sentence, the paragraph or the article is used as the document to be processed, and the document to be processed is decomposed into a plurality of the semantic units.
[0077] S25, inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder;
[0078] The encoder includes any one of a Big Bird encoder and a Longformer encoder.
[0079] Among them, Big Bird encoder is a pre-trained encoder model for extracting more complex semantic information from input token sequences. Big Bird encoder has shown good performance in recent natural language processing tasks. Big Bird encoder adopts sparse attention mechanism, which significantly reduces the complexity and memory requirements of attention calculation.
[0080] Among them, the Longformer encoder effectively reduces the computational complexity and memory consumption of long sequence processing by introducing a hybrid mechanism of local attention and global attention.
[0081] S26, determining a third embedding vector according to a predefined merging method and the second embedding vector corresponding to the semantic unit, inputting the third embedding vector into the trained topic generation model, and obtaining a document topic generated by the trained topic generation model based on the third embedding vector.
[0082] Exemplarily, inputting the third embedding vector into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector includes:
[0083] The third embedding vector is input into the generator of the trained topic generation model, the topic category output by the generator of the trained topic generation model based on the third embedding vector is obtained, and the topic category is used as the document topic of the document to be processed.
[0084] Wherein, after determining a third embedding vector according to the predefined merging mode and the second embedding vector corresponding to the semantic unit, inputting the third embedding vector into the trained topic generation model, and obtaining the document topic generated by the trained topic generation model based on the third embedding vector, the topic generation method includes:
[0085] Step A, obtaining a display page corresponding to the document subject, obtaining a display window of the display page, and displaying the document subject through the display window.
[0086] Exemplarily, after determining a third embedding vector according to the predefined merging mode and the second embedding vector corresponding to the semantic unit, inputting the third embedding vector into the trained topic generation model, and obtaining the document topic generated by the trained topic generation model based on the third embedding vector, the topic generation method includes:
[0087] Step B, obtaining a preset upload time, and determining whether the current time is the upload time;
[0088] When the current time is the upload time, connect to a preset server and upload the to-be-processed document and the document subject to the server.
[0089] Among them, step A is executed before or after step B. Step A can also be executed at the same time as step B. The specific execution order is not limited here.
[0090] In an embodiment of the present invention, the beneficial effects of the scheme lie in two aspects. On the one hand, according to a predefined merging method and the second embedding vector corresponding to the semantic unit, a third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector. Since no manual induction or summary is required, the generation time of the document topic of the document to be processed is reduced, which is beneficial to improving the generation efficiency of the document topic of the document to be processed. On the other hand, since the topic generation model will not be affected by manual intervention, it is beneficial to improve the reliability of the generated document topic.
[0091] See also Figure 3 , Figure 3 yes Figure 1 A specific implementation flow diagram of step S23 is described in detail as follows:
[0092] S31, performing multiple rounds of training on the topic generation model according to the sample set, and determining whether the loss value is less than a preset value during the multiple rounds of training on the topic generation model;
[0093] S32, when the loss value is less than the preset value, stop training the topic generation model and save the trained topic generation model.
[0094] In an embodiment of the present invention, the trained topic generation model is saved, and the trained topic generation model is reloaded and used when needed without retraining, thereby reducing the training cost of the topic generation model.
[0095] See also Figure 4 , Figure 4 yes Figure 1 A specific implementation flow diagram of step S25 is described in detail as follows:
[0096] S41, extracting features of the semantic unit through a preset word embedding model to obtain a first embedding vector corresponding to the semantic unit; S42, inputting the first embedding vector into the encoder, using the attention mechanism of the encoder to calculate the attention score of the first embedding vector in the context, reconstructing the first embedding vector according to the attention score, and generating a second embedding vector corresponding to the semantic unit.
[0097] The step of reconstructing the first embedding vector according to the attention score to generate a second embedding vector corresponding to the semantic unit includes:
[0098] When the attention score is higher than a preset score, the first embedding vector whose attention score is higher than the preset score is reconstructed to generate a second embedding vector corresponding to the semantic unit.
[0099] In an embodiment of the present invention, the first embedding vector is reconstructed according to the attention score to generate a second embedding vector corresponding to the semantic unit, which can focus more on important semantic units and improve the accuracy and efficiency of semantic unit screening.
[0100] See also Figure 5 , Figure 5 yes Figure 1 A specific implementation flow diagram of step S26 is described in detail as follows:
[0101] S51, inputting the second embedding vector corresponding to the semantic unit into an average pooling layer, and using the average pooling layer to merge the second embedding vectors corresponding to each of the semantic units to generate a third embedding vector;
[0102] For the sake of illustration, an example is given below:
[0103] For example, there are semantic unit 1, semantic unit 2, and semantic unit 3. The second embedding vector corresponding to semantic unit 1 is feature vector A, the second embedding vector corresponding to semantic unit 2 is feature vector B, and the second embedding vector corresponding to semantic unit 3 is feature vector C.
[0104] The feature vector A, the feature vector B, and the feature vector C are input into the average pooling layer, and the feature vector A, the feature vector B, and the feature vector C are average pooled using the average pooling layer to generate a third embedding vector.
[0105] S52: Input the third embedding vector into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
[0106] The third embedding vector is input into the generator of the trained topic generation model, the topic category output by the generator of the trained topic generation model based on the third embedding vector is obtained, and the topic category is used as the document topic of the document to be processed.
[0107] In an embodiment of the present invention, the document topic generated by the trained topic generation model based on the third embedding vector is obtained. Since there is no need for manual induction and summarization, the generation time of the document topic of the document to be processed is reduced, which is beneficial to improving the generation efficiency of the document topic of the document to be processed.
[0108] See also Figure 6 , Figure 6 is a schematic diagram of a structure of a theme generating device in one embodiment of the present invention, such as Figure 6 As shown, the theme generation device includes a first acquisition module 101, a second acquisition module 102, a training module 103, a third acquisition module 104, an input module 105, and a generation module 106. The functional modules are described in detail as follows:
[0109] A first acquisition module 101 is used to acquire a plurality of samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data;
[0110] A second acquisition module 102 is used to acquire a predicted topic output by a preset topic generation model based on the preset document data, and acquire a loss value between the preset topic and the predicted topic;
[0111] A training module 103, used to determine the trained topic generation model according to a predefined training method and the loss value;
[0112] The third acquisition module 104 is used to acquire the document to be processed corresponding to the topic generation model, and decompose the document to be processed into multiple semantic units;
[0113] An input module 105, configured to input the first embedding vector corresponding to the semantic unit into an encoder, and generate a second embedding vector corresponding to the semantic unit through the encoder;
[0114] A generation module 106 is used to determine a third embedding vector according to a predefined merging method and the second embedding vector corresponding to the semantic unit, input the third embedding vector into the trained topic generation model, and obtain a document topic generated by the trained topic generation model based on the third embedding vector.
[0115] In one embodiment, the first acquisition module 101 includes:
[0116] An input subunit, used to input the preset document data into a preset topic generation model, and obtain a predicted topic output by the topic generation model based on the preset document data;
[0117] The acquisition subunit is used to obtain the loss value between the preset document data and the predicted topic through a preset loss function, wherein the loss function includes one of a cross entropy loss function and an absolute loss function or a combination thereof.
[0118] In one embodiment, the training module 103 includes:
[0119] A training subunit, configured to perform multiple rounds of training on the topic generation model according to the sample set, and to determine whether the loss value is less than a preset value during the multiple rounds of training on the topic generation model;
[0120] The saving subunit is used to stop training the topic generation model and save the trained topic generation model when the loss value is less than the preset value.
[0121] In one embodiment, the third acquisition module 104 includes:
[0122] A processing subunit, used for obtaining sentences, paragraphs or articles to be processed by the topic generation model;
[0123] The decomposition subunit is used to take the sentence, the paragraph or the article as the document to be processed and decompose the document to be processed into a plurality of the semantic units.
[0124] In one embodiment, the input module 105 includes:
[0125] An extraction subunit, used to extract features from the semantic unit through a preset word embedding model to obtain a first embedding vector corresponding to the semantic unit;
[0126] A generating subunit is used to input the first embedding vector into an encoder, calculate an attention score of the first embedding vector in a context by using an attention mechanism of the encoder, reconstruct the first embedding vector according to the attention score, and generate a second embedding vector corresponding to the semantic unit.
[0127] In one embodiment, the generating module 106 includes:
[0128] a merging subunit, configured to input the second embedding vector corresponding to the semantic unit into an average pooling layer, and use the average pooling layer to merge the second embedding vectors corresponding to each of the semantic units to generate a third embedding vector;
[0129] An output subunit is used to input the third embedding vector into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
[0130] In one embodiment, the theme generation device further includes:
[0131] The display module is used to obtain a display page corresponding to the document theme, obtain a display window of the display page, and display the document theme through the display window.
[0132] In an embodiment of the present invention, the beneficial effects of the scheme lie in two aspects. On the one hand, according to a predefined merging method and the second embedding vector corresponding to the semantic unit, a third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector. Since no manual induction or summary is required, the generation time of the document topic of the document to be processed is reduced, which is beneficial to improving the generation efficiency of the document topic of the document to be processed. On the other hand, since the topic generation model will not be affected by manual intervention, it is beneficial to improve the reliability of the generated document topic.
[0133] For the specific limitations of the topic generating device, please refer to the limitations of the topic generating method above, which will not be repeated here.
[0134] Each module in the above-mentioned theme generation device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0135] See also Figure 7 , Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server. The internal structure diagram thereof may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected through a system bus.
[0136] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps on the server side of a theme generation method are implemented.
[0137] See also Figure 8 , Figure 8 is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external task database through a network connection. When the computer program is executed by the processor, the functions or steps of a subject generation method are implemented.
[0138] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0139] Acquire multiple samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data;
[0140] Obtain a predicted topic output by a preset topic generation model based on the preset document data, and obtain a loss value between the preset topic and the predicted topic;
[0141] Determine the trained topic generation model according to a predefined training method and the loss value;
[0142] Obtaining a document to be processed corresponding to the topic generation model, and decomposing the document to be processed into multiple semantic units;
[0143] Inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder;
[0144] According to a predefined merging method and the second embedding vector corresponding to the semantic unit, a third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
[0145] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0146] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0147] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0148] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0149] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0150] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the 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. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A topic generation method, characterized in that: include: Acquire multiple samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data; Obtain a predicted topic output by a preset topic generation model based on the preset document data, and obtain a loss value between the preset topic and the predicted topic; Determine the trained topic generation model according to a predefined training method and the loss value; Obtaining a document to be processed corresponding to the topic generation model, and decomposing the document to be processed into multiple semantic units; Inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder; According to a predefined merging method and the second embedding vector corresponding to the semantic unit, a third embedding vector is determined, and the third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
2. The topic generation method according to claim 1, characterized in that: The step of obtaining a predicted topic output by a preset topic generation model based on the preset document data, and obtaining a loss value between the preset topic and the predicted topic includes: Inputting the preset document data into a preset topic generation model, and obtaining a predicted topic output by the topic generation model based on the preset document data; The loss value between the preset document data and the predicted topic is obtained through a preset loss function, wherein the loss function includes a cross entropy loss function, an absolute loss function, or a combination thereof.
3. The topic generation method according to claim 1, characterized in that: Determining the trained topic generation model according to the predefined training method and the loss value includes: Performing multiple rounds of training on the topic generation model according to the sample set, and determining whether the loss value is less than a preset value during the multiple rounds of training on the topic generation model; When the loss value is less than the preset value, stop training the topic generation model and save the trained topic generation model.
4. The topic generation method according to claim 1, characterized in that: The step of obtaining the document to be processed corresponding to the topic generation model and decomposing the document to be processed into a plurality of semantic units includes: Obtaining sentences, paragraphs or articles to be processed by the topic generation model; The sentence, the paragraph or the article is used as the document to be processed, and the document to be processed is decomposed into a plurality of the semantic units.
5. The topic generation method according to claim 1, characterized in that: The step of inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder, comprises: Extracting features of the semantic unit using a preset word embedding model to obtain a first embedding vector corresponding to the semantic unit; The first embedding vector is input into an encoder, an attention score of the first embedding vector in a context is calculated using an attention mechanism of the encoder, the first embedding vector is reconstructed according to the attention score, and a second embedding vector corresponding to the semantic unit is generated.
6. The topic generation method according to claim 1, characterized in that: The method of determining a third embedding vector according to a predefined merging mode and the second embedding vector corresponding to the semantic unit, inputting the third embedding vector into the trained topic generation model, and obtaining a document topic generated by the trained topic generation model based on the third embedding vector includes: Inputting the second embedding vector corresponding to the semantic unit into an average pooling layer, and using the average pooling layer to merge the second embedding vectors corresponding to each of the semantic units to generate a third embedding vector; The third embedding vector is input into the trained topic generation model to obtain a document topic generated by the trained topic generation model based on the third embedding vector.
7. The topic generation method according to claim 1, characterized in that: After determining a third embedding vector according to the predefined merging mode and the second embedding vector corresponding to the semantic unit, inputting the third embedding vector into the trained topic generation model, and obtaining the document topic generated by the trained topic generation model based on the third embedding vector, the topic generation method includes: A display page corresponding to the document subject is obtained, a display window of the display page is obtained, and the document subject is displayed through the display window.
8. A theme generating device, characterized in that: include: A first acquisition module, configured to acquire a plurality of samples of a sample set, wherein the samples include preset document data and preset topics corresponding to the preset document data; A second acquisition module is used to obtain a predicted topic output by a preset topic generation model based on the preset document data, and obtain a loss value between the preset topic and the predicted topic; A training module, used to determine the trained topic generation model according to a predefined training method and the loss value; A third acquisition module is used to acquire a document to be processed corresponding to the topic generation model, and decompose the document to be processed into multiple semantic units; An input module, used for inputting the first embedding vector corresponding to the semantic unit into an encoder, and generating a second embedding vector corresponding to the semantic unit through the encoder; A generation module is used to determine a third embedding vector according to a predefined merging method and the second embedding vector corresponding to the semantic unit, input the third embedding vector into the trained topic generation model, and obtain the document topic generated by the trained topic generation model based on the third embedding vector.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the theme generation method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the theme generation method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
An abstract text generation method based on fusion coding
CN109522403A
Abstract extraction method and abstract extraction terminal for financial announcement
CN112784585A
Multi-document automatic abstract generation method
CN113468854A
Abstract generation method and device, electronic equipment and storage medium
CN116167345A
Training method and device of data enhancement model
CN117892134A
