Garbled code recognition method, device and equipment and storage medium
By obtaining the matching degree between the garbled character sequence and the character set, and using a neural network model to automatically identify and decode the target character set to which the garbled characters belong, the problem of inconvenient user operation and preset errors in garbled character recognition of electronic devices is solved, and efficient garbled character recognition is achieved.
Patent Information
- Application Number
- CN202210275421.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-21
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-03-21
AI Technical Summary
In existing technologies, electronic devices require users to manually select a character set or have preset errors that prevent recognition when identifying garbled characters, resulting in inconvenience for users and low recognition efficiency.
By obtaining the matching degree of garbled character sequences and multiple character sets, a neural network model is used to identify the target character set to which the garbled characters belong, and decoding is performed based on the character set to achieve automatic recognition.
It improves the convenience and accuracy of garbled character recognition, avoids the inconvenience of users manually selecting character sets and recognition failures caused by preset errors, and improves character recognition efficiency.
Smart Images

Figure CN114817656B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electronics, and relates to, but is not limited to, a garbled code recognition method, device, equipment and storage medium. BACKGROUND
[0002] There are two ways for an electronic device to determine a character set of a piece of text, namely manual selection and preset. A user can manually select a character set, which requires the user to try each character set, and is very inconvenient. For garbled code characters displayed by an electronic device with a preset error, the user has no way to modify them, such as some mp3 devices, car stereos and the like. SUMMARY
[0003] In view of this, the embodiments of the present application provide a garbled code recognition method, device, equipment and storage medium.
[0004] In a first aspect, the embodiments of the present application provide a garbled code recognition method, which includes: obtaining a first garbled code character sequence to be recognized and at least one character set; the at least one character set includes a first garbled code character in the first garbled code character sequence; determining a first target character set to which the first garbled code character sequence belongs based on a matching degree between the at least one character set and the first garbled code character sequence; and decoding the first garbled code character sequence based on the first target character set to obtain a recognizable character sequence.
[0005] In a second aspect, the embodiments of the present application provide a garbled code recognition device, which includes: an obtaining module, configured to obtain a first garbled code character sequence to be recognized and at least one character set; the at least one character set includes a first garbled code character in the first garbled code character sequence; a first determining module, configured to determine a first target character set to which the first garbled code character sequence belongs based on a matching degree between the at least one character set and the first garbled code character sequence; and a decoding module, configured to decode the first garbled code character sequence based on the first target character set to obtain a recognizable character sequence.
[0006] In a third aspect, the embodiments of the present application provide an electronic device, which includes a memory and a processor, the memory stores a computer program capable of running on the processor, and the processor implements the steps in the garbled code recognition method of the embodiments of the present application when executing the program.
[0007] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, which stores a computer program, and the computer program implements the steps in the garbled code recognition method of the embodiments of the present application when executed by a processor.
[0008] In this embodiment, the target character set to which the garbled character sequence belongs is determined based on the matching degree between the character set and the garbled character sequence. The garbled character sequence is then decoded based on the target character set to obtain a recognizable character sequence. This allows for a more convenient and intelligent determination of the target character set to which the garbled character sequence belongs, avoiding the inconvenience caused by users manually trying different character sets. It also avoids the problem of characters not being recognizable due to character set preset errors in electronic devices, thus improving character recognition efficiency. Attached Figure Description
[0009] Figure 1 This is a flowchart illustrating a garbled character recognition method according to an embodiment of this application;
[0010] Figure 2 This is a flowchart illustrating another garbled character recognition method according to an embodiment of this application;
[0011] Figure 3 This is a flowchart illustrating another method for identifying garbled characters according to an embodiment of this application;
[0012] Figure 4 This is a flowchart illustrating another method for identifying garbled characters according to an embodiment of this application;
[0013] Figure 5 A flowchart illustrating a garbled character recognition method is also provided as an embodiment of this application.
[0014] Figure 6 A flowchart illustrating a garbled character recognition method is also provided as an embodiment of this application.
[0015] Figure 7 A flowchart illustrating a garbled character recognition method is also provided as an embodiment of this application.
[0016] Figure 8 A flowchart illustrating a garbled character recognition method is also provided as an embodiment of this application.
[0017] Figure 9 This is a schematic diagram of the composition structure of a processing device according to an embodiment of this application;
[0018] Figure 10 This is a schematic diagram of a hardware entity of the electronic device of this application. Detailed Implementation
[0019] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and embodiments.
[0020] Figure 1 This is a flowchart illustrating a garbled character recognition method according to an embodiment of this application, as shown below. Figure 1 As shown, the method includes the following steps:
[0021] Step 102: Obtain a first garbled character sequence to be recognized and at least one character set; the at least one character set includes the first garbled characters in the first garbled character sequence;
[0022] Among them, garbled characters refer to a series of characters where, when an electronic device opens a source file using a text editor, some or all characters in the source file cannot be read due to the use of an inappropriate character set; the garbled image can be an image containing garbled characters, which can be scanned by a camera to display the garbled image, and the garbled characters can be recognized from the garbled image displayed on the electronic device using OCR recognition technology; the obtained garbled characters can be arranged in a column in sequence to generate a garbled character sequence; the garbled character sequence can be "鏄ョ湢涓嶈鏅擄紝澶勫闂诲暭楦熴€", and etc.
[0023] Chinese and other multi-byte represented characters have multiple character sets, such as Simplified Chinese (GB2312), Chinese Internal Code Extension Specification (GBK), Unicode, and Traditional Chinese Big5, Western Europe, Korean, and Japanese; the first garbled characters in the first garbled character sequence can belong to one or more character sets.
[0024] Step 104: Determine the first target character set to which the first garbled character sequence belongs based on the matching degree between at least one of the character sets and the first garbled character sequence;
[0025] [[ID=十七]]In some embodiments, the matching degree can be measured by the number of characters in the character set that are the same as the first garbled characters in the first garbled character sequence. Suppose the first garbled character sequence includes 12 garbled characters, and 12 characters in a certain character set are respectively the same as one garbled character, then the matching degree between the character set and the first garbled character sequence can be 100%. Suppose the first garbled character sequence includes 20 garbled characters, and 1 character in a certain character set is the same as one garbled character, then the matching degree between the character set and the first garbled character sequence can be 5%. The first target character set can be determined according to the high or low matching degree between the character set and the first garbled character sequence.
[0026] In some embodiments, the character sets can also be selected in a preset order, and the characters in the character set are matched with the first garbled characters until all the first garbled characters appear in a certain character set, or a certain first garbled character appears only in one character set, then this character set can be determined as the first target character set to which the first garbled character sequence belongs.
[0027] It should be noted that there is an incorrect Roman numeral "十七" in your original text at line 17 which is likely a mistake. I translated it as it is but it might need to be corrected in the original content.For example, when the first garbled character sequence is "鏄ョ湢涓嶈鏅擄紝澶勫闂诲暭楦熴€", the first garbled character "鏄" can be matched with the characters in the character set. If "鏄" only appears in the character set "GBK", it can be determined that the first target character set to which the first garbled character sequence belongs is "GBK"; if "鏄" appears in multiple first candidate character sets, the first garbled character "ョ" can be matched with the characters in the first candidate character sets. If "ョ" appears in multiple second candidate character sets (the second candidate character sets are subsets of the first candidate character sets), the first garbled character "湢" can be matched with the characters in the second candidate character sets until a first garbled character that only appears in one character set appears, and this character set is determined as the first target character set to which the first garbled character sequence belongs.
[0028] Step 106: Decode the first garbled character sequence based on the first target character set to obtain a recognizable character sequence.
[0029] Among them, recognizable characters are recognizable characters converted from garbled characters. Garbled characters generally do not conform to the syntax structure of the corresponding character set or have semantic errors; recognizable character sequences generally have correct semantics and conform to the syntax structure of the corresponding character set. Assuming that the first target character set is the character set "GBK", the first garbled character sequence "“鏄ョ湢涓嶈鏅擄紝澶勫闂诲暭楦熴€”" can be decoded to obtain the recognizable character sequence "春眠不觉晓,处处闻啼鸟。" corresponding to the first garbled character sequence.
[0030] In the embodiments of the present application, by determining the target character set to which the garbled character sequence belongs based on the matching degree between the character set and the garbled character sequence, and decoding the garbled character sequence based on the target character set to obtain a recognizable character sequence, it is possible to more conveniently and intelligently determine the target character set to which the garbled character sequence belongs, avoiding the inconvenience caused by the user manually trying each character set, and also avoiding the problem that characters cannot be recognized due to incorrect presetting of the character set of the electronic device, thereby improving the character recognition efficiency.
[0031] In some embodiments, as Figure 2 shown, the step 104 "determine the first target character set to which the first garbled character sequence belongs based on the matching degree between at least one of the character sets and the first garbled character sequence" can be implemented by the following steps 141 and 142:
[0032] Step 141: Determine the first reference character set with the highest matching degree with the first garbled character sequence from at least one of the character sets;
[0033] First, determine the number of first garbled characters in the character set. Then, determine the character set that contains the most first garbled characters in the first garbled character sequence as the first reference character set with the highest matching degree with the first garbled character sequence.
[0034] Step 142: Determine the first reference character set as the first target character set to which the first garbled character sequence belongs.
[0035] In this embodiment of the application, by determining the first reference character set with the highest matching degree to the garbled character sequence as the first target character set to which the first garbled character sequence belongs, the character set to which the garbled character sequence belongs can be determined more accurately.
[0036] In some embodiments, such as Figure 3 As shown, the method further includes:
[0037] Step 103: Based on the trained first neural network model and the first garbled character sequence, determine the first target character set to which the first garbled character sequence belongs;
[0038] The trained first neural network model is obtained by training the initial neural network model based on the second garbled character and the second target character set to which the second garbled character belongs; the first target character set and the second target character set are character sets in the at least one character set.
[0039] In one embodiment, a supervised learning algorithm can be used to train an initial neural network model using training samples, which consist of a second garbled character and the expected output (the second target character set to which the second garbled character belongs).
[0040] In this embodiment, the character set to which the garbled character sequence belongs is determined based on a trained neural network model. This makes it easier and more intelligent to determine the target character set to which the garbled character sequence belongs, avoiding the inconvenience caused by users manually trying different character sets. It also avoids the problem of characters not being recognized due to the character set preset error of the electronic device, thus improving the efficiency of character recognition.
[0041] In some embodiments, such as Figure 4 As shown, step 106, "based on the first target character set, decoding the first garbled character sequence to obtain a recognizable character sequence," can be achieved through the following steps 161 and 162:
[0042] Step 161: Based on the first target character set, determine the first internal code value sequence corresponding to the first garbled character sequence; the first target character set stores garbled characters and their corresponding internal code values;
[0043] Among them, the internal code refers to the binary character encoding used in the computer Chinese character system. It is the exchange code for communicating between input, output, and the system platform. Through the internal code, the purpose of general and efficient text transmission can be achieved. For example, the American Standard Code for Information Interchange (ASCII); in the character set, the internal code value and the corresponding character can be stored correspondingly. The internal code values corresponding to the same character are different in different character sets. For example, for the characters "你好", the internal code value corresponding to it in the GBK character set is "C4E3BAC3", and the internal code value corresponding to it in the Unicode character set is "4F60597D"; the characters corresponding to the same internal code value are also different in different character sets. For example, the characters displayed by the internal code value "662577204E0D89C96653FF0C5904590495FB557C9E1F3002" in different character sets are shown in Table 1 below.
[0044] Table 1
[0045]
[0046] Step 162: Decode the first internal code value sequence to obtain a recognizable character sequence.
[0047] Among them, by decoding the first internal code value sequence "662577204E0D89C96653FF0C5904590495FB557C9E1F3002", a recognizable character sequence "春眠不觉晓,处处闻啼鸟。" can be obtained.
[0048] In the embodiments of this application, by determining the internal code value sequence corresponding to the garbled character sequence based on the correspondence between the internal code value and the character in the character set, the internal code value sequence corresponding to the garbled character sequence can be determined more accurately and efficiently.
[0049] In some embodiments, as Figure 5 shown, the step 162 "Decode the first internal code value sequence to obtain a recognizable character sequence" can be implemented through the following step 1621 and step 1622:
[0050] Step 1621: Determine the third target character set to which the first internal code value in the first internal code value sequence belongs; recognizable characters and the corresponding internal code values are stored in the third target character set;
[0051] Among them, the character set to which the first internal code value sequence "662577204E0D89C96653…" belongs can be Unicode.
[0052] Step 1622: Determine the recognizable character sequence corresponding to the first internal code value sequence based on the third target character set.
[0053] Among them, the recognizable characters corresponding to the first internal code value in the first internal code value sequence can be sequentially searched from the third target character set, and the recognizable character sequence can be generated in order. For example, it is determined that the recognizable character corresponding to the first internal code value "6625" is "春", the recognizable character corresponding to the first internal code value "7720" is "眠", the recognizable character corresponding to the first internal code value "4E0D" is "不"..., and the recognizable character corresponding to the first internal code value "3002" is "。". The recognizable characters are sequentially generated into the recognizable character sequence "春眠不觉晓,处处闻啼鸟。".
[0054] In the embodiments of the present application, by first determining the third target character set to which the internal code value in the internal code value sequence corresponding to the garbled character sequence belongs, and then searching for the recognizable character corresponding to the internal code value from the third target character set, the recognizable character sequence corresponding to the garbled character sequence can be determined more accurately and conveniently.
[0055] In some embodiments, as Figure 6 shown, the step 1621 of "determining the third target character set to which the first internal code value in the first internal code value sequence belongs" can be implemented by the following steps 16211a and 16212a:
[0056] Step 16211a: Determine the second reference character sequence corresponding to the first internal code value sequence in at least one of the character sets;
[0057] Step 16122a: Determine the character set in which the second reference characters satisfy the grammatical structure of the corresponding character set as the third target character set to which the first internal code value sequence belongs.
[0058] Among them, sentence components can form a certain grammatical structure, and the sentence components can include subject, predicate, object, attributive, adverbial, complement, etc.; the grammatical structures of different character sets are different. Therefore, the character sequences corresponding to different character sets need to conform to the grammatical structure of the belonging character set. For example, the grammatical structure of the character set of simplified Chinese can include subject-predicate phrases, verb-object phrases, modifier-head phrases, complement phrases, and coordinate phrases, etc.; the grammatical structure of Japanese can include subject-predicate structure, subject-object-predicate structure, and subject-complement-predicate structure, etc.; it can be determined whether the character set is the third target character set to which the first internal code value sequence belongs according to whether the second reference character sequence corresponding to the first internal code value sequence in different character sets conforms to the grammatical structure of the belonging character set.
[0059] In some embodiments, semantic analysis may also be performed on the second reference character sequence to determine whether there are semantic errors in the second reference character sequence, and the character set corresponding to the second reference character sequence without semantic errors is determined as the third target character set.
[0060] In some embodiments, the first internal code value sequence may be analyzed first. For example, if there are two adjacent identical internal code values "5904" in the first internal code value sequence, then the second reference character sequence may be further analyzed. When the two second reference characters at the corresponding positions in the second reference character sequence are the same, the character set corresponding to the second reference character sequence is determined as the third target character set. For example, in the character set "Unicode", the characters corresponding to the internal code values "59045904" at two adjacent positions are "处处", so the character set "Unicode" may be determined as the third target character set to which the first internal code value "662577204E0D89C96653…" belongs.
[0061] In the embodiments of the present application, since the recognizable character sequence converted from the garbled character sequence should satisfy the grammatical structure, by determining the character set where the second reference character sequence that satisfies the grammatical structure is located as the third target character set, the third target character set to which the first internal code value sequence belongs can be determined more accurately.
[0062] In some embodiments, as Figure 7 shown, the step 1621 of "determining the third target character set to which the first internal code value in the first internal code value sequence belongs" can be implemented by the following step 16211b:
[0063] Step 16211b: Based on the trained second neural network model and the first internal code value sequence, determine the third target character set to which the first internal code value sequence belongs;
[0064] Among them, the trained second neural network model is obtained by training the initial neural network model based on the second internal code value sequence and the fourth target character set to which the second internal code value sequence belongs; the second internal code value sequence satisfies the grammatical structure of the fourth target character set.
[0065] In one embodiment, a supervised learning algorithm may be used to train the initial neural network model using training samples. The training samples are composed of the second internal code value sequence and the expected output (the fourth target character set to which the second internal code value sequence belongs). Since the recognizable character sequence corresponding to the first internal code value sequence should satisfy the grammatical structure, and the trained second neural network model is trained by the second internal code value sequence that satisfies the grammatical structure of the fourth target character set and the fourth target character set, the trained second neural network model can determine the third target character set to which the first internal code value sequence that satisfies the grammatical structure belongs.
[0066] In one embodiment, the second internal code value sequence may further meet the semantic criteria of the fourth target character set. When the character sequence corresponding to the first internal code value sequence meets the syntactic structure and semantic criteria, the trained second neural network model may determine the third target character set to which the first internal code value sequence belongs.
[0067] In the embodiments of the present application, by determining the character set to which the internal code value sequence belongs based on the trained neural network model, it is possible to more conveniently and intelligently determine the target character set to which the internal code value sequence belongs. Then, according to the correspondence between the internal code value and the character in the target character set, the internal code value is converted into a recognizable character; this avoids the inconvenience caused by the user manually trying each character set and also avoids the problem of characters being unrecognizable due to incorrect presetting of the character set of the electronic device, thus improving the character recognition efficiency.
[0068] Due to historical reasons, there are multiple character sets for languages such as Chinese that require multi-byte representation, such as GB2312, GBK, Unicode, etc. The internal code refers to the binary character encoding used in the computer Chinese character system, which is the exchange code for communicating between input, output, and the system platform. Through the internal code, the purpose of general and efficient text transmission can be achieved. For a piece of text, the internal code values are different for different character sets. For example, for "你好", the internal code value in GBK is: C4E3BAC3, and the internal code value in Unicode is: 4F60597D. When an electronic device displays such text, it needs to correctly identify its encoding character set and decode it, otherwise it may display garbled characters.
[0069] For example, for a piece of text with internal code values like: 662577204E0D89C96653FF0C5904590495FB557C9E1F30, when the device "interprets" it with different character sets, the displayed text is as shown in Table 1 below:
[0070] Table 1
[0071]
[0072] For an electronic device to judge the character set used for a piece of text, there are generally two methods: manual selection and presetting. For an electronic device where the user can manually select the character set, the user needs to try each character set, which is very inconvenient; for the garbled characters displayed by an electronic device with incorrect presetting, the user has no way to modify them, such as some mp3 devices, car audio systems, etc.
[0073] In view of the above problems and the deficiencies of related solutions, this solution proposes: capturing an image of the garbled text displayed through the camera of a mobile device (such as a mobile phone), performing optical character recognition (OCR) on it to identify the garbled text, and using a machine learning algorithm to identify the current character set corresponding to the garbled text, so as to convert the garbled text into a corresponding internal code value based on the current character set used. Then, use a machine learning algorithm to identify the original character set corresponding to the internal code value, and decode and display the internal code value based on the original character set to obtain recognizable text.
[0074] The advantages after adopting this solution are: for devices that cannot change the encoding set and have already displayed garbled characters, the original text can be correctly identified and the garbled text can be quickly displayed as correct readable text, without the user having to try to modify the encoding set (i.e., the character set) one by one.
[0075] Figure 8 It is a schematic flow diagram of another garbled character recognition method for an embodiment of this application, as Figure 8 shown, the method includes the following steps:
[0076] Step 801: Scan the garbled image displayed on the electronic device through the camera of the mobile phone;
[0077] Step 802: OCR recognizes the garbled text in the garbled image;
[0078] Among them, the garbled text is a type of garbled character, and the recognized garbled text can form a first garbled character sequence "鏄ョ湢涓嶈…".
[0079] Step 803: Identify the garbled character set where the garbled text is located through a machine learning algorithm or a machine learning model;
[0080] Among them, the garbled character set is also called the first target character set. The first garbled character sequence can be input into a trained first neural network model, and the first neural network model can output the first target character set where the garbled text in the first garbled character sequence is located; the trained first neural network model is obtained by training an initial neural network model based on the second garbled character and the second target character set to which the second garbled character belongs. The garbled character set corresponding to the first garbled character sequence "鏄ョ湢涓嶈…" can be GBK.
[0081] Step 804: Find out the internal code value (also called the encoding value) corresponding to each garbled text according to the garbled character set;
[0082] Among them, the garbled character set can correspondingly store garbled characters and the internal code values corresponding to the garbled characters; the first internal code value sequence "662577204E0D89C96653..." corresponding to the first garbled character sequence can be found through the garbled character set.
[0083] Step 805: Infer the original character set of this internal code value through a machine learning algorithm or a machine learning model;
[0084] Among them, the original character set is also called the third target character set. The internal code value sequence can be input into the trained second neural network model, and the second neural network model can output the third target character set where the internal code value in the internal code value sequence is located; the trained second neural network model is obtained by training the initial neural network model based on the second internal code value sequence and the fourth target character set to which the second internal code value sequence belongs. The second internal code value sequence satisfies the syntax structure of the fourth target character set. The original character set corresponding to the first internal code value sequence "662577204E0D89C96653..." can be Unicode.
[0085] Step 806: Decode this internal code value according to the original character set and display the corresponding recognizable text.
[0086] Among them, the original character set can correspondingly store recognizable characters and the internal code values corresponding to the recognizable characters; the recognizable characters "Spring slumber runs on oblivious..." corresponding to the first internal code value sequence "662577204E0D89C96653..." can be found through the original character set.
[0087] It should be noted that in the embodiments of the present application, if the above-mentioned garbled code recognition method is implemented in the form of software function modules and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application essentially or the part that contributes to the related technology can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a mobile phone, a tablet computer, a desktop computer, a personal digital assistant, etc.) to execute all or part of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), magnetic disks, or optical discs that can store program codes. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0088] Based on the embodiments of the method, this application provides a garbled character recognition device. The device includes various modules, which can be implemented by a processor in a computer device; of course, it can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0089] Figure 9 This is a schematic diagram of the composition structure of a garbled character recognition device according to an embodiment of this application, as shown below. Figure 9 As shown, the device 900 includes an acquisition module 901, a determination module 902, and a decoding module 903, wherein:
[0090] Acquisition module 901 is used to acquire a first garbled character sequence to be identified and at least one character set; the at least one character set includes the first garbled character in the first garbled character sequence;
[0091] The first determining module 902 is used to determine the first target character set to which the first garbled character sequence belongs based on the matching degree between at least one of the character sets and the first garbled character sequence.
[0092] The decoding module 903 is used to decode the first garbled character sequence based on the first target character set to obtain a recognizable character sequence.
[0093] In some embodiments, the first determining module includes a first determining submodule, configured to determine a first reference character set that has the highest matching degree with the first garbled character sequence from at least one of the character sets; and a second determining submodule, configured to determine the first reference character set as the first target character set to which the first garbled character sequence belongs.
[0094] In some embodiments, the apparatus further includes: a second determining module, configured to determine a first target character set to which the first garbled character sequence belongs based on a trained first neural network model and the first garbled character sequence; wherein the trained first neural network model is trained on an initial neural network model based on a second garbled character and a second target character set to which the second garbled character belongs.
[0095] In some embodiments, the decoding module includes: a third determining submodule, configured to determine a first internal code value sequence corresponding to the first garbled character sequence based on the first target character set; the first target character set stores garbled characters and their corresponding internal code values; and a decoding submodule, configured to decode the first internal code value sequence to obtain a recognizable character sequence.
[0096] In some embodiments, the decoding submodule includes: a first determining unit, configured to determine a third target character set to which the first internal code value in the first internal code value sequence belongs; the third target character set stores identifiable characters and their corresponding internal code values; and a second determining unit, configured to determine an identifiable character sequence corresponding to the first internal code value sequence based on the third target character set.
[0097] In some embodiments, the first determining unit includes: a first determining subunit, configured to determine from at least one of the character sets that the first internal code value sequence corresponds to a second reference character sequence in at least one of the character sets; and a second determining subunit, configured to determine the character set to which the second reference character satisfies the syntax structure of the corresponding character set as the third target character set to which the first internal code value sequence belongs.
[0098] In some embodiments, the first determining unit includes: a third determining subunit, configured to determine a third target character set to which the first internal code value sequence belongs based on a trained second neural network model and the first internal code value sequence; wherein the trained second neural network model is trained on an initial neural network model based on the second internal code value sequence and a fourth target character set to which the second internal code value sequence belongs; and the second internal code value sequence satisfies the grammatical structure of the fourth target character set.
[0099] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0100] Correspondingly, embodiments of this application provide an electronic device, Figure 10 This is a schematic diagram of a hardware entity of an electronic device according to an embodiment of this application, such as... Figure 10 As shown, the hardware entity of the device 1000 includes a memory 1001 and a processor 1002. The memory 1001 stores a computer program that can run on the processor 1002. When the processor 1002 executes the program, it implements the steps in the garbled character recognition method in the above embodiments.
[0101] The memory 1001 is configured to store instructions and applications executable by the processor 1002, and can also cache data to be processed or already processed by the processor 1002 and the various modules in the device 1000 (e.g., image data, audio data, voice communication data and video communication data), which can be implemented by flash memory or random access memory (RAM).
[0102] Correspondingly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the garbled character recognition method described above.
[0103] It should be noted that the descriptions of the storage medium and device embodiments above are similar to those of the method embodiments above, and have similar beneficial effects as the device embodiments. For technical details not disclosed in the storage medium and method embodiments of this application, please refer to the descriptions of the device embodiments of this application for understanding.
[0104] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0105] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0106] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0107] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this application may all be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in hardware or in a combination of hardware and software functional units.
[0108] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks. Alternatively, if the integrated units of this application are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the related technology, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause computer devices (which may be mobile phones, tablets, desktops, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0109] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined to obtain new method embodiments without conflict. The features disclosed in the several product embodiments provided in this application can be arbitrarily combined to obtain new product embodiments without conflict. The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined to obtain new method embodiments or device embodiments without conflict.
[0110] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A garbled character recognition method, applied to a device whose encoding set cannot be changed, the method comprising: Obtain the first garbled character sequence to be identified and at least one character set; The at least one character set includes the first garbled character in the first garbled character sequence; Based on the matching degree between at least one of the character sets and the first garbled character sequence, determine the first target character set to which the first garbled character sequence belongs; Based on the first target character set, determine the first internal code value sequence corresponding to the first garbled character sequence; the first target character set stores garbled characters and their corresponding internal code values; The first internal code value sequence is decoded to obtain a recognizable character sequence.
2. The method according to claim 1, characterized in that, The step of determining the first target character set to which the first garbled character sequence belongs based on the matching degree between at least one of the character sets and the first garbled character sequence includes: From at least one of the character sets, determine a first reference character set that has the highest matching degree with the first garbled character sequence; The first reference character set is determined as the first target character set to which the first garbled character sequence belongs.
3. The method according to claim 1, characterized in that, The method further includes: Based on the trained first neural network model and the first garbled character sequence, determine the first target character set to which the first garbled character sequence belongs; The trained first neural network model is obtained by training the initial neural network model based on the second garbled character and the second target character set to which the second garbled character belongs.
4. The method according to claim 1, characterized in that, Decoding the first internal code value sequence to obtain a recognizable character sequence includes: Determine the third target character set to which the first internal code value in the first internal code value sequence belongs; the third target character set stores recognizable characters and their corresponding internal code values; Based on the third target character set, determine the recognizable character sequence corresponding to the first internal code value sequence.
5. The method according to claim 4, characterized in that, Determining the third target character set to which the first internal code value sequence belongs includes: From at least one of the character sets, determine that the first internal code value sequence corresponds to a second reference character sequence in at least one of the character sets; The character set whose second reference character satisfies the syntax structure of the corresponding character set is determined as the third target character set to which the first internal code value sequence belongs.
6. The method according to claim 4, characterized in that, Determining the third target character set to which the first internal code value sequence belongs includes: Based on the trained second neural network model and the first internal code value sequence, determine the third target character set to which the first internal code value sequence belongs; The trained second neural network model is obtained by training the initial neural network model based on the second internal code value sequence and the fourth target character set to which the second internal code value sequence belongs; the second internal code value sequence satisfies the grammatical structure of the fourth target character set.
7. A garbled character recognition device, applied to a device whose encoding set cannot be changed, the device comprising: The acquisition module is used to acquire the first garbled character sequence to be identified and at least one character set; The at least one character set includes the first garbled character in the first garbled character sequence; The first determining module is used to determine the first target character set to which the first garbled character sequence belongs based on the matching degree between at least one of the character sets and the first garbled character sequence; The third determining module is used to determine the first internal code value sequence corresponding to the first garbled character sequence based on the first target character set; the first target character set stores garbled characters and their corresponding internal code values; The decoding submodule is used to decode the first internal code value sequence to obtain a recognizable character sequence.
8. An electronic device comprising a memory and a processor, the memory storing a computer program executable on the processor, the processor executing the program to implement the steps of the garbled character recognition method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the garbled character recognition method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data recovery method and apparatus
CN108108267A
Character encoding identification method and device
CN108197087A
Method and device for determining character set
CN110704629A