A method and system for automatically generating office documents based on adversarial networks

Through the anti-network technology, the office document generation model is built, and the problems of poor flexibility in the generation of office documents and difficulty in turning into a formal style in the existing technology are solved, efficient automatic processing of office documents is achieved, and office efficiency and information circulation speed are improved.

CN114169294BActive Publication Date: 2024-12-17NO 15 INST OF CHINA ELECTRONICS TECH GRP
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202111442132.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2024-12-17
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

The existing template-based method has poor flexibility in automatically generating office documents, making it difficult to achieve text diversity and coherence, and it is difficult to convert documents with colloquial styles into formal styles.

Method used

The automatic generation method of office documents based on an adversarial network is adopted. By building a model including an office document generator and a style discriminator, using two-way GRU and CNN networks, the oral style documents are trained to convert them into regular style documents, and the model parameters are adjusted to improve the generation effect.

Benefits of technology

It improves work efficiency, shortens office cycles, improves the speed of office information circulation, greatly shortens the time from production to functioning, and enhances the vitality of office agencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114169294B_ABST
    Figure CN114169294B_ABST
Patent Text Reader

Abstract

The present invention discloses an automatic generation method and system of office documents based on adversarial networks. The method comprises: obtaining office documents in a spoken style and real office documents in a formal style; constructing an office document generation model; the office document generation model comprises an office document generator and a style discriminator; training the office document generation model through office documents in a spoken style and real office documents in a formal style; and automatically generating standardized office documents through the trained office document generation model. The present invention can convert lengthy and non-standard office documents into standardized office documents, thereby improving work efficiency, accelerating the circulation of office information, and shortening office time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent office technology, and in particular to an office document automatic generation method and system based on an adversarial network. Background Art

[0002] Office documents are a general term for telegrams, documents, and charts generated and used by party and government agencies at all levels in office work and other party and government actions. The realization of automated processing of office documents can greatly improve the speed of information circulation, greatly shorten the time from the generation of information to its effectiveness, and make party and government agencies full of vitality. The existing template-based method for automatically generating office documents is to set the changed words in a text as blanks, and fill in the blanks when generating text. It does not try to represent the text at a deeper level of grammar and discourse planning. This method has poor flexibility and it is difficult to achieve text diversity and coherence.

[0003] The writing style of formal office documents is standardized, with concise sentences, precise wording, orderly organization, and more abbreviations and office language. However, the writing styles of office documents written by general office workers vary, tending to be colloquial and rhetorical, with complicated and unsophisticated content. How to convert colloquial-style documents into formal-style office documents is a technical problem that needs to be solved in the process of office document automation. Summary of the invention

[0004] In order to solve the above problems, the present invention provides an office document automatic generation method and system based on an adversarial network, which is used to convert lengthy and non-standard office documents into standardized office documents.

[0005] To achieve the above object, the present invention provides the following solutions:

[0006] A method for automatically generating office documents based on an adversarial network, comprising:

[0007] Obtain colloquial-style office documents and formal-style authentic office documents;

[0008] Constructing an office document generation model; the office document generation model includes an office document generator and a style discriminator;

[0009] The office document generation model is trained by using spoken-style office documents and formal-style real office documents;

[0010] Standardized office documents are automatically generated through the trained office document generation model.

[0011] Optionally, the office document generator includes an encoder and a decoder; the encoder adopts a bidirectional GRU network; and the decoder adopts a unidirectional GRU network.

[0012] Optionally, the style discriminator includes a feature extractor and a distribution distance calculation module; the distribution distance calculation module includes a feature vector conversion network; the feature extractor adopts a CNN network; and the feature vector conversion network adopts a fully connected network.

[0013] Optionally, the training of the office document generation model by using the office documents in spoken style and the real office documents in formal style specifically includes:

[0014] Inputting the office document in the spoken language style into an office document generator to obtain an automatically generated office document;

[0015] The style discriminator is used to calculate the distance between the automatically generated office documents and the real office documents with formal style;

[0016] Adjust the parameters of the office document generation model according to the distance between the office document and the real office document in formal style.

[0017] Optionally, the distance between the automatically generated office document and the real office document of the formal style is calculated by a style discriminator, specifically including:

[0018] Extract feature vectors of automatically generated office documents and real office documents with formal style;

[0019] Generate a cost matrix based on the extracted feature vector;

[0020] Calculate a transmission matrix based on the cost matrix;

[0021] The distance between the automatically generated office document and the real office document of formal style is calculated based on the cost matrix and the transfer matrix.

[0022] The present invention also provides an office document automatic generation system based on adversarial network, comprising:

[0023] An acquisition module, used to acquire office documents in spoken style and real office documents in formal style;

[0024] A model building module, used to build an office document generation model; the office document generation model includes an office document generator and a style discriminator;

[0025] A training module, used to train the office document generation model using spoken-style office documents and formal-style real office documents;

[0026] The standardized office document generation module is used to automatically generate standardized office documents through the trained office document generation model.

[0027] Optionally, the office document generator includes an encoder and a decoder; the encoder adopts a bidirectional GRU network; and the decoder adopts a unidirectional GRU network.

[0028] Optionally, the style discriminator includes a feature extractor and a distribution distance calculation module; the distribution distance calculation module includes a feature vector conversion network; the feature extractor adopts a CNN network; and the feature vector conversion network adopts a fully connected network.

[0029] Optionally, the training module specifically includes:

[0030] An input unit, used for inputting the office document in the spoken language style into the office document generator to obtain an automatically generated office document;

[0031] A distance calculation unit, used for calculating the distance between the automatically generated office document and the real office document of formal style through the style discriminator;

[0032] The adjustment unit is used to adjust the parameters of the office document generation model according to the distance between the office document and the real office document of formal style.

[0033] Optionally, the distance calculation unit specifically includes:

[0034] Extraction subunit, used to extract feature vectors of automatically generated office documents and real office documents in formal style;

[0035] A cost matrix generation subunit, used to generate a cost matrix based on the extracted feature vector;

[0036] A transmission matrix calculation subunit, configured to calculate a transmission matrix based on the cost matrix;

[0037] The distance calculation subunit is used to calculate the distance between the automatically generated office document and the real office document of the formal style based on the cost matrix and the transfer matrix.

[0038] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0039] (1)(1) Improve work efficiency. This method can be used to convert colloquial documents into formal office documents, which can save office staff time in editing documents and reduce some links in previous work.

[0040] (2) Accelerate the circulation of office information. Using this method to generate office documents can greatly increase the speed of office information circulation, greatly shorten the time from the generation of office information to its effectiveness, and make the office full of vitality and vigor;

[0041] (3) Shorten the office cycle. By adopting this method, office staff can quickly draft office documents, speed up the transmission of office documents between superior and subordinate offices, and improve the efficiency of each office link. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0043] Figure 1 It is a flow chart of a method for automatically generating office documents based on adversarial networks according to an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of an automatic office document generation method based on an adversarial network according to an embodiment of the present invention;

[0045] Figure 3 4 is a structural diagram of a style discriminator according to an embodiment of the present invention. DETAILED DESCRIPTION

[0046] 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 only 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.

[0047] The purpose of the present invention is to provide an office document automatic generation method and system based on an adversarial network, which is used to convert lengthy and non-standard office documents into standardized office documents.

[0048] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0049] like Figure 1-2 As shown, the present invention provides an automatic generation method of office documents based on adversarial networks, comprising the following steps:

[0050] Step 101: Obtain office documents in a spoken style and authentic office documents in a formal style.

[0051] Step 102: construct an office document generation model; the office document generation model includes an office document generator and a style discriminator.

[0052] Step 103: Train the office document generation model using spoken-style office documents and formal-style real office documents.

[0053] Step 104: Automatically generate standardized office documents using the trained office document generation model.

[0054] Among them, the office document generation model in step 102 includes an office document generator and a style discriminator.

[0055] The office document generator is based on the Sequence to Sequence framework and consists of an encoder and a decoder.

[0056] (1) The purpose of the encoder is to extract the semantic vector of the input oral style office document. The network structure used is a bidirectional GRU, where the calculation process of each direction GRU is shown in formula (1)-formula (4):

[0057] R t =σ(W r ·E[x t ]+U r c t-1 ) (1)

[0058] Z t =σ(W z ·E[x t ]+U z c t-1 ) (2)

[0059] c t =tanh(W c ·E[x t ]+R t ⊙(U c h t-1 )) (3)

[0060] h t =Z t ⊙c t +(1-Z t )⊙h t-1 (4)

[0061] The input document is one-hot encoded to obtain the word embedding matrix E, W r , W z , W z , U r , U z , U c are the weight matrices of model learning, and c is the temporary state vector. t is the reset gate vector, which is used to decide whether the previous state needs to be retained. tis the update gate vector, which is used to determine the proportion of updating the current hidden state to the new state. t is the activated hidden vector, and tanh and σ are both activation functions.

[0062] When calculating, the bidirectional GRU uses the results of calculations in the forward and backward directions. and After vector concatenation, the final calculation result h is obtained. t , so that the state of each word in the sentence is not only related to the previous word, but also retains the information of the following word. The calculation method is shown in formula (5). Indicates connecting the hidden state vectors in two directions. If and They are all d1×d2 dimensions, so after connection they are d1×2d2 dimensions.

[0063]

[0064] (2) For the decoder in the office document generator, the network structure used is a unidirectional GRU. The input vector of the decoder is the intermediate semantic vector output by the encoder. The calculation formula is the same as formula (1) to formula (4).

[0065] In order to solve the discrete problem of the decoder output results, the softmax algorithm is used to calculate a continuous approximate vector for the discrete distribution on the text. The calculation process is shown in formula (6)-formula (8).

[0066] logic t =GRU(h t-1 ,y t-1 ) (6)

[0067]

[0068] y t =W e softmax(o t ) (8)

[0069] Among them, h t-1 is the hidden state vector, y is the current input vector, U, b o , τ are weight coefficients, W e is the weight matrix. The final calculation results in the generated office document y = {y1, y2, y3…, y L}.

[0070] The role of the style discriminator is to calculate whether the text generated by the generator is the same as the real text in terms of semantic style. The loss value is calculated by the cost change distance. Specifically:

[0071] The style discriminator mainly includes a feature extractor and a distribution distance calculation module for calculating different distribution distances, such as Figure 3 As shown in the figure, the function of the feature extractor is to extract the features of the input sentence and encode them into the feature space. The feature vector conversion network in the distribution distance calculation module is the core discriminant module of the discriminator. Its function is to convert the vector of the sentence feature space so that the output value of the subsequent distribution distance calculation module is as large as possible. The distribution distance calculation module adopts the cost change distance D CVD As a loss calculation method.

[0072] (1) Feature extractor: The function of the sentence feature extractor is to extract the internal features of the input sentence. Here, a CNN convolutional network is used as the feature extractor. The input text is represented as a vector x = {w1, w2, w3, ..., w L}∈R d×L , where d is the word vector dimension and L is the length of the input text. Set the convolution kernel W c ∈R d×l , where the first dimension of the convolution kernel is the same as the length of the text vector. The feature extraction calculation is shown in formula (9):

[0073]

[0074] in represents the convolution operation, f is the activation function, b is the bias term, c∈R L-l+1 The feature extractor is used to obtain the feature representations of the generated documents and the real documents. These feature representations all satisfy a certain distribution. Next, the feature representations are input into the distribution distance calculation module.

[0075] (2) Distribution distance calculation module. The feature vector conversion network of this module adopts a fully connected network. Its function is to make the representation vector obtained by the feature extractor consistent with the word embedding vector length of the input text. The cost matrix of the generated text and the real text is obtained through the feature vector conversion network. The calculation method is shown in formula (10). Where d represents the fully connected network, θ is the parameter of the fully connected network, and x and y represent the feature vectors of the generated text and the real text respectively. Suppose the feature vector of the generated text is The feature vector of the real text is The cost matrix is

[0076]

[0077] After obtaining the cost matrix, the corresponding transmission matrix is ​​calculated by the IPOT (Inexact Proximal point method for Optimal Transport) algorithm. The calculation method is shown in formula (11) and formula (12). Where a and b are parameter matrices, and ∈ is the regularization coefficient.

[0078]

[0079] T ij =a i G ij b j (12)

[0080] With the cost matrix C ij and the transmission matrix T ij After that, the loss value of the style discriminator can be calculated. The loss value calculation method here uses the cost change distance (Cost Variation Distance) is expressed and the calculation method is shown in formula (13).

[0081]

[0082] Wherein, step 103 specifically includes:

[0083] Step 1031: input the office document in the spoken language style into an office document generator to obtain an automatically generated office document.

[0084] Step 1032: Calculate the distance between the automatically generated office document and the real office document of the formal style through the style discriminator. This includes: extracting feature vectors of the automatically generated office document and the real office document of the formal style; generating a cost matrix based on the extracted feature vectors; calculating a transfer matrix based on the cost matrix; and calculating the distance between the automatically generated office document and the real office document of the formal style based on the cost matrix and the transfer matrix.

[0085] Step 1033: Adjust the parameters of the office document generation model according to the distance between the office document and the real office document of formal style.

[0086] The specific training method of the model is shown in Table 1.

[0087] Table 1 Office document generation model training process

[0088]

[0089]

[0090] Among them, the specific hyperparameters set during model training are shown in Table 2

[0091] Table 2 Model hyperparameter value settings

[0092]

[0093]

[0094] The advantages of the present invention are:

[0095] (1) Improve work efficiency. This method can be used to convert colloquial documents into formal office documents, which can save office staff time in editing documents and reduce some links in previous work.

[0096] (2) Accelerate the circulation of office information. The use of this method to generate office documents can greatly increase the speed of office information circulation and greatly shorten the time from the generation of office information to its effectiveness, making the office full of vitality and vigor.

[0097] (3) Shorten the office cycle. By adopting this method, office staff can quickly draft office documents, speed up the transmission of office documents between superior and subordinate offices, and improve the efficiency of each office link.

[0098] The present invention also provides an office document automatic generation system based on adversarial network, comprising:

[0099] An acquisition module, used to acquire office documents in spoken style and real office documents in formal style;

[0100] A model building module, used to build an office document generation model; the office document generation model includes an office document generator and a style discriminator;

[0101] A training module, used to train the office document generation model using spoken-style office documents and formal-style real office documents;

[0102] The standardized office document generation module is used to automatically generate standardized office documents through the trained office document generation model.

[0103] The training module specifically includes:

[0104] An input unit, used for inputting the office document in the spoken language style into the office document generator to obtain an automatically generated office document;

[0105] A distance calculation unit, used for calculating the distance between the automatically generated office document and the real office document of formal style through the style discriminator;

[0106] The adjustment unit is used to adjust the parameters of the office document generation model according to the distance between the office document and the real office document of formal style.

[0107] The distance calculation unit specifically includes:

[0108] Extraction subunit, used to extract feature vectors of automatically generated office documents and real office documents in formal style;

[0109] A cost matrix generation subunit, used to generate a cost matrix based on the extracted feature vector;

[0110] A transmission matrix calculation subunit, configured to calculate a transmission matrix based on the cost matrix;

[0111] The distance calculation subunit is used to calculate the distance between the automatically generated office document and the real office document of the formal style based on the cost matrix and the transfer matrix.

[0112] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0113] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for automatically generating office documents based on adversarial networks, characterized in that: include: Obtain colloquial-style office documents and formal-style authentic office documents; Construct an office document generation model; The office document generation model includes an office document generator and a style discriminator; Training the office document generation model by using office documents in spoken style and real office documents in formal style; specifically including: inputting the office documents in spoken style into the office document generator to obtain automatically generated office documents; Calculate the distance between the automatically generated office document and the real office document of formal style through the style discriminator; adjust the parameters of the office document generation model according to the distance between the automatically generated office document and the real office document of formal style; Standardized office documents are automatically generated through the trained office document generation model.

2. The method for automatically generating office documents based on adversarial networks according to claim 1 is characterized in that: The office document generator includes an encoder and a decoder; the encoder adopts a bidirectional GRU network; and the decoder adopts a unidirectional GRU network.

3. The method for automatically generating office documents based on adversarial networks according to claim 1 is characterized in that: The style discriminator includes a feature extractor and a distribution distance calculation module; the distribution distance calculation module includes a feature vector conversion network; the feature extractor adopts a CNN network; and the feature vector conversion network adopts a fully connected network.

4. The method for automatically generating office documents based on adversarial networks according to claim 1 is characterized in that: The style discriminator is used to calculate the distance between the automatically generated office documents and the real office documents with formal styles, including: Extract feature vectors of automatically generated office documents and real office documents with formal style; Generate a cost matrix based on the extracted feature vector; Calculate a transmission matrix based on the cost matrix; The distance between the automatically generated office document and the real office document of formal style is calculated based on the cost matrix and the transfer matrix.

5. An office document automatic generation system based on adversarial network, characterized in that: include: An acquisition module, used to acquire office documents in spoken style and real office documents in formal style; Model building module, used to build office document generation model; The office document generation model includes an office document generator and a style discriminator; The training module is used to train the office document generation model through the office documents in the spoken style and the real office documents in the formal style; specifically comprises: an input unit, used to input the office documents in the spoken style into the office document generator to obtain the automatically generated office documents; a distance calculation unit, used to calculate the distance between the automatically generated office documents and the real office documents in the formal style through the style discriminator; an adjustment unit, used to adjust the parameters of the office document generation model according to the distance between the office documents and the real office documents in the formal style; The standardized office document generation module is used to automatically generate standardized office documents through the trained office document generation model.

6. The office document automatic generation system based on adversarial network according to claim 5 is characterized in that: The office document generator includes an encoder and a decoder; the encoder adopts a bidirectional GRU network; and the decoder adopts a unidirectional GRU network.

7. The office document automatic generation system based on adversarial network according to claim 5 is characterized in that: The style discriminator includes a feature extractor and a distribution distance calculation module; the distribution distance calculation module includes a feature vector conversion network; the feature extractor adopts a CNN network; and the feature vector conversion network adopts a fully connected network.

8. The office document automatic generation system based on adversarial network according to claim 5 is characterized in that: The distance calculation unit specifically includes: Extraction subunit, used to extract feature vectors of automatically generated office documents and real office documents in formal style; A cost matrix generation subunit, used to generate a cost matrix based on the extracted feature vector; A transmission matrix calculation subunit, configured to calculate a transmission matrix based on the cost matrix; The distance calculation subunit is used to calculate the distance between the automatically generated office document and the real office document of the formal style based on the cost matrix and the transfer matrix.

Citation Information

Patent Citations

  • Natural language intention understanding method in man-machine interaction

    CN105786798A

  • Legal consultation system based on legal semantic parts and document big data statistical analysis

    CN110059193A

  • Official document processing method and device, computer equipment and storage medium

    CN111680634A

  • Speech recognition model training method, speech recognition method and related devices

    CN112017643A

  • Text processing method and device and computing equipment

    CN112151019A