Document writing assistance method, system, terminal, and storage medium

By constructing a short text similarity calculation and hybrid error correction model, combined with manuscript tools, we have achieved efficient material recommendation and error correction, solving the problem of time-consuming and laborious material selection in existing manuscript writing systems, and improving writing efficiency and quality.

CN116432611BActive Publication Date: 2026-07-21SHANDONG LUNENG SOFTWARE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG LUNENG SOFTWARE TECH
Filing Date
2023-03-10
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing document writing systems cannot effectively assist users in selecting materials when they lack writing ideas, and they rely on personal experience, resulting in difficulty in guaranteeing document quality and wasting a lot of time and manpower.

Method used

By constructing a short text similarity calculation, word vector calculation, and hybrid error correction model, matching materials are recommended and displayed in real time. Combined with a manuscript tool, the materials are continued and corrected. The Word2vec and CSC-BiLSTM-CRF models are used to optimize the material recommendation and error correction process.

Benefits of technology

It improves the efficiency and quality of manuscript writing, reduces the burden on users, and enables efficient material recommendation and error correction functions, reducing writing omissions and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116432611B_ABST
    Figure CN116432611B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, and particularly provides a manuscript writing assisting method and system, a terminal and a storage medium, which comprise the following steps: collecting written manuscripts and preprocessing the written manuscripts to obtain inputtable texts; inputting the inputtable texts into a first model which is pre-constructed, wherein the first model outputs material texts matched with the inputtable texts in a material library and detects errors of the inputtable texts; adding a display interface to a manuscript opening tool, outputting the matched material texts to the display interface, and marking error detection results on the manuscript display interface; and calling a second model which is pre-constructed based on a user calling instruction to continue writing based on the inputtable texts and the matched material texts, and outputting the continued writing content to the manuscript display interface. The application effectively solves the problems of heavy workload of user text writing, limited writing foundation, time-consuming and laborious writing material screening, writing omission and low writing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence technology, specifically relating to a method, system, terminal, and storage medium for assisting in writing documents. Background Technology

[0002] Currently, written documents have become an important tool and means for companies and organizations to convey policies, exchange experiences, and promote work progress. Employees have a significant need for document writing in their work. Efficient and accurate management and important information exchange both require strong writing skills. However, the document writing process involves analyzing and selecting writing materials from a massive amount of existing documents, which consumes a lot of manpower and time. There is a lack of unified standards for judging the events in the document, which relies heavily on personal experience. This makes it difficult to accurately judge the source and development trend of events, and there are also problems such as omission of key points and textual errors, making it difficult to guarantee the quality of the document writing.

[0003] Traditional article writing assistance systems work by having users access example sentences starting with the currently edited character or word through a file editor. These example sentences are then displayed for reference. This method only provides more example sentences when the user already has a writing idea, but it fails to offer effective assistance to users who lack writing ideas or source material. Summary of the Invention

[0004] In view of the above-mentioned shortcomings of the prior art, the present invention provides a document writing assistance method, system, terminal and storage medium to solve the above-mentioned technical problems.

[0005] In a first aspect, the present invention provides a method for assisting in writing a manuscript, comprising:

[0006] Collect written texts and preprocess them to obtain input-ready text;

[0007] The input text is input into a pre-built first model, and the first model outputs material text from the material library that matches the input text and performs error detection on the input text.

[0008] Add a display interface to the document opening tool, output the matched material text to the display interface, and mark the error detection results on the document display interface;

[0009] The user invokes a pre-built second model based on input text and matched source text to continue writing, and outputs the continued content to the document display interface.

[0010] Furthermore, the first model includes:

[0011] The short text similarity calculation sub-model calculates the similarity between the input text and each text in the material library, and filters out the texts whose similarity reaches a set threshold.

[0012] The word vector calculation sub-model constructs a dense vector for each occurrence of the source text selected by the short text similarity calculation sub-model, and selects keywords of the source text based on the frequency of occurrence of the dense vector in the source text;

[0013] The hybrid error correction sub-model performs multi-level error correction on input text by constructing a knowledge error detection model based on text semantic representation.

[0014] Furthermore, the short text similarity calculation sub-model includes:

[0015] Unsupervised similarity calculation methods were used to train word vectors using word2vec on a large-scale corpus;

[0016] The short text is segmented into words, and the word vector corresponding to each word is found. The word vectors of all words in the short text are summed to obtain the sentence vector of the short text.

[0017] The similarity between two short text sentence vectors is obtained by measuring the distance between them.

[0018] Supervised similarity calculation is performed under labeled conditions. Deep learning modeling is performed based on labeled data, and the similarity between two short texts is directly solved through end-to-end learning of the model.

[0019] Furthermore, the word vector calculation sub-model includes:

[0020] Using Word2vec technology, each word in the fixed material library is represented by a vector. Then, each position t is traversed in the selected material text. The material text has a center word c and context words o. The similarity between the word vectors of c and o is used to calculate the probability of o given c.

[0021] This probability is maximized by continuously adjusting the word vectors;

[0022] Remove meaningless words from the training dataset and train the word vector calculation sub-model using the training dataset;

[0023] For each input, negative sampling is used to update the weights of all correct labels, and only the weights of some incorrect labels are updated.

[0024] Furthermore, the hybrid error correction sub-model includes:

[0025] Input the set of sentences to be proofread and the confusion set into the trained and saved CSC-BiLSTM-CRF model to obtain the error labeling results of the sentences;

[0026] The output annotation results are judged. If an anomaly word marked as incorrect appears in the confusion set, the anomaly word replacement and error correction process is performed. If there is no error, the next sentence is read. Finally, the anomaly words in the confusion set are replaced one by one.

[0027] The replaced sentence is annotated, and the probability of the replaced word being annotated as wrong is calculated. The smallest annotated word in the confusion set is taken as the target confusion word. If the difference between the probability of the abnormal word being wrong and the probability of the target confusion word being wrong is greater than a preset threshold, then the abnormal word is determined to be wrong and the target confusion word is the correct replacement word.

[0028] Replace the abnormal words and output the corrected sentence.

[0029] Furthermore, a display interface is added to the document opening tool. The matched material text is output to the display interface, and error detection results are marked on the document display interface, including:

[0030] Use the view function of the document opening tool to create a new display interface, and input the matching material text into the new display interface;

[0031] Use the annotation function of the document opening tool to annotate the error detection results in the document display interface.

[0032] Furthermore, the second model includes:

[0033] Given input text at the encoder, word representations are computed using a shared, randomly initialized word embedding layer. These representations are then encoded using a single-layer, unidirectional LSTM to obtain the encoder's encoding result and the LSTM's hidden state h. n ;

[0034] The RN network structure rewrites the input text into two N×N matrices, one horizontally and one vertically, and then correlates them with the hidden state h. n The expanded identical matrices are concatenated to obtain triples of all elements. These triples are then processed twice by a multilayer perceptron controlled by different parameters to obtain a new hidden state h'. n ;

[0035] Generate a new hidden state h' in the RN network layer. n Sampling is performed at the reparameter layer, from the new hidden state h' n The latent layer representation z is obtained by sampling from the middle, and the sampling method includes: sampling the new hidden state h' nCalculate μ and σ respectively, and sample from the normal distribution consisting of μ and σ to obtain the initial hidden state h used to guide the decoder generation. z ;

[0036] The initial hidden state h z The input decoder uses a single-layer unidirectional LSTM to generate the continuation text.

[0037] Secondly, the present invention provides a document writing assistance system, comprising:

[0038] The document processing unit is used to collect written documents and preprocess them to obtain input-ready text.

[0039] The first processing unit is used to input the input text into a pre-built first model, and the first model outputs material text from the material library that matches the input text and performs error detection on the input text.

[0040] The document display unit is used to add a display interface to the document opening tool, output the matched material text to the display interface, and mark the error detection results on the document display interface;

[0041] The second processing unit is used to invoke a pre-built second model based on user-invoked instructions to continue writing based on input text and matched source text, and then output the continued content to the document display interface.

[0042] Furthermore, the first model includes:

[0043] The short text similarity calculation sub-model calculates the similarity between the input text and each text in the material library, and filters out the texts whose similarity reaches a set threshold.

[0044] The word vector calculation sub-model constructs a dense vector for each occurrence of the source text selected by the short text similarity calculation sub-model, and selects keywords of the source text based on the frequency of occurrence of the dense vector in the source text;

[0045] The hybrid error correction sub-model performs multi-level error correction on input text by constructing a knowledge error detection model based on text semantic representation.

[0046] Furthermore, the short text similarity calculation sub-model includes:

[0047] Unsupervised similarity calculation methods were used to train word vectors using word2vec on a large-scale corpus;

[0048] The short text is segmented into words, and the word vector corresponding to each word is found. The word vectors of all words in the short text are summed to obtain the sentence vector of the short text.

[0049] The similarity between two short text sentence vectors is obtained by measuring the distance between them.

[0050] Supervised similarity calculation is performed under labeled conditions. Deep learning modeling is performed based on labeled data, and the similarity between two short texts is directly solved through end-to-end learning of the model.

[0051] Furthermore, the word vector calculation sub-model includes:

[0052] Using Word2vec technology, each word in the fixed material library is represented by a vector. Then, each position t is traversed in the selected material text. The material text has a center word c and context words o. The similarity between the word vectors of c and o is used to calculate the probability of o given c.

[0053] This probability is maximized by continuously adjusting the word vectors;

[0054] Remove meaningless words from the training dataset and train the word vector calculation sub-model using the training dataset;

[0055] For each input, negative sampling is used to update the weights of all correct labels, and only the weights of some incorrect labels are updated.

[0056] Furthermore, the hybrid error correction sub-model includes:

[0057] Input the set of sentences to be proofread and the confusion set into the trained and saved CSC-BiLSTM-CRF model to obtain the error labeling results of the sentences;

[0058] The output annotation results are judged. If an anomaly word marked as incorrect appears in the confusion set, the anomaly word replacement and error correction process is performed. If there is no error, the next sentence is read. Finally, the anomaly words in the confusion set are replaced one by one.

[0059] The replaced sentence is annotated, and the probability of the replaced word being annotated as wrong is calculated. The smallest annotated word in the confusion set is taken as the target confusion word. If the difference between the probability of the abnormal word being wrong and the probability of the target confusion word being wrong is greater than a preset threshold, then the abnormal word is determined to be wrong and the target confusion word is the correct replacement word.

[0060] Replace the abnormal words and output the corrected sentence.

[0061] Furthermore, a display interface is added to the document opening tool. The matched material text is output to the display interface, and error detection results are marked on the document display interface, including:

[0062] Use the view function of the document opening tool to create a new display interface, and input the matching material text into the new display interface;

[0063] Use the annotation function of the document opening tool to annotate the error detection results in the document display interface.

[0064] Furthermore, the second model includes:

[0065] Given input text at the encoder, word representations are computed using a shared, randomly initialized word embedding layer. These representations are then encoded using a single-layer, unidirectional LSTM to obtain the encoder's encoding result and the LSTM's hidden state h. n ;

[0066] The RN network structure rewrites the input text into two N×N matrices, one horizontally and one vertically, and then correlates them with the hidden state h. n The expanded identical matrices are concatenated to obtain triples of all elements. These triples are then processed twice by a multilayer perceptron controlled by different parameters to obtain a new hidden state h'. n ;

[0067] Generate a new hidden state h' in the RN network layer. n Sampling is performed at the reparameter layer, from the new hidden state h' n The latent layer representation z is obtained by sampling from the middle, and the sampling method includes: sampling the new hidden state h' n Calculate μ and σ respectively, and sample from the normal distribution consisting of μ and σ to obtain the initial hidden state h used to guide the decoder generation. z ;

[0068] The initial hidden state h z The input decoder uses a single-layer unidirectional LSTM to generate the continuation text.

[0069] Thirdly, a terminal is provided, including:

[0070] Processor, memory, among which,

[0071] This memory is used to store computer programs.

[0072] The processor is used to retrieve and run the computer program from memory, causing the terminal to perform the terminal method described above.

[0073] Fourthly, a computer storage medium is provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the methods described in the above aspects.

[0074] The beneficial effects of this invention are that the document writing assistance method, system, terminal, and storage medium provided by this invention recommend relevant materials through short text matching to guide writing ideas. Furthermore, combined with document opening / editing tools, the recommended results are displayed in real time. Additionally, recommended materials can be embedded into continuation text, and the text can be corrected. This invention effectively solves problems such as heavy workload for users, limited writing skills, time-consuming and laborious material selection, writing omissions, and low writing efficiency, reducing the user's writing burden and improving writing efficiency and quality.

[0075] Furthermore, the design principle of this invention is reliable, the structure is simple, and it has a very wide range of application prospects. Attached Figure Description

[0076] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0077] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.

[0078] Figure 2 This is a schematic block diagram of a system according to an embodiment of the present invention.

[0079] Figure 3 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present invention. Detailed Implementation

[0080] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.

[0081] Figure 1 This is a schematic flowchart illustrating a method according to an embodiment of the present invention. Wherein, Figure 1 The implementing entity can be a document writing assistance system.

[0082] like Figure 1 As shown, the method includes:

[0083] Step 110: Collect the written text and preprocess it to obtain input text;

[0084] Step 120: Input the input text into a pre-built first model. The first model outputs material text from the material library that matches the input text and performs error detection on the input text.

[0085] Step 130: Add a display interface to the document opening tool, output the matched material text to the display interface, and mark the error detection results on the document display interface;

[0086] Step 140: Based on the user's call command, the pre-built second model is invoked to continue writing based on the input text and the matched material text, and the continued content is output to the document display interface.

[0087] Unstructured text data is converted into structured data and stored in the writing library. The `parseToString()` method of the facade class (parses a given file and returns the extracted text content. To avoid unpredictable excessive memory usage, the returned string contains at most the first character extracted from the input document) is used to select an appropriate parser for content parsing, thus enabling the uploading and parsing of writing materials.

[0088] Data is input into the model, and the model is adjusted and retrained based on the output results. Hotspot analysis uses word frequency and inverse text frequency (TF-IDF) to perform lexical analysis on news data, calculates the lexical information values ​​of news articles and their contents, retrieves the key points of each article, and uses a weighted algorithm to rank and display hot words. Text recommendation uses supervised and unsupervised similarity to calculate the similarity value of short texts to achieve recommendation. Text continuation uses existing BERT to pre-train commonly used texts of power grid companies to obtain a common continuation model. By constructing a relationship network between the input text and the pre-trained model, an RN-WAE intelligent continuation model is built. Text correction uses a hybrid model for automatic text correction. This model uses the CSC-BiLSTM-CRF algorithm and the DAE-Decoder algorithm to correct text errors, and then combines the results of the two to obtain the final correction result of the hybrid model. Specifically, the CSC-BiLSTM-CRF algorithm is used for true word errors and shallow semantic errors, while the DAE-Decoder algorithm is used when deep semantic errors or out-of-vocabulary words are present.

[0089] The user-side implementation of model processing and retraining results includes: writing and recommending while writing, which intelligently recommends relevant materials based on the user's input of the article title, the selection of a paragraph of text by the mouse, and the automatic recognition of the text content before the cursor; intelligent error correction, which automatically identifies and intelligently corrects errors in the text caused by similar sounds, similar shapes, idioms, and punctuation; and text generation, which automatically continues and rewrites paragraph content.

[0090] This module integrates intelligent recommendation and text correction services with Office software, and uses Node.js to render the writing assistance module, enabling the application of intelligent writing services within the office software.

[0091] To facilitate understanding of the present invention, the following description further illustrates the manuscript writing assistance method provided by the present invention, based on the principle of the method and the process of assisting in manuscript writing in the embodiments.

[0092] Specifically, taking power-related document writing as an example, the document writing assistance methods include:

[0093] (1) Data extraction: By parsing unstructured documents, the text is converted into text that can be input into the model. When the document is passed to the parsing engine, a suitable type detection mechanism is selected and the document type is detected. A suitable parser is selected from the parser library, which contains classes that use external libraries. The document is passed to select the parser that will parse the content, extract the text, and also throw an exception for unreadable format.

[0094] (2) Model processing and retraining, including short text similarity calculation (B1), word vector calculation (B2), hybrid error correction (B3), and RN-WAE continuation model (B4).

[0095] Module B1: Short text similarity calculation determines the degree of similarity between two short texts. It is a special form of text matching or text implication task, returning a specific numerical value indicating the degree of similarity between the texts. The specific steps are as follows:

[0096] Step B101: First, apply unsupervised similarity calculation and train word vectors using a large-scale corpus via word2vec.

[0097] Step B102: Perform word segmentation on the short text and find the word vector corresponding to each word. Sum the word vectors of all words in the short text, or perform weighted summation according to part of speech or rules to obtain the sentence vector of the short text.

[0098] Step B103: Measure the distance between the sentence vectors of the two short texts to obtain their similarity value.

[0099] Step B104: Perform supervised similarity calculation under labeled conditions. Based on the labeled data, perform deep learning modeling and directly solve for the similarity value of the short text through end-to-end learning of the model.

[0100] Module B2: Word vector calculation involves constructing a dense vector for each word in the text data from the resource library, making it similar to the vectors of words appearing in similar contexts. The specific steps are as follows:

[0101] Step B201: Using Word2vec technology, each word in the fixed text corpus is represented by a vector. Then, each position t in the text is traversed, which has a center word c and a context word o. The similarity between the word vectors of c and o is used to calculate the probability of o given c (and vice versa).

[0102] Step B202: Maximize this probability by continuously adjusting the word vectors.

[0103] Step B203: To effectively train Word2vec, remove meaningless (or higher frequency) words (such as a, the, of, then...) from the dataset. This helps improve the model's accuracy and reduce training time.

[0104] Step B204: Perform negative sampling on each input, that is, update the weights of all correct labels, but only update the weights of a few incorrect labels.

[0105] Module B3: Hybrid error correction involves constructing a knowledge error detection model based on text semantic representation and refining the text semantic fine-grained correction model based on multi-level semantic representation. The specific steps are as follows:

[0106] Step B301: The input consists of the set of sentences to be proofread, the confusion set, and the trained and saved CSC-BiLSTM-CRF model. The output of the model is the annotation result of the sentences.

[0107] Step B302: Judge the output annotation results. If the word X labeled "W" appears in the confusion set, proceed to the next step of confusion word replacement and error correction. If there are no errors, continue reading the next sentence and finally replace the confusion words Xi in the confusion set one by one.

[0108] Step B303: The replaced sentence is labeled using the model, and the probability P(Xi) of the replaced word being labeled as "W" is calculated. The confused word with the minimum probability value in the confusion set is denoted as Xj. If P(X)-P(Xj)>β (β is the threshold), then the original word X is considered to be incorrect, and Xj is the correct replacement word.

[0109] Step B304: After replacing the erroneous words, output the corrected sentence.

[0110] Module B4: The RN-WAE continuation model is an automatic continuation model built using pre-trained methods, implementing a hybrid training method for relationship networks in power grid enterprises. This module does not run by default; it runs when the user enables the continuation function. The specific steps for running it are as follows:

[0111] Step B401: Given an input text X at the encoder, the word representations are first computed using a shared, randomly initialized word embedding layer. Then, the word representations are encoded using a single-layer, unidirectional LSTM to obtain the encoder's encoding result and the LSTM's hidden state h. n .

[0112] Step B402: The RN network structure rewrites the input text into two N×N matrices, one horizontally and one vertically, and then correlates them with the hidden state h. n The expanded identical matrices are concatenated to obtain triples of all elements. These triples are then passed through two multi-layer perceptron (MLP) circuits with different parameter controls to obtain the new hidden state h'. n .

[0113] Step B403: Generate new hidden states h' in the RN network layer n Sampling at the reparameter layer, from the new hidden state h' n The latent representation z is obtained by sampling from the new hidden state h'. n Calculate μ and σ respectively, and sample from the normal distribution consisting of μ and σ to obtain the initial hidden state h used to guide the decoder's generation. z .

[0114] Z i =μ i +σ i *∈,∈~N(0,1)

[0115] Step B404: Set the initial hidden state h z The input decoder uses a single-layer unidirectional LSTM to generate text.

[0116] (3) Assisted writing: The user inputs the target text through the text box. After the text is converted into a string, it is processed by the model in step (2) and output to the corresponding text output box.

[0117] (4) Results display: Users can view the results of the model output in step (2) through the Office software, forming a model output result set on the Office software side.

[0118] The method provided in this implementation automatically generates highly relevant materials for users based on key information in the user-input data, which helps users organize their writing ideas and complete writing conveniently and efficiently. By referencing, citing, and modifying recommended documents, and through a document correction module, errors in document content and format are automatically found, and correction schemes are provided, realizing an intelligent proofreading function, saving document proofreading efficiency and quality, and improving the quality of user writing.

[0119] like Figure 2 As shown, the system 200 includes:

[0120] The document processing unit 210 is used to collect written documents and preprocess them to obtain input text;

[0121] The first processing unit 220 is used to input the input text into a pre-built first model, and the first model outputs material text from the material library that matches the input text and performs error detection on the input text.

[0122] The document display unit 230 is used to add a display interface to the document opening tool, output the matched material text to the display interface, and mark the error detection results on the document display interface;

[0123] The second processing unit 240 is used to invoke a pre-built second model based on user-invoked instructions to continue writing based on input text and matched source text, and output the continued content to the document display interface.

[0124] Optionally, as an embodiment of the present invention, the first model includes:

[0125] The short text similarity calculation sub-model calculates the similarity between the input text and each text in the material library, and filters out the texts whose similarity reaches a set threshold.

[0126] The word vector calculation sub-model constructs a dense vector for each occurrence of the source text selected by the short text similarity calculation sub-model, and selects keywords of the source text based on the frequency of occurrence of the dense vector in the source text;

[0127] The hybrid error correction sub-model performs multi-level error correction on input text by constructing a knowledge error detection model based on text semantic representation.

[0128] Optionally, as an embodiment of the present invention, the short text similarity calculation sub-model includes:

[0129] Unsupervised similarity calculation methods were used to train word vectors using word2vec on a large-scale corpus;

[0130] The short text is segmented into words, and the word vector corresponding to each word is found. The word vectors of all words in the short text are summed to obtain the sentence vector of the short text.

[0131] The similarity between two short text sentence vectors is obtained by measuring the distance between them.

[0132] Supervised similarity calculation is performed under labeled conditions. Deep learning modeling is performed based on labeled data, and the similarity between two short texts is directly solved through end-to-end learning of the model.

[0133] Optionally, as an embodiment of the present invention, the word vector calculation sub-model includes:

[0134] Using Word2vec technology, each word in the fixed material library is represented by a vector. Then, each position t is traversed in the selected material text. The material text has a center word c and context words o. The similarity between the word vectors of c and o is used to calculate the probability of o given c.

[0135] This probability is maximized by continuously adjusting the word vectors;

[0136] Remove meaningless words from the training dataset and train the word vector calculation sub-model using the training dataset;

[0137] For each input, negative sampling is used to update the weights of all correct labels, and only the weights of some incorrect labels are updated.

[0138] Optionally, as an embodiment of the present invention, the hybrid error correction sub-model includes:

[0139] Input the set of sentences to be proofread and the confusion set into the trained and saved CSC-BiLSTM-CRF model to obtain the error labeling results of the sentences;

[0140] The output annotation results are judged. If an anomaly word marked as incorrect appears in the confusion set, the anomaly word replacement and error correction process is performed. If there is no error, the next sentence is read. Finally, the anomaly words in the confusion set are replaced one by one.

[0141] The replaced sentence is annotated, and the probability of the replaced word being annotated as wrong is calculated. The smallest annotated word in the confusion set is taken as the target confusion word. If the difference between the probability of the abnormal word being wrong and the probability of the target confusion word being wrong is greater than a preset threshold, then the abnormal word is determined to be wrong and the target confusion word is the correct replacement word.

[0142] Replace the abnormal words and output the corrected sentence.

[0143] Optionally, as an embodiment of the present invention, a display interface is added to the document opening tool, the matched material text is output to the display interface, and error detection results are marked on the document display interface, including:

[0144] Use the view function of the document opening tool to create a new display interface, and input the matching material text into the new display interface;

[0145] Use the annotation function of the document opening tool to annotate the error detection results in the document display interface.

[0146] Optionally, as an embodiment of the present invention, the second model includes:

[0147] Given input text at the encoder, word representations are computed using a shared, randomly initialized word embedding layer. These representations are then encoded using a single-layer, unidirectional LSTM to obtain the encoder's encoding result and the LSTM's hidden state h. n ;

[0148] The RN network structure rewrites the input text into two N×N matrices, one horizontally and one vertically, and then correlates them with the hidden state h. n The expanded identical matrices are concatenated to obtain triples of all elements. These triples are then processed twice by a multilayer perceptron controlled by different parameters to obtain a new hidden state h'. n ;

[0149] Generate a new hidden state h' in the RN network layer. n Sampling is performed at the reparameter layer, from the new hidden state h' n The latent layer representation z is obtained by sampling from the middle, and the sampling method includes: sampling the new hidden state h' n Calculate μ and σ respectively, and sample from the normal distribution consisting of μ and σ to obtain the initial hidden state h used to guide the decoder generation. z ;

[0150] The initial hidden state h z The input decoder uses a single-layer unidirectional LSTM to generate the continuation text.

[0151] Figure 3 This is a schematic diagram of the structure of a terminal 300 provided in an embodiment of the present invention. The terminal 300 can be used to execute the document writing assistance method provided in the embodiment of the present invention.

[0152] The terminal 300 may include a processor 310, a memory 320, and a communication unit 330. These components communicate via one or more buses. Those skilled in the art will understand that the server structure shown in the figure does not constitute a limitation of the present invention. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0153] The memory 320 can be used to store the execution instructions of the processor 310. The memory 320 can be implemented by any type of volatile or non-volatile memory terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. When the execution instructions in the memory 320 are executed by the processor 310, the terminal 300 is able to perform some or all of the steps in the above method embodiments.

[0154] The processor 310 serves as the control center of the storage terminal, connecting various parts of the electronic terminal via various interfaces and lines. It executes software programs and / or modules stored in the memory 320, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 310 may consist only of a central processing unit (CPU). In this embodiment of the invention, the CPU may have a single processing core or include multiple processing cores.

[0155] The communication unit 330 is used to establish a communication channel, enabling the storage terminal to communicate with other terminals. It can receive user data sent by other terminals or send user data to other terminals.

[0156] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, may include some or all of the steps provided in the embodiments of the present invention. The storage medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0157] Therefore, this invention uses short text matching to recommend relevant materials to guide writing ideas. It also integrates with document opening / editing tools to display the recommendation results in real time. Furthermore, it can embed recommended materials into continuation text and correct errors. This invention effectively solves problems such as heavy workload for users, limited writing skills, time-consuming and laborious material selection, writing omissions, and low writing efficiency, reducing the user's writing burden and improving writing efficiency and quality. The technical effects achieved by this embodiment can be found in the description above and will not be repeated here.

[0158] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other medium capable of storing program code. It includes several instructions to cause a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0159] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the terminal embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.

[0160] In the embodiments provided by this invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or units may be electrical, mechanical, or other forms.

[0161] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0162] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0163] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the invention should also be covered within the protection scope of the invention. Therefore, the protection scope of the invention should be determined by the scope of the claims.

Claims

1. A method for assisting in manuscript writing, characterized in that, include: Collect written texts and preprocess them to obtain input-ready text; The input text is input into a pre-built first model, and the first model outputs material text from the material library that matches the input text and performs error detection on the input text. Add a display interface to the document opening tool, output the matched material text to the display interface, and mark the error detection results on the display interface; The second model, which is pre-built, is invoked based on user commands to continue writing based on input text and matched source text, and the continued content is output to the display interface. The first model includes: The short text similarity calculation sub-model calculates the similarity between the input text and each text in the material library, and filters out the texts whose similarity reaches a set threshold. The word vector calculation sub-model constructs a dense vector for each word in the source text selected by the short text similarity calculation sub-model, and selects keywords from the source text based on the frequency of occurrence of the dense vector in the source text; The hybrid error correction sub-model performs multi-level error correction on input text by constructing a knowledge error detection model based on text semantic representation; The hybrid error correction sub-model includes: Input the set of sentences to be proofread and the confusion set into the trained and saved CSC-BiLSTM-CRF model to obtain the error labeling results of the sentences; The output annotation results are judged. If an anomaly word marked as incorrect appears in the confusion set, the anomaly word replacement and error correction process is performed. If there is no error, the next sentence is read. Finally, the anomaly words in the confusion set are replaced one by one. The replaced sentence is annotated, and the probability of the replaced word being annotated as wrong is calculated. The obfuscated word with the smallest probability of being annotated as wrong in the obfuscation set is selected as the target obfuscated word. If the difference between the probability of the abnormal word being wrong and the probability of the target obfuscated word being wrong is greater than a preset threshold, then the abnormal word is determined to be wrong and the target obfuscated word is the correct replacement word. Replace the abnormal words and output the corrected sentence; The second model includes: Given input text at the encoder, word representations are computed using a shared, randomly initialized word embedding layer. These representations are then encoded using a single-layer, unidirectional LSTM to obtain the encoder's encoding result and the LSTM's hidden state h. n ; The RN network structure rewrites the input text into two N×N matrices, one horizontally and one vertically, and then connects them to the hidden state h. n The expanded identical matrices are concatenated to obtain triples of all elements. These triples are then processed twice by a multilayer perceptron controlled by different parameters to obtain a new hidden state h'. n; Generate a new hidden state h' in the RN network layer. n Sampling at the reparameter layer, from the new hidden state h' n The latent layer representation z is obtained by sampling from the middle, and the sampling method includes: sampling the new hidden state h' n Calculate μ and σ respectively, and sample from the normal distribution consisting of μ and σ to obtain the initial hidden state h used to guide the decoder generation. z ; The initial hidden state h z The input decoder uses a single-layer unidirectional LSTM to generate the continuation text.

2. The method according to claim 1, characterized in that, The short text similarity calculation sub-model includes: Unsupervised similarity calculation methods were used to train word vectors using word2vec on a large-scale corpus; The short text is segmented into words, and the word vector corresponding to each word is found. The word vectors of all words in the short text are summed to obtain the sentence vector of the short text. The similarity between two short text sentence vectors is obtained by measuring the distance between them. Supervised similarity calculation is performed with labeled corpora. Deep learning modeling is performed based on the labeled data, and the similarity between two short texts is directly solved through end-to-end learning of the model.

3. The method according to claim 1, characterized in that, The word vector calculation sub-model includes: Using word2vec technology, each word in the fixed material library is represented by a vector. Then, each position t is traversed in the selected material text. The material text has a center word c and a context word o. The similarity between the word vectors of the center word c and the context word o is used to calculate the probability of the context word o appearing given the center word c. This probability is maximized by continuously adjusting the word vectors; Remove meaningless words from the training dataset and train the word vector calculation sub-model using the training dataset; For each input, negative sampling is used to update the weights of all correct labels, and only the weights of some incorrect labels are updated.

4. The method according to claim 1, characterized in that, Add a display interface to the document opening tool, output the matched source text to the display interface, and mark the error detection results on the display interface, including: Use the view function of the document opening tool to create a new display interface, and input the matching material text into the new display interface; Use the annotation function of the document opening tool to annotate the error detection results in the display interface.

5. A document writing assistance system, characterized in that, For performing the method according to any one of claims 1-4, comprising: The document processing unit is used to collect written documents and preprocess them to obtain input-ready text. The first processing unit is used to input the input text into a pre-built first model, and the first model outputs material text from the material library that matches the input text and performs error detection on the input text. The document display unit is used to add a display interface to the document opening tool, output the matched material text to the display interface, and mark the error detection results on the display interface; The second processing unit is used to invoke a pre-built second model based on user-invoked instructions to continue writing based on input text and matched source text, and then output the continued content to the display interface.

6. A terminal, characterized in that, include: processor; Memory used to store the processor's execution instructions; The processor is configured to perform the method according to any one of claims 1-4.

7. A computer-readable storage medium storing a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-4.