Garbled file decoding method, device, storage medium and decoder
The preset decoder recognizes and obtains the source file according to the file type and traceability rules, the problem of garbled information being unable to be decoded is solved, and the efficient conversion of garbled files into correct text is achieved.
Patent Information
- Application Number
- CN202210871391.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-07-22
AI Technical Summary
It is difficult for the prior art to effectively convert uncommon garbled information into correct text, especially in development tools such as eclipse or IDEA, where there are still a large number of garbled codes that cannot be decoded.
The system file is identified through the preset decoder, the initial decoding file of the system file is obtained, and the source file is obtained according to the file type and traceability rules, and the garbled information is compared with the source code, and the target source code is replaced to realize the conversion of the garbled information.
When there is a large amount of garbled information in the system file, it can efficiently convert it into correct text information, improving the decoding accuracy and efficiency of garbled files.
Smart Images

Figure CN115146590B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, storage medium and decoder for decoding garbled files. Background Art
[0002] Garbled characters refer to a series of characters that are partially or completely unreadable when a text editor opens a source file on the local computer using an inappropriate character set. During system development, when developers import or reopen an existing external project, they may encounter garbled text in the project file due to environmental or encoding issues.
[0003] You can set the corresponding Chinese encoding in development tools such as eclipse or IDEA to display the correct text content of garbled characters, but it can only solve a small part of the garbled characters, and some uncommon garbled characters cannot be converted into correct text. Summary of the Invention
[0004] The embodiments of the present application provide a method, device, storage medium and decoder for decoding a garbled file, which can convert garbled code into correct text.
[0005] The present invention provides a method for decoding a garbled file, the method comprising:
[0006] Get the system files to be processed;
[0007] Inputting the system file into a preset decoder, identifying the system file through the preset decoder, and obtaining an initial decoded file of the system file; the preset decoder is a software development tool kit that performs decoding operations on the system file;
[0008] If the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type;
[0009] Comparing the garbled code information with the source code in the source file to obtain a target source code that matches the garbled code information;
[0010] The garbled information in the initial decoded file is replaced with the target source code to obtain a decoded file.
[0011] Optionally, if the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type includes:
[0012] If the initial decoded file contains garbled information, identifying the character language type of the garbled information; the character language type includes English, Japanese, Korean, Hindi and Arabic;
[0013] Querying a character encoding set corresponding to the character language type, obtaining a target character corresponding to the garbled information, and replacing the garbled information in the initial decoded file with the target character;
[0014] If at least one of the garbled characters does not have a corresponding target character, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
[0015] Optionally, if the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type includes:
[0016] If the initial decoded file contains garbled information, obtaining a target character encoding set for the preset decoder to perform a decoding operation on the system file;
[0017] When the target character encoding set is the same as the character encoding set, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
[0018] Optionally, if the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type includes:
[0019] If the initial decoded file contains garbled information, obtaining the file type of the system file;
[0020] Query the preset rule mapping table to obtain the tracing rule corresponding to the file type;
[0021] Process the file attributes of the system file according to the traceability rule to obtain a traceability identifier of the system file, wherein the file attributes include: file creation time, access time, opening method, and size;
[0022] The file corresponding to the traceability identifier is confirmed as the source file of the system file.
[0023] Optionally, after replacing the garbled information in the initial decoded file with the target source code to obtain the decoded file, the method further includes:
[0024] Establishing a mapping relationship table between the garbled code information and the target source code;
[0025] After the system file is input into a preset decoder, the system file is identified by the preset decoder to obtain an initial decoded file of the system file; the preset decoder is a software development kit that performs a decoding operation on the system file, the method further includes
[0026] When garbled information exists in the initial decoded file, querying the mapping relationship table;
[0027] If it is identified that target garbled code information matching the garbled code information exists in the relationship mapping table, determining the target source code corresponding to the target garbled code information in the relationship mapping table as the target source code of the garbled code information;
[0028] If it is identified that the target garbled code information matching the garbled code information does not exist in the relationship mapping table, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
[0029] Optionally, after replacing the garbled information in the initial decoded file with the target source code to obtain the decoded file, the method further includes:
[0030] Using the garbled code information and the target code to train a preset decoding model to obtain a target decoding model;
[0031] After inputting the system file into a preset decoder, identifying the system file by the preset decoder, and obtaining an initial decoded file of the system file, the method further includes:
[0032] When the initial decoding file contains garbled information, the garbled information is input into the target decoding model.
[0033] Optionally, the file type includes: project file type and document file type.
[0034] The present application also provides a device for decoding a garbled file, comprising:
[0035] A first acquisition module is used to acquire system files to be processed;
[0036] an identification module, configured to input the system file into a preset decoder, identify the system file through the preset decoder, and obtain an initial decoded file of the system file; the preset decoder is a software development tool kit that performs decoding operations on the system file;
[0037] A second acquisition module is configured to acquire a source file of the system file according to the file type of the system file and a tracing rule corresponding to the file type if the initial decoded file contains garbled information;
[0038] A comparison module, configured to compare the garbled code information with the source code in the source file to obtain a target source code that matches the garbled code information;
[0039] The replacement module is used to replace the garbled information in the initial decoded file with the target source code to obtain a decoded file.
[0040] The embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when the computer program is run on a computer, enables the computer to execute the method for decoding a garbled file as described in any one of the above items.
[0041] An embodiment of the present application further provides a decoder comprising a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the garbled file decoding method as described above by calling the computer program.
[0042] The technical solution provided by the embodiment of the present application is that after obtaining the system file to be processed, the system file is input into a preset decoder, the system file is identified by the preset decoder, and the initial decoded file of the system file is obtained, wherein the preset decoder is a software development tool kit that performs decoding operations on the system file. After the preset decoder decodes the initial decoded file, if the initial decoded file contains garbled information, the source file of the system file is obtained according to the file type of the system file and the traceability rules corresponding to the file type, and the garbled information is compared with the source code in the source file to obtain the target source code that matches the garbled information. Finally, the garbled information in the initial decoded file is replaced with the target source code to obtain the decoded file. After determining that there is garbled information in the initial decoded file, the preset decoder obtains the target source code that matches the garbled information by obtaining the source file of the system file. When there is a large amount of garbled information in the system file, the garbled information can be converted into correct text. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0044] Figure 1 A flowchart of a method for decoding garbled files provided in an embodiment of the present application.
[0045] Figure 2 Another flowchart of the method for decoding a garbled file provided in an embodiment of the present application.
[0046] Figure 3Another flowchart of the method for decoding a garbled file provided in an embodiment of the present application.
[0047] Figure 4 This is a schematic diagram of the structure of the garbled file decoding device provided in an embodiment of the present application.
[0048] Figure 5 A schematic diagram of the structure of a decoder provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0050] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0051] The present invention provides a method for decoding a garbled file. The method can be performed by a decoder provided in the present invention, or a device incorporating the decoder. The decoder can be implemented in hardware or software, for example, as a garbled file decoding device or a computer, such as a desktop computer, tablet computer, or PDA.
[0052] In the following embodiments, a preset decoder is used as the execution entity to explain the garbled file decoding method provided in the embodiments of the present application.
[0053] The method provided by the embodiment of the present application is that, in the process of inputting the obtained system file into the preset decoder for decoding, the preset decoder identifies the system file and obtains the initial decoding file of the system file. During the decoding process, when it is found that the system file contains garbled information, the preset decoder obtains the source file of the system file according to the system file type and the tracing rules corresponding to the file type, and then compares the obtained garbled information with the source code in the original file to obtain the target source code that matches the garbled information, and then replaces the garbled information in the initial decoding file with the source code to obtain the decoded file. In the embodiment of the present application, when the preset decoder determines that the initial decoding file of the system file contains garbled information during the decoding of the system file, it obtains the source file of the system file according to the file type and the tracing rules corresponding to the file type, and then obtains the target source code of the garbled information, thereby realizing that after the system file is decoded, the correct text of the garbled information is displayed.
[0054] See also Figure 1 , Figure 1 The following is a flow chart of the method for decoding a garbled file provided in an embodiment of the present application. The specific flow of the method for decoding a garbled file provided in an embodiment of the present application can be as follows:
[0055] 101. Get the system files to be processed.
[0056] During system development, it is usually necessary to decode the already written system files. The system files can be obtained through instant messaging tools (for example, WeChat, QQ), transmitted via Bluetooth, or obtained using wired transmission. In this application, there is no restriction on the method of obtaining the system files.
[0057] The system file may be a file compiled using a coding program, for example, a system file of the project file type compiled using ecplise, or a system file of the web file type compiled using Dreamweaver, or a document file.
[0058] 102. Input the system file into a preset decoder, identify the system file through the preset decoder, and obtain an initial decoded file of the system file; the preset decoder is a software development tool kit that performs decoding operations on the system file.
[0059] The preset decoder is a software development toolkit that performs decoding operations on system files and then displays the source code information corresponding to the system files in the display interface.
[0060] After the preset decoder decodes the system file, an initial decoded file of the system file is obtained. It is understandable that when a system file contains multiple sub-files, the preset decoder also obtains multiple initial decoded files.
[0061] The displayed content of the initial decoded file obtained by decoding with the preset decoder includes the content obtained after correct decoding and garbled information.
[0062] Garbled information refers to the situation where, during the process of decoding the initial decoding file of the system file by the preset decoder, the correct characters corresponding to the code of the initial decoding file cannot be displayed, but other meaningless characters are displayed. For example, when the text content of a document is displayed on a display interface, based on the font information of the text content in the document and the information of the font library that matches the font information, a font library that matches the font information can be found in the computer, and the font library is loaded into the text content, thereby displaying the correct text content. If the electronic device lacks a font library that matches the font information, the text content will be parsed with an unmatched font library, resulting in garbled information when the preset decoder decodes the initial decoding file. Alternatively, when the system file is written in different versions of the encoding program, due to the difference in versions, the same system file displays different decoding results in different encoding programs. Alternatively, because the computer uses different operating systems, different garbled information appears in the process of decoding the same system file.
[0063] 103. If the initial decoded file contains garbled information, obtain the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type.
[0064] It is understandable that the system files may include various types, for example, a system file of the engineering file type generated by C language coding, or a system file of the web file type generated by C# coding.
[0065] For example, the system file of the project file type includes a PKG subfile ending with wxapkg, a DB-SHM subfile ending with db-shm, a DB-WAL subfile ending with db-wal, a DATA subfile ending with data, a text subfile ending with text, or a picture subfile ending with png.
[0066] Exemplarily, the system file of the web file type includes a web page type ending with html.
[0067] Therefore, in this embodiment, the file type of the system file can be determined by directly reading the file suffix during decoding. The preset decoder directly performs source tracing according to the source tracing rule corresponding to the file type.
[0068] For example, when the system file is a system file of the engineering file type, the corresponding traceability rule is to read the storage address of the system file before decoding or before decompression to obtain the source file of the system file. When the system file is a system file of the web file type and the system file has been published, a web crawler such as Scrapy can be used for web crawling, and the crawled web pages that meet the requirements can be accessed to obtain the source file of the system file.
[0069] It can be understood that in this embodiment, the file types of the system files are exemplarily described by the engineering file type and the web file type. The file types of the system files may also include system files of other file types in addition to the above types, and the corresponding traceability rules may also be different. In this embodiment, they will not be described in detail.
[0070] 104. Compare the garbled information with the source code in the source file to obtain the target source code that matches the garbled information.
[0071] In this embodiment, after obtaining the source code, the garbled information is compared with the source code to obtain the target source code that matches the garbled information.
[0072] Exemplarily, in this embodiment, when the preset decoder is decoding, if the decoding fails due to the appearance of rare characters, there is some correctly displayed text information in the garbled information displayed after decoding. After obtaining the source code, the garbled information is directly compared with the source code one by one. When there is a source code in the source code that is similar to the garbled information, it is determined as the target source code that matches the garbled information.
[0073] For example, if "亻恩" appears in the garbled information and "憁" exists in the source code, then the target source code that matches the garbled information is determined to be "憁".
[0074] Exemplarily, when the garbled information consists of multiple characters and contains correct text information, the garbled information is compared with the source code. When the correct text information in the garbled information is consistent with the correct text information in the source code, the garbled information is determined according to the correct text information.
[0075] For example, if "亻恩恫" appears in the garbled information and "愡恫" exists in the source code, then the source code "愡恫" is determined to be the target source code that matches the garbled information.
[0076] 105. Replace the garbled information in the initial decoded file with the target source code to obtain a decoded file.
[0077] In this embodiment, after obtaining the target source code that matches the garbled information in the initial decoded file, the target source code is used to replace the garbled information in the initial decoded file to obtain a decoded file, and the decoded file is displayed in the display interface.
[0078] In this embodiment, after obtaining the system file to be processed, the system file is input into a preset decoder, and the system file is identified by the preset decoder to obtain an initial decoded file of the system file, wherein the preset decoder is a software development toolkit that performs decoding operations on the system file. After the preset decoder decodes the initial decoded file, if the initial decoded file contains garbled information, the source file of the system file is obtained according to the file type of the system file and the traceability rules corresponding to the file type, and the garbled information is compared with the source code in the source file to obtain the target source code that matches the garbled information. Finally, the garbled information in the initial decoded file is replaced with the target source code to obtain the decoded file. After determining that there is garbled information in the initial decoded file, the preset decoder obtains the target source code that matches the garbled information by obtaining the source file of the system file. When there is a large amount of garbled information in the system file, the garbled information can be converted into correct text.
[0079] Reference Figure 2 In some embodiments, the preset decoder obtains the source file of the system file according to the decoding condition of the garbled information. The steps of the preset decoder obtaining the source file of the system file include:
[0080] 201. If the initial decoded file contains garbled information, identify the character language type of the garbled information; the character language type includes English, Japanese, Korean, Hindi, and Arabic;
[0081] 202. Query the character encoding set corresponding to the character language type, obtain the target character corresponding to the garbled code information, and replace the garbled code information in the initial decoding file with the target character;
[0082] 203. If at least one of the garbled characters does not have a corresponding target character, obtain the source file of the system file according to the file type of the system file and a tracing rule corresponding to the file type.
[0083] After determining that the initial decoded file contains garbled information, the preset decoder identifies the language type of the characters in the garbled information, wherein the character language types include: English, Japanese, Korean, Hindi and Arabic, German, Spanish, Russian, French, etc.
[0084] It is understandable that, in computer encoding, different types of character languages use different character encodings, so when decoding, it is necessary to determine the corresponding character encoding in order to obtain the corresponding character.
[0085] Therefore, in this embodiment, after the preset decoder determines that the initial decoded file contains garbled information, the character language type of the garbled information can be obtained. It can be understood that in the programming process, the same character encoding set is usually used for programming, but in special cases, other character encoding sets under the same character language type will be used. Therefore, in this embodiment, when the preset decoder determines that there is garbled information in the decoded initial decoded file, it decodes the garbled information in turn according to the character encoding set of the character language type of the garbled information to check whether the garbled information is caused by an error in the use of the character encoding set. If the decoding is successful using the character encoding set, it is determined that the character in the character encoding set is the target character corresponding to the garbled information.
[0086] The preset decoder sequentially decodes the garbled information in the initial decoded file using different character encoding sets under the same character language type. Further confirmation is made as to whether any garbled information still exists. If at least one garbled information exists for which the target character cannot be found in the character encoding, the system file's source file is searched based on the system file type and corresponding tracing rules.
[0087] In this embodiment, when garbled information exists in the initial decoded file, the garbled information is first decoded using the character encoding set corresponding to the character language type of the garbled information. After finding the target character corresponding to the garbled information in the character encoding set, the source file of the system file is obtained through the tracing rule to decode the garbled information. By re-decoding the garbled information after the first decoding using a different character encoding set, the speed of converting the garbled information into correct text can be improved.
[0088] In some embodiments, when the preset decoder uses the target character encoding set to decode the system file to obtain garbled information, it checks whether the character encoding set of the garbled information is the same as the target character encoding set. If they are the same, it means that the garbled information cannot be decoded using the corresponding character encoding set, that is, there is a situation where the decoding fails due to an error in the system file content. Therefore, the preset decoder directly obtains the source file of the system file through the traceability rule. This reduces the time of decoding using other character encoding sets and improves the efficiency of converting garbled information into correct text.
[0089] Reference Figure 3 In some embodiments, obtaining the source file of a system file according to the system file type and the tracing rule corresponding to the file type includes:
[0090] 301. If the initial decoded file contains garbled information, obtain the file type of the system file;
[0091] 302. Query a preset rule mapping table to obtain a traceability rule corresponding to the file type;
[0092] 303. Process the file attributes of the system file according to the traceability rule to obtain a traceability identifier of the system file. The file attributes include: file creation time, access time, opening method, and size.
[0093] 304. Set the file corresponding to the traceability identifier as the source file of the system file.
[0094] After determining that the initial decoded file contains garbled information, the preset decoder obtains the file type of the system file, and then determines the traceability rule corresponding to the file type in the preset rule mapping table, processes the file attributes of the system file according to the traceability rule, and then obtains the traceability identifier of the system file, and confirms the file corresponding to the traceability identifier as the source file of the system file.
[0095] Among them, file attributes include: file creation time, access time, opening method, size, occupied space, modification time, version number, number of characters, etc.
[0096] For example, in this embodiment, the system file is described as a document-type file. After the preset decoder determines that the system file is a document-type file, it determines from the mapping table that the corresponding traceability rule for the document-type file is to trace the source by file naming. The file attributes of the system file, such as file size and version number, are filtered according to the traceability rule to obtain a traceability identifier for the system file. The file that matches the traceability identifier is then determined to be the source file of the system file.
[0097] In this embodiment, the traceability rules corresponding to the file type are determined through a preset rule mapping table, and the system file attributes are processed according to the traceability rules to obtain a traceability identifier, and then the file consistent with the traceability identifier is determined to be the source file of the system file. By establishing a mapping table, the source file of the system file can be quickly obtained.
[0098] In some embodiments, the preset decoder can also improve the efficiency of determining the text information when the garbled information is correctly displayed by establishing a mapping table.
[0099] For example, after obtaining the text information when the garbled information is correctly displayed, the garbled information and the target source code may be mapped and stored in a relationship mapping table.
[0100] When the preset decoder determines that there is garbled information in the initial decoding file, it queries the mapping relationship table to determine whether there is target garbled information consistent with the garbled information obtained by decoding in the mapping relationship table. If so, the target source code corresponding to the target garbled information in the relationship mapping table is determined as the target source code of the garbled information.
[0101] When the target garbled code information matching the garbled code information does not exist in the relationship mapping table, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
[0102] In this embodiment, the target source code of the garbled information is determined by establishing a relationship mapping table between the garbled information and the target source code. That is, the target source code of the garbled information is directly obtained through the relationship mapping table, which improves the speed of determining the target source code of the garbled information.
[0103] In some embodiments, the preset decoder can also obtain a target decoding model through self-learning. If the initial decoding file contains garbled information, the garbled information is input into the target decoding model, and the target source code of the garbled information is determined through the output information of the output layer of the target decoding model.
[0104] Among them, the preset encoder obtains a large amount of garbled information and target source code, marks them, inputs the garbled information into the preset decoding model, and reversely adjusts the setting parameters of the preset decoding model through the marked target source code and the target source code output by the output layer of the preset decoding model until the target source code output by the output layer of the preset decoding model matches the target source code in the sample data, and determines that the preset decoding model obtained by current training is the target decoding model.
[0105] It is understandable that, in order to improve the accuracy of the target decoding model, the preset decoder may also determine the target source code by combining the relationship mapping table with the target decoding model.
[0106] In one embodiment, a garbled file decoding device 400 is also provided. Figure 4 , Figure 4 This is a schematic diagram of the structure of a garbled file decoding device 400 provided in an embodiment of the present application. The garbled file decoding device 400 is applied to a decoder, including:
[0107] A first acquisition module 401 is used to acquire a system file to be processed;
[0108] Identification module 402, configured to input the system file into a preset decoder, identify the system file through the preset decoder, and obtain an initial decoded file of the system file; the preset decoder is a software development tool kit that performs decoding operations on the system file;
[0109] The second acquisition module 403 is configured to acquire the source file of the system file according to the file type of the system file and the source tracing rule corresponding to the file type if the initial decoded file contains garbled information;
[0110] A comparison module 404 is configured to compare the garbled code information with the source code in the source file to obtain a target source code that matches the garbled code information;
[0111] The replacement module 405 is configured to replace the garbled information in the initial decoded file with the target source code to obtain a decoded file.
[0112] In some embodiments, the second acquisition module 403 further includes:
[0113] If the initial decoded file contains garbled information, identifying the character language type of the garbled information; the character language type includes English, Japanese, Korean, Hindi and Arabic;
[0114] Querying a character encoding set corresponding to the character language type, obtaining a target character corresponding to the garbled information, and replacing the garbled information in the initial decoded file with the target character;
[0115] If at least one of the garbled characters does not have a corresponding target character, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
[0116] In some embodiments, the second acquisition module 403 further includes:
[0117] If the initial decoded file contains garbled information, obtaining a target character encoding set for the preset decoder to perform a decoding operation on the system file;
[0118] When the target character encoding set is the same as the character encoding set, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
[0119] In some embodiments, the second acquisition module 403 further includes:
[0120] If the initial decoded file contains garbled information, obtaining the file type of the system file;
[0121] Query the preset rule mapping table to obtain the tracing rule corresponding to the file type;
[0122] Process the file attributes of the system file according to the traceability rule to obtain a traceability identifier of the system file, wherein the file attributes include: file creation time, access time, opening method, and size;
[0123] The file corresponding to the traceability identifier is confirmed as the source file of the system file.
[0124] The replacement module 405 replaces the garbled information in the initial decoded file with the target source code to obtain the decoded file, and further includes:
[0125] Establishing a mapping relationship table between the garbled code information and the target source code;
[0126] After the system file is input into a preset decoder, the system file is identified by the preset decoder to obtain an initial decoded file of the system file; the preset decoder is a software development kit that performs a decoding operation on the system file, the method further includes
[0127] When garbled information exists in the initial decoded file, querying the mapping relationship table;
[0128] If it is identified that target garbled code information matching the garbled code information exists in the relationship mapping table, determining the target source code corresponding to the target garbled code information in the relationship mapping table as the target source code of the garbled code information;
[0129] If it is identified that the target garbled code information matching the garbled code information does not exist in the relationship mapping table, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
[0130] The replacement module 405 replaces the garbled information in the initial decoded file with the target source code to obtain the decoded file, and further includes:
[0131] Using the garbled code information and the target code to train a preset decoding model to obtain a target decoding model;
[0132] After inputting the system file into a preset decoder, identifying the system file by the preset decoder, and obtaining an initial decoded file of the system file, the method further includes:
[0133] When the initial decoding file contains garbled information, the garbled information is input into the target decoding model.
[0134] It should be noted that the garbled file decoding device 400 provided in the embodiment of the present application and the garbled file decoding method in the above embodiment have the same concept. Through the garbled file decoding device 400, any method provided in the garbled file decoding method embodiment can be implemented. The specific implementation process is detailed in the garbled file decoding method embodiment, which will not be repeated here.
[0135] As can be seen from the above, the garbled file decoding device 400 proposed in the embodiment of the present application, after obtaining the system file to be processed, inputs the system file into the preset decoder, identifies the system file through the preset decoder, and obtains the initial decoded file of the system file, wherein the preset decoder is a software development toolkit that performs decoding operations on the system file. After the preset decoder decodes the initial decoded file, if the initial decoded file contains garbled information, then according to the file type of the system file and the traceability rules corresponding to the file type, the source file of the system file is obtained, and the garbled information and the source code in the source file are compared to obtain the target source code that matches the garbled information. Finally, the garbled information in the initial decoded file is replaced with the target source code to obtain the decoded file. After determining that there is garbled information in the initial decoded file, the preset decoder obtains the target source code that matches the garbled information by obtaining the source file of the system file. When there is a large amount of garbled information in the system file, the garbled information can be converted into correct text.
[0136] The embodiment of the present application also provides a decoder, such as Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of a decoder provided in an embodiment of the present application. The decoder 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored in the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. Those skilled in the art will appreciate that the electronic device structure shown in the figure does not limit the electronic device and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0137] The processor 501 is the control center of the decoder 500. It uses various interfaces and lines to connect the various parts of the entire decoder 500. By running or loading software programs and / or modules stored in the memory 502 and calling data stored in the memory 502, it executes various functions of the decoder 500 and processes data, thereby monitoring the decoder 500 as a whole.
[0138] In the embodiment of the present application, the processor 501 in the decoder 500 loads instructions corresponding to one or more application processes into the memory 502 according to the following steps, and the processor 501 runs the application stored in the memory 502 to implement various functions:
[0139] Get the system files to be processed;
[0140] Inputting the system file into a preset decoder, identifying the system file through the preset decoder, and obtaining an initial decoded file of the system file; the preset decoder is a software development tool kit that performs decoding operations on the system file;
[0141] If the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type;
[0142] Comparing the garbled code information with the source code in the source file to obtain a target source code that matches the garbled code information;
[0143] The garbled information in the initial decoded file is replaced with the target source code to obtain a decoded file.
[0144] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0145] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0146] As can be seen from the above, the computer provided in this embodiment, after obtaining the system file to be processed, inputs the system file into the preset decoder, identifies the system file through the preset decoder, and obtains the initial decoded file of the system file, wherein the preset decoder is a software development toolkit that performs decoding operations on the system file. After the preset decoder decodes the initial decoded file, if the initial decoded file contains garbled information, then according to the file type of the system file and the traceability rules corresponding to the file type, the source file of the system file is obtained, and the garbled information is compared with the source code in the source file to obtain the target source code that matches the garbled information. Finally, the garbled information in the initial decoded file is replaced with the target source code to obtain the decoded file. After determining that there is garbled information in the initial decoded file, the preset decoder obtains the target source code that matches the garbled information by obtaining the source file of the system file. When there is a large amount of garbled information in the system file, the garbled information can be converted into correct text.
[0147] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0148] To this end, the embodiments of the present application provide a computer-readable storage medium. Persons skilled in the art will appreciate that all or part of the steps in the above-described embodiment methods can be implemented by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. When executed, the program includes the following steps:
[0149] Get the system files to be processed;
[0150] Inputting the system file into a preset decoder, identifying the system file through the preset decoder, and obtaining an initial decoded file of the system file; the preset decoder is a software development tool kit that performs decoding operations on the system file;
[0151] If the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type;
[0152] Comparing the garbled code information with the source code in the source file to obtain a target source code that matches the garbled code information;
[0153] The garbled information in the initial decoded file is replaced with the target source code to obtain a decoded file.
[0154] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0155] The above-mentioned storage medium may be ROM / RAM, a magnetic disk, an optical disk, etc. Since the computer program stored in the storage medium can execute the steps of any of the garbled file decoding methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the garbled file decoding methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0156] The above is a detailed introduction to a garbled file decoding method, device, medium and electronic device provided in the embodiments of the present application. Specific examples are used herein 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 and core idea of the present application. At the same time, for those skilled in the art, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A method for decoding garbled files, characterized in that: The method comprises: Get the system files to be processed; Inputting the system file into a preset decoder, identifying the system file through the preset decoder, and obtaining an initial decoded file of the system file, wherein the preset decoder is a software development tool kit that performs a decoding operation on the system file; If the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type; Comparing the garbled code information with the source code in the source file to obtain a target source code that matches the garbled code information; Replacing the garbled information in the initial decoded file with the target source code to obtain a decoded file; Wherein, after replacing the garbled information in the initial decoded file with the target source code to obtain the decoded file, the method further includes: Using the garbled code information and the target source code to train a preset decoding model to obtain a target decoding model; After inputting the system file into a preset decoder, identifying the system file by the preset decoder, and obtaining an initial decoded file of the system file, the method further includes: When the initial decoding file contains garbled information, the garbled information is input into the target decoding model, and the target source code of the garbled information is determined through output information of the output layer of the target decoding model.
2. The method according to claim 1, characterized in that If the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type includes: If the initial decoded file contains garbled information, identifying the character language type of the garbled information; the character language type includes English, Japanese, Korean, Hindi and Arabic; Querying a character encoding set corresponding to the character language type, obtaining a target character corresponding to the garbled information, and replacing the garbled information in the initial decoded file with the target character; If at least one of the garbled characters does not have a corresponding target character, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
3. The method according to claim 2, characterized in that If the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type includes: If the initial decoded file contains garbled information, obtaining a target character encoding set for the preset decoder to perform a decoding operation on the system file; When the target character encoding set is the same as the character encoding set, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
4. The method according to claim 1, wherein If the initial decoded file contains garbled information, obtaining the source file of the system file according to the file type of the system file and the tracing rule corresponding to the file type includes: If the initial decoded file contains garbled information, obtaining the file type of the system file; Query the preset rule mapping table to obtain the tracing rule corresponding to the file type; Process the file attributes of the system file according to the traceability rule to obtain a traceability identifier of the system file, wherein the file attributes include: file creation time, access time, opening method, and size; The file corresponding to the traceability identifier is confirmed as the source file of the system file.
5. The method according to any one of claims 1 to 4, characterized in that After replacing the garbled information in the initial decoded file with the target source code to obtain the decoded file, the method further includes: Establishing a relationship mapping table between the garbled information and the target source code; After the system file is input into a preset decoder, the system file is identified by the preset decoder to obtain an initial decoded file of the system file; the preset decoder is a software development kit that performs a decoding operation on the system file, the method further includes When garbled information exists in the initial decoded file, querying the relationship mapping table; If it is identified that target garbled code information matching the garbled code information exists in the relationship mapping table, determining the target source code corresponding to the target garbled code information in the relationship mapping table as the target source code of the garbled code information; If it is identified that the target garbled code information matching the garbled code information does not exist in the relationship mapping table, the source file of the system file is obtained according to the file type of the system file and the tracing rule corresponding to the file type.
6. The method according to claim 1, characterized in that The file types include: project file type and document file type.
7. A garbled file decoding device, characterized in that: include: A first acquisition module is used to acquire system files to be processed; An identification module, configured to input the system file into a preset decoder, identify the system file through the preset decoder, and obtain an initial decoded file of the system file; The preset decoder is a software development kit that performs decoding operations on system files; A second acquisition module is configured to acquire a source file of the system file according to the file type of the system file and a tracing rule corresponding to the file type if the initial decoded file contains garbled information; A comparison module, configured to compare the garbled code information with the source code in the source file to obtain a target source code that matches the garbled code information; A replacement module, configured to replace the garbled information in the initial decoded file with the target source code to obtain a decoded file; The replacement module is further configured to input the garbled information into a target decoding model when the initial decoding file contains garbled information, and determine the target source code of the garbled information through output information of an output layer of the target decoding model; The recognition module is further configured to train a preset decoding model using the garbled code information and the target source code to obtain a target decoding model.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is run on a computer, the computer is enabled to execute the method for decoding a garbled file according to any one of claims 1 to 6.
9. A decoder comprising a processor and a memory, wherein the memory stores a computer program, characterized in that: The processor is configured to execute the garbled file decoding method according to any one of claims 1 to 6 by calling the computer program.
Citation Information
Patent Citations
Method and system for detecting and repairing text document messy codes
CN104424010A