WO2015043072A1 - 一种选择读取目标文档的编码格式的方法及其系统 - Google Patents

一种选择读取目标文档的编码格式的方法及其系统 Download PDF

Info

Publication number
WO2015043072A1
WO2015043072A1 PCT/CN2013/088745 CN2013088745W WO2015043072A1 WO 2015043072 A1 WO2015043072 A1 WO 2015043072A1 CN 2013088745 W CN2013088745 W CN 2013088745W WO 2015043072 A1 WO2015043072 A1 WO 2015043072A1
Authority
WO
WIPO (PCT)
Prior art keywords
encoding format
garbled
target document
characters
read
Prior art date
Application number
PCT/CN2013/088745
Other languages
English (en)
French (fr)
Inventor
叶茂
万巍
金立峰
王元龙
Original Assignee
北大方正集团有限公司
北京方正阿帕比技术有限公司
北京大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北大方正集团有限公司, 北京方正阿帕比技术有限公司, 北京大学 filed Critical 北大方正集团有限公司
Priority to US15/025,513 priority Critical patent/US10366143B2/en
Priority to EP13894578.7A priority patent/EP3051428B1/en
Priority to JP2016517326A priority patent/JP6280211B2/ja
Publication of WO2015043072A1 publication Critical patent/WO2015043072A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • G06F40/146Coding or compression of tree-structured data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • G06F9/454Multi-language systems; Localisation; Internationalisation

Definitions

  • the present invention relates to a method and system for selecting an encoding format for reading a target document, and belongs to the technical field of electrical digital data processing.
  • Encoding format refers to the digitization of words, numbers or other objects in a predetermined manner.
  • the coding format is widely used in related fields such as electronic computers and televisions.
  • the file encoding format also known as the character encoding format, is used to specify how characters are represented when processing text. When the Chinese file is read, the case where the file encoding format is not correctly matched may cause an exception or an incorrect result.
  • Common Chinese character encoding formats include GB2312, BIG5, GBK, UTF-8, etc.
  • the encoding format reading method of the text document disclosed in the prior art is to read the first few bytes of the text document, determine the values of the bytes, and thereby know the format of the encoding.
  • the first few bytes of the text document do not retain the encoding format information of the text document. In this way, the encoding format of the text document cannot be obtained. If there is a mechanism to read the document by selecting the correct encoding format, it will greatly reduce the problems caused by the file encoding format and improve the development efficiency.
  • the technical problem to be solved by the present invention is that the prior art only reads out the first few words of the target document. Section, determine the value of these bytes, so as to know the format of the encoding, but sometimes, the first few bytes of the target document does not retain the encoding format information of the document, and the encoding format of the document cannot be obtained.
  • the present invention is achieved by the following technical solutions:
  • a method for selecting an encoding format of a target document comprising: reading a reference document by using at least one reference encoding format, determining all or part of a garbled pattern obtained when the reference document is read by using the reference encoding format; Reading a target document in an encoding format; for each encoding format, comparing data generated when the encoding format reads the target document with a determined garbled pattern, determining a result generated when the target document is read by using the encoding format Garbled; statistically garbled when the target document is read using each encoding format, and compared, and then determines the encoding format of the target document.
  • the reference encoding format belongs to a coding format set that includes all or part of an encoding format.
  • the reference document is read by all of the reference encoding formats to determine all or part of the garbled pattern obtained when the reference document is read using the reference encoding format.
  • the process of determining all or part code patterns obtained when the reference document is read by using the reference encoding format is as follows: for the garbled character string obtained when the reference document is read by using the reference encoding format, in the code string
  • the non-effective judgment character is obtained by the judgment character; the statistically valid judges the number of occurrences of the garbled character in the character, and obtains the garbled pattern.
  • the non-effective judgment character refers to an English alphabet, a number, and a white space character; and the valid judgment character refers to all characters except the non-effective judgment character.
  • the statistics effectively determines the number of occurrences of garbled characters in the character, and when the garbled mode is obtained, the threshold of the preset number of times is set, and all the garbled characters whose occurrence times are greater than the threshold are saved in the garbled mode.
  • the statistics effectively determine the number of occurrences of garbled characters in the character, and when the garbled mode is obtained, press The number of garbled characters appears in reverse order to arrange garbled characters; the garbled characters in the preceding part are obtained, and the garbled characters obtained are garbled mode.
  • the garbled characters arranged in the first k% are obtained, and the garbled characters are saved in a garbled mode, where k is a positive number, 50 ⁇ k ⁇ 100.
  • the part of the content is read each time the target document is read by using one encoding format, until a preset number of valid judgment characters is obtained; if all the contents of the document are read, the preset is not obtained.
  • comparing the data generated when the encoding format is read by the encoding file with the determined garbled pattern, determining a garbled code generated when the target document is read by using the encoding format is: going through each encoding The data generated when the target document is read by the format is compared one by one with the garbled characters in the garbled mode one by one. If the garbled characters contain the data, it is determined that the data is garbled. Otherwise, the data is not considered to be a ⁇ code.
  • counting the garbled characters generated when the target document is read by using each encoding format, and comparing, and then determining the encoding format of the target document is: counting using the encoding format to read the encoding
  • the garbled ratio generated when the target document is generated, the encoding format with the lowest garbled ratio is selected as the encoding format for reading the target document; or the garbled ratio generated when the target document is read by using each encoding format is selected, and the garbled ratio is selected to be lower than
  • the encoding format of the preset threshold is used as an encoding format for reading the target document.
  • the garbled ratio is a ratio of the garbled characters to valid judgment characters.
  • the encoding format belongs to the encoding format set each time the target document is read using one encoding format.
  • a system for selecting an encoding format of a target document comprising: a garbled pattern generating module, configured to read a reference document by using at least one reference encoding format, and determine all or part obtained when the reference document is read by using the reference encoding format Garbled mode; a target document reading module for reading a target document each time using an encoding format; reading a garbled module for encoding each encoding format Formatting the data generated when the target document is read, comparing with the determined garbled pattern, determining garbled characters generated when the target document is read by using the encoding format; reading an encoding format selection module, for using each encoding format statistically The garbled characters generated when the target document is read are compared and then determined, and then the encoding format of the target document is read.
  • the reference encoding format belongs to a coding format set that includes all or part of
  • the reference document is read by all of the reference encoding formats to determine all or part of the garbled pattern obtained when the reference document is read using the reference encoding format.
  • the process of determining all or part code patterns obtained when the reference document is read by using the reference encoding format is as follows: For the garbled character string obtained when the reference document is read by using the reference encoding format, deleting the I ⁇ L code The non-valid judgment character in the string is judged by the valid judgment character; the statistically valid judges the number of occurrences of the garbled character in the character, and obtains the garbled pattern.
  • the non-effective judgment character refers to an English alphabet, a number, and a white space character; and the valid judgment character refers to all characters except the non-effective judgment character.
  • the statistics effectively determines the number of occurrences of garbled characters in the character, and when the garbled mode is obtained, the threshold of the preset number of times is set, and all the garbled characters whose occurrence times are greater than the threshold are saved in the garbled mode.
  • the statistics effectively determine the number of occurrences of garbled characters in the character, and when the garbled mode is obtained, the garbled characters are arranged in reverse order according to the number of occurrences of garbled characters; the garbled characters in the preceding part are obtained, and the garbled characters are garbled. .
  • the garbled characters arranged in the first k% are obtained, and the garbled characters are saved in a garbled mode, where k is a positive number, 50 ⁇ k ⁇ 100.
  • the part of the content is read each time the target document is read by using one encoding format, until a preset number of valid judgment characters is obtained; if all the contents of the document are read, the preset is not obtained. If the number of characters is valid, the number of valid judgment characters obtained will be taken as the standard. The number of valid characters is 50-1000.
  • comparing the data generated when the encoding format is read by the encoding file with the determined garbled pattern, determining a garbled code generated when the target document is read by using the encoding format is: going through each encoding The data generated when the target document is read by the format is compared one by one with the garbled characters in the garbled mode one by one. If the garbled characters contain the data, it is determined that the data is garbled. Otherwise, the data is not considered to be a ⁇ code.
  • counting the garbled characters generated when the target document is read by using each encoding format, and comparing, and then determining the encoding format of the target document is: counting using the encoding format to read the encoding
  • the garbled ratio generated when the target document is generated, and the encoding format with the lowest garbled ratio is selected as the encoding format for reading the target document; or, the garbled ratio generated when the target document is read by using each encoding format is statistically selected, and the garbled ratio is low.
  • the encoding format of the preset threshold is used as an encoding format for reading the target document.
  • the garbled ratio is a ratio of the garbled characters to valid judgment characters.
  • the encoding format belongs to the set of encoding formats each time the target document is read using an encoding format.
  • the above technical solution has the following one or more advantages compared to the prior art:
  • the method and system for selecting the encoding format of the target document first reading the reference document by referring to the encoding format to obtain the garbled pattern, and then, when reading the target document, Each encoding format, comparing data generated when the encoding format is read by the encoding format with a determined garbled pattern, determining garbled characters generated when the target document is read by using the encoding format; The garbled code generated when the target document is read, the garbled ratio is minimized or garbled.
  • the first few bytes of the target document are read, and the values of the bytes are determined, so that the encoded code is known. Format, however, sometimes, the first few bytes of the target document do not retain the encoding format information of the document, and the encoding format of the document cannot be obtained.
  • the garbled character having a higher number of occurrences of garbled characters is used as a garbled pattern according to a certain ratio, filtering some uncommon garble characters, and improving subsequent selection.
  • the efficiency of reading the encoding format of the target document is used as a garbled pattern according to a certain ratio, filtering some uncommon garble characters, and improving subsequent selection.
  • the method for selecting an encoding format for reading a target document according to the present disclosure is to select an encoding format for reading a target document according to a method with a minimum garbled ratio, which is cleverly conceived, simple in method, and easy to implement.
  • the method for selecting an encoding format for reading a target document when the garbled ratio is less than a preset threshold, the encoding format is used as an encoding format for reading a document, thereby avoiding reading with all encoding formats. Longer processing time is required when selecting the target document, which further improves the efficiency of selecting the encoding of the target document.
  • FIG. 1 is an embodiment of the method for selecting an encoding format for reading a target document according to the present invention.
  • FIG. 2 is a block diagram of an embodiment of a system for selecting an encoding format for reading a target document according to the present invention.
  • DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiment 1 This embodiment provides a method for selecting an encoding format of a target document, which is shown in FIG. 1 , and the steps include:
  • the document in this embodiment is a text document.
  • the reference encoding format belongs to a set of encoding formats that include all encoding formats.
  • the process of determining all or part of the garbled pattern obtained when the reference document is read by using the reference encoding format is as follows: For the garbled string obtained when the reference document is read using the reference encoding format, deleting the illegible character string is invalid Judging the character, obtaining the judgment character; statistically determining the number of occurrences of the garbled character in the character, and obtaining the garbled pattern.
  • the non-effective judgment characters refer to English letters, numbers and blank characters; the effective judgment characters refer to all characters except the valid judgment characters.
  • the illegible character string obtained when the reference document is read by using the reference encoding format is deleted, and the non-effective judgment character in the garbled character string is deleted, so that the number of processed characters is less, and the processing is further improved.
  • Speed JL also improves the accuracy of getting garbled.
  • the statistics effectively determines the number of occurrences of garbled characters in the character, and when the garbled mode is obtained, the threshold of the preset number of times is garbled mode for all garbled characters whose occurrence times are greater than the threshold.
  • a garbled character with a high number of garbled character occurrences is used as a garbled pattern according to a certain ratio, and some extraordinary garbled characters are filtered, which improves the efficiency of subsequent selection of the encoding format of the target document.
  • the number of occurrences of garbled characters in the character is statistically determined.
  • the garbled characters are arranged in reverse order according to the number of occurrences of garbled characters; the garbled characters in the preceding part are obtained, and the garbled characters are saved in garbled mode.
  • the first 80% of garbled characters are obtained, and these garbled characters are garbled patterns that need to be acquired.
  • the first k% garbled characters are taken and the garbled characters are saved in garbled mode.
  • k is a positive number and k has a value range of 60 ⁇ k ⁇ 90.
  • k can choose different values such as 60, 70, 75, 90, etc., and choose different values according to the user's needs.
  • the encoding format belongs to the encoding format set, which means that it belongs to the previous one.
  • the reference encoding format and the encoding format of the selected read target document belong to the same set.
  • the garbled pattern has a high recognition rate for the generated garbled characters. If the number of valid judgment characters set in advance is not obtained after reading all the contents of the target document, the number of valid judgment characters actually obtained is taken as the standard. The number of valid characters is 50-1000.
  • the number of valid judged characters is taken as 100.
  • the number of valid characters can be determined by taking different values such as 70, 150, 200, 300, 500, 700, 1000, etc., and different values are selected according to the needs of the user.
  • the method for selecting the encoding format of the target document in the embodiment, only part of the content of the target document is read when the target document is read, and the number of valid judgment characters set in advance is obtained, so that the selected valid judgment characters are not lost. Sexuality further increases the efficiency of selecting the encoding of the target document.
  • each encoding format For each encoding format, compare the data generated when the encoding format reads the target document with the determined garble pattern, and determine garbled characters generated when the target document is read by using the encoding format.
  • the specific process is: when the target document is read by each encoding format The data is compared with the garbled characters in the garbled mode one by one. If the garbled characters contain this data, it is determined that the data is garbled. Otherwise, the data is not considered to be a ⁇ code.
  • the specific process is: counting the garbled ratio generated when the target document is read by using each encoding format, and selecting the encoding format with the lowest garbled ratio as the encoding format of the read target document.
  • the garbled ratio is the proportion of the illegible characters in the valid judgment characters read.
  • the method for selecting the encoding format of the target document in this embodiment is to select the encoding format of the target document according to the method with the smallest garbled ratio, and the concept is ingenious, the method is simple, and the implementation is easy.
  • the garbled ratio generated when the target document is read by using each encoding format is counted, and the encoding format whose garbled ratio is lower than the preset threshold is selected as the encoding format of the read target document.
  • the method for selecting the encoding format of the target document in this embodiment when the garbled ratio is less than the preset threshold, uses the encoding format as the encoding format of the read document, and avoids using all the encoding formats to obtain the target document. The selection requires a long processing time, which further improves the efficiency of encoding the target document.
  • the method for selecting an encoding format for reading a target document and the system thereof in the embodiment first obtain a garbled pattern by reading a document by referring to an encoding format, and then reading the encoding format for each encoding format when reading the target document.
  • the data generated when the target document is taken is compared with the determined garbled pattern, and the garbled code generated when the target document is read by using the encoding format is determined; and the garbled code generated when the target document is read by using each encoding format is counted, and the garbled ratio is minimized.
  • the encoding format whose garbled ratio is lower than the preset threshold is determined as the encoding format of the read target document.
  • Embodiment 2 First, collect 500 reference documents. Reading the reference document by at least one reference encoding format, Determine all or part of the garbled pattern obtained when reading the reference document using the reference encoding format. Take one of the above reference documents to read the document in UTF-8 encoding format, for example, the original text "Mid-Autumn Festival, our company sent me a fee of 1,500 yuan, everyone is very happy! ,,, J ⁇ The encoding format of the document is UTF-8, which is read using the GB2312 code, and the order is obtained.
  • the target document is read by the encoding format GB2312, and 100 valid judgment characters are obtained.
  • the encoding format UTF-8 and the encoding format GB2312 The data generated when the target format is read by the encoding format is compared with the garbled characters in the determined garbled pattern, and the garbled characters generated when the target document is read by the encoding format are determined.
  • the UTF-8 is used to read the mesh. Acquiring the document data 100 according to the statistical model distortion determining the number of significant characters garbled characters is 86, the calculated ratio of 86% garbled characters.
  • the data obtained by the target document is read by the encoding format GB2312, and the proportion of the garbled characters is calculated to be 0%.
  • Embodiment 3 provides a method for selecting a Chinese text document reading and encoding format, which includes two stages, a first stage is a process of obtaining a garbled pattern by statistics, and a second stage is selecting a reading and encoding format of a target document. 1 ⁇ 2.
  • the non-effective judgment characters refer to English letters (including upper and lower case), numbers, and white space characters (including spaces, tabs, line breaks, etc.); valid judgment characters refer to non-English letters (including upper and lower case), numbers, and Blank characters (including spaces, tabs, newlines, etc.).
  • the process of garbled pattern is obtained through statistics.
  • the encoding format of the file is expressed as / ( )
  • the garbled encoding format is output as the reference encoding format
  • the reference encoding format is expressed as C: , which means that the ⁇ code is generated when the file is read in the encoding format in use.
  • the third step is to delete the non-valid judgment characters in the L code string.
  • the fourth step is to scan the garbled characters. The number of occurrences of each garbled character in the string.
  • the second to fourth steps are repeated for each reference document, and the number of occurrences of each garbled character is counted.
  • the garbled characters are arranged in reverse order of the number of occurrences of garbled characters.
  • the garbled characters of the first m% are obtained.
  • the garbled characters are garbled patterns that need to be obtained.
  • the value of m is greater than or equal to 50 and less than 100, and m is between 60 and 90.
  • the process of selecting the target encoding format for the target document is selected.
  • the target document here is also a Chinese text document. There are two implementations at this stage.
  • the implementation manner is as follows:
  • an encoding format c is obtained from the encoding format set C, and part of the content of the target document is read by using the encoding format c, and the first n valid judgment characters are obtained. If the number of valid judgment characters obtained is still less than n when the entire file is read, the number of characters actually obtained is taken as the standard. Assume that this stage finally obtains m valid judgment characters. The value of n is greater than or equal to 10, and the value range is [50, 1000].
  • the second step the number m of garbled characters in the m valid decision characters is counted according to the garbled pattern, and the garbled ratio m, /m is calculated.
  • One method of adding the encoding format c and the garbled ratio m, /m to the list statistical garbled characters is: m, zero, and each character of m characters is read in turn, if the character belongs to garbled mode, then m, Add one; when traversing m characters, the value in m, is the number of garbled characters.
  • the third step for the other encoding formats in the encoding format set C, repeat the first step to the second step.
  • the encoding format with the smallest selection ratio in the list L is returned as the encoding format of the read target document.
  • the second stage can also be performed as follows:
  • an encoding format c is obtained from the encoding format set C, and the encoding content c is used to read part of the target document.
  • the second step the number m of garbled characters in the m valid decision characters is counted according to the garbled pattern, and the ratio m, /m of the garbled characters is calculated.
  • One way to count garbled characters is: m, set zero, and read each of the m characters in turn. If the character belongs to garbled mode, m, add one; when traversing m characters, m, The value is the number of garbled characters.
  • the third step if the garbled ratio m, /m is greater than or equal to the threshold, the first step and the second step are repeated. If the garbled ratio is less than the threshold, the encoding format c, is returned.
  • the threshold value is greater than or equal to 1%, and the threshold value is between 5% and 50%, which is 15% in this embodiment.
  • the garbled mode is obtained by statistics, and the read encoding format of the target document (which is a Chinese text document) is automatically selected according to the garbled mode.
  • Embodiment 4 This embodiment provides a method for selecting an encoding format for reading a target document, including a first phase and a second phase, as follows: In the first phase, a garbled mode is obtained by statistics. The collection of encodings of interest is ⁇ UTF-8, GB2312 ⁇ . In the first step, 1000 Chinese text documents are collected as reference documents, which are used as Chinese training corpus. Among them, 500 files are UTF-8 code, and another 500 files are GB2312 code.
  • the text document in this embodiment refers to a text document in a format with a suffix of .txt.
  • the second step is to obtain a UTF-8 encoded file and read the document using GB2312 encoding to obtain a garbled string.
  • the non-valid judgment character in the L code string is deleted.
  • the fourth step is to count the number of occurrences of each garbled character in the garbled string.
  • the fifth step for each reference document, repeat steps 2 through 4 to count the number of occurrences of each garbled character.
  • the garbled characters are arranged in reverse order of the number of occurrences of garbled characters.
  • the seventh step the first 80% of garbled characters are obtained.
  • the garbled pattern contains common garbled features under the focused code set ⁇ UTF-8, GB2312 ⁇ .
  • the garbled pattern obtained is [ ⁇ ].
  • the first step is to get an encoding UTF-8 from the collection of encodings of interest ⁇ UTF-8, GB2312 ⁇ . Encodes the first 100 valid judgment characters of UTF-8 to read the target document.
  • the second step according to the garbled mode, the number of garbled characters in the 100 valid decision characters is 86, and the proportion of the garbled characters is 86%. Add the entry in the list L (UTF-8, 86%).
  • the second phase may also be implemented in the following manner, including: First, obtaining an encoding UTF-8 from the focused encoding set ⁇ UTF-8, GB2312 ⁇ , using the encoding UTF -8 Read the first 100 valid judgment characters of the target document.
  • FIG. 2 is a structural diagram of an embodiment of a system for selecting an encoding format of a target document according to the present invention.
  • the embodiment provides a system for selecting an encoding format of a target document, including: an L code mode generating module 21 And for reading the reference document by using at least one reference encoding format to determine all or part of the garbled mode obtained when the reference document is read by using the reference encoding format.
  • the reference encoding format belongs to a set of encoding formats including all or part of the encoding format, and the reference encoding format is an encoding format that generates garbled characters when the reference format is read in the encoding format.
  • the process of determining all or part of the garbled pattern obtained when reading the reference document by using the reference encoding format is as follows: For the garbled character string obtained when the reference document is read using the reference encoding format, the non-valid character in the I ⁇ L code string is deleted. , obtain a valid judgment character; statistically determine the number of occurrences of garbled characters in the character, and obtain a garbled pattern.
  • the non-effective judgment characters refer to English letters, numbers and blank characters; the effective judgment characters refer to all characters except the valid judgment characters.
  • the illegible character string obtained when the reference document is read by using the reference encoding format is deleted, and the non-effective judgment character in the garbled character string is deleted, so that the number of processed characters is less, and the processing is further improved.
  • Speed JL also improves the accuracy of getting garbled.
  • the statistics effectively determines the number of occurrences of garbled characters in the character, and when the garbled mode is obtained, the threshold of the preset number of times is garbled mode for all garbled characters whose occurrence times are greater than the threshold.
  • a garbled character with a high number of garbled character occurrences is used as a garbled pattern according to a certain ratio, and some unusual garbled characters are filtered, which provides a good basis for the subsequent selection of the accuracy of the encoding format of the target document.
  • the statistics effectively determines the number of occurrences of garbled characters in the character, and when the garbled mode is obtained, the garbled characters are arranged in reverse order according to the number of occurrences of garbled characters; the garbled characters in the preceding part are obtained, and the garbled characters are saved in the garbled mode.
  • the garbled characters arranged in the first k% and save the garbled characters in the garbled mode, where k is a positive number, 50 ⁇ k ⁇ 100.
  • the first 80% of garbled characters are obtained, and these garbled characters are garbled patterns that need to be acquired.
  • the first k% of garbled characters are obtained and the garbled characters are saved in garbled mode.
  • k is a positive number and k has a value range of 60 ⁇ k ⁇ 90. k can select different values such as 60, 70, 75, 90, etc., and select different values according to the user's needs.
  • the target document reading module 22 is configured to read the target document each time using an encoding format.
  • the module obtains a preset number of valid judgment characters, and the encoding format belongs to a coding format set to which the reference encoding format belongs. If the number of valid judgment characters set in advance is not obtained after reading all the contents of all the documents, the number of valid judgment characters actually obtained is taken as the standard.
  • the number of valid characters is 50-1000.
  • the number of valid judgment characters is 100.
  • the effective number of characters can be determined as 70, 150, 200, Different values such as 300, 500, 700, and 1000, and different values are selected according to the needs of the user.
  • the L code module 23 is configured to compare, for each encoding format, the data generated when the encoding format reads the target document with the determined garbled pattern, and determine garbled characters generated when the target document is read by using the encoding format.
  • the specific process is: comparing the data generated when the target document is read by each encoding format with the garbled characters in the garbled mode one by one, and if the garbled characters include the data, determining that the data is garbled; otherwise, the data is not considered as ⁇ ⁇ Code.
  • the non-effective judging character in the I ⁇ L code string is deleted, and the T-effect judging character is obtained; the statistically valid judges the number of occurrences of the garbled character in the character, Get garbled mode.
  • the garbled ratio generated when the target document is read by using each encoding format is counted, and the encoding format with the lowest encoding ratio is used as the encoding format of the target document.
  • the garbled ratio generated when the target document is read by using each encoding format is counted, and the encoding format whose garbled ratio is lower than the preset threshold is selected as the encoding format of the read target document.
  • the garbled ratio is the proportion of garbled characters occupying the valid judgment characters read.
  • the system for selecting the encoding format of the target document in the embodiment by using the method for selecting the encoding format of the target document of the present invention, effectively avoids the prior art only reading the first few bytes of the target document, and determining The value of these bytes, so that the format of the encoding is known, but sometimes, the first few bytes of the target document do not retain the encoding format information of the document, and the encoding format of the document cannot be obtained. It is apparent that the above-described embodiments are merely illustrative of the examples, and are not intended to limit the embodiments. Other variations or modifications of the various forms may be made in the above description for those skilled in the art. There is no need and no way to exhaust all of the implementations.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the present invention may employ a computer-usable storage medium (including but not limited to disk storage, in one or more of the computer-usable program code embodied therein.
  • the computational instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that instructions stored in the computer readable memory produce an article of manufacture including the instruction device.
  • the instruction means implements the functions specified in one or more blocks of the flow or in a flow or block diagram of the flowchart.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Document Processing Apparatus (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

本发明提供一种选择读取目标文档的编码格式的方法及其系统,首先通过参考编码格式读取参考文档获得乱码模式,然后在对目标文档读取时,对于每种编码格式,将该编码格式读取目标文档时产生的数据与确定的乱码模式进行比较,确定利用该编码格式读取目标文档时产生的乱码;再统计利用每种编码格式读取目标文档时产生的乱码,并进行比较,然后确定读取目标文档的编码格式。上述技术方案有效避免了现有技术中只是读出目标文档的前几个字节,判定这些字节的值,从而得知其编码的格式,但是,有时候,目标文档的前几个字节并没有保留该文档的编码格式信息,无法获得该文档的编码格式的问题。

Description

一种选择读取目标女档的编码格式的方法及其系统
技术领域 本发明涉及一种选择读取目标文档的编码格式的方法及其系统, 属于电数 字数据处理技术领域。 背景技术 编码格式是指用预先规定的方法将文字、 数字或其他对象编成数码。 编码 格式在电子计算机、 电视等相关领域广泛使用。 文件编码格式也称为字符编码 格式, 用于指定在处理文本时如何表示字符。 读取中文文件时, 未正确匹配文 件编码格式的情况可能会导致发生异常或产生不正确的结果。 常见的汉字编码 格式包括 GB2312、 BIG5、 GBK、 UTF-8等, 对于简体汉字的编码格式, 目前 又以 GB2312和 UTF-8最为常用。 在 windows系统中, 文本文档被广泛使用, 开发人员在编写程序读取文档 时经常遇到中文编码格式问题。 例如, 当读取一个文档进行后续处理时, 发现 程序产出的结果与预期不一致, 通过调试 «, 发现根本原因是读 件时, 由于程序中用于读取文件的编码格式与文件本身的编码格式不一致, 导致程序 读取得到的是乱码,从而带来了后续的错误。这种情况普遍存在于开发过程中。 此外, 当需要读取的文档数量很多, 并且这些文件的编码格式可能不一致时, 就更需要能够有一种选择读取目标文档的编码格式的方法来提高开发效率。 现有技术中公开的文本文档的编码格式读取方法, 是读出文本文档的前几 个字节, 判定这些字节的值, 从而得知其编码的格式。 但是, 有时候, 文本文 档的前几个字节并没有保留该文本文档的编码格式信息, 通过这种方法就无法 得到该文本文档的编码格式。 如果能够有一种机制, 通过选择正确的编码格式 来读取文档, 将可以大大降低由于文件编码格式引起的问题, 提高开发效率。 发明内容 本发明所要解决的技术问题是现有技术只是读出所述目标文档的前几个字 节, 判定这些字节的值, 从而得知其编码的格式, 但是, 有时候, 目标文档的 前几个字节并没有保留该文档的编码格式信息, 无法获得该文档的编码格式的 问题。 为解决上述技术问题, 本发明是通过以下技术方案实现的:
一种选择读取目标文档的编码格式的方法, 包括: 通过至少一个参考编码 格式读取参考文档, 确定利用所述参考编码格式读取参考文档时得到的全部或 部分乱码模式; 每次利用一种编码格式读取目标文档; 对于每种编码格式, 将 该编码格式读取所述目标文档时产生的数据与确定的乱码模式进行比较, 确定 利用该编码格式读取所述目标文档时产生的乱码; 统计利用每种编码格式读取 所述目标文档时产生的乱码, 并进行比较, 然后确定读取所述目标文档的编码 格式。 可选地,所述参考编码格式属于包含了全部或部分编码格式的编码格式集,
Figure imgf000004_0001
格式。 可选地, 通过所有的参考编码格式读取参考文档, 确定利用所述参考编码 格式读取参考文档时得到的全部或部分乱码模式。
可选地, 所述确定利用所述参考编码格式读取参考文档时得到的全部或部 码模式的过程如下: 对于使用参考编码格式读取参考文档时获得的乱码字 符串, 删 码字符串中的非有效判断字符, 获^ 效判断字符; 统计有效判 断字符中乱码字符的出现次数, 获取乱码模式。 可选地, 所述非有效判断字符指英文字母、 数字和空白字符; 所述有效判 断字符指除所述非有效判断字符以外的所有字符。
可选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 预 先设定次数的阈值, 对于出现次数大于所述阈值的所有乱码字符, 保存为乱码 模式。
可选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 按 乱码字符出现次数倒序排列乱码字符; 取得排列在前的部分乱码字符, 并将所 取的乱码字符^ 为乱码模式。 可选地, 取得排列在前 k%的乱码字符, 并将所取的乱码字符保存为乱码 模式, 其中 k为正数, 50≤k≤100。 可选地, 所述每次利用一种编码格式读取目标文档时读取部分内容, 直到 获得预先设置的有效判断字符数为止; 若读取所述文档的所有内容后仍未获得 预先设置的有效判断字符数, 则按实际获取的有效判断字符数为准。 有效判断字符数为 50-1000。 可选地, 将该编码格式读取所述目标文档时产生的数据与确定的乱码模式 进行比较, 确定利用该编码格式读取所述目标文档时产生的乱码的过程为: 将 通过每个编码格式读取所述目标文档时产生的数据逐个与所述乱码模式中的乱 码字符逐个比较, 如果乱码字符包含此数据, 则判定此数据为乱码, 否则, 则 不认为该数据为^ ^码。 可选地, 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行 比较, 然后确定读取所述目标文档的编码格式的过程为: 统计利用每种编码格 式读取所述目标文档时产生的乱码比例, 选择乱码比例最低的编码格式作为读 取所述目标文档的编码格式; 或统计利用每种编码格式读取所述目标文档时产 生的乱码比例, 选择乱码比例低于预设阈值的编码格式作为读取所述目标文档 的编码格式。 可选地, 所述乱码比例为所述乱码字符占有效判断字符的比例。 可选地, 在每次利用一种编码格式读取目标文档时, 所述编码格式属于所 述编码格式集。 一种选 ^取目标文档的编码格式的系统, 包括: 乱码模式生成模块, 用 于通过至少一个参考编码格式读取参考文档, 确定利用所述参考编码格式读取 参考文档时得到的全部或部分乱码模式; 目标文档读取模块, 用于每次利用一 种编码格式读取目标文档; 读取乱码模块, 用于对于每种编码格式, 将该编码 格式读取所述目标文档时产生的数据与确定的乱码模式进行比较, 确定利用该 编码格式读取所述目标文档时产生的乱码; 读取编码格式选择模块, 用于统计 利用每种编码格式读取所述目标文档时产生的乱码, 并进行比较, 然后确定读 取所述目标文档的编码格式。 可选地,所述参考编码格式属于包含了全部或部分编码格式的编码格式集,
Figure imgf000006_0001
格式。 可选地, 通过所有的参考编码格式读取参考文档, 确定利用所述参考编码 格式读取参考文档时得到的全部或部分乱码模式。
可选地, 所述确定利用所述参考编码格式读取参考文档时得到的全部或部 码模式的过程如下: 对于使用参考编码格式读取参考文档时获得的乱码字 符串, 删 I^L码字符串中的非有效判断字符, 获^ 效判断字符; 统计有效判 断字符中乱码字符的出现次数, 获取乱码模式。 可选地, 所述非有效判断字符指英文字母、 数字和空白字符; 所述有效判 断字符指除所述非有效判断字符以外的所有字符。 可选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 预 先设定次数的阈值, 对于出现次数大于所述阈值的所有乱码字符, 保存为乱码 模式。
可选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 按 乱码字符出现次数倒序排列乱码字符; 取得排列在前的部分乱码字符, 并将所 取的乱码字符^ 为乱码模式。 可选地, 取得排列在前 k%的乱码字符, 并将所取的乱码字符保存为乱码 模式, 其中 k为正数, 50≤k≤100。 可选地, 所述每次利用一种编码格式读取目标文档时读取部分内容, 直到 获得预先设置的有效判断字符数为止; 若读取所述文档的所有内容后仍未获得 预先设置的有效判断字符数, 则按实际获取的有效判断字符数为准。 有效判断字符数为 50-1000。
可选地, 将该编码格式读取所述目标文档时产生的数据与确定的乱码模式 进行比较, 确定利用该编码格式读取所述目标文档时产生的乱码的过程为: 将 通过每个编码格式读取所述目标文档时产生的数据逐个与所述乱码模式中的乱 码字符逐个比较, 如果乱码字符包含此数据, 则判定此数据为乱码, 否则, 则 不认为该数据为^ ^码。 可选地, 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行 比较, 然后确定读取所述目标文档的编码格式的过程为: 统计利用每种编码格 式读取所述目标文档时产生的乱码比例, 选择乱码比例最低的编码格式作为读 取所述目标文档的编码格式; 或, 统计利用每种编码格式读取所述目标文档时 产生的乱码比例, 选择乱码比例低于预设阈值的编码格式作为读取所述目标文 档的编码格式。 可选地, 所述乱码比例为所述乱码字符占有效判断字符的比例。 可选地, 在每次利用一种编码格式读取目标文档时, 所述编码格式属于所 述编码格式集。
一种或多种具有计算机可执行指令的计算机可读介廣, 所述指令在由计算 机执行时, 执行选择读取目标文档的编码格式的方法, 该方法包括: 通过至少 一个参考编码格式读取参考文档, 确定利用所述参考编码格式读取参考文档时 得到的全部或部分乱码模式; 每次利用一种编码格式读取目标文档; 对于每种 编码格式, 将该编码格式读取所述目标文档时产生的数据与确定的乱码模式进 行比较, 确定利用该编码格式读取所述目标文档时产生的乱码; 统计利用每种 编码格式读取所述目标文档时产生的乱码, 并进行比较, 然后确定读取所述目 标文档的编码格式。 开的上述技术方案相比现有技术具有以下一个或者多个优点:
( 1 ) 开所述的选 ^取目标文档的编码格式的方法及其系统, 首先通 过参考编码格式读取参考文档获得乱码模式, 然后在对目标文档读取时, 对于 每种编码格式, 将该编码格式读取所述目标文档时产生的数据与确定的乱码模 式进行比较, 确定利用该编码格式读取所述目标文档时产生的乱码; 再统计利 用每种编码格式读取所述目标文档时产生的乱码, 将乱码比例最小的或乱码比 现有技术中只是读出所述目标文档的前几个字节, 判定这些字节的值, 从而得 知其编码的格式, 但是, 有时候, 目标文档的前几个字节并没有保留该文档的 编码格式信息, 无法获得该文档的编码格式的问题。
( 2 )本公开所述的选择读取目标文档的编码格式的方法, 所述获取乱码模 式的过程中, 对于使用参考编码格式读取参考文档时获得的乱码字符串, 删除 了乱码字符串中的非有效判断字符, 使处理的字符数更少, 进一步提高了处理 速度, 同也提高了获取乱码的准确率。
( 3 )本公开所述的选择读取目标文档的编码格式的方法, 按一定的比例取 乱码字符出现次数较高的乱码字符作为乱码模式, 过滤了一些非常见的乱码字 符, 提高了后续选择读取目标文档的编码格式的效率。
( 4 )本公开所述的选择读取目标文档的编码格式的方法, 是依据乱码比例 最小的方法选择读取目标文档的编码格式, 构思巧妙, 方法简单, 易于实现。
( 5 )本公开所述的选择读取目标文档的编码格式的方法,根据乱码比例小 于预设阈值时就将该编码格式作为读取文档的编码格式, 避免了利用所有的编 码格式进行读取目标文档后才选择时需要较长的处理时间, 进一步提高了选择 读取目标文档的编码的效率。
( 6 )本公开所述的选择读取目标文档的编码格式的方法,每次利用一种编 码格式读取目标文档时读取部分内容, 获得预先设置的有效判断字符数为止, 使选取的所述有效判断字符既不失代表性又进一步提高了选择读取目标文档的 编码的效率。
( 7 ) 开所述的选 ^取目标文档的编码格式的系统, 利用 开的选 ^取目标文档的编码格式的方法, 有效避免了现有技术中只是读出所述目标 文档的前几个字节, 判定这些字节的值, 从而得知其编码的格式, 但是, 有时 候, 目标文档的前几个字节并没有保留该文档的编码格式信息, 无法获得该文 档的编码格式的问题。 附图说明 为了使本发明的内容更容易被清楚的理解, 下面结合附图,对本发明作进 一步详细的说明, 其中, 图 1是本发明选择读取目标文档的编码格式的方法一个实施例的流程图; 图 2是本发明选择读取目标文档的编码格式的系统一个实施例的结构图。 具体实施方式 实施例一 本实施例提供一种选 ^取目标文档的编码格式的方法, 其¾½图如图 1 所示, 步骤包括:
Sl、 通过至少一个参考编码格式读取参考文档, 确定利用参考编码格式读 取参考文档时得到的全部或部分乱码模式。 本实施例中文档为文本文档。 参考 编码格式属于包含了全部编码格式的编码格式集。 一个实施例中, 确定利用参考编码格式读取参考文档时得到的全部或部分 乱码模式的过程如下: 对于使用参考编码格式读取参考文档时获得的乱码字符 串, 删除乱码字符串中的非有效判断字符, 获^ 效判断字符; 统计有效判断 字符中乱码字符的出现次数, 获取乱码模式。 其中, 非有效判断字符指英文字 母、 数字和空白字符; 有效判断字符指除非有效判断字符以外的所有字符。 本实施例获取乱码模式的过程中, 对于使用参考编码格式读取参考文档时 获得的乱码字符串, 删除了乱码字符串中的非有效判断字符, 使处理的字符数 更少, 进一步提高了处理速 JL, 同也提高了获取乱码的准确率。 优选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 预 先设定次数的阈值,对于出现次数大于阈值的所有乱码字符, 为乱码模式。 本实施例按一定的比例取乱码字符出现次数较高的乱码字符作为乱码模式, 过滤了一些非常见的乱码字符, 提高了后续选择读取目标文档的编码格式的效 率。
优选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 按 乱码字符出现次数倒序排列乱码字符; 取得排列在前的部分乱码字符, 并将所 取的乱码字符保存为乱码模式。 取得排列在前 k%的乱码字符, 并将所取的乱 码字符保存为乱码模式, 其中 k为正数, 50≤k≤100。 在本实施例中, 在本实施 例中, 取得前 80%的乱码字符, 这些乱码字符就是需要获取的乱码模式。 作为可替换的实施例, 取得前 k%的乱码字符, 并将所取的乱码字符保存 为乱码模式。 其中 k为正数, k的取值范围为 60≤k≤90。 k可以选择 60、 70、 75、 90等不同的值, 根据用户的需求选择不同的值。
S2、 每次利用一种编码格式读取目标文档时读取部分内容, 直到获得预先 设置的有效判断字符数为止。 编码格式属于编码格式集, 也就是说属于之前的
Figure imgf000010_0001
这样参考编码格式和选择读取目标文档的编 码格式属于相同的集合, 对于已经建立过^^码模式的编码格式, 再次进行选择 读取时, 乱码模式对产生的乱码的识别率高。 若读取该目标文档的所有内容后 仍未获得预先设置的有效判断字符数, 则按实际获取的有效判断字符数为准。 有效判断字符数为 50-1000。 优选地, 有效判断字符数取 100。 在其他实施例中 有效判断字符数可以取 70、 150、 200、 300、 500、 700、 1000等不同的值, 根 据用户的需求来选择不同的值。 本实施例的选择读取目标文档的编码格式的方法, 在读取目标文档时只读 取目标文档的部分内容, 获得预先设置的有效判断字符数为止, 使选取的有效 判断字符既不失代表性又进一步提高了选择读取目标文档的编码的效率。
S3、 对于每种编码格式, 将该编码格式读取目标文档时产生的数据与确定 的乱码模式进行比较, 确定利用该编码格式读取目标文档时产生的乱码。 一个实施例中, 具体过程为: 将通过每个编码格式读取目标文档时产生的 数据逐个与乱码模式中的乱码字符比较, 如果乱码字符包含此数据, 则判定此 数据为乱码, 否则, 则不认为该数据为^ ^码。
S4、 统计利用每种编码格式读取目标文档时产生的乱码, 并进行比较, 然 后确定读取目标文档的编码格式。
一个实施例中, 具体过程为: 统计利用每种编码格式读取目标文档时产生 的乱码比例, 选择乱码比例最低的编码格式作为读取目标文档的编码格式。 其 中, 乱码比例为乱码字符占所读取的有效判断字符的比例。 本实施例的选择读取目标文档的编码格式的方法, 是依据乱码比例最小的 方法选择读取目标文档的编码格式, 构思巧妙, 方法简单, 易于实现。 优选地, 统计利用每种编码格式读取目标文档时产生的乱码比例, 选择乱 码比例低于预设阈值的编码格式作为读取目标文档的编码格式。 本实施例的选择读取目标文档的编码格式的方法, 根据乱码比例小于预设 阈值时就将该编码格式作为读取文档的编码格式, 避免了利用所有的编码格式 进 ^取目标文档后才选择时需要较长的处理时间, 进一步提高了选 ^取目 标文档的编码的效率。 本实施例的选择读取目标文档的编码格式的方法及其系统, 首先通过参考 编码格式读取文档获得乱码模式, 然后在对目标文档读取时, 对于每种编码格 式, 将该编码格式读取目标文档时产生的数据与确定的乱码模式进行比较, 确 定利用该编码格式读取目标文档时产生的乱码; 再统计利用每种编码格式读取 目标文档时产生的乱码, 将乱码比例最小的或乱码比例低于预设阈值的编码格 式确定为读取目标文档的编码格式。 有效避免了现有技术中只是读出目标文档 的前几个字节, 判定这些字节的值, 从而得知其编码的格式, 但是, 有时候, 目标文档的前几个字节并没有保留该文档的编码格式信息, 无法获得该文档的 编码格式的问题。 实施例二 第一、 收集 500个参考文档。 通过至少一个参考编码格式读取参考文档, 确定利用参考编码格式读取参考文档时得到的全部或部分乱码模式。 取上述参考文档中的一个文档使用 UTF-8编码格式读取该文档, 例如原文 本"中秋节, 我们公司给我发了一千五百元过节费, 大家都很 happy! ,,, J^ 文档的编码格式为 UTF-8,使用 GB2312编码读取,得到"锘夸腑绉令令锛令令
令", 删除非有效判断字符 "yhappy",剩余的字符都为有效判定字符, "锘夸腑绉 锛令,,, 再判断是否是乱码, 进行计算。 取上述参考文档中的一个文档使用 GB2312编码格式读取该文档, 例如原 L ^"我的体重很重, 75千克, 我老婆的体重很轻, 才 38千克。 ", 文本文档的 编 码 格 式 为 GB2312 , 使 用 UTF-8 编 码 读 取 , 得 到 "令 η令令令令 ^令令 i令 75 令 X令令令令令令 令令令令 ^令令 E1令令 38 令1
,,, 删除非有效判断字符 "7538",剩余的字符都为有效判定字符, "令 η令令令令 ^令令 i令 令令令令令令 令令令令 ^令令 IE令令 令| 令,,, 再 判断是否是乱码, ¾ 十算。 对 500个参考文档逐个分别使用 UTF-8和 GB2312编码格式读取, 统计有 效判断字符中乱码字符的出现次数,取得前 80%的乱码字符为 "锛涓銪紝鐄瑰杆 浜鏈", 将这些乱码字符^ 为乱码模式。 第二、取编码格式 UTF-8,使用编码格式 UTF-8读取目标文档的部分内容, 当读取到第 112个字符时, 共获取 100个有效判断字符。 然后再使用编码格式 GB2312读取目标文档, 获取 100个有效判断字符。 第三、 分别对于编码格式 UTF-8和编码格式 GB2312, 将该编码格式读取 目标文档时产生的数据与确定的乱码模式中的乱码字符进行比较, 确定利用该 编码格式读取目标文档时产生的乱码字符。 第四、 使用编码格式 UTF-8读取目标文档获取的数据, 根据乱码模式统计 100个有效判定字符中乱码字符的个数为 86, 计算得到乱码字符的比例 86%。 使用编码格式 GB2312读取目标文档获取的数据,计算得到乱码字符的比例 0%。 则将乱码比例最小的编码格式 GB2312作为读取目标文档的编码格式。 实施例三 本实施例提供一种选择中文文本文档读取编码格式方法, 包含两个阶段, 第一个阶段是通过统计得到乱码模式的过程, 第二个阶段是选择目标文档的读 取编码格式的½。 本实施例中, 非有效判断字符指英文字母(包含大小写)、数字和空白字符 (包括空格、制表符、换行符等);有效判断字符指非英文字母(包含大小写 )、 数字和空白字符(包括空格、 制表符、换行符等)。 本实施例从编码格式集中选 择一种文件编码格式作为参考编码格式, 编码格式集 C = {Cl ,c2 , 其中 C,是 一种中文文本文档的编码格式, 作为参考编码格式去读取参考文档。 第一个阶段, 通过统计得到乱码模式的过程。 第一步,收集中文训练语料,将中文训练语料库 = {«,", 作为参考文 档集, 其中 是一个中文文本文档, 即本实施例中的一个参考文档。 文件 的 编码格式表示为 /( ), 读取文件 时会产出乱码的编码格式作为参 考编码格式, 参考编码格式的集合表示为 C:, 可知 、, 即当使用 中 的编码格式读取文件 时会产生^ ^码。 第二步, 取得一个参考文档 , 分别使用 C;中的不同参考编码格式读取文 件, 得到多 NL码字符串。 第三步, 删^ L码字符串中的非有效判断字符。 第四步, 统计乱码字符串中各乱码字符出现的次数。 第五步,对于每一个参考文档 重复第二到第四步, 统计各乱码字符 出现次数。 第六步, 按乱码字符出现次数倒序排列乱码字符。 第七步,取得前 m%的乱码字符,这些乱码字符就是需要获取的乱码模式, 该乱码模式包含了编码格式集 C = {Cl , c2 ,… , C }下的常见 ^^码特征。 m的取值大于 等于 50且小于 100, m取值在 60和 90之间。 第二个阶段, 选择目标文档的读取编码格式的过程。 此处的目标文档也为 中文文本文档。 本阶段有两种实现方式。 实现方式一如下: 第一步,从编码格式集 C中取得一种编码格式 c,,使用编码格式 c,读取目标 文档的部分内容, 获得前 n个有效判断字符。 若完成整个文件的读取时, 获取 的有效判断字符数仍小于 n, 则以实际获取的字符数为准。 假设该阶段最终获 得了 m个有效判断字符。 n的取值大于等于 10, 取值区间 [50,1000】。 第二步,根据乱码模式统计 m个有效判定字符中乱码字符的个数 m,,计算 得到乱码比例 m,/m。 将编码格式 c,及乱码比例 m,/m加入列表 统计乱码字 符的一种方法为: m,置零, 依次读取 m个字符中的每一个字符, 如果该字符属 于乱码模式,则 m,加一; 当遍历 m个字符后, m,中 的值就是乱码字符数。 第三步, 对于编码格式集 C中的其他编码格式, 重复第一步到第二步。 第四步, 返回列表 L中选 码比例最小的编码格式作为读取目标文档的 编码格式。 作为可以替换的另外一种实施方式, 第二个阶段也可如下进行: 第一步,从编码格式集 C中取得一种编码格式 c,,使用编码格式 c,读取目标 文档的部分内容, 获取前 n个有效判断字符。 若完成整个文件的读取时, 获取 的有效判断字符数仍小于 n, 则以实际获取的字符数为准。 假设该阶段最终获 得了 m个有效判断字符。 n的取值大于等于 10, 取值区间为 [50,1000】。 第二步,根据乱码模式统计 m个有效判定字符中乱码字符的个数 m,,计算 得到乱码字符的比例 m,/m。统计乱码字符的一种方法为: m,置零,依次读取 m 个字符中的每一个字符,如果该字符属于乱码模式,则 m,加一; 当遍历 m个字 符后, m,中 的值就是乱码字符数。 第三步, 如果乱码比例 m,/m大于等于阈值 , 则重复第一步和第二步。 如 果乱码比例小于阈值 , 则返回编码格式 c,。 阈值 取值大于等于 1%, 阈值 取 值在 5%到 50%之间, 本实施例中取 15%。 本实施例是通过统计得到乱码模式, 根据乱码模式自动选择目标文档(为 中文文本文档)的读取编码格式。 实施例四 本实施例提供一种选择读取目标文档的编码格式的方法, 包括第一阶段和 第二阶段, 具体如下: 第一个阶段,通过统计得到乱码模式。关注的编码集合是 { UTF-8,GB2312}。 第一步,收集 1000个中文文本文档作为参考文档,将其作为中文训练语料, 其中 500个文件是 UTF-8编码, 另 500个文件是 GB2312编码。 本实施例中文 本文档指后缀为. txt的格式的文本文档。 第二步, 从中取得一个 UTF-8编码的文件, 使用 GB2312编码读取文档, 得到乱码字符串。 第三步, 删^ L码字符串中的非有效判断字符。 第四步, 统计乱码字符串中各乱码字符出现的次数。 第五步, 对于每一个参考文档, 重复第二到第四步, 统计各乱码字符出现 次数。 第六步, 按乱码字符出现次数倒序排列乱码字符。 第七步,取得前 80%的乱码字符,这些乱码字符就是需要获取的乱码模式, 该乱码模式包含了关注的编码集合 {UTF-8, GB2312}下的常见乱码特征。得到的 乱码模式为 [令锛涓銪紝鐄瑰浜鏈鎿】。 第二个阶段, 选择目标文档的读取编码。 第一步,从关注的编码集合 {UTF-8,GB2312}中取得一种编码 UTF-8,使用 编码 UTF-8读取目标文档的前 100个有效判断字符。 第二步, 根据乱码模式统计 100个有效判定字符中乱码字符的个数为 86, 计^ 到乱码字符的比例 86%。 在列表 L中加入条目(UTF-8, 86%). 第三步, 对于编码 GB2312, 重复第一步和第二步。 在列表 L中加入条目 (GB2312,0%) 第四步, 返回列表 L中选择乱码比例最小的编码, 即 GB2312作为读取目 标文档的编码格式。 可以看出, 通过编码 GB2312来读取目标文档最可能正确 地读取该文档的内容。 作为可替换的实施方式, 第二个阶段还可以通过以下方式来实现, 具体包 括: 第一步,从关注的编码集合 {UTF-8,GB2312}中取得一种编码 UTF-8,使用 编码 UTF-8读取目标文档的前 100个有效判断字符。 第二步, 根据乱码模式统计 100个有效判定字符中乱码字符的个数为 86, 计算得到乱码字符的比例 86%。 第三步, 阈值 设置为 15%, 因为乱码比例 86%大于阈值 所以使用编 码 GB2312重复第一步和第二步。 得到乱码字符的比例 0%, 小于阈值 则返 回编码 GB2312, 将 GB2312作为读取目标文档的编码格式。 实施例五 图 2是本发明选择读取目标文档的编码格式的系统一个实施例的结构图, 本实施例提供一种选 ^取目标文档的编码格式的系统, 包括: L码模式生成模块 21, 用于通过至少一个参考编码格式读取参考文档, 确 定利用参考编码格式读取参考文档时得到的全部或部分乱码模式。 参考编码格 式属于包含了全部或部分编码格式的编码格式集, 且参考编码格式是该编码格 式集中读取参考文档时会产生乱码的编码格式。 确定利用参考编码格式读取参考文档时得到的全部或部分乱码模式的过程 如下: 对于使用参考编码格式读取参考文档时获得的乱码字符串, 删 I^L码字 符串中的非有效判断字符, 获取有效判断字符; 统计有效判断字符中乱码字符 的出现次数, 获取乱码模式。 其中, 非有效判断字符指英文字母、 数字和空白 字符; 有效判断字符指除非有效判断字符以外的所有字符。 本实施例获取乱码模式的过程中, 对于使用参考编码格式读取参考文档时 获得的乱码字符串, 删除了乱码字符串中的非有效判断字符, 使处理的字符数 更少, 进一步提高了处理速 JL, 同也提高了获取乱码的准确率。 优选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 预 先设定次数的阈值,对于出现次数大于阈值的所有乱码字符, 为乱码模式。 本实施例按一定的比例取乱码字符出现次数较高的乱码字符作为乱码模式, 过滤了一些非常见的乱码字符, 为后续选择读取目标文档的编码格式的准确性 提供了很好的依据。 优选地, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 按 乱码字符出现次数倒序排列乱码字符; 取得排列在前的部分乱码字符, 并将所 取的乱码字符保存为乱码模式。 取得排列在前 k%的乱码字符, 并将所取的乱 码字符保存为乱码模式, 其中 k为正数, 50≤k≤100。 在本实施例中, 在本实施 例中, 取得前 80%的乱码字符, 这些乱码字符就是需要获取的乱码模式。 在其他实施例中, 取得前 k%的乱码字符, 并将所取的乱码字符保存为乱 码模式。 其中 k为正数, k的取值范围为 60≤k≤90。 k可以选择 60、 70、 75、 90等不同的值, 根据用户的需求选择不同的值。 目标文档读取模块 22, 用于每次利用一种编码格式读取目标文档。 该模块 以获得预先设置的有效判断字符数为止, 编码格式属于参考编码格式所属的编 码格式集。若读取所有文档的所有内容后仍未获得预先设置的有效判断字符数, 则按实际获取的有效判断字符数为准。有效判断字符数为 50-1000。优选地,有 效判断字符数取 100。 在其他实施例中有效判断字符数可以取 70、 150、 200、 300、 500、 700、 1000等不同的值, 根据用户的需求来选择不同的值。 读取 L码模块 23, 用于对于每种编码格式, 将该编码格式读取目标文档时 产生的数据与确定的乱码模式进行比较, 确定利用该编码格式读取目标文档时 产生的乱码。 具体过程为: 将通过每个编码格式读取目标文档时产生的数据逐个与乱码 模式中的乱码字符比较, 如果乱码字符包含此数据, 则判定此数据为乱码, 否 则, 则不认为该数据为^ ^码。 优选地, 对于使用编码格式读取目标文档时获得的乱码字符串, 删 I^L码 字符串中的非有效判断字符, 获^ T效判断字符; 统计有效判断字符中乱码字 符的出现次数, 获取乱码模式。
24, 用于统计利用每种编码格式读取目标文档时产 生的乱码, 并进行比较, 然后确定读取目标文档的编码格式。 具体过程为: 统计利用每种编码格式读取目标文档时产生的乱码比例, 选 码比例最低的编码格式作为读取目标文档的编码格式。 优选地, 统计利用每种编码格式读取目标文档时产生的乱码比例, 选择乱 码比例低于预设阈值的编码格式作为读取目标文档的编码格式。 其中乱码比例 为乱码字符占所读取的有效判断字符的比例。 本实施例的选 ^取目标文档的编码格式的系统, 利用本发明的选 ^取 目标文档的编码格式的方法, 有效避免了现有技术中只是读出目标文档的前几 个字节, 判定这些字节的值, 从而得知其编码的格式, 但是, 有时候, 目标文 档的前几个字节并没有保留该文档的编码格式信息, 无法获得该文档的编码格 式的问题。 显然, 上述实施例仅仅是为清楚地说明所作的举例, 而并非对实施方式的 限定。 对于所属领域的普通技术人员来说, 在上述说明的 上还可以做出其 它不同形式的变化或变动。 这里无需也无法对所有的实施方式予以穷举。 而由 本领域内的技术人员应明白, 本发明的实施例可提供为方法、 系统、 或计 算机程序产品。 因此, 本发明可采用完全硬件实施例、 完全软件实施例、 或结 合软件和硬件方面的实施例的形式。 而且, 本发明可采用在一个或多个其中包 含有计算机可用程序代码的计算机可用存储介廣 (包括但不限于磁盘存储器、
CD-ROM, 光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、 i殳备(系统)、和计算机程序产品 的流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流程图和 / 或方框图中的每一流程和 /或方框、 以及流程图和 /或方框图中的流程和 /或 方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入式 处理机或其他可编程数据处理设备的处理器以产生一个机器, 使得通过计算机 或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流 程或多个流程和 /或方框图一个方框或多个方框中指定的功能的装置。
这些计算^^序指令也可存储在能引导计算机或其他可编程数据处理设备 以特定方式工作的计算机可读存储器中, 使得存储在该计算机可读存储器中的 指令产生包括指令装置的制造品, 该指令装置实现在流程图一个流程或多个流 程和 /或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上, 使 得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理, 从而在计算机或其他可编程设备上执行的指令提供用于实现在¾½图一个¾½ 或多个流程和 /或方框图一个方框或多个方框中指定的功能的步骤。 尽管已描述了本发明的优选实施例, 但 ^域内的技术人员一旦得知了基 本创造性概念, 则可对这些实施例作出另外的变更和修改。 所以, 所附权利要 求意欲解释为包括优选实施例以及落 发明范围的所有变更和修改。

Claims

权 利 要 求
1. 一种选择读取目标文档的编码格式的方法, 其特征在于, 包括: 通过至少一个参考编码格式读取参考文档, 确定利用所述参考编码格式读 取参考文档时得到的 或部^ L码模式; 每次利用一种编码格式读取目标文档; 对于每种编码格式, 将该编码格式读取所述目标文档时产生的数据与确定 的乱码模式进行比较, 确定利用该编码格式读取所述目标文档时产生的乱码; 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行比较, 然 后确定读取所述目标文档的编码格式。
2. 根据权利要求 1所述的选择读取目标文档的编码格式的方法, 其特征在 于, 所述参考编码格式属于包含了全部或部分编码格式的编码格式集, 且所述 参考编码格式是该编码格式集中读取所述参考文档时会产生乱码的编码格式。
3. 根据权利要求 1或 2所述的选择读取目标文档的编码格式的方法, 其特 征在于, 通过所有的参考编码格式读取参考文档, 确定利用所述参考编码格式 读取参考文档时得到的全部或部分乱码模式。
4.根据权利要求 1-3中任一所述的选 ^取目标文档的编码格式的方法, 其特征在于, 所述确定利用所述参考编码格式读取参考文档时得到的全部或部 码模式的½如下: 对于使用参考编码格式读取参考文档时获得的乱码字符串, 删 I^L码字符 串中的非有效判断字符, 获^ T效判断字符; 统计有效判断字符中乱码字符的 出现次数, 获取乱码模式。
5.根据权利要求 4所述的选 ^取目标文档的编码格式的方法, 其特 ^ 于, 所述非有效判断字符指英文字母、数字和空白字符; 所述有效判断字符指 除所述非有效判断字符以外的所有字符。
6.根据权利要求 4所述的选 ^取目标文档的编码格式的方法, 其特 ^ 于, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 预先设定次 数的阈值, 对于出现次数大于所述阈值的所有乱码字符, 保存为乱码模式。
7.根据权利要求 4所述的选择读取目标文档的编码格式的方法, 其特征在 于, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 按乱码字符 出现次数倒序排列乱码字符; 取得排列在前的部分乱码字符, 并将所取的乱码 字符^ 为^码模式。
8.根据权利要求 7所述的选择读取目标文档的编码格式的方法, 其特征在 于, 取得排列在前 k%的乱码字符, 并将所取的乱码字符保存为乱码模式, 其 中 k为正数, 50≤k≤100。
9.根据权利要求 1-8中任一所述的选 ^取目标文档的编码格式的方法, 其特征在于, 所述每次利用一种编码格式读取目标文档时读取部分内容, 直到 获得预先设置的有效判断字符数为止; 若读取所述文档的所有内容后仍未获得 预先设置的有效判断字符数, 则按实际获取的有效判断字符数为准。
10.根据权利要求 9所述的选 ^取目标文档的编码格式的方法,其特 于, 有效判断字符数为 50-1000。
11.根据权利要求 1-10中任一所述的选 ^取目标文档的编码格式的方法, 其特征在于, 将该编码格式读取所述目标文档时产生的数据与确定的乱码模式 进行比较, 确定利用该编码格式读取所述目标文档时产生的乱码的过程为: 将通过每个编码格式读取所述目标文档时产生的数据逐个与所述 L码模式 中的乱码字符比较, 如果乱码字符包含此数据, 则判定此数据为乱码, 否则, 则不认为该数据为乱码。
12.根据权利要求 1-11中任一所述的选 ^取目标文档的编码格式的方法, 其特征在于, 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行 比较, 然后确定读取所述目标文档的编码格式的过程为: 统计利用每种编码格式读取所述目标文档时产生的乱码比例, 选择乱码比 例最低的编码格式作为读取所述目标文档的编码格式。
13.根据权利要求 1-11中任一所述的选 ^取目标文档的编码格式的方法, 其特征在于, 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行 比较, 然后确定读取所述目标文档的编码格式的过程为: 统计利用每种编码格式读取所述目标文档时产生的乱码比例, 选择乱码比 例低于预设阈值的编码格式作为读取所述目标文档的编码格式。
14.根据权利要求 12-13 中任一所述的选 ^取目标文档的编码格式的方 法, 其特征在于: 所述乱码比例为所述乱码字符占有效判断字符的比例。
15.根据权利要求 1-14中任一所述的选 ^取目标文档的编码格式的方法, 其特征在于: 在每次利用一种编码格式读取目标文档时, 所述编码格式属于所 述编码格式集。
16. 一种选 ^取目标文档的编码格式的系统, 其特征在于, 包括: L码模式生成模块, 用于通过至少一个参考编码格式读取参考文档, 确定 利用所述参考编码格式读取参考文档时得到的全部或部分乱码模式; 目标文档读取模块, 用于每次利用一种编码格式读取目标文档; 读取乱码模块, 用于对于每种编码格式, 将该编码格式读取所述目标文档 时产生的数据与确定的乱码模式进行比较, 确定利用该编码格式读取所述目标 文档时产生的乱码; 读取编码格式选择模块, 用于统计利用每种编码格式读取所述目标文档时 产生的乱码, 并进行比较, 然后确定读取所述目标文档的编码格式。
17. 根据权利要求 16所述的选 ^取目标文档的编码格式的系统, 其特征 在于, 所述参考编码格式属于包含了全部或部分编码格式的编码格式集, 且所
Figure imgf000022_0001
18. 根据权利要求 16或 17所述的选 ^取目标文档的编码格式的系统, 其特征在于, 通过所有的参考编码格式读取参考文档, 确定利用所述参考编码 格式读取参考文档时得到的全部或部^ L码模式。
19.根据权利要求 16-18 中任一所述的选 ^取目标文档的编码格式的系 统, 其特征在于, 所述确定利用所述参考编码格式读取参考文档时得到的全部 或部^ L码模式的½如下: 对于使用参考编码格式读取参考文档时获得的乱码字符串, 删 I^L码字符 串中的非有效判断字符, 获^ 效判断字符; 统计有效判断字符中乱码字符的 出现次数, 获取乱码模式。
20.根据权利要求 19所述的选 ^取目标文档的编码格式的系统, 其特征 在于, 所述非有效判断字符指英文字母、数字和空白字符; 所述有效判断字符 指除所述非有效判断字符以外的所有字符。
21.根据权利要求 19所述的选 ^取目标文档的编码格式的系统, 其特征 在于, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 预先设定 次数的阈值, 对于出现次数大于所述阈值的所有乱码字符, 保存为乱码模式。
22.根据权利要求 19所述的选 ^取目标文档的编码格式的系统, 其特征 在于, 统计有效判断字符中乱码字符的出现次数, 获取乱码模式时, 按乱码字 符出现次数倒序排列乱码字符; 取得排列在前的部分乱码字符, 并将所取的乱 码字符保存为乱码模式。
23.根据权利要求 22所述的选 ^取目标文档的编码格式的系统, 其特征 在于, 取得排列在前 k%的乱码字符, 并将所取的乱码字符保存为乱码模式, 其中 k为正数, 50≤k≤100。
24.根据权利要求 16-23 中任一所述的选 ^取目标文档的编码格式的系 统, 其特征在于, 所述每次利用一种编码格式读取目标文档时读取部分内容, 直到获得预先设置的有效判断字符数为止; 若读取所述文档的所有内容后仍未 获得预先设置的有效判断字符数, 则按实际获取的有效判断字符数为准。
25.根据权利要求 24所述的选 ^取目标文档的编码格式的系统, 其特征 在于, 有效判断字符数为 50-1000。
26.根据权利要求 16-25 中任一所述的选 ^取目标文档的编码格式的系 统, 其特征在于, 将该编码格式读取所述目标文档时产生的数据与确定的乱码 模式进行比较,确定利用该编码格式读取所述目标文档时产生的乱码的过程为: 将通过每个编码格式读取所述目标文档时产生的数据逐个与所述 L码模式 中的乱码字符比较, 如果乱码字符包含此数据, 则判定此数据为乱码, 否则, 则不认为该数据为乱码。
27.根据权利要求 16-26中任一所述的选 ^取目标文档的编码格式的系统, 其特征在于, 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行 比较, 然后确定读取所述目标文档的编码格式的过程为: 统计利用每种编码格式读取所述目标文档时产生的乱码比例, 选择乱码比 例最低的编码格式作为读取所述目标文档的编码格式。
28.根据权利要求 16-26中任一所述的选 ^取目标文档的编码格式的系统, 其特征在于, 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行 比较, 然后确定读取所述目标文档的编码格式的过程为: 统计利用每种编码格式读取所述目标文档时产生的乱码比例, 选择乱码比 例低于预设阈值的编码格式作为读取所述目标文档的编码格式。
29.根据权利要求 27-28 中任一所述的选 ^取目标文档的编码格式的系 统, 其特征在于, 所述乱码比例为所述乱码字符占有效判断字符的比例。
30.根据权利要求 16-29 中任一所述的选 ^取目标文档的编码格式的系 统, 其特征在于, 在每次利用一种编码格式读取目标文档时, 所述编码格式属 于所述编码格式集。
31. 一种或多种具有计算机可执行指令的计算机可读介廣, 所述指令在由 计算机执行时, 执行选择读取目标文档的编码格式的方法, 该方法包括: 通过至少一个参考编码格式读取参考文档, 确定利用所述参考编码格式读 取参考文档时得到的 或部^ L码模式; 每次利用一种编码格式读取目标文档; 对于每种编码格式, 将该编码格式读取所述目标文档时产生的数据与确定 的乱码模式进行比较, 确定利用该编码格式读取所述目标文档时产生的乱码; 统计利用每种编码格式读取所述目标文档时产生的乱码, 并进行比较, 然 后确定读取所述目标文档的编码格式。
PCT/CN2013/088745 2013-09-29 2013-12-06 一种选择读取目标文档的编码格式的方法及其系统 WO2015043072A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
US15/025,513 US10366143B2 (en) 2013-09-29 2013-12-06 Method and system for selecting encoding format for reading target document
EP13894578.7A EP3051428B1 (en) 2013-09-29 2013-12-06 Method and system for selecting an encoding format for reading a target document
JP2016517326A JP6280211B2 (ja) 2013-09-29 2013-12-06 ターゲット文書を読取るためのエンコーディングフォーマットを選択する方法及びシステム

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310456276.6A CN104516862B (zh) 2013-09-29 2013-09-29 一种选择读取目标文档的编码格式的方法及其系统
CN201310456276.6 2013-09-29

Publications (1)

Publication Number Publication Date
WO2015043072A1 true WO2015043072A1 (zh) 2015-04-02

Family

ID=52741913

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/088745 WO2015043072A1 (zh) 2013-09-29 2013-12-06 一种选择读取目标文档的编码格式的方法及其系统

Country Status (5)

Country Link
US (1) US10366143B2 (zh)
EP (1) EP3051428B1 (zh)
JP (1) JP6280211B2 (zh)
CN (1) CN104516862B (zh)
WO (1) WO2015043072A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105988977A (zh) * 2015-02-16 2016-10-05 珠海金山办公软件有限公司 一种字符编码识别结果的显示方法和装置
CN105760364B (zh) * 2016-02-22 2018-09-04 深圳市茁壮网络股份有限公司 一种字符集检测方法和装置
CN105847931B (zh) * 2016-03-28 2019-08-27 深圳Tcl新技术有限公司 字幕显示方法及装置
CN106407438A (zh) * 2016-09-28 2017-02-15 珠海迈越信息技术有限公司 一种数据处理方法及系统
CN108108267B (zh) * 2016-11-25 2021-06-22 北京国双科技有限公司 数据的恢复方法和装置
CN108271041B (zh) * 2016-12-30 2021-01-22 北京国双科技有限公司 乱码处理方法和装置
CN112580302B (zh) * 2020-12-11 2023-07-14 海信视像科技股份有限公司 一种字幕校正方法及显示设备
CN114629707B (zh) * 2022-03-16 2024-05-24 深信服科技股份有限公司 一种乱码检测方法、装置及电子设备和存储介质
CN114757145A (zh) * 2022-03-21 2022-07-15 慧之安信息技术股份有限公司 一种判断消息字符集编码的方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350858A (zh) * 2008-09-10 2009-01-21 深圳华为通信技术有限公司 一种短信解码的方法和用户终端
CN101526963A (zh) * 2009-04-17 2009-09-09 深圳华为通信技术有限公司 网页编码识别方法、装置和终端设备
CN102360392A (zh) * 2011-10-24 2012-02-22 青岛海信移动通信技术股份有限公司 一种确定网页编码方式的方法及设备
CN102567293A (zh) * 2010-12-13 2012-07-11 汉王科技股份有限公司 文本文件的编码格式探测方法和装置

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3203544B2 (ja) * 1996-01-31 2001-08-27 日本電信電話株式会社 テキスト最尤復号方法及び最尤復号装置と、データ通信ネットワーク装置
US6049869A (en) * 1997-10-03 2000-04-11 Microsoft Corporation Method and system for detecting and identifying a text or data encoding system
JP2000148754A (ja) * 1998-11-13 2000-05-30 Omron Corp マルチリンガル・システム,マルチリンガル処理方法およびマルチリンガル処理のプログラムを記憶した媒体
US7191114B1 (en) * 1999-08-27 2007-03-13 International Business Machines Corporation System and method for evaluating character sets to determine a best match encoding a message
CA2312540A1 (en) * 2000-06-27 2001-12-27 Neteka Inc. Network address name resolution server
US6701320B1 (en) * 2002-04-24 2004-03-02 Bmc Software, Inc. System and method for determining a character encoding scheme
US7148824B1 (en) * 2005-08-05 2006-12-12 Xerox Corporation Automatic detection of character encoding format using statistical analysis of the text strings
US7711673B1 (en) * 2005-09-28 2010-05-04 Trend Micro Incorporated Automatic charset detection using SIM algorithm with charset grouping
CN101034391A (zh) * 2007-04-26 2007-09-12 北京立通无限科技有限公司 一种确定文本流字符集的方法及装置
CN101055593A (zh) * 2007-06-15 2007-10-17 中国科学院软件研究所 藏文网页及其编码的识别方法
CN101110072A (zh) * 2007-08-21 2008-01-23 无敌科技(西安)有限公司 一种自动辨识文字编码的装置及其方法
JP2010176237A (ja) * 2009-01-28 2010-08-12 Nec Corp 文字コード自動判別システム、文字コード自動判別方法及び文字コード自動判別プログラム

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350858A (zh) * 2008-09-10 2009-01-21 深圳华为通信技术有限公司 一种短信解码的方法和用户终端
CN101526963A (zh) * 2009-04-17 2009-09-09 深圳华为通信技术有限公司 网页编码识别方法、装置和终端设备
CN102567293A (zh) * 2010-12-13 2012-07-11 汉王科技股份有限公司 文本文件的编码格式探测方法和装置
CN102360392A (zh) * 2011-10-24 2012-02-22 青岛海信移动通信技术股份有限公司 一种确定网页编码方式的方法及设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3051428A4 *

Also Published As

Publication number Publication date
JP6280211B2 (ja) 2018-02-14
CN104516862B (zh) 2018-05-01
EP3051428A1 (en) 2016-08-03
JP2016540269A (ja) 2016-12-22
EP3051428B1 (en) 2019-08-14
EP3051428A4 (en) 2017-06-07
US20160239467A1 (en) 2016-08-18
CN104516862A (zh) 2015-04-15
US10366143B2 (en) 2019-07-30

Similar Documents

Publication Publication Date Title
WO2015043072A1 (zh) 一种选择读取目标文档的编码格式的方法及其系统
WO2016180268A1 (zh) 一种文本聚合方法及装置
CN109241274B (zh) 文本聚类方法及装置
CN105912514B (zh) 基于指纹特征的文本复制检测系统及方法
JP6562461B2 (ja) 動的手書き検証、手書きに基づくユーザ認証、手書きデータ生成、及び手書きデータ保存
WO2017084586A1 (zh) 基于深度学习方法推断恶意代码规则的方法、系统及设备
US9852122B2 (en) Method of automated analysis of text documents
WO2017028789A1 (zh) 网络攻击检测方法和设备
CN110222790B (zh) 用户身份识别方法、装置及服务器
WO2022089227A1 (zh) 地址参数处理方法及相关设备
CN103455753B (zh) 一种样本文件分析方法及装置
WO2023039942A1 (zh) 基于文本识别的要素信息提取方法、装置、设备及介质
US11886583B2 (en) Description-entropy-based intelligent detection method for big data mobile software similarity
US20130322759A1 (en) Method and device for identifying font
CN104424435B (zh) 一种获取病毒特征码的方法及装置
Zhang et al. Effective and Fast Near Duplicate Detection via Signature‐Based Compression Metrics
US11997116B2 (en) Detection device and detection method for malicious HTTP request
CN111159996B (zh) 基于文本指纹算法的短文本集合相似度比较方法及系统
CN115618809A (zh) 基于二元字符频次的字符分组方法及安全字库构建方法
JP2015115652A (ja) 情報処理装置、情報処理方法及びプログラム
KR101943065B1 (ko) 전자문서 오류 검출 장치 및 방법
CN107656909B (zh) 一种基于文档混合特征的文档相似度判定方法和装置
CN111104484A (zh) 文本相似度检测方法、装置及电子设备
CN115169291B (zh) 文本转换方法、装置、终端设备和计算机可读存储介质
CN115952411B (zh) 一种前端界面的动态语言反混淆特征提取方法及提取系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13894578

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2016517326

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 15025513

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2013894578

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2013894578

Country of ref document: EP