Text correction method and device

By using the fusion technology of Word2Vec word vector and TF-IDF feature vector in scientific and technological paper editing, matching and replacing wrong words, the problems of low work efficiency and high error rate of editors in the existing technology are solved, and efficient and accurate Text correction effect.

CN119047437BActive Publication Date: 2025-02-18长江水利委员会网络与信息中心
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411546772.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-18
Estimated Expiration
2044-11-01

Smart Images

  • Figure CN119047437B_ABST
    Figure CN119047437B_ABST
Patent Text Reader

Abstract

The present invention provides a text correction method and device, the method comprising: pre-processing a current document to construct a vocabulary of the current document; inputting the vocabulary of the current document into a pre-trained Word2Vec model to extract the Word2Vec word vector of each word in the vocabulary; and, under a preset document set, using a TF-IDF algorithm to calculate the TF-IDF value corresponding to each word in each document, and constructing the TF-IDF feature vector of each word; performing vector feature fusion on the TF-IDF feature vector of each word and the Word2Vec word vector to form a vector representation of each word; matching the corresponding target error word in a preset database according to the vector representation of each word; using the standard word corresponding to the target error word to replace each word in the current document, so as to realize text correction of the current document. The present invention greatly improves the efficiency of text editing and effectively reduces the error rate of text editing quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer automatic detection and editing, and in particular to a text correction method and device. Background Art

[0002] Editing and processing scientific papers is an important part of editing work, which is mainly divided into three aspects: content processing, technical processing and language processing. At present, conventional editing software on the market has error checking and correction functions, but it mainly modifies the paper language logic, typos, symbols, etc., and is powerless when it comes to professional technology. In addition, its basic database is relatively fixed, and it is difficult for users to modify it according to their own needs, which to a certain extent restricts the development of editing and proofreading work.

[0003] For scientific and technological papers, technical processing is often the key and difficult point. It involves many academic and scientific issues and a wide range of knowledge, which is difficult for editors to master in a short period of time. They usually rely on the experience repeatedly explored and summarized in the long-term publication process (including agreed rules of review meetings and finalization meetings, industry norms, expert suggestions, etc., hereinafter referred to as "empirical rules"). Since such empirical rules are personalized, distributed in a wide range of professional fields and are very cumbersome, they are difficult for editors to master and have a high error rate, and cannot meet the needs of digitalization and informatization of scientific and technological journals.

[0004] Therefore, it is of practical significance to use information technology to apply empirical rules to the editing of scientific papers to realize intelligent detection and correction of papers, thereby improving the work efficiency of editors. Summary of the invention

[0005] The present invention provides a text correction method and device, which are used to solve the defect of low working efficiency of editors in the prior art.

[0006] In a first aspect, the present invention provides a text correction method, comprising: preprocessing a current document to construct a vocabulary of the current document; inputting the vocabulary of the current document into a pre-trained Word2Vec model to extract the Word2Vec word vector of each word in the vocabulary; and, under a preset document set, using a TF-IDF algorithm to calculate the TF-IDF value corresponding to each word in each document to construct a TF-IDF feature vector of each word; performing vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form a vector representation of each word; matching corresponding target error words in a preset database according to the vector representation of each word; wherein the preset database includes a one-to-one corresponding plurality of error words and standard words, the error word refers to a word that does not meet the preset standard, and the standard word is a word that meets the preset standard, and the preset standard is determined according to industry standards and expert rules; using the standard word corresponding to the target error word, each word in the current document is replaced to achieve text correction of the current document.

[0007] The text correction method provided by the present invention also includes: adjusting the Word2Vec model and / or the vector feature fusion method according to the matching result and / or the replacement result.

[0008] According to the text correction method provided by the present invention, the current document is preprocessed to construct a vocabulary of the current document, including: performing text cleaning and word segmentation on the current document to construct a vocabulary of the current document.

[0009] According to the text correction method provided by the present invention, under a preset document set, the TF-IDF algorithm is used to calculate the TF-IDF value corresponding to each word in each document, and the TF-IDF feature vector of each word is constructed, including: calculating the word frequency TF of each word in the vocabulary of each document, and calculating the inverse document frequency IDF of each word in the preset document set; calculating the TF-IDF value corresponding to each word in each document according to the word frequency TF of each word in the vocabulary of each document and the inverse document frequency IDF in the preset document set; and constructing the TF-IDF feature vector of each word according to the TF-IDF value corresponding to each word in each document.

[0010] According to the text correction method provided by the present invention, vector feature fusion is performed on the TF-IDF feature vector and the Word2Vec word vector of each word to form the vector representation of each word, including: dimension unification of the TF-IDF feature vector and the Word2Vec word vector of each word; weighted feature fusion of the TF-IDF feature vector and the Word2Vec word vector to form a weighted fusion vector; and normalization of the weighted fusion vector to generate the vector representation of each word.

[0011] According to the text correction method provided by the present invention, the corresponding target error word is matched in a preset database according to the vector representation of each word, including: calculating the similarity between the vector representation of each word and the vector representation of the error word in the preset database; wherein the vector representation of the error word is pre-constructed; in the case where there is an error word in the preset database whose similarity with each word is greater than a preset similarity threshold, the error word with the greatest similarity is used as the target error word.

[0012] According to the text correction method provided by the present invention, the operation of preprocessing the current document further includes at least one of the following operations: removing stop words, extracting stems, tagging parts of speech, and converting to lowercase.

[0013] In a second aspect, the present invention further provides a text correction device, comprising:

[0014] The document processing module is used to pre-process the current document and build the vocabulary of the current document;

[0015] The feature extraction module is used to input the vocabulary of the current document into the pre-trained Word2Vec model to extract the Word2Vec word vector of each word in the vocabulary; and, under a preset document set, use the TF-IDF algorithm to calculate the TF-IDF value corresponding to each word in each document, and construct the TF-IDF feature vector of each word;

[0016] A feature fusion module, used for performing vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form a vector representation of each word;

[0017] A matching module, used for matching a corresponding target wrong word in a preset database according to the vector representation of each word; wherein the preset database includes a plurality of wrong words and standard words in one-to-one correspondence, wherein the wrong word refers to a word that does not meet the preset standard, and the standard word refers to a word that meets the preset standard, and the preset standard is determined according to industry standards and expert rules;

[0018] The text replacement correction module is used to replace each of the words with the standard words corresponding to the target erroneous words, so as to correct the text of the current document.

[0019] In a third aspect, the present invention provides an electronic device 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 any of the above-described text correction methods when executing the program.

[0020] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described text correction methods.

[0021] The text correction method and device provided by the present invention integrate the empirical rules in the text editing process, pre-establish a high-quality wrong word-standard word database, and transform the traditional manual editing (which is greatly affected by the individual's learning and memory abilities) into an integrated computing system that automatically completes it. First, through data integration, the originally scattered, diverse, and complex text editing work is integrated into the computer program, and the empirical rules are maximized, effectively avoiding the loss of work results; second, it helps to guide editing beginners to quickly grasp the key points and reduce the difficulty of editing scientific papers; third, it greatly improves the text editing efficiency and reduces the error rate of text editing quality.

[0022] The present invention not only considers the semantic information of words (through the Word2Vec model), but also considers the importance of words in specific contexts (through the TF-IDF value), so that the correction result is more accurate and reasonable. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0024] Figure 1 It is one of the flow charts of the text correction method provided by the present invention;

[0025] Figure 2 This is the second flow chart of the text correction method provided by the present invention;

[0026] Figure 3 It is a framework diagram of a standardized intelligent detection and correction system for scientific and technological papers involved in the present invention;

[0027] Figure 4It is a structural schematic diagram of the text correction device provided by the present invention;

[0028] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings 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.

[0030] It should be noted that, in the description of the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.

[0031] Combine the following Figure 1-Figure 5 The text correction method and device provided by the embodiments of the present invention are described.

[0032] Figure 1 It is one of the flowcharts of the text correction method provided by the present invention, such as Figure 1 As shown, including but not limited to the following steps:

[0033] Step 101: Preprocess the current document and build a vocabulary of the current document.

[0034] The current document may be a Word document (generally a scientific paper in the present invention). Optionally, the current document is cleaned and segmented to construct a vocabulary of the current document. Of course, other operations may also be performed to obtain a clean vocabulary. The following is an example of constructing a vocabulary of the current document:

[0035] (1) Text cleaning: Remove irrelevant characters in the current document, such as special symbols, punctuation marks, etc., and only retain text information.

[0036] (2) Word segmentation: splitting a continuous text string into separate words or phrases.

[0037] (3) Stop word removal: Stop words refer to words that frequently appear in the text but contribute little to the meaning of the text, such as "de", "shi", "zai", etc. Removing these words from the text can reduce the noise in subsequent processing.

[0038] (4) Stemming: For some languages, such as English, it may be necessary to restore the vocabulary to its basic form. For example, convert "running" to "run".

[0039] (5) Part-of-speech tagging: Perform part-of-speech tagging on each word in the text to identify whether it is a noun, verb, adjective, etc.

[0040] (6) Convert to lowercase: To avoid treating "Apple" and "apple" as two different words, convert the English text to lowercase.

[0041] (7) Build a vocabulary: After processing all the text, build a unified vocabulary for subsequent text representation and vectorization.

[0042] Step 102: Input the vocabulary of the current document into the pre-trained Word2Vec model to extract the Word2Vec word vectors of each vocabulary in the vocabulary; and, under the preset document set, use the TF-IDF algorithm to calculate the TF-IDF values corresponding to each vocabulary in each document, and construct the TF-IDF feature vectors of each vocabulary.

[0043] The preset document set may include all the processed documents and the documents prepared in advance for training the Word2Vec model.

[0044] Step 103: Perform vector feature fusion on the TF-IDF feature vectors and Word2Vec word vectors of each vocabulary to form the vector representation of each vocabulary.

[0045] Step 104: Match the corresponding target error words in the preset database according to the vector representation of each vocabulary.

[0046] Among them, the preset database includes a variety of error words and standard words in one-to-one correspondence. The error words refer to words that do not meet the preset standards, and the standard words are words that meet the preset standards. The preset standards are determined according to industry standards and expert rules.

[0047] Step 105: Use the standard words corresponding to the target error words to replace each vocabulary in the current document to achieve text correction of the current document.

[0048] The text correction method provided by the present invention integrates the empirical rules in the text editing process, pre-establishes a high-quality wrong word-standard word database, and transforms the traditional manual editing (which is greatly affected by the individual's learning and memory abilities) into an integrated computing system for automatic completion. First, through data integration, the originally scattered, diverse and complex scientific and technological paper editing work is integrated into the computer program, and the empirical rules are maximized, effectively avoiding the loss of work results; second, it helps to guide editing beginners to quickly grasp the key points and reduce the difficulty of text editing; third, it greatly improves the text editing efficiency and reduces the error rate of text editing quality.

[0049] Based on the content of the above embodiment, as an optional embodiment, the text correction method provided by the present invention uses the TF-IDF algorithm to calculate the TF-IDF value corresponding to each word in each document, and constructs the TF-IDF feature vector of each word, including the following steps:

[0050] (1) Calculate the term frequency TF of each word in the vocabulary of each document, and calculate the inverse document frequency IDF of each word in a preset document set.

[0051] Term frequency (TF) is the number of times a word appears in a document divided by the total number of words in the document. d Vocabulary in t , TF can be expressed as:

[0052] .

[0053] Inverse document frequency (IDF) reflects the importance of a word in the entire document collection. For word t, IDF can be expressed as:

[0054]

[0055] (2) calculating the TF-IDF value corresponding to each word in each document according to the word frequency TF of each word in the vocabulary of each document and the inverse document frequency IDF in a preset document set;

[0056] The TF-IDF value is the product of TF and IDF, expressed as:

[0057]

[0058] (3) Constructing a TF-IDF feature vector for each word according to the TF-IDF value corresponding to each word in each document.

[0059] For a word t, Eigenvector , which can be expressed as:

[0060]

[0061] in, are the documents in the preset document set D.

[0062] It should be noted that if the vocabulary t In the documentation d If it appears in Corresponding documents d The location is If not present, the value of Corresponding documents d The position is set to 0.

[0063] The present invention can construct a TF-IDF feature vector for each word in the above manner to facilitate subsequent feature fusion.

[0064] Based on the contents of the above embodiments, as an optional embodiment, the text correction method provided by the present invention, the Word2Vec model is usually obtained by training a large amount of text data, the purpose of which is to learn the word vector of each word, and these vectors can reflect the semantic relationship between words in a multidimensional space.

[0065] The training method of the Word2Vec model includes: building a corresponding vocabulary based on a pre-prepared document set to form a training data set; selecting the Skip-Gram model, setting hyperparameters, and training the model based on the training data set until the model converges to generate word vectors with excellent performance.

[0066] Based on the content of the above embodiment, as an optional embodiment, the text correction method provided by the present invention performs vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form the vector representation of each word, including the following steps:

[0067] (1) Unify the dimensions of the TF-IDF feature vector and Word2Vec word vector of each word.

[0068] Since there is usually a problem of inconsistent dimensions between TF-IDF feature vectors and Word2Vec word vectors. Optionally, the present invention maps the TF-IDF feature vector to the same dimensional space as the Word2Vec word vector. As another optional method, the present invention can also directly perform dimensionality processing on the low-dimensional vector by setting it to zero, so that the dimensions of the two vectors are consistent.

[0069] (2) Performing weighted feature fusion on the TF-IDF feature vector and the Word2Vec word vector to form a weighted fusion vector.

[0070] Weighted fusion means assigning different weights to TF-IDF feature vectors and Word2Vec word vectors to emphasize or weaken the importance of certain features. The choice of weights can be determined according to the requirements of the task or through cross-validation.

[0071] The present invention determines a weight coefficient ɑ (which can be obtained through experiments) for weighting the TF-IDF feature vector and the Word2Vec word vector; multiply each element of the TF-IDF vector by ɑ, and multiply each element of the Word2Vec vector by 1-ɑ, then:

[0072] Weighted TF-IDF feature vector = ɑ TF-IDF feature vector;

[0073] Weighted Word2Vec word vector = (1-ɑ)·Word2Vec word vector.

[0074] Add the weighted TF-IDF vector and Word2Vec vector to get the weighted fusion vector , that is:

[0075] = weighted TF-IDF feature vector + weighted Word2Vec word vector.

[0076] (3) Normalizing the weighted fusion vector to generate a vector representation of each word.

[0077]

[0078] in, is the normalized vector representation.

[0079] Based on the content of the above embodiments, as an optional embodiment, the text correction method provided by the present invention further includes: adjusting the Word2Vec model and / or the vector feature fusion method according to the matching results and / or replacement results.

[0080] Specifically, this embodiment is to further optimize the effect of text correction. The following are optional adjustment methods:

[0081] (1) The Word2Vec model can be adjusted in the following ways:

[0082] Retrain the model: If you find that some wrong words are not correctly recognized, you can consider adding more domain-related training data to the training set and then retrain the Word2Vec model. This will enable the model to better capture the semantic information of these specific words.

[0083] Fine-tuning the model: If you already have a pre-trained model, you can fine-tune it according to the specific task. This means continuing to train the model using data from a preset document collection to make the model better suited to the specific domain.

[0084] Adjust hyperparameters: Depending on the matching effect, you can adjust some hyperparameters of the Word2Vec model, such as window size, number of dimensions, minimum word frequency threshold, etc., to obtain more appropriate word vectors.

[0085] (2) The vector feature fusion method can be adjusted in the following ways:

[0086] Weighted fusion: You can try different weighting schemes to combine TF-IDF feature vectors and Word2Vec word vectors. For example, you can adjust the weight ratio of TF-IDF value and word vector based on the final correction result to find the best fusion ratio.

[0087] Dynamic adjustment: Dynamically adjust the fusion method according to different document types or fields. For example, for some documents that pay great attention to vocabulary accuracy, the weight of TF-IDF feature vectors can be increased; for those documents that pay more attention to semantic coherence, the weight of Word2Vec word vectors can be increased.

[0088] Through the above method, the present invention can continuously optimize the way of fusing the Word2Vec model and vector features, thereby improving the accuracy and efficiency of text correction.

[0089] Based on the content of the above embodiment, as an optional embodiment, the text correction method provided by the present invention matches the corresponding target error word in a preset database according to the vector representation of each word, including the following steps:

[0090] (1) Calculating the similarity between the vector representation of each word and the vector representation of the wrong word in the preset database.

[0091] Commonly used similarity metrics include cosine similarity, Euclidean distance, etc. In the present invention, cosine similarity can be selected to calculate the similarity between the above two vectors.

[0092] Among them, the vector representation of the wrong word is pre-constructed; the construction method can refer to the method for obtaining the vector representation of any word in the present invention, which will not be repeated here.

[0093] (2) When there is an erroneous word in the preset database whose similarity with each of the words is greater than a preset similarity threshold, the erroneous word with the greatest similarity is used as the target erroneous word.

[0094] The present invention can define a preset similarity threshold through historical experience, and only when the calculated similarity is greater than the threshold, the word is considered to match a certain wrong word in the database.

[0095] Furthermore, for each word, if there are multiple wrong words with similarities greater than a threshold, the wrong word with the greatest similarity is selected as the target wrong word.

[0096] In summary, the present invention achieves more accurate matching and replacement by establishing an empirical rule database and integrating the advantages of two algorithms: word vectors generated by Word2Vec and feature vectors extracted by the TF-IDF algorithm. By using pre-entered empirical rules and comparing and correcting them with the text, it helps to assist novice editors to quickly grasp the key points, greatly improves the efficiency of scientific paper editing, and effectively reduces the error rate of editing and proofreading quality of scientific journals.

[0097] Furthermore, Figure 2 This is the second flow chart of the text correction method provided by the present invention. Figure 3 This is a framework diagram of the standardized intelligent detection and correction system for scientific papers involved in the present invention. In order to more clearly illustrate the technical solution of the present invention, the following is combined with Figure 2 and Figure 3 A complete implementation process is described below.

[0098] (1) Software page design: The software interface displays four functions: data entry, document opening, editing and modification, and querying modification records.

[0099] (2) The editors collect and organize national and industry standards and the empirical rules in the process of publishing scientific papers (including the agreed rules of review meetings and finalization meetings, industry norms, expert suggestions, etc.), and enter the "wrong words" and "standard words" into the database one by one to improve the information storage module.

[0100] Specifically, empirical rules include but are not limited to the following two categories:

[0101] The first category refers to national and industry standards (hereinafter referred to as "standards"), such as: "Rules for Writing Academic Papers" (GB / T7713.2-2022), "International System of Units and Their Applications" (GB / T 3100-93), "Rules for Citation of Information and Documentation References" (GB / T 7714-2015), etc., mainly including paper formats, sentences and other contents.

[0102] The second category refers to the rules that editors of scientific and technological journals have repeatedly explored and summarized in the long-term publication process (including agreed rules of review meetings and finalization meetings, industry norms, expert suggestions, etc.), including but not limited to: the use of professional terms and professional verbs in different contexts (including English abbreviations), fixed expression common engineering conventions, formula symbols, common standardized quantity names, unit symbols, and easily misspelled characters.

[0103] Optionally, the "wrong word" in the present invention is defined as follows:

[0104] The first category is the errors in sentences, wrong words and improper collocation in the Standard, such as (correct ones are in brackets): radiation, much attention, born in a certain place, grid division, deflection, weakening, similar runoff size, normalization, substitution into formula, perseverance, delay of construction period, etc.;

[0105] The second category is that the sentences (words) are not wrong, but they are used inappropriately in scientific papers, or non-standard, obsolete nouns and terms are used, which are often difficult to identify when using conventional means of detection. For example (correct ones are in brackets): noise (noise), conductivity (conductivity), probability (probability), threshold (threshold), specific heat (specific heat capacity), thermal conductivity factor (thermal conductivity coefficient), specific gravity (density or relative density), mechanism (mechanism), concrete (concrete), mechanical properties (mechanical properties), test days / d (test time / d), weight 100g (mass 100g), X is a dimensionless proportional constant (X is a dimensionless proportional constant), etc. There is another type of "wrong word" that needs to be judged based on expert advice. For example, in terms of the difference in rock mass classification, in highway and railway tunnels, rock mass is divided into I~V "grades" (Engineering Rock Mass Classification Standard (GB / T 50218)), and in water conservancy and hydropower engineering, rock mass is divided into I~V "classes" (Code for Geological Survey for Water Conservancy and Hydropower Engineering (GB50487)). There are differences in the use of professional terms in different usage contexts.

[0106] Optionally, the “standard words” in the present invention are defined as follows:

[0107] The words in scientific and technological papers that conform to the terms of various disciplines and relevant standards promulgated by the National Committee for the Examination of Natural Science Terminology, and the standardized words and usage specified in the "China Academic Journal (CD-ROM Edition) Retrieval and Evaluation Data Specifications".

[0108] For ease of understanding, let's take the common incorrect phrase "X is a dimensionless proportional constant" in scientific papers as an example. Enter "dimensionless" into "incorrect word" and "dimension one" into "standard word", and the system will record and store it.

[0109] (3) Extract the text in the Word document and preprocess the text in the Word document, including word segmentation, stop word removal, etc., to obtain the key words in the text.

[0110] Specifically, the text is tokenized and stop words are removed to obtain ["X", "dimensionless", "proportion", "constant"].

[0111] (4) Generate TF-IDF feature vectors, train the Word2Vec model, and combine the TF-IDF feature vectors with the Word2Vec word vectors through weighted averaging to form a new vector representation.

[0112] Through the TF-IDF feature vector obtaining method introduced in the above embodiment, the TF-IDF vector of the “wrong word” or “dimensionless” in this example is obtained as [0.5, 0.2, 0.3].

[0113] The “dimensionless” Word2Vec word vector obtained using the Word2Vec model is [0.5, -0.1, 0.2].

[0114] In this embodiment, ɑ is set to 0.5, that is, the contributions of the two are equal, and the weighted fusion vector is:

[0115] +

[0116]

[0117] Furthermore, normalization is performed:

[0118]

[0119] .

[0120] (5) Use the fused vector representation to perform matching operations. When a matching "wrong word" is found, find the corresponding "standard word" in the database and replace it.

[0121] In this embodiment, “dimension one” is used to replace “dimensionless”.

[0122] It should be noted that whether to replace the words in the original text is determined based on the database query results. If the corresponding wrong word is found, the replacement is performed; if not found, the original word is kept or other preset strategies are adopted.

[0123] (6) According to the actual matching and replacement effects, adjust and optimize the model parameters, feature fusion methods, etc. to improve the accuracy and efficiency of the operation.

[0124] Specifically, if it is found that "dimensionless" is incorrectly replaced, the value of the weight coefficient ɑ can be adjusted, or other parameters of the TF-IDF and Word2Vec models can be reselected and the model can be retrained.

[0125] (7) The editor confirms the words to be replaced by the system one by one, completes the modification and saves it after confirmation.

[0126] Specifically, professionals review and confirm the results of the automatic replacement to ensure the accuracy of the replacement. During the review process, the staff found that the "dimensionless" in "X is a dimensionless proportional constant" was correctly replaced with "dimension one", so they confirmed the replacement. If the replacement is incorrect, the staff will make corrections and provide feedback to the system to optimize the replacement algorithm.

[0127] As an optional embodiment, the present invention also provides a specific process of using the standardized intelligent detection and correction system for scientific and technological papers to edit text, as shown below:

[0128] (1) Data entry: enter the "wrong words" and "standard words" in the empirical rules into the preset database according to categories (professional terms, commonly used conventional expressions, standardized quantity nouns, easily mistaken characters, etc.);

[0129] (2) Open document: Import the document to be edited.

[0130] (3) Information modification: The system extracts text information from the Word document, pre-processes the text in the Word document, and compares the extracted data information with the "wrong words" in the database. If there is no "wrong word", it will be skipped directly; if there is an "wrong word", it will be replaced with a "standard word".

[0131] (4) Confirm the modification: Confirm the modification content, and the program will automatically add the confirmed modification record to the database for storage and backup.

[0132] (5) View modification records: store and query confirmed modification information.

[0133] It should be noted that the above system is only a feasible text editing system designed based on the text correction method provided by the present invention. Researchers can divide the system into different functional modules according to actual needs, and design a more beautiful human-computer interaction interface. However, as long as the text correction method provided by the present invention is adopted, it is essentially within the protection scope of the present invention.

[0134] Figure 4 Schematic diagram of the structure of the text correction device provided by the present invention. Figure 4As shown, the device includes: a document processing module 410, a feature extraction module 420, a feature fusion module 430, a matching module 440 and a text replacement correction module 450;

[0135] The document processing module 410 is used to pre-process the current document and construct a vocabulary of the current document;

[0136] The feature extraction module 420 is used to input the vocabulary of the current document into the pre-trained Word2Vec model to extract the Word2Vec word vector of each word in the vocabulary; and, under a preset document set, use the TF-IDF algorithm to calculate the TF-IDF value corresponding to each word in each document, and construct the TF-IDF feature vector of each word;

[0137] A feature fusion module 430 is used to perform vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form a vector representation of each word;

[0138] A matching module 440 is used to match a corresponding target wrong word in a preset database according to the vector representation of each word; wherein the preset database includes a plurality of wrong words and standard words in one-to-one correspondence, wherein the wrong word refers to a word that does not meet the preset standard, and the standard word refers to a word that meets the preset standard, and the preset standard is determined according to industry standards and expert rules;

[0139] The text replacement correction module 450 is used to replace each of the words with the standard words corresponding to the target erroneous words, so as to correct the text of the current document.

[0140] It should be noted that the text correction device provided in the embodiment of the present invention can execute the text correction method described in any of the above embodiments during specific operation, which will not be described in detail in this embodiment.

[0141] Figure 5 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other via the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the text correction method.

[0142] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0143] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the text correction method provided in the above-mentioned embodiments.

[0144] On the other hand, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the text correction method provided in the above embodiments.

[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A text correction method, characterized in that: include: Preprocess the current document and build the vocabulary of the current document; Input the vocabulary of the current document into the pre-trained Word2Vec model, extract the Word2Vec word vector of each word in the vocabulary; and, under the preset document set, use the TF-IDF algorithm to calculate the TF-IDF value corresponding to each word in each document, and construct the TF-IDF feature vector of each word; Performing vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form a vector representation of each word; According to the vector representation of each word, a corresponding target error word is matched in a preset database; wherein the preset database includes a plurality of error words and standard words corresponding to each other, the error word refers to a word that does not meet the preset standard, and the standard word refers to a word that meets the preset standard, and the preset standard is determined according to industry standards and expert rules; Using the standard word corresponding to the target incorrect word, each word in the current document is replaced to correct the text of the current document; Performing vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form a vector representation of each word, including: Unifying the dimensions of the TF-IDF feature vector and the Word2Vec word vector of each word; Performing weighted feature fusion on the TF-IDF feature vector and the Word2Vec word vector to form a weighted fusion vector; Normalizing the weighted fusion vector to generate a vector representation of each word; It also includes: for documents that focus on lexical accuracy, increase the weight of TF-IDF feature vectors; for documents that focus more on semantic coherence, increase the weight of Word2Vec word vectors.

2. The text correction method according to claim 1, characterized in that: Also includes: According to the matching result and / or the replacement result, the Word2Vec model and / or the vector feature fusion method are adjusted.

3. The text correction method according to claim 1, characterized in that: Preprocess the current document and build the vocabulary of the current document, including: Perform text cleaning and word segmentation on the current document to build the vocabulary of the current document.

4. The text correction method according to claim 1, characterized in that: Under the preset document set, the TF-IDF value corresponding to each word in each document is calculated using the TF-IDF algorithm to construct the TF-IDF feature vector of each word, including: Calculate the word frequency TF of each word in the vocabulary of each document, and calculate the inverse document frequency IDF of each word in the preset document set; Calculate the TF-IDF value corresponding to each word in each document according to the word frequency TF of each word in the vocabulary of each document and the inverse document frequency IDF in the preset document set; According to the TF-IDF value corresponding to each word in each document, a TF-IDF feature vector of each word is constructed.

5. The text correction method according to claim 1, characterized in that: According to the vector representation of each word, matching the corresponding target error word in the preset database includes: Calculating the similarity between the vector representation of each word and the vector representation of the wrong word in the preset database; wherein the vector representation of the wrong word is pre-constructed; When there is an erroneous word in the preset database whose similarity with each of the words is greater than a preset similarity threshold, the erroneous word with the greatest similarity is used as the target erroneous word.

6. The text correction method according to claim 1, characterized in that: The operation of preprocessing the current document also includes at least one of the following operations: Remove stop words, stem, tag parts of speech, and convert to lower case.

7. A text correction device, characterized in that: include: The document processing module is used to pre-process the current document and build the vocabulary of the current document; The feature extraction module is used to input the vocabulary of the current document into the pre-trained Word2Vec model to extract the Word2Vec word vector of each word in the vocabulary; and, under a preset document set, use the TF-IDF algorithm to calculate the TF-IDF value corresponding to each word in each document, and construct the TF-IDF feature vector of each word; A feature fusion module, used for performing vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form a vector representation of each word; Performing vector feature fusion on the TF-IDF feature vector and the Word2Vec word vector of each word to form a vector representation of each word, including: Unifying the dimensions of the TF-IDF feature vector and the Word2Vec word vector of each word; Performing weighted feature fusion on the TF-IDF feature vector and the Word2Vec word vector to form a weighted fusion vector; Normalizing the weighted fusion vector to generate a vector representation of each word; A matching module, used for matching a corresponding target wrong word in a preset database according to the vector representation of each word; wherein the preset database includes a plurality of wrong words and standard words in one-to-one correspondence, wherein the wrong word refers to a word that does not meet the preset standard, and the standard word refers to a word that meets the preset standard, and the preset standard is determined according to industry standards and expert rules; A text replacement correction module, used to replace each of the words with a standard word corresponding to the target erroneous word, so as to correct the text of the current document; The device is also used to increase the weight of the TF-IDF feature vector for documents that focus on vocabulary accuracy; and to increase the weight of the Word2Vec word vector for documents that focus more on semantic coherence.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the text correction method according to any one of claims 1 to 6 are implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the text correction method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Text processing method and device and electronic equipment

    CN115455944A