Data coding method and device, data decoding method and device, equipment, storage medium and product

By using dynamic dictionaries to encode and decode data, the high storage and maintenance costs of existing technologies are solved, achieving data security and efficient data compression, especially with significant compression effects on identifier data in business data.

CN121603010APending Publication Date: 2026-03-03BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411147121.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing data encoding schemes rely on pre-established encoding dictionaries, resulting in high storage and maintenance costs, as well as the risk of data leakage, making it difficult to guarantee data security and data compression rates.

Method used

A dynamic dictionary is used to encode and decode data. The basic dictionary is dynamically updated. For consecutive repeated characters that do not exist in the basic dictionary, a preset identifier is used for encoding. During decoding, the most recently determined target character is used for decoding. The dynamic dictionary does not need to be stored or maintained.

Benefits of technology

It reduces storage resource consumption and the maintenance cost of the encoding dictionary, while ensuring data security and a high data compression rate, especially for the identification data in business data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121603010A_ABST
    Figure CN121603010A_ABST
Patent Text Reader

Abstract

The invention provides a data encoding method and device, a data decoding method and device, equipment, a storage medium and a product, and relates to the technical field of computers. The method comprises the following steps: acquiring original data to be coded; encoding the original data by using a first dynamic dictionary to obtain encoded data corresponding to the original data, the first dynamic dictionary being a dictionary dynamically updated according to a basic dictionary and the original data in the process of encoding the original data, and the first dynamic dictionary being a dictionary dynamically updated according to the basic dictionary and the original data; and for the continuous repeated characters which do not exist in the basic dictionary in the original data, preset identifiers are determined as corresponding target codes, the preset identifiers corresponding to different continuous repeated characters are different, and the preset identifiers are different from the basic codes in the basic dictionary. By adopting the technical scheme, the dynamic dictionary after coding does not need to be stored and maintained, the occupation of storage resources and the maintenance cost of the coding dictionary are reduced, and a certain data compression rate can be ensured while the data security is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to data encoding methods, decoding methods, apparatus, devices, storage media, and products. Background Technology

[0002] Typically, data can be encoded to reduce the amount of data transmitted or to reduce the amount of storage space occupied by the data.

[0003] Data encoding generally relies on a pre-established code table, or simply dictionary. The index number of the dictionary is used to replace the character to be encoded, and the number of bytes occupied by an index number is often smaller than the character to be encoded, thereby achieving the purpose of compressing the file.

[0004] However, both encoding and decoding rely on encoding dictionaries, which require long-term storage and maintenance and are subject to leakage risks, making it difficult to guarantee data security. Summary of the Invention

[0005] This disclosure provides data encoding methods, decoding methods, apparatus, devices, storage media, and products, which can optimize existing data encoding and decoding processing schemes.

[0006] In a first aspect, embodiments of this disclosure provide a data encoding method, including:

[0007] Obtain the raw data to be encoded;

[0008] The original data is encoded using a first dynamic dictionary to obtain the encoded data corresponding to the original data. The first dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the original data during the encoding process. For consecutive repeated characters in the original data that do not exist in the base dictionary, a preset identifier is determined as the target code corresponding to the consecutive repeated characters. The preset identifiers corresponding to different consecutive repeated characters are all different, and the preset identifiers are different from the base codes in the base dictionary.

[0009] Secondly, embodiments of this disclosure also provide a data decoding method, including:

[0010] Obtain the encoded data to be decoded;

[0011] The encoded data is decoded using a second dynamic dictionary to obtain the original data corresponding to the encoded data. The second dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the encoded data during the decoding process. For encodings in the encoded data that do not exist in the base dictionary, characters from the most recently determined target decoder are used for decoding.

[0012] Thirdly, embodiments of this disclosure also provide a data encoding apparatus, including:

[0013] The raw data acquisition module is used to acquire the raw data to be encoded.

[0014] An encoding module is used to encode the original data using a first dynamic dictionary to obtain encoded data corresponding to the original data. The first dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the original data during the encoding process. For consecutive repeating characters in the original data that do not exist in the base dictionary, a preset identifier is determined as the target code corresponding to the consecutive repeating characters. The preset identifiers corresponding to different consecutive repeating characters are all different, and the preset identifiers are different from the base codes in the base dictionary.

[0015] Fourthly, embodiments of this disclosure also provide a data decoding apparatus, including:

[0016] The encoded data acquisition module is used to acquire the encoded data to be decoded;

[0017] The decoding module is used to decode the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data. The second dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the encoded data during the decoding process. For encodings in the encoded data that do not exist in the base dictionary, the characters in the most recently determined target decoder are used for decoding.

[0018] Fifthly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:

[0019] One or more processors;

[0020] Storage device for storing one or more programs.

[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement the methods provided in the embodiments of this disclosure.

[0022] In a sixth aspect, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the methods provided in embodiments of this disclosure.

[0023] In a seventh aspect, embodiments of this disclosure also provide a computer program product, including a computer program that, when executed by a processor, implements the method provided in embodiments of this disclosure.

[0024] The data encoding scheme provided in this embodiment obtains the original data to be encoded; the original data is encoded using a first dynamic dictionary to obtain the encoded data corresponding to the original data. The first dynamic dictionary is dynamically updated based on a base dictionary and the original data during the encoding process. For consecutive repeating characters in the original data that are not present in the base dictionary, a preset identifier is determined as the corresponding target code. Different consecutive repeating characters correspond to different preset identifiers, and the preset identifiers are different from the base codes in the base dictionary. By adopting the above technical solution, the encoding dictionary used when encoding the original data is dynamically generated based on the base dictionary. Consecutive repeating characters that are not present in the base dictionary are encoded using preset identifiers that are different from the base codes in the base dictionary. The dynamic dictionary after encoding does not need to be stored or maintained, reducing the occupation of storage resources and the maintenance cost of the encoding dictionary. While ensuring data security, a certain data compression rate can also be guaranteed.

[0025] The data decoding scheme provided in this disclosure involves obtaining encoded data to be decoded; decoding the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data. The second dynamic dictionary is dynamically updated based on a base dictionary and the encoded data during the decoding process. For codes in the encoded data that are not present in the base dictionary, decoding is performed using characters from the most recently determined target decoder. By adopting the above technical solution, the decoding dictionary used when decoding encoded data is dynamically generated based on the base dictionary. The codes corresponding to consecutive repeating characters not present in the base dictionary can be determined based on the most recently determined decoder. This eliminates the need to pre-store the decoding dictionary corresponding to the encoded data, reducing storage resource consumption and encoding dictionary maintenance costs, while ensuring data security. Attached Figure Description

[0026] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0027] Figure 1 This is a flowchart illustrating a data encoding method provided in an embodiment of the present disclosure;

[0028] Figure 2 This is a flowchart illustrating another data encoding method provided in an embodiment of the present disclosure;

[0029] Figure 3a This is a schematic diagram of a data encoding process provided in an embodiment of the present disclosure;

[0030] Figure 3b This is a schematic diagram of a data encoding process provided in an embodiment of the present disclosure;

[0031] Figure 3c This is a schematic diagram of a data encoding process provided in an embodiment of the present disclosure;

[0032] Figure 3d This is a schematic diagram of a data encoding process provided in an embodiment of the present disclosure;

[0033] Figure 3e This is a schematic diagram of a data encoding process provided in an embodiment of the present disclosure;

[0034] Figure 4 This is a schematic flowchart of a data decoding method provided in an embodiment of the present disclosure;

[0035] Figure 5 This is a schematic flowchart of another data decoding method provided in an embodiment of this disclosure;

[0036] Figure 6 This is a schematic diagram of a data encoding process provided in an embodiment of the present disclosure;

[0037] Figure 7 This is a schematic diagram of the structure of a data encoding device provided in an embodiment of the present disclosure;

[0038] Figure 8 This is a schematic diagram of the structure of a data decoding device provided in an embodiment of the present disclosure;

[0039] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0040] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0041] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0042] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0043] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0044] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0045] Figure 1 This is a schematic diagram of a data encoding process provided by an embodiment of the present disclosure. The embodiments of the present disclosure are applicable to situations where data is encoded, such as situations where data is encoded before being sent to a peer device. The method can be executed by a data encoding device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal such as a mobile phone, smartwatch, tablet computer, or personal digital assistant, or a personal computer (PC) or server.

[0046] like Figure 1 As shown, the method includes:

[0047] Step 101: Obtain the raw data to be encoded.

[0048] In this embodiment of the disclosure, the original data is data containing consecutive repeating characters, and the characters contained in the original data can be recorded as characters to be encoded. Optionally, the original data may include business data, such as identification data in business data. The source of the original data is not limited; it may be data generated by the local device, data generated by the local device that needs to be sent to the peer device, or data obtained by the local device from the first device that needs to be forwarded to the second device.

[0049] For example, in e-commerce business scenarios, the storage, querying, and transmission of structured product information are involved. This structured product information mainly includes product category attribute data. With the rapid development of e-commerce, multiple business units often exist, such as product information (e.g., displayed as product cards), product details display, and order management. Each business unit may have a need to query product category attribute data. The large volume of query requests and the large amount of product category attribute data can easily cause data query delays, server-side pressure, and service instability. To solve these problems, in this embodiment, the server providing the product category attribute data query service (denoted as the data center) can pre-push the product category attribute data to the business units. The business units store the product category attribute data locally and can query the local data when needed, reducing query latency. Since the product category attribute data is large, the data center can adopt the data encoding scheme in this embodiment, encoding the product category attribute data to be pushed as the raw data to be encoded, and then pushing the encoded data to the business units. This can achieve data compression and improve data transmission efficiency. In addition, an intermediate server can be set up between the data center and the business end. The intermediate server can obtain product category attribute data from the data center in advance, encode the obtained product category attribute data as the raw data to be encoded, and then push the encoded data to the business end.

[0050] Step 102: Encode the original data using a first dynamic dictionary to obtain the encoded data corresponding to the original data. The first dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the original data during the encoding process. For consecutive repeated characters in the original data that do not exist in the base dictionary, a preset identifier is determined as the target code corresponding to the consecutive repeated characters. The preset identifiers corresponding to different consecutive repeated characters are all different, and the preset identifiers are different from the base codes in the base dictionary.

[0051] Data encoding typically relies on a pre-established code table, or simply dictionary. The dictionary's index numbers are used to represent the characters to be encoded, and the number of bytes occupied by an index number is often smaller than the character it represents, thus achieving file compression. However, both encoding and decoding depend on the code table, which requires long-term storage and maintenance and is susceptible to leakage, making it difficult to guarantee data security.

[0052] In this embodiment of the disclosure, a dynamic dictionary is used to encode the original data. The dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the original data during the encoding process. The base dictionary can be a dictionary capable of encoding any character, such as an encoding dictionary based on 8-bit (Universal Character Set / Unicode Transformation Format, UTF-8), that is, an encoding dictionary that supports all characters in the UTF-8 character set for both encoding and decoding.

[0053] For example, after obtaining the original data to be encoded, the first dynamic dictionary is initialized. The initialized first dynamic dictionary is an empty dictionary. For the characters to be encoded that exist in the basic dictionary in the original data, the corresponding encoding in the basic dictionary (denoted as the basic encoding) can be written into the first dynamic dictionary as the corresponding index symbol, so that the index symbol in the first dynamic dictionary can be used to replace the characters to be encoded to achieve encoding.

[0054] However, the basic dictionary needs to consider the comprehensiveness of the encoding, making it difficult to perform targeted encoding on the raw data, resulting in low data compression rate. In this embodiment, for consecutive repeating characters in the raw data that do not exist in the basic dictionary, a preset identifier is used for encoding, that is, the preset identifier is determined as the target code corresponding to the consecutive repeating characters. For example, the preset identifiers in the preset identifier sequence are used for encoding, and different consecutive repeating characters correspond to different preset identifiers. This is equivalent to using a single preset identifier to encode multiple characters, which can effectively improve the data compression rate. The preset identifier sequence can be set according to actual needs. For example, a preset identifier can be represented by a preset character (such as 'e') followed by a serial number. The serial number can be represented in hexadecimal, so that the preset identifier is different from the basic codes in the basic dictionary.

[0055] For example, after all the characters in the original data have been identified with their corresponding codes (denoted as target codes), the encoded data corresponding to the original data is determined based on all the identified target codes.

[0056] The data encoding method provided in this embodiment uses an encoding dictionary that is dynamically generated based on a basic dictionary when encoding the original data. Continuous repeated characters that do not exist in the basic dictionary are encoded using a preset identifier that is different from the basic encoding in the basic dictionary. The dynamic dictionary after encoding does not need to be stored or maintained, reducing the occupation of storage resources and the maintenance cost of the encoding dictionary. It can ensure a certain data compression rate while ensuring data security.

[0057] In some embodiments, encoding the original data using a first dynamic dictionary to obtain encoded data corresponding to the original data includes: determining the current string to be encoded from the original data; if the current string to be encoded does not exist in the first dynamic dictionary, and the number of characters in the current string to be encoded is consistent with the number of units of characters corresponding to the basic dictionary, then obtaining the basic encoding corresponding to the current string to be encoded from the basic dictionary; using the obtained basic encoding as the index symbol corresponding to the current string to be encoded and writing it into the first dynamic dictionary; determining the index symbol corresponding to the current string to be encoded in the first dynamic dictionary as the target encoding corresponding to the current string to be encoded; if all characters in the original data have a corresponding target encoding, then determining the encoded data corresponding to the original data based on all determined target encodings. Therefore, if the current string to be encoded does not exist in the first dynamic dictionary, the first dynamic dictionary can be quickly updated based on the basic dictionary to achieve fast encoding of the current string to be encoded.

[0058] For example, the current string to be encoded may include one or more characters to be encoded from the original data. The number of characters to be encoded in the initially determined current string is consistent with the number of units of characters corresponding to the base dictionary. The number of units of characters can be understood as the minimum number of characters that can be encoded in the base dictionary; for example, if the base dictionary is UTF-8, the number of units of characters is 1. If the current string to be encoded does not exist in the first dynamic dictionary, and the number of characters in the current string to be encoded is consistent with the number of units of characters corresponding to the base dictionary, then the base encoding corresponding to the base dictionary can be used for encoding. Specifically, the base encoding corresponding to the current string to be encoded is obtained from the base dictionary, and the obtained base encoding is used as the index symbol corresponding to the current string to be encoded. This is then written into the first dynamic dictionary to update the first dynamic dictionary. After the update, the index symbol corresponding to the current string to be encoded already exists in the first dynamic dictionary. Therefore, the index symbol corresponding to the current string to be encoded in the first dynamic dictionary is determined as the target encoding corresponding to the current string to be encoded.

[0059] In some embodiments, after determining the current string to be encoded from the original data, the method further includes: if the current string to be encoded exists in the first dynamic dictionary, then obtaining the next character to be encoded from the original data; if the obtained character to be encoded is the same as a character in the current string to be encoded, then concatenating the obtained character to be encoded with the current string to be encoded to update the current string to be encoded; if the updated current string to be encoded does not exist in the first dynamic dictionary, then determining the last used preset identifier in the preset identifier sequence, and determining the next preset identifier of the last used preset identifier as the target preset identifier; and writing the target preset identifier as the index symbol corresponding to the updated current string to be encoded into the first dynamic dictionary. Thus, by attempting to find longer consecutive repeating characters for encoding, the compression rate of consecutive repeating characters can be improved, thereby improving the overall compression rate of the original data.

[0060] For example, if the current string to be encoded exists in the first dynamic dictionary, in order to improve the compression rate of consecutive repeating characters, the index symbol corresponding to the current string to be encoded in the first dynamic dictionary can be temporarily not used for encoding. Instead, the next character to be encoded is obtained from the original data, and it is determined whether the obtained next character to be encoded is the same as a character in the current string to be encoded (if there are multiple characters in the current string to be encoded, then all of them are the same). If they are the same, it means that a longer consecutive repeating character can be formed (that is, more consecutive repeating characters). The obtained character to be encoded is concatenated with the current string to be encoded to update the current string to be encoded. The first dynamic dictionary is then queried to see if a longer consecutive repeating character exists. If the updated current string to be encoded does not exist, it means that the updated current string to be encoded cannot be encoded based on the current first dynamic dictionary. The last used preset identifier in the preset identifier sequence is determined, and the next preset identifier of the last used preset identifier is determined as the target preset identifier. This ensures that the target preset identifier is different from the existing index symbols in the first dynamic dictionary. The target preset identifier is used as the index symbol corresponding to the updated current string to be encoded and written into the first dynamic dictionary. Subsequently, the index symbol corresponding to the updated current string to be encoded in the first dynamic dictionary (that is, the target preset identifier just determined) can be determined as the target encoding corresponding to the updated current string to be encoded.

[0061] Optionally, after concatenating the acquired character to be encoded with the current string to be encoded to update the current string, the method further includes: if the updated current string to be encoded exists in the first dynamic dictionary, then continue to acquire the next character to be encoded from the original data. Thus, by finding the longest enable string, the compression rate of consecutive repeating characters can be improved, thereby increasing the overall compression rate of the original data.

[0062] For example, if the updated current string to be encoded exists in the first dynamic dictionary, the updated current string to be encoded is determined as the new current string to be encoded, and the next character to be encoded is obtained from the original data. If the obtained character to be encoded is the same as the character in the current string to be encoded, the obtained character to be encoded is concatenated with the current string to be encoded to continue updating the current string to be encoded. The system then continues to determine whether the updated current string to be encoded exists in the first dynamic dictionary, and then determines whether to obtain the next character to be encoded based on the determination result.

[0063] In some embodiments, after obtaining the next character to be encoded from the original data, the method further includes: if the obtained character to be encoded is different from the character in the current string to be encoded, then the index symbol corresponding to the current string to be encoded in the first dynamic dictionary is determined as the target code corresponding to the current string to be encoded. Therefore, if it is impossible to form a longer continuous repeating character sequence, the existing index symbols in the first dynamic dictionary can be used for encoding quickly, improving encoding accuracy and efficiency.

[0064] For example, if the obtained character to be encoded is different from the character in the current string to be encoded, the obtained character to be encoded is determined as the new current string to be encoded, and it is determined whether the current string to be encoded exists in the first dynamic dictionary. Based on the determination result, it is determined whether to directly use the first dynamic dictionary for encoding, or to first obtain the basic encoding corresponding to the current string to be encoded from the basic dictionary and update the first dynamic dictionary before using the updated first dynamic dictionary for encoding.

[0065] In some embodiments, determining the last used preset identifier in the preset identifier sequence if the updated current string to be encoded does not exist in the first dynamic dictionary includes: if the updated current string to be encoded does not exist in the first dynamic dictionary, determining whether the number of characters in the updated current string to be encoded is greater than or equal to a preset threshold; if not, determining the last used preset identifier in the preset identifier sequence. Therefore, when the number of characters is small, new preset identifiers can be quickly added to update the first dynamic dictionary, improving encoding efficiency.

[0066] For example, the preset threshold can be set according to actual needs, such as 5. Assume the current string to be encoded is "www," which is three consecutive "w"s. "www" exists in the first dynamic dictionary. Assume the next character to be encoded is also "w." After concatenation, the updated string to be encoded is "wwww," which is four consecutive "w"s. "wwww" does not exist in the first dynamic dictionary. Since the number of characters in the updated string to be encoded is less than 5, the last used preset identifier in the preset identifier sequence can be determined, and the next preset identifier can be used to update the first dynamic dictionary.

[0067] In some embodiments, after determining whether the number of characters in the updated current string to be encoded is greater than or equal to a preset threshold, the method further includes: if so, performing at least one splitting process on the updated current string to be encoded to obtain at least one set of substrings to be encoded, wherein the set of substrings to be encoded includes at least two substrings to be encoded; determining a target set of substrings to be encoded from the at least one set of substrings to be encoded; obtaining the index symbols corresponding to at least two substrings to be encoded in the target set of substrings to be encoded from the first dynamic dictionary; concatenating the obtained index symbols; and determining the concatenation result as the target encoding corresponding to the current string to be encoded. Thus, the number of index symbols cached in the first dynamic dictionary can be reduced by splitting and combining strings.

[0068] For example, the preset threshold can be 5. Assume the current string to be encoded is wwww, which is four consecutive repeating 'w's. The first dynamic dictionary contains wwww. Assume the next character to be encoded is also 'w'. After concatenation, the updated string to be encoded is wwwww, which is five consecutive repeating 'w's. The first dynamic dictionary does not contain wwwww. Since the updated string has 5 or more characters, it can be split into multiple ways, such as w and wwww, w and ww and ww, w and w and www, ww and www, www and ww, and wwww and w, resulting in multiple sets of substrings to be encoded. One of these sets can be selected as the target set of substrings to be encoded. For example, if the target set is ww and www, and the index symbols for ww and www in the first dynamic dictionary are e5 and e6 respectively, they can be concatenated as e5e6. The concatenation result e5e6 is then selected as the target encoding for the current string wwwww, without needing to update the first dynamic dictionary with a new preset identifier.

[0069] Figure 2 This is a flowchart illustrating another data encoding method provided in an embodiment of the present disclosure. The embodiments of the present disclosure are optimized based on the various optional schemes in the above embodiments. Specifically, the method includes the following steps:

[0070] Step 201: Obtain the raw data to be encoded.

[0071] Optionally, this step may include: obtaining identifier data from the business data, wherein each row of the identifier data stores one identifier piece of information; and performing row and column transformation on the identifier data to obtain the original data to be encoded. This can improve the compression rate of the identifier data in the business data.

[0072] For example, identification information is generally represented by an incremental number, such as a category ID, which can start from 1 and increment sequentially to represent different category IDs. When there are many categories, the number of digits in the category ID increases accordingly, but the difference between any two adjacent category IDs is 1. The difference between most adjacent category IDs is only reflected in the last digit. For example, 12341, 12342, and 12343 have the same first four digits. After row and column conversion, we get 111, 222, 333, 444, and 123, which contain many consecutive repeated characters, effectively improving the compression rate. It should be noted that the identification data in business data is usually very large. Therefore, after row and column conversion, there will be a large number of consecutive repeated characters. The data encoding scheme in this embodiment can significantly improve the data compression rate.

[0073] Optionally, before performing row-column conversion on the identifier data, the method further includes: for each row of identifier information stored in the identifier data, determining whether the number of bits occupied by the current identifier information reaches a preset number of bits threshold; if not, using a preset character to pad the current identifier information so that the number of bits occupied by the current identifier information after padding reaches the preset number of bits threshold. This can further improve the compression rate of identifier data in business data.

[0074] For example, the preset bit length threshold can be set according to actual needs. Different types of identifier data can have different preset bit length thresholds. For example, the preset bit length threshold for category ID is 7, and the preset bit length threshold for category name is 20. The preset character can be set according to actual needs, such as 0. Taking category ID 12341 as an example, it is currently 5 digits, which is less than 7 digits. Therefore, the preset character 0 can be used for padding to get 1234100. After padding, the proportion of consecutive repeating characters in the original data can be increased, thereby further improving the compression rate of identifier data in business data.

[0075] Step 202: Determine the string to be encoded from the original data.

[0076] For example, each time this step is performed, the current string to be encoded determined from the raw data is a single character, consistent with the number of units of characters corresponding to the basic dictionary (such as UTF-8).

[0077] Step 203: Determine whether it satisfies that the current string to be encoded does not exist in the first dynamic dictionary and the number of characters in the current string to be encoded is the same as the number of unit characters corresponding to the basic dictionary. If so, execute Step 204; otherwise, execute Step 206.

[0078] Exemplarily, if the current string to be encoded does not exist in the first dynamic dictionary and the number of characters in the current string to be encoded is the same as the number of unit characters corresponding to the basic dictionary, it means that the index symbol corresponding to the current string to be encoded does not exist in the first dynamic dictionary and cannot be directly encoded using the current first dynamic dictionary. Therefore, it is necessary to update the first dynamic dictionary by executing Step 204.

[0079] Step 204: Obtain the basic encoding corresponding to the current string to be encoded from the basic dictionary, and write the obtained basic encoding as the index symbol corresponding to the current string to be encoded into the first dynamic dictionary.

[0080] Exemplarily, assume that the current string to be encoded is "dui", and the corresponding basic encoding in the basic dictionary is "23545". Then write the index symbol "23545" and "dui" into the first dynamic dictionary. That is, in the updated first dynamic dictionary, the index symbol corresponding to "dui" is "23545".

[0081] Step 205: Determine the index symbol corresponding to the current string to be encoded in the first dynamic dictionary as the target encoding corresponding to the current string to be encoded, and execute Step 211.

[0082] Step 206: Obtain the next character to be encoded from the original data.

[0083] Step 207: Determine whether the obtained character to be encoded is the same as the character in the current string to be encoded. If so, execute Step 208; otherwise, execute Step 205.

[0084] Step 208: Concatenate the obtained character to be encoded with the current string to be encoded to update the current string to be encoded.

[0085] Step 209: Determine whether the updated current string to be encoded exists in the first dynamic dictionary. If so, return to execute Step 206; otherwise, execute Step 210.

[0086] Step 210: Determine the last used preset identifier in the preset identifier sequence, and determine the next preset identifier of the last used preset identifier as the target preset identifier. Write the target preset identifier as the index symbol corresponding to the updated current string to be encoded into the first dynamic dictionary, and return to execute Step 205.

[0087] Step 211: Determine whether all characters in the original data have been determined to correspond to the target codes. If so, execute Step 212; otherwise, execute Step 202.

[0088] Step 212: Determine the encoded data corresponding to the original data according to all the determined target codes.

[0089] To facilitate understanding of the technical solutions of the embodiments of the present disclosure, specific examples are used for illustration below. Assume that the original data to be encoded is "duiduiduiduiduidu w duiwwwwwwwwww ceshi ceshi &*", which can be understood by referring to Figures 3a to 3e for understanding.

[0090] As Figure 3a in the first step of, first, the probe P detects the first "dui" in the original data (the object to be encoded) as the current string to be encoded. Since the first dynamic dictionary is initially empty, "dui" does not exist in the first dynamic dictionary. The basic code "23545" corresponding to "dui" is obtained from the basic dictionary, and the basic code "23545" is written into the first dynamic dictionary, resulting in the first dynamic dictionary being [dui: 23545]. And write the encoding result, that is, determine the index symbol corresponding to "dui" in the first dynamic dictionary as the target code corresponding to "dui" (that is, the encoding result in the figure), and the encoding result is

[23545] .

[0091] As Figure 3b in the second step of, continue to determine the current string to be encoded from the original data. The probe detects the second "dui" as the current string to be encoded. Since "dui" already exists in the first dynamic dictionary, the probe is set to the next position for exploration. The third position is still "dui", which is the same as the character in the current string to be encoded. Therefore, after splicing, the updated current string to be encoded is "duidui". Then query the first dynamic dictionary. Since it does not exist, ex (x starts from 0) is automatically written into the dictionary, that is, e0 is written, and the updated first dynamic dictionary is [dui: 23545, duidui: e0]. The target code corresponding to "duidui" is e0, and the encoding result is [23545, e0].

[0092] As Figure 3cIn the third step, continue to determine the current string to be encoded from the original data. The probe detects the fourth "dui" as the current string to be encoded. Since "dui" already exists in the first dynamic dictionary, the probe is set to the next position for exploration. The fifth position is still "dui", which is the same as the character in the current string to be encoded. Therefore, after concatenation, the updated current string to be encoded is "duidui". Then, query the first dynamic dictionary. Since "duidui" already exists in the first dynamic dictionary, the probe is set to the next position for exploration. The sixth position is still "dui", which is the same as the character in the current string to be encoded. Therefore, after concatenation, the updated current string to be encoded is "duiduidui". Then, query the first dynamic dictionary. Since it does not exist, "e1" is automatically written into the dictionary. The updated first dynamic dictionary is [dui: 23545, duidui: e0, duiduidui: e1]. The target code corresponding to "duiduidui" is "e1", and the encoding result is [23545, e0, e1].

[0093] Such as Figure 3d In the fourth step, the probe P detects the seventh "w" in the original data as the current string to be encoded. After querying the first dynamic dictionary, "w" does not exist in the first dynamic dictionary. The basic code "119" corresponding to "w" is obtained from the basic dictionary. The basic code "119" is written into the first dynamic dictionary. The first dynamic dictionary becomes [dui: 23545, duidui: e0, duiduidui: e1, w: 119], and it is written into the encoding result. The encoding result is [23545, e0, e1, 119].

[0094] Such as Figure 3e In the fifth step, the probe P detects the eighth "dui" in the original data as the current string to be encoded. After querying the first dynamic dictionary, since "dui" already exists in the first dynamic dictionary, the probe is set to the next position for exploration. The ninth position is still "dui", which is the same as the character in the current string to be encoded. Therefore, after concatenation, the updated current string to be encoded is "duidui". Then, query the first dynamic dictionary. Since "duidui" already exists in the first dynamic dictionary, the probe is set to the next position for exploration. The tenth position is "w", which is different from the character in the current string "duidui". The pointer moves back, and the index symbol corresponding to "duidui" is written into the encoding result. The encoding result is [23545, e0, e1, 119, e0].

[0095] By analogy, the encoding data for the original data "duiduiduiduiduiwduiduiwwwwwwwwwwtesttest&*" is [23545, e0, e1, 119, e0, 119, e3, e4, e5, 27979, e6, 38, 42].

[0096] The data encoding method provided in this disclosure uses an encoding dictionary dynamically generated based on a basic dictionary when encoding raw data. Consecutive repeated characters not present in the basic dictionary are encoded using preset symbols. When the current string to be encoded exists in the dynamic dictionary, the next character to be encoded is attempted to be obtained. If a longer string to be encoded can be formed, the obtained character to be encoded and the current string to be encoded are concatenated. If the concatenated string does not exist in the dynamic dictionary, the next unused preset identifier from the preset identifier sequence is used for encoding. This effectively improves the compression ratio. The encoded dynamic dictionary does not require storage or maintenance, reducing the occupation of storage resources and the maintenance cost of the encoding dictionary. It ensures high data compression ratio while guaranteeing data security, especially for identifier data in business data, where it exhibits a very high data compression ratio.

[0097] Figure 4 This is a flowchart illustrating a data decoding method provided in an embodiment of the present disclosure. This embodiment is applicable to situations where data decoding processing is performed, such as when data is decoded after receiving encoded data sent by a peer device. The method can be executed by a data encoding device, which can be implemented in software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal like a mobile phone, smartwatch, tablet computer, or personal digital assistant, or a device like a personal computer (PC) or server.

[0098] like Figure 4 As shown, the method includes:

[0099] Step 401: Obtain the encoded data to be decoded.

[0100] The encoded data in this embodiment is specifically encoded data obtained using the data encoding method described above. Optionally, it can be encoded data obtained by encoding the identifier data in the business data.

[0101] Step 402: Decode the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data. The second dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the encoded data during the decoding process. For encodings in the encoded data that do not exist in the base dictionary, the characters in the most recently determined target decoder are used for decoding.

[0102] In this embodiment of the disclosure, a dynamic dictionary is used to decode the encoded data. The dynamic dictionary is a dictionary that is dynamically updated based on the base dictionary and the encoded data during the decoding process. The base dictionary is the base dictionary in the data encoding scheme, such as the UTF-8-based encoding dictionary mentioned above.

[0103] For example, after obtaining the encoded data to be decoded, the second dynamic dictionary is first initialized. The initialized second dynamic dictionary is an empty dictionary. For the encoding data that exists in the basic dictionary, the corresponding decoding (denoted as the basic character) in the basic dictionary can be written into the second dynamic dictionary as the corresponding index value, so that the index value in the second dynamic dictionary can be used to replace the encoding to be decoded to achieve decoding.

[0104] In the above data encoding scheme, for consecutive repeated characters in the original data that do not exist in the basic dictionary, a preset identifier in the preset identifier sequence is used for encoding. Therefore, the encoding to be decoded may not exist in the basic dictionary. For the encoding that does not exist in the basic dictionary, the character in the most recently determined target decoder is used for decoding.

[0105] The data decoding method provided in this disclosure uses a decoding dictionary that is dynamically generated based on a basic dictionary when decoding encoded data. The encoding of consecutive repeating characters that do not exist in the basic dictionary can be determined based on the most recently determined decoding. It does not require pre-storing the decoding dictionary corresponding to the encoded data, thereby reducing the occupation of storage resources and the maintenance cost of the encoding dictionary, and ensuring data security.

[0106] In some embodiments, decoding the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data includes: determining the current encoding to be decoded from the encoded data; if the current encoding to be decoded does not exist in the second dynamic dictionary, querying the basic dictionary to see if the current encoding to be decoded exists; if it does, obtaining the basic character corresponding to the current encoding to be decoded from the basic dictionary; writing the obtained basic character as the index value corresponding to the current encoding to be decoded into the second dynamic dictionary; determining the index value corresponding to the current encoding to be decoded in the second dynamic dictionary as the target decoder corresponding to the current encoding to be decoded; if all encodings in the encoded data have a corresponding target decoder, determining the original data corresponding to the encoded data based on all determined target decoders. Therefore, decoding can be performed quickly and accurately even when the current encoding to be decoded exists in the basic dictionary.

[0107] In some embodiments, after querying the basic dictionary to see if the current encoding to be decoded exists, the method further includes: if it does not exist, concatenating the target character with the most recently determined target decoder to obtain a concatenated decoder, wherein the target character is a character in the most recently acquired target decoder; and writing the concatenated decoder as the index value corresponding to the current encoding to be decoded into the second dynamic dictionary. Thus, decoding can be performed quickly and accurately when neither the second dynamic dictionary nor the basic dictionary contains the current encoding to be decoded, without using a pre-stored decoding dictionary corresponding to the encoded data.

[0108] Figure 5 This is a flowchart illustrating another data decoding method provided in this embodiment. This embodiment optimizes the various optional solutions in the above embodiments. Specifically, the method includes the following steps:

[0109] Step 501: Obtain the encoded data to be decoded.

[0110] Step 502: Determine the current encoding to be decoded from the encoded data.

[0111] Step 503: Determine whether the current encoding to be decoded exists in the second dynamic dictionary. If yes, proceed to step 509; otherwise, proceed to step 504.

[0112] Step 504: Determine if the basic dictionary contains the current encoding to be decoded. If yes, proceed to step 505; otherwise, proceed to step 507.

[0113] Step 505: Obtain the basic character corresponding to the current encoding to be decoded from the basic dictionary.

[0114] Step 506: Use the obtained basic character as the index value corresponding to the current encoding to be decoded, and write it into the second dynamic dictionary. Then execute step 509.

[0115] Step 507: Concatenate the target character based on the most recently determined target decoder to obtain the concatenated decoder, where the target character is the character in the most recently obtained target decoder.

[0116] Step 508: Use the concatenated decoding as the index value corresponding to the current encoding to be decoded, and write it into the second dynamic dictionary. Then execute step 509.

[0117] Step 509: Determine the index value corresponding to the current code to be decoded in the second dynamic dictionary as the target decoder corresponding to the current code to be decoded.

[0118] Step 510: Determine whether all encodings in the encoded data have been assigned to a specific target decoder. If yes, proceed to step 511; otherwise, return to step 502.

[0119] Step 511: Determine the original data corresponding to the encoded data according to all the determined target decodings.

[0120] To facilitate understanding of the technical solution of the embodiments of the present disclosure, the following continues with the above specific example for illustration. Suppose the original data "对对对对对对w对对wwwwwwwwww测试测试&*" is encoded as [23545, e0, e1, 119, e0, 119, e3, e4, e5, 27979, e6, 38, 42], that is, the encoded data to be decoded is [23545, e0, e1, 119, e0, 119, e3, e4, e5, 27979, e6, 38, 42].

[0121] Figure 6 A schematic diagram of a data encoding process provided by an embodiment of the present disclosure is shown in Figure 6 As shown, the probe P detects the first digit "23545" of the encoded data to be decoded (that is, the object to be decoded) as the current encoded code to be decoded determined from the encoded data. Since it is the first encoded code to be decoded and the second dynamic dictionary is empty, the base dictionary can be directly queried. The corresponding base character "对" in the base dictionary is written into the second dynamic dictionary as the corresponding index value. The second dynamic dictionary is used for decoding, and the corresponding target decoding (that is, the current decoding result) is "对", and the corresponding character decoding (that is, the target character) is "对". Detect the second digit "e0", which does not exist in both the second dynamic dictionary and the base dictionary. Then, the target character "对" is concatenated based on the nearest target decoding "对" to obtain the concatenated decoding "对对", which is written into the second dynamic dictionary, and the current target decoding "对对" is obtained. Continue to detect the third digit "e1", which does not exist in both the second dynamic dictionary and the base dictionary. Then, the target character "对" is concatenated based on the nearest target decoding "对对" to obtain the concatenated decoding "对对对", which is written into the second dynamic dictionary, and the current target decoding "对对对" is obtained. The total decoding result is "对对对对对对". And so on, the original data "对对对对对对w对对wwwwwwwwww测试测试&*" after decoding can be finally obtained.

[0122] The data encoding method provided by the embodiments of the present disclosure uses a decoding dictionary dynamically generated according to the base dictionary when decoding the encoded data. If the current encoded code to be decoded does not exist in the dynamic dictionary, it is judged whether it exists in the base dictionary. If it exists, the dynamic dictionary can be quickly updated and the corresponding target decoding can be determined. If it does not exist in the base dictionary, the nearest determined target decoding is concatenated with the characters in the target decoding to obtain the decoding result of consecutive repeated characters. There is no need to pre-store the decoding dictionary corresponding to the encoded data, reducing the occupation of storage resources and the maintenance cost of the encoding dictionary, and ensuring data security.

[0123] Figure 7 This is a schematic diagram of the structure of a data encoding device provided in an embodiment of the present disclosure, as shown below. Figure 7 As shown, the device includes:

[0124] The raw data acquisition module 701 is used to acquire the raw data to be encoded;

[0125] Encoding module 702 is used to encode the original data using a first dynamic dictionary to obtain encoded data corresponding to the original data. The first dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the original data during the encoding process. For consecutive repeating characters in the original data that do not exist in the base dictionary, a preset identifier is determined as the target code corresponding to the consecutive repeating characters. The preset identifiers corresponding to different consecutive repeating characters are all different, and the preset identifiers are different from the base codes in the base dictionary.

[0126] The data encoding device provided in this embodiment uses an encoding dictionary that is dynamically generated based on a basic dictionary when encoding raw data. Continuous repeated characters that do not exist in the basic dictionary are encoded using preset identifiers that are different from the basic encodings in the basic dictionary. The dynamic dictionary after encoding does not need to be stored or maintained, reducing the occupation of storage resources and the maintenance cost of the encoding dictionary. It can ensure a certain data compression rate while ensuring data security.

[0127] Optionally, the encoding module includes:

[0128] A string determination unit is used to determine the current string to be encoded from the original data;

[0129] The basic encoding acquisition unit is used to acquire the basic encoding corresponding to the current string to be encoded from the basic dictionary if the current string to be encoded does not exist in the first dynamic dictionary and the number of characters in the current string to be encoded is consistent with the number of unit characters corresponding to the basic dictionary.

[0130] The first writing unit is used to write the acquired basic encoding as the index symbol corresponding to the current string to be encoded into the first dynamic dictionary;

[0131] The target encoding determination unit is used to determine the index symbol corresponding to the current string to be encoded in the first dynamic dictionary as the target encoding corresponding to the current string to be encoded.

[0132] The encoding data determination unit is used to determine the encoding data corresponding to the original data based on all the determined target codes if all characters in the original data have been determined to have corresponding target codes.

[0133] Optionally, the encoding module may also include:

[0134] The first character acquisition unit is used to acquire the next character to be encoded from the original data after determining the current string to be encoded from the original data, if the current string to be encoded exists in the first dynamic dictionary.

[0135] The concatenation unit is used to concatenate the acquired character to be encoded with the current character to be encoded if the acquired character to be encoded is the same as the character in the current character to be encoded, so as to update the current character to be encoded.

[0136] The target preset identifier determination unit is used to determine the last used preset identifier in the preset identifier sequence if there is no updated current string to be encoded in the first dynamic dictionary, and to determine the next preset identifier of the last used preset identifier as the target preset identifier.

[0137] The second writing unit is used to write the target preset identifier as the index symbol corresponding to the updated current string to be encoded into the first dynamic dictionary.

[0138] Optionally, the encoding module may also include:

[0139] The second character acquisition unit is used to, after concatenating the acquired character to be encoded with the current string to be encoded to update the current string to be encoded, continue to acquire the next character to be encoded from the original data if the updated current string to be encoded exists in the first dynamic dictionary.

[0140] The target encoding determination unit is further configured to, after obtaining the next character to be encoded from the original data, if the obtained character to be encoded is different from the character in the current character to be encoded, determine the index symbol corresponding to the current character to be encoded in the first dynamic dictionary as the target encoding of the current character to be encoded.

[0141] Optionally, the step of determining the last used preset identifier in the preset identifier sequence if the updated current string to be encoded does not exist in the first dynamic dictionary includes: if the updated current string to be encoded does not exist in the first dynamic dictionary, determining whether the number of characters in the updated current string to be encoded is greater than or equal to a preset threshold; if not, determining the last used preset identifier in the preset identifier sequence.

[0142] Optionally, the encoding module may also include:

[0143] The splitting unit is used to, after determining whether the number of characters in the updated current string to be encoded is greater than or equal to a preset threshold, perform splitting processing on the updated current string to be encoded using at least one splitting method to obtain at least one set of substrings to be encoded, wherein the set of substrings to be encoded includes at least two substrings to be encoded.

[0144] A target set determination unit is used to determine a target set of substrings to be encoded from the at least one set of substrings to be encoded.

[0145] An index symbol acquisition unit is used to acquire, from the first dynamic dictionary, the index symbols corresponding to at least two substrings to be encoded in the target substring set respectively;

[0146] The symbol concatenation unit is used to concatenate the acquired index symbols and determine the concatenation result as the target encoding corresponding to the current string to be encoded.

[0147] Optionally, the raw data acquisition module includes:

[0148] The identification data acquisition unit is used to acquire identification data from business data, wherein each line of the identification data stores one piece of identification information;

[0149] The padding unit is used to determine whether the number of bits occupied by the current identification information in each row of the identification data reaches the preset number of bits threshold. If it does not reach the preset number of bits threshold, the current identification information is padded with a preset character so that the number of bits occupied by the current identification information after padding reaches the preset number of bits threshold.

[0150] The conversion unit is used to perform row and column conversion on the identification data to obtain the original data to be encoded.

[0151] The data encoding apparatus provided in this disclosure can execute the data encoding method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.

[0152] Figure 8 This is a schematic diagram of the structure of a data encoding device provided in an embodiment of the present disclosure, as shown below. Figure 8 As shown, the device includes:

[0153] The encoded data acquisition module 801 is used to acquire the encoded data to be decoded;

[0154] The decoding module 802 is used to decode the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data. The second dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the encoded data during the decoding process. For encodings in the encoded data that do not exist in the base dictionary, the characters in the most recently determined target decoder are used for decoding.

[0155] The data decoding device provided in this embodiment uses a decoding dictionary that is dynamically generated based on a basic dictionary when decoding encoded data. The encoding of consecutive repeating characters that do not exist in the basic dictionary can be determined based on the most recently determined decoding. It does not require pre-storing the decoding dictionary corresponding to the encoded data, thereby reducing the occupation of storage resources and the maintenance cost of the encoding dictionary, and ensuring data security.

[0156] Optionally, the decoding module includes:

[0157] The code to be decoded is determined from the encoded data;

[0158] The basic character acquisition unit is used to query the basic dictionary to see if the current code to be decoded exists if the current code to be decoded does not exist in the second dynamic dictionary; if it does exist, the basic character corresponding to the current code to be decoded is obtained from the basic dictionary.

[0159] The first writing unit is used to write the acquired basic character as the index value corresponding to the current encoding to be decoded into the second dynamic dictionary;

[0160] The target decoding determination unit is used to determine the index value corresponding to the current code to be decoded in the second dynamic dictionary as the target decoder corresponding to the current code to be decoded;

[0161] The original data determination unit is used to determine the original data corresponding to the encoded data based on all the determined target decoders if all the encodings in the encoded data have been determined.

[0162] Optionally, the decoding module also includes:

[0163] The target character concatenation unit is used to concatenate the target character based on the most recently determined target decoder after querying the basic dictionary to see if the current code to be decoded exists. If it does not exist, the target character is the character in the most recently obtained target decoder.

[0164] The second writing unit is used to write the concatenated decoding as the index value corresponding to the current encoding to be decoded into the second dynamic dictionary.

[0165] The data decoding apparatus provided in this disclosure can execute the data decoding method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.

[0166] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.

[0167] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 9 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 9 The diagram below shows the structure of the terminal device or server 900. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 9 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0168] like Figure 9 As shown, the electronic device 900 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An edit / output (I / O) interface 905 is also connected to the bus 904.

[0169] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 9An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0170] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by a processing device 901, it performs the functions defined in the methods of embodiments of this disclosure.

[0171] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0172] The electronic device provided in this embodiment belongs to the same inventive concept as the data encoding method and / or data decoding method provided in the above embodiments. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0173] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the data encoding and / or data decoding methods provided in the above embodiments.

[0174] This disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the data encoding method and / or data decoding method provided in the above embodiments.

[0175] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0176] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0177] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0178] The aforementioned computer-readable medium carries one or more programs. When the aforementioned one or more programs are executed by the electronic device, the electronic device causes the electronic device to: acquire raw data to be encoded; encode the raw data using a first dynamic dictionary to obtain encoded data corresponding to the raw data, wherein the first dynamic dictionary is a dictionary dynamically updated based on a base dictionary and the raw data during the encoding process of the raw data. For consecutive repeating characters in the raw data that do not exist in the base dictionary, a preset identifier is determined as the target code corresponding to the consecutive repeating characters. The preset identifiers corresponding to different consecutive repeating characters are all different, and the preset identifiers are different from the base codes in the base dictionary.

[0179] Alternatively, the aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire encoded data to be decoded; and decode the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data, wherein the second dynamic dictionary is a dictionary dynamically updated based on a base dictionary and the encoded data during the decoding process, and for encodings in the encoded data that do not exist in the base dictionary, decodes them using characters from the most recently determined target decoder.

[0180] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0181] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0182] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a module does not necessarily limit the module itself; for example, a raw data acquisition module can also be described as "a module for acquiring raw data to be encoded".

[0183] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0184] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0185] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0186] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0187] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A data encoding method, characterized in that, include: Obtain the raw data to be encoded; The original data is encoded using a first dynamic dictionary to obtain the encoded data corresponding to the original data. The first dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the original data during the encoding process. For consecutive repeated characters in the original data that do not exist in the base dictionary, a preset identifier is determined as the target code corresponding to the consecutive repeated characters. The preset identifiers corresponding to different consecutive repeated characters are all different, and the preset identifiers are different from the base codes in the base dictionary.

2. The method according to claim 1, characterized in that, The original data is encoded using a first dynamic dictionary to obtain encoded data corresponding to the original data, including: Determine the current string to be encoded from the original data; If the current string to be encoded does not exist in the first dynamic dictionary, and the number of characters in the current string to be encoded is the same as the number of units of characters corresponding to the basic dictionary, then the basic encoding corresponding to the current string to be encoded is obtained from the basic dictionary. The obtained basic encoding is used as the index symbol corresponding to the current string to be encoded and written into the first dynamic dictionary; The index symbol corresponding to the current string to be encoded in the first dynamic dictionary is determined as the target encoding corresponding to the current string to be encoded; If all characters in the original data have a corresponding target encoding, then the encoded data corresponding to the original data is determined based on all the determined target encodings.

3. The method according to claim 2, characterized in that, The preset identifier exists in a preset identifier sequence; wherein, after determining the current string to be encoded from the original data, the method further includes: If the current string to be encoded exists in the first dynamic dictionary, then the next character to be encoded is obtained from the original data; If the obtained character to be encoded is the same as the character in the current string to be encoded, then the obtained character to be encoded is concatenated with the current string to be encoded to update the current string to be encoded. If the updated current string to be encoded does not exist in the first dynamic dictionary, then the last used preset identifier in the preset identifier sequence is determined, and the next preset identifier of the last used preset identifier is determined as the target preset identifier; The target preset identifier is used as the index symbol corresponding to the updated current string to be encoded and written into the first dynamic dictionary.

4. The method according to claim 3, characterized in that, After concatenating the acquired character to be encoded with the current string to be encoded to update the current string, the process also includes: If the updated string to be encoded exists in the first dynamic dictionary, then the next character to be encoded is obtained from the original data.

5. The method according to claim 3, characterized in that, After obtaining the next character to be encoded from the original data, the process further includes: If the obtained character to be encoded is different from the character in the current string to be encoded, then the index symbol corresponding to the current string to be encoded in the first dynamic dictionary is determined as the target encoding corresponding to the current string to be encoded.

6. The method according to claim 3, characterized in that, If the updated current string to be encoded does not exist in the first dynamic dictionary, then determining the last used preset identifier in the preset identifier sequence includes: If the updated current string to be encoded does not exist in the first dynamic dictionary, then determine whether the number of characters in the updated current string to be encoded is greater than or equal to a preset threshold. If not, then determine the last used preset identifier in the preset identifier sequence.

7. The method according to claim 6, characterized in that, After determining whether the number of characters in the updated string to be encoded is greater than or equal to a preset threshold, the process also includes: If so, the updated current string to be encoded is split in at least one way to obtain at least one set of substrings to be encoded, wherein the set of substrings to be encoded includes at least two substrings to be encoded. Determine the target set of substrings to be encoded from the at least one set of substrings to be encoded; Obtain the index symbols corresponding to at least two substrings to be encoded from the target substring set from the first dynamic dictionary; The obtained index symbols are concatenated, and the concatenation result is determined as the target encoding corresponding to the current string to be encoded.

8. The method according to any one of claims 1-7, characterized in that, The process of obtaining the raw data to be encoded includes: Obtain the identification data from the business data, wherein each line of the identification data stores one piece of identification information; For each row of identifier information stored in the identifier data, it is determined whether the number of bits occupied by the current identifier information reaches the preset number of bits threshold. If not, a preset character is used to fill in the current identifier information so that the number of bits occupied by the current identifier information after the filling process reaches the preset number of bits threshold. The identification data is transformed into rows and columns to obtain the original data to be encoded.

9. A data decoding method, characterized in that, include: Obtain the encoded data to be decoded; The encoded data is decoded using a second dynamic dictionary to obtain the original data corresponding to the encoded data. The second dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the encoded data during the decoding process. For encodings in the encoded data that do not exist in the base dictionary, characters from the most recently determined target decoder are used for decoding.

10. The method according to claim 9, characterized in that, The step of decoding the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data includes: Determine the current encoding to be decoded from the encoded data; If the current code to be decoded does not exist in the second dynamic dictionary, then the basic dictionary is queried to see if the current code to be decoded exists. If it does, the basic character corresponding to the current code to be decoded is obtained from the basic dictionary. The acquired basic character is used as the index value corresponding to the current encoding to be decoded and written into the second dynamic dictionary; The index value corresponding to the current code to be decoded in the second dynamic dictionary is determined as the target decoder corresponding to the current code to be decoded; If all the encodings in the encoded data have a corresponding target decoder, then the original data corresponding to the encoded data is determined based on all the determined target decoders.

11. The method according to claim 10, characterized in that, After querying the basic dictionary to see if the current encoding to be decoded exists, the following steps are also included: If it does not exist, then the target character is concatenated based on the most recently determined target decoder to obtain the concatenated decoder, wherein the target character is the character in the most recently obtained target decoder; The concatenated decoding is used as the index value corresponding to the current encoding to be decoded and written into the second dynamic dictionary.

12. A data encoding device, characterized in that, include: The raw data acquisition module is used to acquire the raw data to be encoded. An encoding module is used to encode the original data using a first dynamic dictionary to obtain encoded data corresponding to the original data. The first dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the original data during the encoding process. For consecutive repeating characters in the original data that do not exist in the base dictionary, a preset identifier is determined as the target code corresponding to the consecutive repeating characters. The preset identifiers corresponding to different consecutive repeating characters are all different, and the preset identifiers are different from the base codes in the base dictionary.

13. A data decoding device, characterized in that, include: The encoded data acquisition module is used to acquire the encoded data to be decoded; The decoding module is used to decode the encoded data using a second dynamic dictionary to obtain the original data corresponding to the encoded data. The second dynamic dictionary is a dictionary that is dynamically updated based on a base dictionary and the encoded data during the decoding process. For encodings in the encoded data that do not exist in the base dictionary, the characters in the most recently determined target decoder are used for decoding.

14. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-11.

15. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the method as described in any one of claims 1-11.

16. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-11.