A method and device for testing the correctness of scientific formulas

Through the combination of MathML format, image rendering, and OCR technology, the error problem in cross-platform conversion of scientific formulas is solved, accurate conversion and error correction of formulas are achieved, and the compatibility and reusability of data are ensured.

CN111046637BActive Publication Date: 2024-08-27SMALL BOATS SAILING EDUCATION TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911360663.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-25
Publication Date
2024-08-27
Estimated Expiration
2039-12-25

AI Technical Summary

Technical Problem

In the publishing industry, the data formats of scientific formulas vary with different software and platforms, leading to errors in cross-platform conversion, and it is difficult to achieve effective compatibility and error correction between different formats with existing technology.

Method used

Using the MathML format as the core, it acquires and identifies scientific formulas, converts its initial data format into the target data format, and uses image rendering and OCR technology for content comparison, combined with the minimum edit distance algorithm and manual error correction to ensure the correctness and accuracy of the formulas. compatibility.

Benefits of technology

It achieves the accuracy of cross-platform conversion of scientific formulas between Windows, Linux and Mac OS operating systems, improves the reliability and efficiency of the conversion process through error correction functions, and ensures the correctness and reuse of scientific formula data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111046637B
    Figure CN111046637B
Patent Text Reader

Abstract

The present invention provides a method and device for checking the correctness of a scientific formula. The method acquires and identifies a scientific formula, converts it into a target data format according to an initial data format of the scientific formula, and determines whether the scientific formula has been entered and reviewed. If the current formula has not been entered and reviewed, the content represented by the initial data format is checked to see whether it is consistent with the content represented by the target data format. The method takes MathML format data as the core, and uses the markup structure of MathML to solve the problem that errors are prone to occur during the cross-platform conversion of current scientific formula data between Windows, Linux and Mac OS operating systems. At the same time, the scientific formula data that has been corrected in the error correction module can be saved, and the scientific formula materials that have been entered and proofread can be reused.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of electronic document editing and publishing, and in particular to a method and device for checking the correctness of a scientific formula. Background Art

[0002] In the field of publications, especially in the field of textbook publishing, various scientific formula materials are indispensable. With the continuous advancement of informatization, the continuous development and evolution of electronic publishing and teaching tools, various software and document formats for entering scientific formulas have continued to increase. In the current publishing industry, in the editing of scientific formulas, the software used mainly includes Word, MathType, etc.; while in the printing process, Tex software is mainly used. Due to different application scenarios, the data formats of the scientific formulas entered are different, and different data formats are not 100% compatible with each other. Some foreign input software also requires special intervention during operation. In order to make full use of the existing scientific formulas in different data formats and avoid duplication of work, a method is needed to realize the correct conversion of scientific formulas entered on different platforms and different software. Summary of the invention

[0003] In view of the above reasons, the purpose of the present invention is to provide a method for checking the correctness of scientific formulas. The method is based on MathML format data, is compatible with different input platforms and input software, and realizes the correct conversion of scientific formulas between different platforms and software.

[0004] To achieve the above object, the present invention adopts the following technical solution: a method for testing the correctness of a scientific formula, which comprises the following steps:

[0005] Acquire and identify scientific formulas, and convert the initial data format into the target data format according to the scientific formulas;

[0006] Determine whether the scientific formula has been entered and reviewed. If the current formula has not been entered and reviewed, check whether the content represented by the initial data format is consistent with the content represented by the target data format.

[0007] Furthermore, the “checking whether the content represented by the initial data format is consistent with the content represented by the target data format” includes:

[0008] Rendering the initial data format and the target data format into a picture; or converting the initial data format and / or the target data format into a third data format, and rendering the third data format into a picture;

[0009] Convert the content in the picture into text;

[0010] Compare the text difference values ​​after the image conversion to determine whether the difference values ​​are within the set judgment result range.

[0011] Furthermore, before the "rendering into a picture", the process also includes: judging the picture rendering result, and if the rendering is successful, converting the content in the picture into text.

[0012] Furthermore, the “rendering into a picture” includes: obtaining a vector diagram in the format of the formula to be reviewed, and converting the vector diagram into a picture of RGB channels;

[0013] Preferably, the "obtaining a vector diagram in the formula format to be reviewed" includes: converting the SVG data formula format into an RGB channel image, converting the SVG image into PDF, and then converting the PDF into a picture.

[0014] Furthermore, the “converting the content in the picture into text” includes: converting the content in the picture into text using OCR recognition.

[0015] Further, the “comparing text difference values ​​after image conversion” includes using a minimum edit distance algorithm for comparison;

[0016] Preferably, if the verification result shows inconsistent contents, manual correction is performed.

[0017] Furthermore, the “converting the initial data format into the target data format according to the scientific formula” includes:

[0018] Obtain the initial data format and target data format of the scientific formula to be converted, parse the formula to be converted, and verify the legitimacy of the content;

[0019] Perform format conversion according to the target data format;

[0020] Format the converted formula data to produce data with unified standards.

[0021] The present invention also provides a device for correctly converting scientific formulas, which includes: a formula processing module, the formula processing module acquires and identifies scientific formulas, and converts the scientific formulas into target data formats according to the initial data format;

[0022] A judgment module, wherein the judgment module judges whether the scientific formula has been entered and reviewed. If the current formula has not been entered and reviewed, the judgment module checks whether the content represented by the initial data format is consistent with the content represented by the target data format;

[0023] Preferably, it also includes an error correction module, which provides an entry for manual error correction when the checked contents are inconsistent.

[0024] Furthermore, the judging module includes:

[0025] A first submodule, which renders an initial data format and a target data format into a picture; or converts the initial data format and / or the target data format into a third data format, and renders the third data format into a picture;

[0026] A second submodule, wherein the second submodule converts the content in the picture into text;

[0027] The third submodule compares the text difference value after the image conversion to determine whether the difference value is within a set determination result interval.

[0028] Furthermore, the formula processing module includes: a content parsing module, a conversion module and a formatting module;

[0029] The content parsing module: obtains the initial data format and target data format of the scientific formula to be converted, parses the formula, and verifies the legitimacy of the content;

[0030] The conversion module is provided with a conversion relationship matching table, and structures the formula data according to the scientific formula conversion relationship matching table, and converts the scientific formula data in the initial format into the target format;

[0031] The formatting module is used to format formula data and produce data with unified standards.

[0032] The present invention takes MathML format data as the core and utilizes MathML's marked structure to solve the problem that errors are prone to occur during the current cross-platform conversion of scientific formula data between Windows, Linux and Mac OS operating systems. At the same time, errors occurring during the conversion process can be corrected, and the corrected scientific formula data can be saved, so that the input and proofread scientific formula materials can be reused. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 is a flow chart of the method of the present invention;

[0034] Figure 2 A flow chart of an embodiment of the present invention;

[0035] Figure 3 It is a functional module structure diagram of the present invention;

[0036] Figure 4 This is a flow chart of the scientific formula format conversion method of the present invention;

[0037] Figure 5 This is a module diagram of the scientific formula format conversion device of the present invention;

[0038] Figure 6 This is a conversion logic diagram between formats in the conversion relationship matching table of the present invention. DETAILED DESCRIPTION

[0039] The scientific formula correctness checking method and device of the present invention are further described in detail below in conjunction with the accompanying drawings.

[0040] One aspect of the present invention provides a method for verifying the correctness of a scientific formula, comprising:

[0041] Acquire and identify scientific formulas, and convert the initial data format into the target data format according to the scientific formulas;

[0042] The acquisition of the identification scientific formula may include the following ways:

[0043] a) Provide data entry function. Provide a formula entry editor, users can use latex or visual methods to enter formulas.

[0044] b) Import from Word document format. Extract MathType formulas or formulas in Word's own format from existing documents.

[0045] c) The function of importing from tex files extracts mathematical formulas from the files according to the semantics of latex format.

[0046] refer to Figure 4 , the “converting the initial data format into the target data format according to the scientific formula” includes:

[0047] Obtain the initial data format and target data format of the scientific formula to be converted, parse the formula to be converted, and verify the legitimacy of the content;

[0048] Perform format conversion according to the target data format;

[0049] Format the converted formula data to produce data with unified standards.

[0050] The first step is to obtain the initial data format and target data format of the scientific formula to be converted, parse the formula to be converted, and verify the legitimacy of the content;

[0051] In one embodiment, the initial data format of the scientific formula to be converted includes: extracting the formula content in the document, or providing a formula input editor for input, or operating the *.tex file in a programmatic manner to obtain the formula. The content of the *.tex file is plain text, in which the latex code of the formula is wrapped with a $ symbol, and the program only needs to extract the content wrapped with a $ symbol in the document content as the latex code of the formula.

[0052] The "parsing the formula data to be converted and verifying the legality of the content" includes: checking whether there are illegal characters in the scientific formula to be converted, and if there are illegal characters, processing the illegal characters so that the scientific formula to be converted meets the set legal standards. In one embodiment, the illegal characters refer to control characters in a computer. In one embodiment, the set legal standards include: until there are no illegal characters in the scientific formula to be converted, if there are no illegal characters, format conversion is performed; in other embodiments, the legal standards may also be to allow the existence of illegal characters that are not essential in some formulas, and these in essential contents do not affect the content expressed by the formula.

[0053] The second step is to perform format conversion according to the target data format; before this step, it also includes setting a conversion relationship matching table; matching the initial data format and the target data format in the conversion relationship matching table, if a match is found, the format conversion of the scientific formula is performed according to the conversion relationship set in the conversion relationship matching table.

[0054] The data formats in the conversion relationship matching table include at least: SVG data format, LaTex data format, MathML data format, OMML data format and MathType data format; and the relationship matching table is provided with at least a conversion matching relationship between two data formats.

[0055] refer to Figure 6 In one embodiment, the conversion relationship set in the conversion relationship matching table is:

[0056] MathML data format and Latex data format are converted into SVG data format in one direction respectively;

[0057] Convert between MathML data format and Latex data format;

[0058] Conversion between MathML data format and OMML data format;

[0059] Convert between MathML data format and MathType data format.

[0060] In one embodiment, mutual conversions between five formats are matched, including at least the following conversion situations:

[0061] 1. Latex=>MathML. In one embodiment, MathJax can be used to convert the format.

[0062] 2. Latex, MathML=>SVG: In one embodiment, MathJax can be used to convert the format;

[0063] 3. MathML=>Latex: In one embodiment, a custom XSLT can be used to convert MathML to Latex;

[0064] 4. MathML OMML: In one embodiment, the conversion can be performed using OMML2MML.xslt defined in Word;

[0065] 5. MathML MathType: In one embodiment, the MathType official SDK can be used for conversion;

[0066] 6. OMML, Latex to MathType:

[0067] a) Convert Latex and OMML to MathML first

[0068] b) In one embodiment, MathML can be converted to MathType using the MathType SDK

[0069] 7. MathType=>MathML: In one embodiment, the MathType SDK can be used for conversion;

[0070] 8. MathType=>Latex, OMML:

[0071] a) In one embodiment, the MathType SDK can be used to convert to MathML;

[0072] b) Convert MathML to Latex and OMML.

[0073] At the same time, according to the characteristics of each data format, this embodiment also has the following beneficial effects:

[0074] a) Convert the large MathML data generated by the web into short latex code for data storage, reducing storage space and facilitating data maintenance.

[0075] b) Convert the latex data storage into SVG or MathML format that can be directly displayed and edited on the web.

[0076] In one embodiment, when the initial data format is: Latex, OMML, MathType, before the format conversion, it also includes: structured formula data,

[0077] The "structured formula data" includes: converting the scientific formula to be converted into a formula structure in MathML data format, and converting it into the target data format through MathML data format. Since the formula data in MathML format is complete and clear in describing the style and structure of the formula, the initial format will be converted into the formula data in MathML format first, and then the data in MathML format will be converted into the target format, so as to realize the mutual conversion between Latex, OMML, MathType and MathML, the mutual conversion between Latex, OMML, MathType and MathML and SVG, and the one-way conversion between Latex, MathML and SVG, so as to achieve the mutual conversion between formulas in multiple formats between multiple terminals such as web page operation terminal, word document editing terminal and typesetting and printing terminal.

[0078] In addition, the Chinese characters in latex are converted to garbled characters by the official MathType SDK, and many latex commands cannot be supported. However, due to the particularity of MathML as a markup language, the structure of the formula is clearly described, and Chinese characters are stored in the form of Unicode. The MathType SDK has a good conversion effect on the MathML format. Therefore, when converting other formula formats to MathType formulas, the formula formats will be uniformly converted to MathML format before using the MathtType SDK for conversion. This method solves the problem of MathType's limited support for latex.

[0079] The third step is to format the converted formula data to produce data of a unified standard. The “formatting the converted formula data” includes:

[0080] Arrange the scientific formula data after format conversion to check whether there are illegal characters and / or unsupported characters. If there are illegal characters, delete the illegal characters and then re-arrange them to meet the set formatting standards.

[0081] In one embodiment, the formatting standard can be set as follows: until there are no illegal characters in the scientific formula after the format conversion is completed, if there are unsupported characters, the unsupported characters are replaced and rearranged until there are no unsupported characters. In other embodiments, other standards can also be set as needed.

[0082] In one embodiment, the illegal characters include at least: control characters in the computer; the unsupported characters include: Unicode codes not supported in the target format. The character sets of Unicode codes supported by data in each format are not exactly the same, and there may be multiple Unicode codes for the same formula symbol. Formula conversion will replace the Unicode codes not supported in the target format with corresponding Unicode codes that can be supported.

[0083] Determine whether the scientific formula has been entered and reviewed. If the current formula has not been entered and reviewed, check whether the content represented by the initial data format is consistent with the content represented by the target data format.

[0084] Furthermore, the “checking whether the content represented by the initial data format is consistent with the content represented by the target data format” includes:

[0085] Rendering the initial data format and the target data format into a picture; or converting the initial data format and / or the target data format into a third data format, and rendering the third data format into a picture;

[0086] Convert the content in the picture into text;

[0087] Compare the text difference values ​​after the image conversion to determine whether the difference values ​​are within the set judgment result range.

[0088] Furthermore, before the "rendering into a picture", the process also includes: judging the picture rendering result, and if the rendering is successful, converting the content in the picture into text.

[0089] Furthermore, the “rendering into a picture” includes: obtaining a vector diagram in the format of the formula to be reviewed, and converting the vector diagram into a picture of RGB channels;

[0090] Preferably, the "obtaining a vector diagram in the formula format to be reviewed" includes: converting the SVG data formula format into an RGB channel image, converting the SVG image into PDF, and then converting the PDF into a picture.

[0091] Furthermore, the “converting the content in the picture into text” includes: converting the content in the picture into text using OCR recognition.

[0092] Further, the “comparing text difference values ​​after image conversion” includes using a minimum edit distance algorithm for comparison;

[0093] Preferably, if the verification result shows inconsistent contents, manual correction is performed.

[0094] The present invention also provides a device for correctly converting scientific formulas, which includes: a formula processing module, the formula processing module acquires and identifies scientific formulas, and converts the scientific formulas into target data formats according to the initial data format;

[0095] A judgment module, wherein the judgment module judges whether the scientific formula has been entered and reviewed. If the current formula has not been entered and reviewed, the judgment module checks whether the content represented by the initial data format is consistent with the content represented by the target data format;

[0096] Preferably, it also includes an error correction module, which provides an entry for manual error correction when the checked contents are inconsistent.

[0097] Furthermore, the judging module includes:

[0098] A first submodule, which renders an initial data format and a target data format into a picture; or converts the initial data format and / or the target data format into a third data format, and renders the third data format into a picture;

[0099] A second submodule, wherein the second submodule converts the content in the picture into text;

[0100] The third submodule compares the text difference value after the image conversion to determine whether the difference value is within a set determination result interval.

[0101] refer to Figure 5 , the formula processing module includes: a content parsing module, a conversion module and a formatting module;

[0102] The content parsing module: obtains the initial data format and target data format of the scientific formula to be converted, parses the formula, and verifies the legitimacy of the content;

[0103] The conversion module is provided with a conversion relationship matching table, and structures the formula data according to the scientific formula conversion relationship matching table, and converts the scientific formula data in the initial format into the target format;

[0104] The formatting module is used to format formula data and produce data with unified standards.

[0105] The content parsing module: obtains the initial data format and target data format of the scientific formula to be converted, parses the formula, and verifies the legitimacy of the content;

[0106] The conversion module is provided with a conversion relationship matching table, and structures the formula data according to the scientific formula conversion relationship matching table, and converts the scientific formula data in the initial format into the target format;

[0107] The formatting module is used to format formula data and produce data with unified standards.

[0108] The conversion module converts at least two data formats among the data formats of LaTex, SVG, MathML, OMML and MathType according to the conversion relationship matching table;

[0109] Furthermore, the conversion module includes a plurality of submodules:

[0110] A first submodule, the first conversion module unidirectionally converts the MathML data format into the SVG data format;

[0111] The second submodule, the second conversion module converts the Latex data format into the SVG data format in one direction;

[0112] A third submodule, the third conversion module converts the MathML data format into the Latex data format;

[0113] A fourth submodule, wherein the fourth conversion module converts the MathML data format into the OMML data format;

[0114] A fifth submodule, the fifth conversion module converts the MathML data format into the MathType data format and vice versa;

[0115] Furthermore, the conversion module also includes: a structuring module. When the initial data format is: LaTex, OMML, MathType, before format conversion, the structuring module converts the scientific formula to be converted into a formula structure in the MathML data format, first converting it into the MathML data format and then converting it into the target data format.

[0116] A legality verification module is provided in the parsing module, and the legality verification module checks whether there are illegal characters in the scientific formula to be converted. If there are illegal characters, the illegal characters are processed so that the scientific formula to be converted meets the set legality standard;

[0117] The formatting module organizes the scientific formula data after the format conversion, checks whether there are illegal characters and unsupported characters, and if there are illegal characters, deletes the illegal characters and reorganizes them to meet the set formatting standards.

[0118] Specifically, the following embodiments are also provided:

[0119] Example 1: Online formula editor

[0120] When publications or teaching lesson plans are produced and reviewed on the Web, the scientific formulas are in MathML or SVG format. According to user habits, Office Word software is used for text editing. On the Windows platform, scientific formula data in OMML and MathType formats are more compatible with Office software. In printing scenarios, most users use the Tex system for typesetting and printing; at the same time, in order to edit and reprint old books, scientific data in Latex format under the Tex system also needs to be converted into OMML or MathType formats for processing, or converted into MathML or SVG formats for display.

[0121] When users edit scientific formulas using the visual interface on the Web, the generated scientific formula data format is in MathML format. For edited scientific formulas, the formulas can also be rendered in SVG format for display. When users need to save edited scientific formulas, they can choose to save the scientific formula data in Latex format for the sake of saving storage space.

[0122] refer to Figure 2-Figure 4 As shown, when the user completes editing the scientific formula on the Web end, the content parsing module obtains the initial data format and the target data format of the scientific formula to be converted, parses the formula, and detects whether there are illegal characters in the MathML data of the scientific formula to be converted. In this embodiment, the illegal characters are control characters. Therefore, it is necessary to find out whether all the characters in the scientific formula data to be converted are the same as the characters in the US-ASCII control character table. If there are control characters in the scientific formula data to be converted, the characters are directly deleted.

[0123] After completing the above steps, the original data format and the target format of the scientific formula are searched in the conversion relationship matching table preset in the conversion module to find a reasonable format conversion method.

[0124] The conversion relationship matching table in this embodiment (see Figure 5 ) is as follows:

[0125] 1.Latex=>MathML: Use MathJax for conversion;

[0126] 2. Latex, MathML=>SVG: Use MathJax for conversion;

[0127] 3.MathML=>Latex: Use custom XSLT to convert MathML to Latex;

[0128] 4.MathML OMML: Use OMML2MML.xslt defined in Word for conversion;

[0129] 5.MathML MathType: Use MathType official SDK for conversion;

[0130] 6. OMML, Latex to MathType:

[0131] a) Convert Latex and OMML to MathML

[0132] b) Convert MathML to MathType using MathType SDK

[0133] 7.MathType=>MathML: Use MathType SDK for conversion;

[0134] 8.MathType=>Latex, OMML:

[0135] a) Convert to MathML using MathType SDK;

[0136] b) Convert MathML to Latex, OMML.

[0137] The conversion relationship in this embodiment is a one-way conversion of MathML to Latex format, which matches the content in the third row of the conversion relationship matching table and is converted according to the mapping relationship.

[0138] Since MathML is essentially a markup language, it has the advantage of clearly describing the structure of formulas, and Chinese characters are stored in the form of Unicode codes, so the XSLT parser can be used to specify the content of character encoding replacement. The configuration process is as follows:

[0139] 1. Specify the corresponding Latex command according to the MathML tag;

[0140] 2. Convert Unicode characters in MathML to corresponding Latex commands.

[0141] In this embodiment, the core code segment of the XSLT parser is exemplified as follows:

[0142] <xsl:template match="m:math[not(@mode)or@mode='inline'][not(@display)]|m:math[@display='inline']">

[0143] <xsl:text> $;< / xsl:text>

[0144] <xsl:apply-templates / >

[0145] <xsl:text> $;< / xsl:text>

[0146]

[0147] The above code segment configures the XSLT parser. The third submodule in the conversion module completes the work of converting scientific formula data in MathML format into Latex format.

[0148] Since the formula data in MathML format has a complete and clear description of the style and structure of the formula, the present invention preferentially converts the initial format into the formula data in MathML format, and then converts the data in MathML format into the target format. This operation is defined as structured formula data.

[0149] After completing the above steps, in the formatting module, the scientific data in Latex format will be further subjected to the operation of deleting illegal characters and replacing unsupported characters. In this embodiment, the illegal characters are control characters, and the supported characters are Unicode characters supported in MathType software, which are processed according to the provisions in the MTEF V.5 file in this embodiment.

[0150] In one embodiment of the present invention:

[0151] Under Windows platform, when users need to convert previously generated Word documents into latex format data and use the tex system for typesetting and printing, if third-party software is used to directly convert Word documents containing scientific formulas into latex format files, Chinese characters in scientific formulas will be garbled and some mathematical symbols will be converted incorrectly. At this time, if the garbled scientific formulas are manually adjusted manually, it will take a lot of time and the proofreading results may still be wrong.

[0152] like Figure 1-3 As shown, first of all, users can enter the original information of scientific formulas in two ways:

[0153] (1) With the help of the formula input editor: In the editor input mode, users can enter formula information in text form according to the syntax specified by the Latex language. For example, when you need to enter the formula "a+b=c", you can type "$a+b=c$" in the editor text box. At the same time, users can also use a visual method to select the mathematical symbols, subscripts and subscripts, numbers or letters required for the formula in the input interface to generate a complete scientific formula.

[0154] (2) Importing from Office Word documents: When this method is used, the scientific formula data format extracted is in MathType format, and is extracted using OOXML, a standard format specification developed by Microsoft for Office software. In this embodiment, when extracting scientific formulas, the extraction is performed by recording and calling macros.

[0155] Typical Java code is as follows:

[0156] ActiveXComponent word=new ActiveXComponent("Word.Application");

[0157] Dispatch documents=word.getProperty("Documents").toDispatch();

[0158] Dispatch document = Dispatch.call (documents,"Open","d: / test1.doc").toDispatch(); / / Specify the document named "test1.doc" in the root directory of disk d and open it;

[0159] Dispatch.call(word,"Run",new Variant("macro1")); / / Run the macro on this document; In addition to using Java language, you can also use other computer languages ​​or call SDK to implement the above functions.

[0160] When the data entry module obtains the original information of the scientific formula, it will first save the original information of the scientific formula. Generally, the way to save the scientific formula information is to establish a database and assign an ID number to each formula. The stored original information of the scientific formula and the converted data in various formats are managed by the operation of the database management system.

[0161] Then, the conversion module searches the database to see if the MathType data entered this time has been saved, and processes the scientific formulas entered in this batch differently according to the search results:

[0162] a) If the scientific formula entered this time is not found in the database, the formula is converted into MathML format data according to the MathType data of the scientific formula entered this time. Since MathML data is essentially a subset of the XML language, it is universal under Windows, Mac OS and Linux platforms. Therefore, by converting the data containing scientific formula information into MathML data before processing, it is possible to avoid garbled characters or conversion errors in the format conversion process of scientific formulas, especially scientific formulas containing Chinese characters.

[0163] After obtaining MathML data, the conversion module converts the formula format according to the following logic:

[0164] If the scientific formula data source is a Word document, it is determined that the data needs to be printed and published, and the formula data is converted into Latex format;

[0165] If the scientific formula data source is a tex document, it is determined that the data needs to be typeset or saved in a text editing software such as Word, and the formula data needs to be converted into MathType format.

[0166] After obtaining scientific formula data in the formats for editing and printing, this embodiment performs a machine audit on the correctness of the conversion. The audit steps are as follows:

[0167] (1) Generate a bmp image of a scientific formula based on Latex data, and use OCR to identify the text information in the bmp image1.

[0168] (2) Perform OCR recognition on the wmf bitmap contained in the MathType data to obtain text information 2.

[0169] (3) Calculate the minimum edit distance L between text information 1 and text information 2.

[0170] If L=0, the conversion is considered successful, an ID number is assigned to the scientific formula entered this time, and the data is saved in MathType, MathML and latex formats.

[0171] If 0<L≤0.5, it is considered that manual correction is required. After manually checking the formulas of MathType data and latex data, an ID number is assigned to the scientific formula entered this time, and the data in MathType, MathML and latex formats are saved.

[0172] If L>0.5, it is considered that the input scientific formula conversion has failed, and steps (1)-(3) are repeated.

[0173] Among them, in manual error correction, the auditor needs to manually correct the scientific formula being reviewed based on the errors in the formula conversion.

[0174] b) If the scientific formula entered this time is found in the database, it is necessary to further determine whether the scientific formula has been reviewed. Depending on whether it has been reviewed, there are two situations:

[0175] b1: Audited:

[0176] According to the function of this device, if a formula has been reviewed, it means that the formula has been reviewed and found to be correct (if it fails to pass the review, it needs to be manually modified or re-converted by the machine according to the process in a), and finally a scientific formula that has been verified and found to be correct is formed), and it has two types of scientific formula data formats: editing and printing. Therefore, the ID number of the scientific formula that has been entered and passed the review can be directly returned.

[0177] b2: If it has been entered but not reviewed, the scientific data to be found will be sent to the review module, and the scientific formula to be found will be reviewed according to the steps in the above situation a).

[0178] In the target embodiment of the present invention, when the user needs to edit the content in the tex file, especially the scientific formula, in the Word software, it is necessary to extract the scientific formula information contained in the tex file in the input module. The tex file is an electronic document generated by the typesetting system Tex, and its save format suffix is ​​tex. The tex file is essentially a plain text file, which uses the "$" symbol to wrap the formula data. The Latex language related to the tex file is also a descriptive computer language developed based on the wrapping of the formula data with the "$" symbol.

[0179] After the input module obtains the scientific formula data contained in the tex document, the original information of the scientific formula is saved. Generally, the way to save the scientific formula information is to establish a database and assign an ID number to each formula. The stored original information of the scientific formula and the converted data in various formats are managed by the operation of the database management system.

[0180] The conversion module searches the database to see if the scientific formula entered this time has been saved, and processes the scientific formulas entered in this batch differently according to the search results:

[0181] a) If the scientific formula entered this time is not found in the database, the conversion module converts the character scientific formula data contained in the tex document into data in MathML format according to the formula character content in the tex document. Then, the conversion module converts the MathML data into MathType format according to the MathType data format.

[0182] Since MathType software has good compatibility with the Windows platform and can be embedded in Word software, scientific formula data in Latex format can be accurately converted to MathType data compatible with Word software through the transition of MathML data, avoiding the problem of Chinese characters being converted into garbled characters.

[0183] After obtaining scientific formula data in MathML and MathType formats, this embodiment performs a machine audit on the correctness of the conversion. The audit steps are as follows:

[0184] (1) Generate a bmp image of a scientific formula based on Latex data, and use OCR to identify the text information in the bmp image1.

[0185] (2) Perform OCR recognition on the wmf bitmap contained in the MathType data to obtain text information 2.

[0186] (3) Calculate the minimum edit distance L between text information 1 and text information 2.

[0187] If L=0, the conversion is considered successful, an ID number is assigned to the scientific formula entered this time, and the data is saved in MathType, MathML and latex formats.

[0188] If 0<L≤0.5, it is considered that manual correction is required. After manually checking the formulas of MathType data and latex data, an ID number is assigned to the scientific formula entered this time, and the data in MathType, MathML and latex formats are saved.

[0189] If L>0.5, it is considered that the input scientific formula conversion has failed, and steps (1)-(3) are repeated.

[0190] Among them, in manual error correction, the auditor needs to manually correct the scientific formula being reviewed based on the errors in the formula conversion.

[0191] b) If the scientific formula entered this time is found in the database, it is necessary to further determine whether the scientific formula has been reviewed. Depending on whether it has been reviewed, there are two situations:

[0192] b1: Audited:

[0193] According to the function of this device, if a formula has been reviewed, it means that the formula has been reviewed and found to be correct (if it fails to pass the review, it needs to be manually modified or re-converted by the machine according to the process in a), and finally a scientific formula that has been verified and found to be correct is formed.), and it has two types of scientific formula data formats: editing and printing. Therefore, the ID number of the scientific formula that has been entered and passed the review can be directly returned.

[0194] b2: If it has been entered but not reviewed, the scientific data to be found will be sent to the review module, and the scientific formula to be found will be reviewed according to the steps in the above situation a).

[0195] The above is a detailed introduction to a method and device for checking the correctness of a scientific formula provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scopes. The content of this specification should not be understood as a limitation on the technical solution of the present invention.

Claims

1. A method for testing the correctness of a scientific formula, characterized in that: The steps include: acquire and identify scientific formulas; Convert scientific formula source data format to target data format, including: Obtain the initial data format and target data format of the scientific formula to be converted, parse the scientific formula to be converted, and verify the legality of the content; perform format conversion according to the target data format; format the converted formula data to produce data with unified standards; Before format conversion according to the target data format, it also includes: A conversion relationship matching table is set; the initial data format and the target data format are matched in the conversion relationship matching table, and if a match is found, the format conversion of the scientific formula is performed according to the conversion relationship set in the conversion relationship matching table; the data formats in the conversion relationship matching table include at least: SVG data format, LaTex data format, MathML data format, OMML data format and MathType data format; the relationship matching table is set with at least two conversion matching relationships between data formats; Determine whether the scientific formula after format conversion has been entered and reviewed. If the current formula has not been entered and reviewed, check whether the content represented by the initial data format is consistent with the content represented by the target data format, including: Rendering the scientific formula in the initial data format and the scientific formula in the target data format into a picture; or, converting the scientific formula in the initial data format and / or the target data format into a third data format, and rendering the third data format into a picture; Determine the image rendering result; If the rendering is successful, use OCR recognition to convert the content in the image into text; Use the minimum edit distance algorithm to compare the text difference value after the image is converted to determine whether the difference value is within the set judgment result range, including: Calculate the minimum edit distance L between the first text information and the second text information; If L=0, the conversion is considered successful, an ID number is assigned to the scientific formula entered this time, and the data is saved in MathType, MathML, and latex formats; If 0<L≤0.5, it is considered that manual correction is needed. After manually checking the formulas of MathType data and latex data, an ID number is assigned to the scientific formula entered this time, and the data in MathType, MathML and latex formats are saved; If L>0.5, it is considered that the input scientific formula conversion has failed.

2. The method for checking the correctness of a scientific formula according to claim 1, characterized in that: The "rendering into a picture" includes: obtaining a vector graph in the format of the formula to be reviewed, and converting the vector graph into a picture of RGB channels; The "obtaining a vector graph in a formula format to be reviewed, and converting the vector graph into an image of an RGB channel" includes: converting an SVG data formula format into an RGB channel image.

3. The method for checking the correctness of a scientific formula according to claim 1, characterized in that: If the verification result shows inconsistent content, manual correction will be performed.

4. A scientific formula correctness verification device, used to execute the method described in any one of claims 1 to 3, characterized in that: A formula processing module, the formula processing module acquires and recognizes scientific formulas, and converts an initial data format of the scientific formula into a target data format; The formula processing module includes: a content parsing module, a conversion module and a formatting module; The content parsing module: obtains the initial data format and target data format of the scientific formula to be converted, parses the formula, and verifies the legitimacy of the content; The conversion module is provided with a conversion relationship matching table, and according to the scientific formula conversion relationship matching table, the formula data is structured to convert the scientific formula in the initial data format into the scientific formula in the target data format; The formatting module is used to format formula data and produce data of unified standard; A judgment module is used to judge whether the scientific formula after format conversion has been entered and reviewed. If the current formula has not been entered and reviewed, it is used to check whether the content represented by the initial data format is consistent with the content represented by the target data format.

5. The scientific formula correctness testing device according to claim 4, characterized in that: It also includes an error correction module, which provides an entry for manual error correction when the checked contents are inconsistent.