File processing method, device and electronic equipment
Through automatic comparison and processing files to be processed, combined with the preset rules library to generate structured documents, solve the problem of low -level processing efficiency and accuracy and accuracy of standard text in existing technologies, and achieve more efficient and accurate structural documents generate.
Patent Information
- Application Number
- CN202210057731.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-19
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2042-01-19
AI Technical Summary
In the prior art, the structured processing efficiency and accuracy of standard text are low, mainly due to the influence of OCR recognition accuracy and the need for manual verification and confirmation.
By obtaining the editing file to be processed, determine the category of its belonging, find the target rules file matched from the preset rules library, perform comparison processing, generate files after processing, and generate structured files through school pairs.
It reduces the dependence on manual verification and confirmation, and improves the efficiency and accuracy of structured document generation.
Smart Images

Figure CN114399774B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of file processing, and in particular to a file processing method, device and electronic equipment. Background Art
[0002] The main technology for structural processing of standard text is to perform OCR (Optical Character Recognition) on the scanned file lines, and then complete the extraction of structured information through manual review and proofreading. Specifically, the OCR recognition tool recognizes the scanned file and forms an electronic document; due to the influence of stains on the file and the accuracy of OCR recognition, the electronic document needs to be manually proofread to correct the recognition errors; the electronic document data that has been manually proofread can be converted into an XML (Extensible Markup Language) file of structured data in a specified manner or format through tools (automation) or manual or both to complete reverse structural processing. This manual review and proofreading method reduces the efficiency of generating structured text. Summary of the invention
[0003] The purpose of the present invention is to provide a file processing method, device and electronic device to improve the generation efficiency and accuracy of structured files.
[0004] The present invention provides a file processing method, which includes: obtaining an editable first file to be processed; determining the category to which the first file to be processed belongs; searching a target rule file that matches the category from a preset rule library; comparing the first file to be processed with the target rule file to obtain a comparison result, processing the first file to be processed according to the comparison result to obtain a processed second file to be processed; and proofreading the second file to be processed to obtain a structured file corresponding to the second file to be processed.
[0005] Furthermore, the step of determining the category to which the first file to be processed belongs includes: extracting a first keyword from the first file to be processed; and determining the category to which the first file to be processed belongs according to the first keyword.
[0006] Furthermore, the target rule file includes at least one page rule sub-file, and each page rule sub-file includes multiple target size information and multiple target keywords; wherein the target position of each target keyword in each page rule sub-file corresponds to the pixel position indicated by the target size information associated with the target keyword.
[0007] Furthermore, the steps of comparing the first file to be processed with the target rule file to obtain a comparison result, processing the first file to be processed according to the comparison result, and obtaining a processed second file to be processed include: performing line-by-line scanning and detection on the first file to be processed to extract multiple keywords to be processed in the first file to be processed, and first position information corresponding to each keyword to be processed; for each target position, judging whether the first target keyword corresponding to the target position in the target rule file matches the first keyword to be processed in the first file to be processed, and if they do not match, determining that the first keyword to be processed is the first exception information; or, for each first position information, judging whether the second keyword to be processed corresponding to the first position information in the first file to be processed matches the second target keyword corresponding to the first position information in the target rule file, and if they do not match, determining that the second keyword to be processed is the second exception information; processing the first file to be processed according to the target exception information to obtain a processed second file to be processed; wherein the target exception information includes: the first exception information and / or the second exception information.
[0008] Furthermore, the step of processing the first file to be processed according to the target exception information to obtain the processed second file to be processed includes: processing the first file to be processed according to a preset processing method according to the target exception information to obtain a third file to be processed; wherein the preset processing method includes at least one of the following: modification, deletion and addition; performing word segmentation and parsing on the third file to be processed to obtain the processed second file to be processed.
[0009] Furthermore, the second file to be processed includes multiple processed second keywords; the second file to be processed is proofread to obtain a structured file corresponding to the second file to be processed, including: adding model information to the second file to be processed according to its category, to obtain a fourth file to be processed with the added information; wherein the model information includes at least one of the following: the font, font size and position identifier corresponding to each second keyword; converting the fourth file to be processed according to a preset format to obtain a structured file corresponding to the second file to be processed.
[0010] Furthermore, the categories include one of the following: national standards, industry standards, local standards, group standards and enterprise standards.
[0011] The present invention provides a file processing device, which includes: an acquisition module, used to acquire an editable first file to be processed; a determination module, used to determine the category to which the first file to be processed belongs; a search module, used to search for a target rule file that matches the category from a preset rule library; a comparison module, used to compare the first file to be processed with the target rule file to obtain a comparison result, and process the first file to be processed according to the comparison result to obtain a processed second file to be processed; and a processing module, used to proofread the second file to be processed to obtain a structured file corresponding to the second file to be processed.
[0012] An electronic device provided by the present invention comprises a memory and a processor. The memory stores a computer program that can be run on the processor. When the processor executes the computer program, the above-mentioned file processing method is implemented.
[0013] The present invention provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code enables the processor to execute the above-mentioned file processing method.
[0014] The file processing method, device and electronic device provided by the present invention obtain an editable first file to be processed; determine the category to which the first file to be processed belongs; search for a target rule file that matches the category from a preset rule library; compare the first file to be processed with the target rule file to obtain a comparison result, process the first file to be processed according to the comparison result to obtain a processed second file to be processed; proofread the second file to be processed to obtain a structured file corresponding to the second file to be processed. This method can automatically compare the first file to be processed with its corresponding target rule file, and process the first file to be processed according to the comparison result to obtain the second file to be processed; and then proofread the second file to be processed to obtain the corresponding structured file. This method can reduce the reliance on manual verification and confirmation, and improve the efficiency of generating structured files. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 A flowchart of a file processing method provided by an embodiment of the present invention;
[0017] Figure 2 A process diagram of a file processing method provided by an embodiment of the present invention;
[0018] Figure 3 A process diagram of another file processing method provided by an embodiment of the present invention;
[0019] Figure 4 A flowchart of another file processing method provided by an embodiment of the present invention;
[0020] Figure 5 A schematic diagram of a national standard cover format provided by an embodiment of the present invention;
[0021] Figure 6 A flowchart of another file processing method provided by an embodiment of the present invention;
[0022] Figure 7 A schematic diagram of the structure of a file processing device provided by an embodiment of the present invention;
[0023] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than 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.
[0025] At present, the structural processing of standard texts is to convert paper standard texts into PDF (Portable Document Format) files through scanners, etc., and through OCR recognition tools on the market, such PDF files can be converted into PDF files that can edit and select text in the file to form electronic documents, and the electronic documents are manually reviewed and proofread. Through tools (automation) or manual or both, the files after manual review and proofreading are made into XML files of structured data in a specified manner or format to complete reverse structural processing. Since standard files contain more industry-related Chinese and English abbreviations, units represented by non-Chinese characters, etc., it brings great difficulties to word segmentation and subsequent related analysis. Therefore, for standard special texts, the generation efficiency and accuracy of structured texts are obviously reduced by OCR recognition and manual review and proofreading. Based on this, the embodiment of the present invention provides a file processing method, device and electronic device, which can be applied to applications that need to process files.
[0026] To facilitate understanding of this embodiment, a file processing method disclosed in an embodiment of the present invention is first described in detail; Figure 1 As shown, the method comprises the following steps:
[0027] Step S102, obtaining a first editable file to be processed.
[0028] The above-mentioned editable first file to be processed may be one of a Word file, an Excel file, a PowerPoint file and a PDF file.
[0029] Step S104: determine the category to which the first file to be processed belongs.
[0030] The above-mentioned first file to be processed is a standard text, which has multiple categories. Different categories of standards have different format requirements and content requirements. Therefore, in actual implementation, it is necessary to first determine the category of the first file to be processed. For example, the category can be national standards, industry standards, local standards, group standards or enterprise standards.
[0031] Step S106: searching the preset rule library for a target rule file that matches the category.
[0032] The above-mentioned preset rule base can be a rule base containing text dot matrix information established based on the structure and writing requirements of the standard in Part 1 of the standardization work guidelines, and for the page number and position, meaning, requirements, text, etc. of each element in the document. The page number and position can include the cover, directory page, appendix page, header, title, text, footer, etc., the meaning can include the standard name, standard number, chapter number, chapter title, date, etc., the requirements can include size, font requirements, etc., and the text can include ICS (International Classification for Standards, International Standard Classification), GB (Guo Biao, National Standard), standards, etc. on the homepage. The preset rule base contains target rule files corresponding to the formats and contents required by various standard text categories.
[0033] Step S108, comparing the first file to be processed with the target rule file to obtain a comparison result, and processing the first file to be processed according to the comparison result to obtain a processed second file to be processed.
[0034] The above target rule file is generated according to the standard format rules in the rule base. According to different standard format categories, multiple target rule files can be generated.
[0035] Step S110, proofreading the second file to be processed to obtain a structured file corresponding to the second file to be processed.
[0036] See also Figure 2The process diagram of a file processing method shown in FIG. 1 is a common structured processing method of standard texts. Figure 2 In the process, a paper medium is scanned by a scanner to obtain a scanned file; OCR recognition is performed on the scanned file lines to generate an electronic document; due to the influence of stains on the initial PDF file (corresponding to the above-mentioned scanned file) and the accuracy of OCR recognition, it is necessary to manually check the generated electronic document to correct the recognition errors therein; the electronic document data that has been manually checked can be made into an XML file of structured data in a specified manner or format to complete reverse structuring processing. The efficiency and accuracy of OCR recognition and manual review and proofreading are low.
[0037] See also Figure 3 The process diagram of another file processing method shown in FIG. 1 is the file processing method adopted by this solution. Figure 3 In the process, a standard paper text, that is, a paper medium, is converted into an initial PDF file through a scanner. The scanned initial PDF file or the initial PDF file of the image type is not editable. Through the OCR recognition tool on the market, this type of PDF file can be converted into a PDF file that can edit the text in the selected file, select and copy the text in the PDF file, and paste it into other Word, Excel or PowerPoint files to form an electronic document (equivalent to the first to-be-processed file mentioned above); after determining the category to which the electronic document belongs, a denoising process based on dot matrix analysis is performed, and the process includes directly searching for a target rule file that matches the category from a preset rule library; finding the corresponding target rule file in the rule library according to the standard format category of the electronic document, comparing the electronic document with the target rule file through the algorithm library, marking the inconsistent or questionable places, processing the marks, and obtaining the second to-be-processed file; after the denoising process, the second to-be-processed file is proofread through the model proofreading to obtain the corresponding structured file in XML format.
[0038] The above-mentioned file processing method obtains an editable first file to be processed; determines the category to which the first file to be processed belongs; searches for a target rule file that matches the category from a preset rule library; compares the first file to be processed with the target rule file to obtain a comparison result, processes the first file to be processed according to the comparison result, and obtains a processed second file to be processed; and proofreads the second file to be processed to obtain a structured file corresponding to the second file to be processed. This method can automatically compare the first file to be processed with its corresponding target rule file, and processes the first file to be processed according to the comparison result to obtain the second file to be processed; and then proofreads the second file to be processed to obtain the corresponding structured file. This method can reduce the reliance on manual verification and confirmation, and improve the efficiency of generating structured files.
[0039] The embodiment of the present invention also provides another file processing method, which is implemented on the basis of the method in the above embodiment; Figure 4 As shown, the method comprises the following steps:
[0040] Step S202, obtaining a first editable file to be processed.
[0041] Step S204: extracting a first keyword from the first file to be processed.
[0042] The above-mentioned first file to be processed is a standard text, which has multiple categories. Standard texts of different categories have different category identifiers; the above-mentioned first keyword represents the category identifier, which is generally located on the first page of the standard text, that is, the cover position. In actual implementation, the first keyword in the cover of the first file to be processed is extracted to obtain the category identifier.
[0043] Step S206: determining the category to which the first to-be-processed file belongs according to the first keyword.
[0044] For example, if the first keyword is GB, it can be considered that the category to which the first file to be processed belongs is a national standard; if the first keyword is DB, it can be considered that the category to which the first file to be processed belongs is a local standard, and so on.
[0045] Step S208: searching the preset rule library for a target rule file that matches the category.
[0046] The above-mentioned target rule file includes at least one page rule sub-file, and each page rule sub-file includes multiple target size information and multiple target keywords; wherein the target position of each target keyword in each page rule sub-file corresponds to the pixel position indicated by the target size information associated with the target keyword.
[0047] The above rule sub-file can be a cover, Figure 5It is a national standard cover format, including length and width information in millimeters, as well as structural elements such as GB, standard name, release date, and implementation date (corresponding to the above target keywords). In actual implementation, a corresponding relationship between pixel matrix and format size, as well as the required text information and sequence relationship, is established. According to the required size information, the corresponding pixel position is obtained at a specific resolution, and the specific text (equivalent to the above target keyword) information corresponding to this position is recorded at the same time; Figure 5 As shown, each structural element has a clear meaning in different positions on the cover. For example, the file name is written on the second line of the cover in size 1 bold; under the file name, the English translation is written in size 4 bold.
[0048] Step S210 , scanning and detecting the first file to be processed line by line to extract a plurality of keywords to be processed in the first file to be processed and first position information corresponding to each keyword to be processed.
[0049] In actual implementation, for the electronic file that needs to be parsed and confirmed (equivalent to the above-mentioned first file to be processed), the first position information corresponding to multiple first keywords to be processed in the electronic file can be obtained by scanning and detecting the file line by line. According to the analysis of different position information, the structured element category of the keywords to be processed corresponding to each position can be accurately known, and then combined with the standard dot matrix information rule library, a comparative analysis can be performed.
[0050] Step S212, for each target position, determine whether the first target keyword corresponding to the target position in the target rule file matches the first to-be-processed keyword corresponding to the target position in the first to-be-processed file. If they do not match, determine that the first to-be-processed keyword is the first exception information.
[0051] Alternatively, for each first position information, determine whether the second to-be-processed keyword corresponding to the first position information in the first to-be-processed file matches the second target keyword corresponding to the first position information in the target rule file. If they do not match, determine that the second to-be-processed keyword is the second exception information.
[0052] During the comparative analysis, the target position can be determined first, and the first target keyword corresponding to the target position in the target rule file can be determined. Assuming that the first target keyword is GB, it can be determined whether GB is consistent with the first to-be-processed keyword extracted from the target position in the first to-be-processed file. If they are inconsistent, the first to-be-processed keyword is determined to be the first abnormal information, and the first to-be-processed keyword and / or the second to-be-processed keyword are color-coded.
[0053] During the comparison analysis, the first position information may be determined first, and the second keyword to be processed corresponding to the first position information in the first to-be-processed file may be determined. Assuming that the second keyword to be processed is a date, it is determined whether the date matches the format requirement of the second target keyword corresponding to the first position information in the target rule file. If not, the second keyword to be processed is determined to be the second abnormal information. The second keyword to be processed is color-coded.
[0054] Step S214: Process the first file to be processed according to the target exception information to obtain a processed second file to be processed; wherein the target exception information includes: the first exception information and / or the second exception information.
[0055] Most of the color identifications obtained by the above comparison have been directly corrected in accordance with the rule base, and only require a simple confirmation. However, some of them are questionable after being combined with the rule base, and it is impossible to directly determine whether they are wrong. Manual intervention is still required to confirm them.
[0056] After step S212, the text information required by the rules (corresponding to the first file to be processed mentioned above) already includes the verification abnormality reminder. Previously, the proofreader had to rely on visual confirmation of the text information. At this time, the proofreader only needs to confirm the reminder information, which greatly improves the proofreading efficiency.
[0057] The step S214 can be specifically obtained by the following steps A to B:
[0058] Step A: Process the first file to be processed in a preset processing method according to target exception information to obtain a third file to be processed; wherein the preset processing method includes at least one of the following: modification, deletion and addition.
[0059] In actual implementation, if the target rule file corresponds to GB, and it is found that the text extracted from the first file to be processed is inconsistent, the inconsistent text is modified to make it the same as GB; if the target rule file corresponds to the date, and it is found that the text extracted from the first file to be processed contains letters, the letters are deleted to make it consistent with the date format requirements; if the target rule file corresponds to the standard name, and it is found that the corresponding characters are missing from the text extracted from the first file to be processed, the corresponding characters are added to make it consistent with the standard name, and the third file to be processed is obtained by performing corresponding processing on the first file to be processed.
[0060] Step B: performing word segmentation and parsing processing on the third file to be processed to obtain a processed second file to be processed.
[0061] In actual implementation, the third file to be processed is segmented and parsed in a similar way to OCR recognition. The meaning of the text is identified by matching with the rule base, for example, which contents correspond to: standard name, standard number, standard publication date, etc., extract the corresponding information, and finally generate a structured data model with label identification (corresponding to the second file to be processed). For example, a structured data will contain: a chapter, an article, a section, a paragraph, type, content, where the type can include text, table, image, formula, terminology.
[0062] Step S216: proofread the second file to be processed to obtain a structured file corresponding to the second file to be processed.
[0063] The above-mentioned file processing method obtains an editable first file to be processed; extracts a first keyword from the first file to be processed; determines the category to which the first file to be processed belongs according to the first keyword; searches for a target rule file that matches the category from a preset rule library; compares the first file to be processed with the target rule file to obtain a comparison result, modifies, deletes and adds the first file to be processed according to the comparison result, and obtains a processed third file to be processed; performs word segmentation and parsing on the third file to be processed to obtain a second file to be processed, and performs proofreading on the second file to be processed to obtain a structured file corresponding to the second file to be processed. This method can detect entry information that violates the rules, and more accurately implements word segmentation and parsing of the text, thereby achieving model noise reduction, improving the efficiency and accuracy of structured information extraction, and generating a structured data model after noise reduction processing and analysis.
[0064] The embodiment of the present invention also provides another file processing method, which is implemented on the basis of the method in the first embodiment above; in this method, the second file to be processed includes a plurality of processed second keywords; Figure 6 As shown, the method comprises the following steps:
[0065] Step S302, obtaining a first editable file to be processed.
[0066] Step S304: determine the category to which the first file to be processed belongs.
[0067] The categories include one of the following: national standards, industry standards, local standards, group standards and enterprise standards. In actual implementation, the categories may also include similar document categories with format or style requirements.
[0068] According to the scope of application of standards, my country's standards are divided into five levels: national standards (GB), industry standards, local standards, group standards and enterprise standards. National standards are applicable nationwide, and standards of other levels shall not conflict with national standards; industry standards are applicable within a certain industry in the country, such as chemical industry standards (code HG), petrochemical industry standards (code SH), and building materials industry standards (code JC). Industry standards are applicable within a certain industry in the country; local standards refer to standards that need to be unified within a province, autonomous region, or municipality directly under the central government. The local standard number is composed of the local standard code, standard sequence number, and release year. The local standard code is composed of the Chinese pinyin letter "DB" plus the first two digits of the administrative division code of the province, autonomous region, or municipality directly under the central government plus a slash, forming a mandatory local standard code; the state supports the use of independent innovation technologies to formulate group standards and enterprise standards in important industries, strategic emerging industries, key common technologies, etc. Group standards are formulated by social groups, and the group standard number is composed of the group standard code (T), social group code, group standard sequence number, and year number in sequence; enterprise standards are formulated by enterprises and are applicable within the enterprise.
[0069] Step S306: searching the preset rule library for a target rule file that matches the category.
[0070] Step S308, comparing the first file to be processed with the target rule file to obtain a comparison result, and processing the first file to be processed according to the comparison result to obtain a processed second file to be processed.
[0071] Step S310, adding model information to the second file to be processed according to the category to which it belongs, to obtain a fourth file to be processed after the information is added; wherein the model information includes at least one of the following: the font, font size and position identifier corresponding to each second keyword.
[0072] By confirming whether the category of the first file to be processed is national standard, industry standard, local standard or enterprise standard, model information is automatically added to the second file to be processed, such as font, font size, location identifier, related information of standards or terms, and other information that needs to be recorded, to obtain a fourth file to be processed.
[0073] Step S312: convert the fourth file to be processed according to a preset format to obtain a structured file corresponding to the second file to be processed.
[0074] The document data after adding the model information (corresponding to the fourth file to be processed) can be transformed into an XML file of structured data in a specified manner or format through tools (automation) or manual methods or both to complete reverse structuring processing.
[0075] The above-mentioned file processing method obtains an editable first file to be processed; determines the category to which the first file to be processed belongs; searches for a target rule file that matches the category from a preset rule library; compares the first file to be processed with the target rule file to obtain a comparison result, processes the first file to be processed according to the comparison result, and obtains a processed second file to be processed; adds model information to the second file to be processed according to the category to which it belongs, and obtains a fourth file to be processed after the information is added; converts the fourth file to be processed according to a preset format, and obtains a structured file corresponding to the second file to be processed. This method, combined with a standard rule library, can automatically compare, reduce the reliance on manual verification and confirmation, and greatly improves the efficiency and accuracy of structured information extraction of standard texts, increasing the original recognition accuracy of about 80%, especially the rule-related part, to more than 98%.
[0076] The embodiment of the present invention also provides a file processing device, such as Figure 7 As shown, the device includes: an acquisition module 70, used for acquiring an editable first file to be processed; a determination module 71, used for determining the category to which the first file to be processed belongs; a search module 72, used for searching a target rule file that matches the category from a preset rule library; a comparison module 73, used for comparing the first file to be processed with the target rule file to obtain a comparison result, and processing the first file to be processed according to the comparison result to obtain a processed second file to be processed; and a processing module 74, used for proofreading the second file to be processed to obtain a structured file corresponding to the second file to be processed.
[0077] The above-mentioned file processing device obtains an editable first file to be processed; determines the category to which the first file to be processed belongs; searches for a target rule file that matches the category from a preset rule library; compares the first file to be processed with the target rule file to obtain a comparison result, processes the first file to be processed according to the comparison result to obtain a processed second file to be processed; and proofreads the second file to be processed to obtain a structured file corresponding to the second file to be processed. The device can automatically compare the first file to be processed with its corresponding target rule file, and processes the first file to be processed according to the comparison result to obtain a second file to be processed; and then proofreads the second file to be processed to obtain a corresponding structured file. The device can reduce the reliance on manual verification and confirmation, and improve the efficiency of generating structured files.
[0078] Furthermore, the determination module is further used to: extract a first keyword from the first file to be processed; and determine the category to which the first file to be processed belongs according to the first keyword.
[0079] Furthermore, the search module is also used for: the target rule file includes at least one page rule sub-file, each page rule sub-file includes multiple target size information and multiple target keywords; wherein the target position of each target keyword in each page rule sub-file in the rule sub-file corresponds to the pixel position indicated by the target size information associated with the target keyword.
[0080] Furthermore, the comparison module is also used to: perform line-by-line scanning and detection on the first file to be processed to extract multiple keywords to be processed in the first file to be processed, and the first position information corresponding to each keyword to be processed; for each target position, determine whether the first target keyword corresponding to the target position in the target rule file matches the first keyword to be processed corresponding to the target position in the first file to be processed; if they do not match, determine that the first keyword to be processed is the first exception information; or, for each first position information, determine whether the second keyword to be processed corresponding to the first position information in the first file to be processed matches the second target keyword corresponding to the first position information in the target rule file; if they do not match, determine that the second keyword to be processed is the second exception information; process the first file to be processed according to the target exception information to obtain a processed second file to be processed; wherein the target exception information includes: the first exception information and / or the second exception information.
[0081] Furthermore, the comparison module is also used to: process the first file to be processed according to a preset processing method based on the target exception information to obtain a third file to be processed; wherein the preset processing method includes at least one of the following: modification, deletion and addition; perform word segmentation and parsing on the third file to be processed to obtain a processed second file to be processed.
[0082] Furthermore, the processing module is also used for: the second file to be processed includes multiple processed second keywords; according to the category to which it belongs, model information is added to the second file to be processed to obtain a fourth file to be processed with the added information; wherein the model information includes at least one of the following: the font, font size and position identifier corresponding to each second keyword; the fourth file to be processed is converted according to a preset format to obtain a structured file corresponding to the second file to be processed.
[0083] Furthermore, the categories include one of the following: national standards, industry standards, local standards, group standards and enterprise standards.
[0084] The file processing device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned file processing method embodiment. For the part of the file processing device embodiment, reference may be made to the corresponding contents in the aforementioned file processing method embodiment.
[0085] The embodiment of the present invention further provides an electronic device, see Figure 8 As shown, the electronic device includes a processor 130 and a memory 131 , wherein the memory 131 stores machine executable instructions that can be executed by the processor 130 , and the processor 130 executes the machine executable instructions to implement the above-mentioned file processing method.
[0086] Further, Figure 8 The electronic device shown further includes a bus 132 and a communication interface 133 , and the processor 130 , the communication interface 133 and the memory 131 are connected via the bus 132 .
[0087] The memory 131 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 132 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0088] The processor 130 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 130. The above processor 130 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the above embodiment in combination with its hardware.
[0089] An embodiment of the present invention also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned file processing method. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0090] The computer program product of the file processing method, device and electronic device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.
[0091] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium, including several 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 methods 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., which can store program codes.
[0092] 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 replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A file processing method, characterized in that: The method comprises: Get the first editable file to be processed; Determining the category to which the first to-be-processed file belongs; Searching for a target rule file matching the category from a preset rule library; Comparing the first file to be processed with the target rule file to obtain a comparison result, and processing the first file to be processed according to the comparison result to obtain a processed second file to be processed; Proofreading the second file to be processed to obtain a structured file corresponding to the second file to be processed; The target rule file includes at least one page of rule sub-files, and each page of the rule sub-files includes a plurality of target size information and a plurality of target keywords; Wherein, the target position of each target keyword in the rule subfile of each page corresponds to the pixel position indicated by the target size information associated with the target keyword; The second to-be-processed file includes a plurality of processed second keywords; The step of proofreading the second file to be processed to obtain a structured file corresponding to the second file to be processed includes: According to the category, model information is added to the second to-be-processed file to obtain a fourth to-be-processed file after the information is added; wherein the model information includes at least one of the following: the font, font size and position identifier corresponding to each of the second keywords; Converting the fourth file to be processed according to a preset format to obtain a structured file corresponding to the second file to be processed; The steps of comparing the first to-be-processed file with the target rule file to obtain a comparison result, and processing the first to-be-processed file according to the comparison result to obtain a processed second to-be-processed file include: Performing line-by-line scanning and detection on the first file to be processed to extract a plurality of keywords to be processed in the first file to be processed, and first position information corresponding to each keyword to be processed; For each target position, determine whether the first target keyword corresponding to the target position in the target rule file matches the first to-be-processed keyword corresponding to the target position in the first to-be-processed file, and if they do not match, determine that the first to-be-processed keyword is the first abnormal information; Alternatively, for each first position information, determine whether the second to-be-processed keyword corresponding to the first position information in the first to-be-processed file matches the second target keyword corresponding to the first position information in the target rule file, and if they do not match, determine that the second to-be-processed keyword is the second abnormal information; According to the target exception information, the first to-be-processed file is processed to obtain the processed second to-be-processed file; wherein the target exception information includes: the first exception information and / or the second exception information; The target position of each target keyword in the rule subfile of each page, and the implementation method corresponding to the pixel position indicated by the target size information associated with the target keyword include: A corresponding relationship between the pixel matrix and the format size, as well as the required text information and the order relationship is established. According to the required size information, the corresponding pixel position is obtained at a specific resolution, and the target keyword corresponding to the pixel position is recorded at the same time, so that the target position of each target keyword in the rule subfile of each page corresponds to the pixel position indicated by the target size information associated with the target keyword.
2. The method according to claim 1, characterized in that The step of determining the category to which the first to-be-processed file belongs includes: Extracting a first keyword from the first file to be processed; The category to which the first to-be-processed file belongs is determined according to the first keyword.
3. The method according to claim 1, characterized in that The step of processing the first to-be-processed file according to the target exception information to obtain the processed second to-be-processed file includes: According to the target abnormal information, the first to-be-processed file is processed in a preset processing manner to obtain a third to-be-processed file; wherein the preset processing manner includes at least one of the following: modification, deletion and addition; The third file to be processed is segmented and parsed to obtain the processed second file to be processed.
4. The method according to claim 1, characterized in that The categories include one of the following: national standards, industry standards, local standards, group standards and enterprise standards.
5. A file processing device using the file processing method according to claim 1, characterized in that: The device comprises: An acquisition module, used for acquiring a first editable file to be processed; A determination module, used to determine the category to which the first to-be-processed file belongs; A search module, used to search for a target rule file matching the category from a preset rule library; A comparison module, used for comparing the first file to be processed with the target rule file to obtain a comparison result, and processing the first file to be processed according to the comparison result to obtain a processed second file to be processed; The processing module is used to proofread the second file to be processed to obtain a structured file corresponding to the second file to be processed.
6. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method and software for digitalizing full text of standard document
CN101794278A
Document editing method and device, electronic equipment and computer readable storage medium
CN111159982A