WO2021051532A1 - 数据压缩方法、装置、设备及计算机可读存储介质 - Google Patents

数据压缩方法、装置、设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2021051532A1
WO2021051532A1 PCT/CN2019/117104 CN2019117104W WO2021051532A1 WO 2021051532 A1 WO2021051532 A1 WO 2021051532A1 CN 2019117104 W CN2019117104 W CN 2019117104W WO 2021051532 A1 WO2021051532 A1 WO 2021051532A1
Authority
WO
WIPO (PCT)
Prior art keywords
compressed
data
label
prefix
subscript
Prior art date
Application number
PCT/CN2019/117104
Other languages
English (en)
French (fr)
Inventor
张�杰
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021051532A1 publication Critical patent/WO2021051532A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/3059Digital compression and data reduction techniques where the original information is represented by a subset or similar information, e.g. lossy compression

Definitions

  • This application relates to the field of data processing technology, in particular to data compression methods, devices, equipment, and computer-readable storage media.
  • Data compression is a technical method to reduce the amount of original data to reduce storage space and improve its transmission, storage and processing efficiency without losing useful information.
  • a string compression algorithm is usually used when compressing original data.
  • the most commonly used string compression algorithm generally compresses a string in which the same character appears consecutively. For example, if the string to be compressed is aabccccaaa, it will be a2b1c4a3 after compression.
  • the inventor realizes that the application range of this compression method is very narrow, and the compression ratio is also limited. For large projects that store hundreds of millions of data, the compression ratio is far from enough.
  • the main purpose of this application is to provide a data compression method, device, equipment, and computer-readable storage medium, aiming to solve the technical problem of low compression rate of the existing data compression method.
  • the first aspect of the present application provides a data compression method, including: acquiring data to be compressed, and classifying the data to be compressed, wherein the data to be compressed includes data with numerical values and data without Numerical data; identifying the classified data to be compressed, determining the label and value with numerical data, and determining the label without numerical data, wherein the label includes a label prefix and a label Subscript, the label prefix is a letter, and the label subscript and value are numbers; the label subscript and value with numerical data are compressed based on a preset algorithm, and the label subscript without numerical data is performed Compress to obtain the compressed label subscript and the compressed value; query the label prefix of the data to be compressed to determine whether there is continuous data to be compressed with the same label prefix; if there is no continuous label with the same prefix For the data to be compressed with the tag prefix, a second preset symbol is inserted between the tag prefix and the compressed tag subscript; based on the tag prefix, the second preset symbol,
  • a second aspect of the present application provides a data compression device, including: a classification module for obtaining data to be compressed and classifying the data to be compressed, wherein the data to be compressed includes data with numerical values and data without Numerical data; a division module for identifying the classified data to be compressed, determining the label and value with numerical data, and determining the label without numerical data, wherein the label It includes label prefix and label subscript.
  • the label prefix is a letter, and the label subscript and value are numbers;
  • the compression module is used to compress the label subscript and value with numerical data based on a preset algorithm, and to The label subscript without numerical data is compressed to obtain the compressed label subscript and the compressed value;
  • the query module is used to query the label prefix of the data to be compressed to determine whether there are consecutive labels with the same The data to be compressed of the label prefix; an insertion module for inserting a second preset symbol between the label prefix and the compressed label subscript if there is no continuous data to be compressed with the same label prefix ;
  • Output module based on the tag prefix, the second preset symbol, the compressed tag subscript, or the tag prefix, the second preset symbol, the compressed tag Mark the compressed value to obtain compressed data, and output the compressed data.
  • a third aspect of the present application provides a data compression device, including: a memory and at least one processor, the memory stores instructions, the memory and the at least one processor are interconnected by wires; the at least one processor The instruction in the memory is invoked, so that the data compression device executes the method described in the first aspect.
  • the fourth aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer instructions, and when the computer instructions run on a computer, the computer executes the above-mentioned first aspect method.
  • the data compression method, device, equipment, and computer-readable storage medium provided by this application first obtain the data to be compressed, and classify the data to be compressed into numerical data and non-numerical data; Identify the data to be compressed, determine the labels and values with numerical data and labels without numerical data.
  • the labels include label prefixes and label subscripts; compress the label subscripts and values with numerical data based on a preset algorithm , Compress the label subscripts without numerical data to obtain the compressed label subscript and the compressed value; further query the label prefix of the compressed data, if there is no continuous waiting with the same label prefix To compress data, insert the second preset symbol between the tag prefix and the compressed tag subscript; finally, based on the tag prefix, the second preset symbol, the compressed tag subscript, or the tag prefix, the second preset symbol Set the symbol, the compressed label subscript and the compressed value to obtain the compressed data, and output the compressed data.
  • the data compression method proposed in this application uses a preset algorithm to compress the label subscript and value part of the compressed data separately, which can save nearly half of the memory space and greatly improve the data compression rate; at the same time, after the label prefix and compression The second preset symbol is inserted between the label subscripts to improve the speed and accuracy of decompression.
  • FIG. 1 is a schematic diagram of the structure of a data compression device in a hardware operating environment involved in the solution of the embodiment in this application;
  • FIG. 2 is a schematic flowchart of an embodiment of a data compression method in this application
  • FIG. 3 is a schematic diagram of functional modules of an embodiment of the data compression device in this application.
  • FIG. 4 is a schematic diagram of functional units of a classification module in an embodiment of the data compression device in this application;
  • FIG. 5 is a schematic diagram of functional modules of another embodiment of the data compression device in this application.
  • FIG. 6 is a schematic diagram of functional modules of another embodiment of the data compression device in this application.
  • the embodiments of the application provide a data compression method, device, equipment, and storage medium.
  • the label subscript and value part of the compressed data are compressed separately by using a preset algorithm, which can save nearly half of the memory space and greatly improve the data. Compression rate; At the same time, a second preset symbol is inserted between the label prefix and the compressed label subscript to improve the speed and accuracy of decompression.
  • Fig. 1 is a schematic structural diagram of a data compression device in a hardware operating environment involved in a solution of an embodiment of the application.
  • the data compression device in the embodiment of the present application may be a terminal device with data processing capabilities, such as a portable computer and a server.
  • the data compression device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a data compression program.
  • the network interface 1004 is mainly used to connect to a back-end server and perform data communication with the back-end server;
  • the user interface 1003 is mainly used to connect to a client (user side) and perform data communication with the client;
  • the processor 1001 may be used to call a data compression program stored in the memory 1005, and execute the operations of the following data compression method embodiments.
  • FIG. 2 is a schematic flowchart of an embodiment of a data compression method according to the present application.
  • the data compression method includes:
  • Step S10 Obtain the data to be compressed, and classify the data to be compressed, where the data to be compressed includes data with numerical values and data without numerical values.
  • the data to be compressed is first obtained.
  • the data to be compressed can be divided into data with a numeric value and data without a numeric value.
  • the data with a numeric value includes two parts: a label and a value. It also includes label prefix and label subscript.
  • Data without numeric value only includes the label part.
  • the data to be compressed pa1001: 12 is data with numeric values, where pa1001 is the label, pa is the label prefix, 1001 is the label subscript, and 12 is the value.
  • the label and the value are separated by ":", the label part There is no need to separate the label prefix and the label subscript.
  • the data to be compressed pb1004 is data without numeric type.
  • pb1004 is the label
  • pb is the label prefix
  • 1004 is the label subscript.
  • the process of classifying the label data to be compressed is as follows: First, it is determined whether the label data to be compressed is label data with or without numerical value.
  • the label data to be compressed carries the first preset
  • the symbol ":” is label data with numerical value
  • the label before the first preset symbol ":” is the label
  • the value after the first preset symbol ":” is.
  • the first preset symbol may also be other symbols besides ":", such as "/", "*", etc.
  • the type of the first preset symbol is different here. Do restrictions.
  • Step S20 Identify the classified data to be compressed, determine the label and value with numerical data, and determine the label without numerical data, where the label includes a label prefix and a label subscript, the label prefix is a letter, and the label Subscripts and values are numbers.
  • the label prefix, label subscript and/or value of the data to be compressed is divided.
  • the label prefix is a letter
  • the label subscript and value are numbers.
  • step S30 the label subscripts and values with numerical data are compressed based on the preset algorithm, and the label subscripts without numerical data are compressed to obtain the compressed label subscript and the compressed value.
  • the label subscript and/or value of the data to be compressed are determined, the label subscript and/or value are compressed based on a preset compression algorithm.
  • the data is compressed according to the type of data to be compressed. Different, can be divided into different compression methods.
  • the label part and the value part of the data to be compressed are compressed separately; if the data to be compressed is data without a numeric value, only the label part of the data to be compressed is performed compression.
  • the label includes a label prefix and a label subscript. In this embodiment, when the label part is compressed, only the label subscript is compressed, and the label prefix does not need to be compressed.
  • the 62-ary compression method is used to compress the label subscript and/or the value part of the label part.
  • the so-called 62-ary compression method refers to the use of the 9 numbers 0-9 to represent the 9 numbers 0-9 in turn.
  • the 26 lowercase letters az correspond to the 25 digits between 10 and 35
  • the 26 uppercase letters AZ correspond to the 25 digits between 36 and 61.
  • the number 8 is represented by the 62 base or 8 and the number 12 is represented by the 62 base is the lowercase letter c.
  • Step S40 Query the label prefix of the data to be compressed to determine whether there are consecutive data to be compressed with the same label prefix; if not, perform step S50.
  • the label prefix of the data to be compressed is queried to determine the data to be compressed Whether there is continuous data to be compressed with the same label prefix in the data, for continuous data to be compressed with the same label prefix, the number of the same label prefix can be simplified in the compressed data, and the same label is continuous You can keep only one prefix to improve the data compression rate.
  • Step S50 inserting a second preset symbol between the label prefix and the compressed label subscript.
  • a second preset symbol is inserted between the uncompressed label prefix and the compressed label subscript to distinguish between the prefix and the subscript.
  • the data obtained after compression by the preset algorithm is pag9. If the corresponding symbols are not inserted to distinguish, it will not be possible to identify which of the compressed data are label prefixes and which are Label subscript. For example, there may be cases where pa is a label prefix and g9 is a label subscript, or there may be cases where p is a label prefix and ag9 is a label subscript, which is not conducive to subsequent accurate decompression.
  • the first preset symbol is different from the second preset symbol. After the second preset symbol is inserted, the compression process of the data to be compressed is completed.
  • Step S60 Obtain compressed data based on the label prefix, the second preset symbol, the compressed label subscript, or the label prefix, the second preset symbol, the compressed label subscript, and the compressed value, and output The compressed data.
  • the label prefix pa is not compressed, and the label subscript is compressed to g9.
  • the middle of the label subscript and the value part is the first preset symbol
  • the label prefix pa is not compressed
  • the label subscript is compressed to g9
  • the value part is compressed to c.
  • the label prefix, label subscript, and value part of the data to be decompressed can be accurately distinguished, so as to improve the accuracy of decompression.
  • the labels include label prefixes and label subscripts; based on a preset algorithm, the label subscripts and values with numerical data are compressed, and the label subscripts without numerical data are compressed, Obtain the compressed label subscript and the compressed value; further query the label prefix of the compressed data.
  • the label prefix and the compressed label subscript Insert the second preset symbol between; finally, based on the label prefix, the second preset symbol, the compressed label subscript, or the label prefix, the second preset symbol, the compressed label subscript and the compressed value , Get the compressed data, and output the compressed data.
  • the data compression method proposed in this application uses a preset algorithm to compress the label subscript and value part of the compressed data separately, which can save nearly half of the memory space and greatly improve the data compression rate; at the same time, after the label prefix and compression The second preset symbol is inserted between the label subscripts to improve the speed and accuracy of decompression.
  • step S40 it further includes:
  • Step S70 if there are n consecutive data to be compressed with the same label prefix, the number of the same label prefix in the compressed data is simplified to one, where n ⁇ 2;
  • Step S80 inserting a second preset symbol between the same label prefix and the compressed label subscript
  • Step S90 placing the same label prefix on the left side of the second preset symbol, and placing the different label subscripts and values corresponding to the same label prefix on the right side of the second preset symbol in order;
  • Step S100 when the data to be compressed with different label prefixes appear after n consecutive data to be compressed with the same label prefix, after the label subscript or value of the nth consecutive data to be compressed with the same label prefix , Insert the third preset symbol before the different label prefix.
  • multiple consecutive data to be compressed can be The same tag prefix in the data is placed on the left side of the second preset symbol, and different tag subscripts and/or values in the multiple to-be-compressed data are placed on the right side of the second preset symbol in sequence to improve the compression rate.
  • the third preset symbol is inserted after the value or label subscript of the data to be compressed corresponding to the last continuous same label prefix and before the different label prefix , To indicate that the tag prefixes of the data to be compressed before and after the third preset symbol are different.
  • the third preset symbol "#" is used before the position of the different label prefix appears in the compressed data.
  • the third preset symbol can also be in other forms, such as "/", ",", etc.
  • the form of the third preset symbol is not limited.
  • the compression process in this embodiment is exemplified.
  • the data to be compressed is pa1001:12, pa1002:35, pa1003:63, pb1004:23, pb1005:26, pb1006:27, pb1007:13, and the above data to be compressed includes 7 data.
  • the data before compression is 69 bytes, and the data after compression is 40 bytes, so the compression ratio reaches 58%. If there are more data to be compressed with the same tag prefix, the compression rate will be higher.
  • the above-mentioned data to be compressed includes 7 data.
  • the data before compression has 48 bytes, but after compression only 26 bytes, the compression rate reaches 54%. Similarly, if there are more data to be compressed with the same label prefix, the compression rate will be higher.
  • the number of the same label prefixes is simplified after compression, and the same label prefix is placed in the second preset symbol On the left side of, different label subscripts and/or values corresponding to the same label prefix are placed on the right side of the second preset symbol in order to improve the data compression rate.
  • FIG. 3 is a schematic diagram of functional modules of an embodiment of a data compression device according to the present application.
  • the data compression device includes:
  • the classification module 10 is configured to obtain the data to be compressed and classify the data to be compressed, wherein the data to be compressed includes data with numerical values and data without numerical values;
  • the dividing module 20 is configured to identify the classified data to be compressed, determine the label and the value with the numerical data, and determine the label without the numerical data, wherein the label includes a label prefix And the label subscript, the label prefix is a letter, and the label subscript and value are numbers;
  • the compression module 30 is configured to compress the label subscripts and values with numerical data based on a preset algorithm, and compress the label subscripts without numerical data, to obtain the compressed label subscripts and The compressed value;
  • the query module 40 is configured to query the label prefix of the data to be compressed, and determine whether there is continuous data to be compressed with the same label prefix;
  • the inserting module 50 is configured to insert a second preset symbol between the label prefix and the compressed label subscript if there is no continuous data to be compressed with the same label prefix;
  • the output module 60 is configured to be based on the tag prefix, the second preset symbol, the compressed tag subscript, or the tag prefix, the second preset symbol, and the compressed tag subscript Mark the compressed value to obtain compressed data, and output the compressed data.
  • the classification module 10 includes:
  • the query unit 101 is configured to obtain data to be compressed, perform a query in the data to be compressed, and determine whether the data to be compressed includes a first preset symbol;
  • the determining unit 102 is configured to determine the to-be-compressed data including the first preset symbol as data with a numeric value, and determine the data to be compressed that does not include the first preset symbol as data without a numeric value.
  • the data compression device further includes:
  • the simplification module 70 is configured to, if there are n consecutive data to be compressed with the same label prefix, reduce the number of the same label prefix in the compressed data to one, where n ⁇ 2;
  • a simplified insertion module 80 configured to insert a second preset symbol between the same label prefix and the compressed label subscript
  • the arranging module 90 is configured to place the same label prefix on the left side of the second preset symbol, and place the different label subscripts and values corresponding to the same label prefix on the right side of the second preset symbol in sequence .
  • the data compression device further includes:
  • the connection module 100 is configured to: when the data to be compressed with different label prefixes appear after the n consecutive data to be compressed with the same label prefix, the label of the nth continuous data to be compressed with the same label prefix After the subscript or value, and before the different label prefix, a third preset symbol is inserted.
  • compression module 30 is specifically configured to:
  • the label subscript and the value of the data to be compressed are compressed respectively to obtain the compressed label subscript and the compressed value; if the to be compressed If the data is data without a numeric value, the label subscript of the data to be compressed is compressed to obtain the compressed label subscript.
  • the present application also provides a data compression device, including: a memory and at least one processor, the memory stores instructions, the memory and the at least one processor are interconnected by wires; the at least one processor calls the The instructions in the memory enable the data compression device to execute the steps in the above data compression method.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
  • the computer-readable storage medium stores computer instructions, and when the computer instructions are executed on the computer, the computer executes the following steps:
  • Identify the classified data to be compressed determine the label and value with numerical data, and determine the label without numerical data, wherein the label includes a label prefix and a label subscript.
  • the prefix is a letter, and the label subscript and value are numbers;

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

一种数据压缩方法、装置、设备及计算机可读存储介质。方法包括:获取待压缩数据,对待压缩数据进行分类;对分类后的待压缩数据进行识别,确定带数值型数据的标签和数值,以及不带数值型数据的标签,标签包括标签前缀和标签下标;对带数值型数据的标签下标和数值进行压缩;对待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;若不存在,则在标签前缀和压缩后的标签下标之间插入第二预设符号;基于标签前缀、第二预设符号、压缩后的标签下标,或标签前缀、第二预设符号、压缩后的标签下标、压缩后的数值,得到压缩后的数据,并输出压缩后的数据。提高了数据压缩率。

Description

数据压缩方法、装置、设备及计算机可读存储介质
本申请要求于2019年9月16日提交中国专利局、申请号为201910871503.9、发明名称为“数据压缩方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及数据处理技术领域,尤其涉及数据压缩方法、装置、设备及计算机可读存储介质。
背景技术
数据压缩是在不丢失有用信息的前提下,缩减原始数据的数据量以减少存储空间,提高其传输、存储和处理效率的一种技术方法。现有技术中,对原始数据进行压缩时通常使用字符串压缩算法,目前,最常用的字符串压缩算法一般是针对连续出现相同字符的字符串进行压缩。例如,待压缩字符串为aabccccaaa,则压缩后为a2b1c4a3。发明人意识到这种压缩方法的应用范围非常狭窄,压缩比例也有限,对于存储了数亿级数据的大型项目来说,压缩率远远不够。
发明内容
本申请的主要目的在于提供一种数据压缩方法、装置、设备及计算机可读存储介质,旨在解决现有的数据压缩方法压缩率低的技术问题。
为实现上述目的,本申请第一方面提供了一种数据压缩方法,包括:获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字;基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;基于所述标签前 缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
本申请第二方面提供了一种数据压缩装置,包括:分类模块,用于获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;划分模块,用于对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字;压缩模块,用于基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;查询模块,用于对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;插入模块,用于若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;输出模块,用于基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
本申请第三方面提供了一种数据压缩设备,包括:存储器和至少一个处理器,所述存储器中存储有指令,所述存储器和所述至少一个处理器通过线路互联;所述至少一个处理器调用所述存储器中的所述指令,以使得所述数据压缩设备执行上述第一方面所述的方法。
本申请的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行上述第一方面所述的方法。
本申请提供的一种数据压缩方法、装置、设备及计算机可读存储介质,首先获取待压缩数据,并对待压缩数据进行分类,分为带数值型数据和不带数值型数据;对分类后的待压缩数据进行识别,确定带数值型数据的标签和数值以及不带数值型数据的标签,标签包括标签前缀和标签下标;基于预设算法对带数值型数据的标签下标和数值进行压缩,对不带数值型数据的标签下标进行压 缩,得到压缩后的标签下标和压缩后的数值;进一步地对待压缩数据的标签前缀进行查询,如果不存在连续的带有相同标签前缀的待压缩数据,则在标签前缀和压缩后的标签下标之间插入第二预设符号;最后,基于标签前缀、第二预设符号、压缩后的标签下标,或是标签前缀、第二预设符号、压缩后的标签下标及压缩后的数值,得到压缩后的数据,并输出压缩后的数据。本申请提出的数据压缩方法,采用预设算法对待压缩数据的标签下标和数值部分分别进行压缩,可以节省接近一半的内存空间,极大地提高了数据压缩率;同时,在标签前缀和压缩后的标签下标之间插入第二预设符号,提高了解压的速度及正确率。
附图说明
图1为本申请中实施例方案涉及的硬件运行环境的数据压缩设备结构示意图;
图2为本申请中数据压缩方法一实施例的流程示意图;
图3为本申请中数据压缩装置一实施例的功能模块示意图;
图4为本申请中数据压缩装置一实施例中分类模块的功能单元示意图;
图5为本申请中数据压缩装置另一实施例的功能模块示意图;
图6为本申请中数据压缩装置另一实施例的功能模块示意图。
具体实施方式
本申请实施例提供了一种数据压缩方法、装置、设备及存储介质,采用预设算法对待压缩数据的标签下标和数值部分分别进行压缩,可以节省接近一半的内存空间,极大地提高了数据压缩率;同时,在标签前缀和压缩后的标签下标之间插入第二预设符号,提高了解压的速度及正确率。
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例进行描述。
如图1所示,图1为本申请实施例方案涉及的硬件运行环境的数据压缩设备结构示意图。
本申请实施例中的数据压缩设备可以是便携计算机、服务器等具有数据处理能力的终端设备。
如图1所示,该数据压缩设备可以包括:处理器1001,例如CPU,网络 接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选地可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选地还可以是独立于前述处理器1001的存储装置。
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及数据压缩程序。
在图1所示的数据压缩设备中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的数据压缩程序,并执行以下数据压缩方法的各实施例的操作。
参照图2,图2为本申请数据压缩方法一实施例的流程示意图,在该实施例中,数据压缩方法包括:
步骤S10,获取待压缩数据,并对待压缩数据进行分类,其中,待压缩数据包括带数值型数据和不带数值型数据。
在本实施例中,首先获取待压缩的数据,具体地,待压缩数据可以分为带数值型的数据和不带数值型的数据,其中,带数值型的数据包括标签和数值两部分,标签还包括标签前缀和标签下标,不带数值型的数据只包括标签部分。例如,待压缩的数据pa1001:12是带数值型的数据,其中,pa1001为标签,pa为标签前缀,1001为标签下标,12为数值,标签和数值中间用“:”隔开,标签部分的标签前缀和标签下标之间不用符号隔开;又比如,待压缩的数据pb1004为不带数值型的数据,同样地,pb1004为标签,pb为标签前缀,1004为标签下标。
具体地,对待压缩的标签数据进行分类的过程如下:首先确定待压缩的标签数据是带数值型的标签数据,还是不带数值型的标签数据,待压缩的标签数据中带有第一预设符号“:”的为带数值型的标签数据,第一预设符号“:”前为标签,第一预设符号“:”后为数值。可以理解的是,在本实施例中,第一预 设符号还可以是除了“:”之外的其他符号,例如“/”、“*”等,在此对第一预设符号的类型不做限制。
步骤S20,对分类后的待压缩数据进行识别,确定带数值型数据的标签和数值,以及确定不带数值型数据的标签,其中,标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字。
进一步地,当确定是带数值型数据还是不带数值型数据后,对待压缩数据的标签前缀、标签下标和/或数值进行划分。具体地,标签前缀为字母,标签下标和数值为数字。
步骤S30,基于预设算法对带数值型数据的标签下标和数值进行压缩,以及对不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值。
进一步地,当确定待压缩数据的标签前缀、标签下标和/或数值之后,基于预设的压缩算法对标签下标和/或数值进行压缩,在压缩过程中,根据待压缩数据的类型的不同,可分为不同的压缩方式。
例如,若待压缩数据是带数值型的数据,则针对待压缩数据的标签部分和数值部分分别进行压缩;若待压缩数据是不带数值型的数据,则仅针对待压缩数据的标签部分进行压缩。其中,标签又包括标签前缀和标签下标,在本实施例中,在进行标签部分压缩时,仅对标签下标进行压缩,标签前缀不需要进行压缩。
进一步地,对标签部分的标签下标和/或数值部分进行压缩采用的是62进制压缩法,所谓62进制压缩法,是指使用0-9这9个数字依次表示0-9这9个数字本身,而使用a-z这26个小写字母对应表示10~35中间的这25个数字,并使用A-Z这26个大写字母对应表示36~61中间的25个数字。例如,数字8用62进制来表示还是8,而数字12用62进制来表示就是小写字母c。
以不带数值型的数据pa1001为例,举例说明62进制压缩方法的压缩过程:对待压缩数据pa1001进行划分,确定标签前缀pa和标签下标1001,标签前缀不进行压缩,对于标签下标1001,利用十进制-六十二进制的进制转换公式转换后为169,由于在62进制中,采用0-9这9个数字依次表示0-9这9个数字本身,采用a-z这26个小写字母对应表示10~35中间的这25个数字,16 在62进制中对应字母g,9在62进制中对应数字9,因此,标签下标1001经过62进制转换后为g 9。
步骤S40,对待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;若否,则执行步骤S50。
在本实施例中,为了进一步地提高数据压缩的效率,以及节省存储空间,当基于预设算法对标签下标和/或数值进行压缩后,对待压缩数据的标签前缀进行查询,判断待压缩数据中是否存在连续的带有相同标签前缀的待压缩数据,针对连续的带有相同标签前缀的待压缩数据,可以在压缩后的数据中对该相同标签前缀的个数进行简化,连续的相同标签前缀可以只保留一个,提高数据压缩率。
步骤S50,在标签前缀和压缩后的标签下标之间插入第二预设符号。
进一步地,当基于62进制压缩法对待压缩数据的标签部分和/或数值部分进行压缩后,为了提高压缩后的数据读取的准确度,便于后续压缩数据的解压,本实施例中,在未压缩的标签前缀和压缩后的标签下标之间插入第二预设符号,以便进行前缀和下标的区分。
例如,对于不带数值型数据pa1001而言,通过预设算法进行压缩后得到的数据为pag9,如果不插入相应的符号以进行区分,则无法识别压缩后的数据中哪些是标签前缀,哪些是标签下标。比如,可能存在pa是标签前缀、g 9是标签下标的情况,也可能存在p是标签前缀,ag9是标签下标的情况,不利于后续进行准确的解压。
因此,通过在压缩后的数据中插入第二预设符号,以进行标签前缀和标签下标的区分。具体地,可以是未压缩的标签前缀和压缩后的标签下标之间插入“=”以进行划分,还可以是插入其他的符号,比如“/”、“;”等,在本实施例中,对第二预设符号的形式并不作限制,当然,第一预设符号与第二预设符号不同,插入第二预设符号后,即完成了对待压缩数据的压缩过程。
步骤S60,基于标签前缀、第二预设符号、压缩后的标签下标,或标签前缀、第二预设符号、压缩后的标签下标、压缩后的数值,得到压缩后的数据,并输出压缩后的数据。
对于不带数值型数据pa1001而言,标签前缀pa不进行压缩,标签下标压 缩后为g9,在标签前缀和压缩后的标签下标之间插入第二预设符号“=”,因此,不带数值型数据pa1001压缩后为pa=g9;
对于带数值型数据pa1001:12而言,标签下标与数值部分中间是第一预设符号,标签前缀pa不进行压缩,标签下标压缩后为g9,数值部分压缩后为c,在标签前缀和压缩后的标签下标之间插入第二预设符号“=”。因此,带数值型数据pa1001:12压缩后为pa=g9:c。后续进行数据解压时,可以准确区分待解压数据的标签前缀、标签下标和数值部分,以便提高解压的准确度。
在本实施例中,首先获取待压缩数据,并对待压缩数据进行分类,分为带数值型数据和不带数值型数据;对分类后的待压缩数据进行识别,确定带数值型数据的标签和数值以及不带数值型数据的标签,标签包括标签前缀和标签下标;基于预设算法对带数值型数据的标签下标和数值进行压缩,对不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;进一步地对待压缩数据的标签前缀进行查询,如果不存在连续的带有相同标签前缀的待压缩数据,则在标签前缀和压缩后的标签下标之间插入第二预设符号;最后,基于标签前缀、第二预设符号、压缩后的标签下标,或是标签前缀、第二预设符号、压缩后的标签下标及压缩后的数值,得到压缩后的数据,并输出压缩后的数据。本申请提出的数据压缩方法,采用预设算法对待压缩数据的标签下标和数值部分分别进行压缩,可以节省接近一半的内存空间,极大地提高了数据压缩率;同时,在标签前缀和压缩后的标签下标之间插入第二预设符号,提高了解压的速度及正确率。
进一步地,在步骤S40之后,还包括:
步骤S70,若存在n个连续的带有相同标签前缀的待压缩数据,则将压缩后的数据中相同标签前缀的数量简化为1个,其中,n≥2;
步骤S80,在相同标签前缀和压缩后的标签下标之间插入第二预设符号;
步骤S90,将相同标签前缀放在第二预设符号的左边,并将相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边;
步骤S100,当n个连续的带有相同标签前缀的待压缩数据后出现不同标签前缀的待压缩数据时,在第n个连续的带有相同标签前缀的待压缩数据的标签下标或数值之后、不同标签前缀之前,插入第三预设符号。
在本实施例中,为了进一步地提高数据压缩的效率,以及节省存储空间,当检测到待压缩的数据中存在连续的带有相同标签前缀的待压缩数据时,可以将连续的多个待压缩数据中相同的标签前缀放在第二预设符号的左边,将多个待压缩数据中不同的标签下标和/或数值依次放在第二预设符号的右边,以提高压缩率。
首先,同样对待压缩数据进行标签前缀、标签下标和数值的划分,并按照预设算法分别进行标签下标和数值的压缩。进一步地,对待压缩数据的标签前缀进行检测,判断待压缩数据中是否存在标签前缀连续相同的情况。如果存在标签前缀连续相同的情况,则将这连续相同的标签前缀所对应的待压缩数据压缩后的形式进行调整。具体地,在压缩后的数据中,连续相同的标签前缀只保留一个,压缩后的标签下标和数值仍按照第一实施例中的方式进行排列,并在连续相同的标签前缀和压缩后的标签下标和/或数值之间插入第二预设符号进行区分。
进一步地,当连续相同的标签前缀后出现不同的标签前缀时,在最后一个连续相同的标签前缀对应的待压缩数据的数值或标签下标之后、不同的标签前缀之前,插入第三预设符号,以表明第三预设符号前后的待压缩数据的标签前缀不同。
例如,若待压缩数据为pa1001:12,pa1002:35,pa1003:63,三个待压缩数据均带有相同的标签前缀pa,因此,基于预设算法对待压缩数据进行压缩后的形式为:pa=g9:c,pa=ga:z,pa=gb:Z。为了进一步地减少数据存储空间,提高数据压缩率,将相同的标签前缀pa的数量简化为一个,放在第二预设符号“=”的左边,三个待压缩数据中不同的标签下标以及数值分别进行压缩后,按照顺序依次放在第二预设符号“=”的右边,即压缩为:pa=g9:c,ga:z,gb:Z。
进一步地,当在连续的带有相同标签前缀的待压缩数据后出现了带有不同标签前缀的数据时,在压缩后的数据中出现不同标签前缀的位置之前,使用第三预设符号“#”进行区分,第三预设符号还可以是其他形式,比如“/”、“,”等,在本实施例中,对第三预设符号的形式并不作限制,当然,第一预设符号、第二预设符号与第三预设符号三者不同。例如,待压缩数据为pa1001:12, pa1002:35,pa1003:63,pb1004:23,则压缩后的数据为pa=g9:c,ga:z,gb:Z#pb=gc:n。
具体地,以待压缩数据为带数值型数据为例,举例说明本实施例中的压缩过程。例如,待压缩数据为pa1001:12,pa1002:35,pa1003:63,pb1004:23,pb1005:26,pb1006:27,pb1007:13,上述待压缩数据中包括了7个数据,通过对各个待压缩数据的标签下标和数值部分采用62进制方法进行压缩,以及简化连续相同的标签前缀的个数,并在标签前缀和标签下标之间插入第二预设符号“=”,得到压缩后的数据为pa=g9:c,ga:z,gb:Z#pb=gc:n,gd:q,ge:r,gf:d。压缩前的数据有69个字节,而压缩后的数据为40个字节,因此,压缩率达到了58%。如果连续的带有相同标签前缀的待压缩数据越多,则压缩率会更高。
而对于不带数值型数据而言,假设压缩前的数据为pa1001,pa1002,pa1003,pb1004,pb1005,pb1006,pb1007,同样地,上述待压缩数据中包括7个数据。采用62进制压缩方法进行压缩后的数据为pa=g9,ga,gb#pb=gc,gd,ge,gf。压缩前的数据有48个字节,而压缩后只有26个字节,压缩率达到了54%。同样地,如果连续的带有相同标签前缀的待压缩数据越多,则压缩率会更高。
在本实施例中,如果待压缩数据中存在连续的带有相同标签前缀的待压缩数据,则在压缩后对相同的标签前缀的数量进行简化,将相同的标签前缀放在第二预设符号的左边,将相同的标签前缀对应的不同的标签下标和/或数值按照顺序依次放在第二预设符号的右边,提高数据的压缩率。
参照图3,图3为本申请数据压缩装置一实施例的功能模块示意图。
在本实施例中,数据压缩装置包括:
分类模块10,用于获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;
划分模块20,用于对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字;
压缩模块30,用于基于预设算法对所述带数值型数据的标签下标和数值 进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;
查询模块40,用于对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;
插入模块50,用于若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;
输出模块60,用于基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
进一步地,参照图4,所述分类模块10包括:
查询单元101,用于获取待压缩数据,并在所述待压缩数据中进行查询,判断所述待压缩数据中是否包含第一预设符号;
确定单元102,用于将包含第一预设符号的待压缩数据确定为带数值型数据,将不包含所述第一预设符号的待压缩数据确定为不带数值型数据。
进一步地,参照图5,所述数据压缩装置还包括:
简化模块70,用于若存在n个连续的带有相同标签前缀的待压缩数据,则将压缩后的数据中所述相同标签前缀的数量简化为1个,其中,n≥2;
简化插入模块80,用于在所述相同标签前缀和所述压缩后的标签下标之间插入第二预设符号;
排列模块90,用于将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边。
进一步地,参照图6,所述数据压缩装置还包括:
连接模块100,用于当所述n个连续的带有相同标签前缀的待压缩数据后出现不同标签前缀的待压缩数据时,在第n个连续的带有相同标签前缀的待压缩数据的标签下标或数值之后、所述不同标签前缀之前,插入第三预设符号。
进一步地,所述压缩模块30具体用于:
若所述待压缩数据是所述带数值型的数据,则对所述待压缩数据的标签下标和数值分别进行压缩,得到压缩后的标签下标和压缩后的数值;若所述待压 缩数据是不带数值型的数据,则对所述待压缩数据的标签下标进行压缩,得到压缩后的标签下标。
本申请还提供一种数据压缩设备,包括:存储器和至少一个处理器,所述存储器中存储有指令,所述存储器和所述至少一个处理器通过线路互联;所述至少一个处理器调用所述存储器中的所述指令,以使得所述数据压缩设备执行上述数据压缩方法中的步骤。
本申请还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,也可以为易失性计算机可读存储介质。计算机可读存储介质存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:
获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;
对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字;
基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;
对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;
若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;
基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
以上实施例仅用以说明本申请的技术方案,而非对其限制;本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种数据压缩方法,所述数据压缩方法包括以下步骤:
    获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;
    对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字;
    基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;
    对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;
    若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
  2. 如权利要求1所述的数据压缩方法,所述获取待压缩数据,并对所述待压缩数据进行分类包括:
    获取待压缩数据,并在所述待压缩数据中进行查询,判断所述待压缩数据中是否包含第一预设符号;
    将包含第一预设符号的待压缩数据确定为带数值型数据,将不包含所述第一预设符号的待压缩数据确定为不带数值型数据;
    其中,所述若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号之后,包括:
    基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述第一预设符号和所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
  3. 如权利要求1所述的数据压缩方法,所述对所述待压缩数据的标签前 缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据之后,还包括:
    若存在n个连续的带有相同标签前缀的待压缩数据,则将压缩后的数据中所述相同标签前缀的数量简化为1个,其中,n≥2;
    在所述相同标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边。
  4. 如权利要求3所述的数据压缩方法,所述将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边之后,还包括:
    当所述n个连续的带有相同标签前缀的待压缩数据后出现不同标签前缀的待压缩数据时,在第n个连续的带有相同标签前缀的待压缩数据的标签下标或数值之后、所述不同标签前缀之前,插入第三预设符号。
  5. 如权利要求1所述的数据压缩方法,所述基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值包括:
    若所述待压缩数据是所述带数值型的数据,则对所述待压缩数据的标签下标和数值分别进行压缩,得到压缩后的标签下标和压缩后的数值;
    若所述待压缩数据是不带数值型的数据,则对所述待压缩数据的标签下标进行压缩,得到压缩后的标签下标。
  6. 一种数据压缩装置,所述数据压缩装置包括:
    分类模块,用于获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;
    划分模块,用于对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字;
    压缩模块,用于基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;
    查询模块,用于对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;
    插入模块,用于若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    输出模块,用于基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
  7. 如权利要求6所述的数据压缩装置,所述分类模块包括:
    查询单元,用于获取待压缩数据,并在所述待压缩数据中进行查询,判断所述待压缩数据中是否包含第一预设符号;
    确定单元,用于将包含第一预设符号的待压缩数据确定为带数值型数据,将不包含所述第一预设符号的待压缩数据确定为不带数值型数据。
  8. 如权利要求6所述的数据压缩装置,所述数据压缩装置还包括:
    简化模块,用于若存在n个连续的带有相同标签前缀的待压缩数据,则将压缩后的数据中所述相同标签前缀的数量简化为1个,其中,n≥2;
    简化插入模块,用于在所述相同标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    排列模块,用于将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边。
  9. 如权利要求8所述的数据压缩装置,所述数据压缩装置还包括:
    连接模块,用于当所述n个连续的带有相同标签前缀的待压缩数据后出现不同标签前缀的待压缩数据时,在第n个连续的带有相同标签前缀的待压缩数据的标签下标或数值之后、所述不同标签前缀之前,插入第三预设符号。
  10. 如权利要求6所述的数据压缩装置,所述数据压缩装置具体用于:
    若所述待压缩数据是所述带数值型的数据,则对所述待压缩数据的标签下标和数值分别进行压缩,得到压缩后的标签下标和压缩后的数值;
    若所述待压缩数据是不带数值型的数据,则对所述待压缩数据的标签下标进行压缩,得到压缩后的标签下标。
  11. 一种数据压缩设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如下步骤:
    获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;
    对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标签下标,标签前缀为字母,标签下标和数值为数字;
    基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;
    对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;
    若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
  12. 如权利要求11所述的数据压缩设备,所述处理器执行所述计算机程序实现所述获取待压缩数据,并对所述待压缩数据进行分类时,包括以下步骤:
    获取待压缩数据,并在所述待压缩数据中进行查询,判断所述待压缩数据中是否包含第一预设符号;
    将包含第一预设符号的待压缩数据确定为带数值型数据,将不包含所述第一预设符号的待压缩数据确定为不带数值型数据;
    其中,所述若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号之后,包括:
    基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述第一预设符号和所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
  13. 如权利要求11所述的数据压缩设备,所述处理器执行所述计算机程序实现所述对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据之后,还包括以下步骤:
    若存在n个连续的带有相同标签前缀的待压缩数据,则将压缩后的数据中所述相同标签前缀的数量简化为1个,其中,n≥2;
    在所述相同标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边。
  14. 如权利要求13所述的数据压缩设备,所述处理器执行所述计算机程序实现所述将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边之后,还包括以下步骤:
    当所述n个连续的带有相同标签前缀的待压缩数据后出现不同标签前缀的待压缩数据时,在第n个连续的带有相同标签前缀的待压缩数据的标签下标或数值之后、所述不同标签前缀之前,插入第三预设符号。
  15. 如权利要求11所述的数据压缩设备,所述处理器执行所述计算机程序实现所述基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值时,包括以下步骤:
    若所述待压缩数据是所述带数值型的数据,则对所述待压缩数据的标签下标和数值分别进行压缩,得到压缩后的标签下标和压缩后的数值;
    若所述待压缩数据是不带数值型的数据,则对所述待压缩数据的标签下标进行压缩,得到压缩后的标签下标。
  16. 一种计算机可读存储介质,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:
    获取待压缩数据,并对所述待压缩数据进行分类,其中,所述待压缩数据包括带数值型数据和不带数值型数据;
    对所述分类后的待压缩数据进行识别,确定所述带数值型数据的标签和数值,以及确定所述不带数值型数据的标签,其中,所述标签包括标签前缀和标 签下标,标签前缀为字母,标签下标和数值为数字;
    基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值;
    对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据;
    若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标,或所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
  17. 如权利要求16所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述处理器执行所述计算机程序实现所述获取待压缩数据,并对所述待压缩数据进行分类时,使得计算机执行如下步骤:
    获取待压缩数据,并在所述待压缩数据中进行查询,判断所述待压缩数据中是否包含第一预设符号;
    将包含第一预设符号的待压缩数据确定为带数值型数据,将不包含所述第一预设符号的待压缩数据确定为不带数值型数据;
    其中,所述若不存在连续的带有相同标签前缀的待压缩数据,则在所述标签前缀和所述压缩后的标签下标之间插入第二预设符号之后,包括:
    基于所述标签前缀、所述第二预设符号、所述压缩后的标签下标、所述第一预设符号和所述压缩后的数值,得到压缩后的数据,并输出所述压缩后的数据。
  18. 如权利要求16所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述对所述待压缩数据的标签前缀进行查询,判断是否存在连续的带有相同标签前缀的待压缩数据之后,还使得计算机还执行如下步骤:
    若存在n个连续的带有相同标签前缀的待压缩数据,则将压缩后的数据中所述相同标签前缀的数量简化为1个,其中,n≥2;
    在所述相同标签前缀和所述压缩后的标签下标之间插入第二预设符号;
    将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边。
  19. 如权利要求18所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述将所述相同标签前缀放在第二预设符号的左边,并将所述相同标签前缀对应的不同标签下标和数值,按照顺序依次放在第二预设符号的右边之后,还使得计算机执行如下步骤:
    当所述n个连续的带有相同标签前缀的待压缩数据后出现不同标签前缀的待压缩数据时,在第n个连续的带有相同标签前缀的待压缩数据的标签下标或数值之后、所述不同标签前缀之前,插入第三预设符号。
  20. 如权利要求16所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述基于预设算法对所述带数值型数据的标签下标和数值进行压缩,以及对所述不带数值型数据的标签下标进行压缩,得到压缩后的标签下标和压缩后的数值时,使得计算机执行如下步骤:
    若所述待压缩数据是所述带数值型的数据,则对所述待压缩数据的标签下标和数值分别进行压缩,得到压缩后的标签下标和压缩后的数值;
    若所述待压缩数据是不带数值型的数据,则对所述待压缩数据的标签下标进行压缩,得到压缩后的标签下标。
PCT/CN2019/117104 2019-09-16 2019-11-11 数据压缩方法、装置、设备及计算机可读存储介质 WO2021051532A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910871503.9A CN110808738B (zh) 2019-09-16 2019-09-16 数据压缩方法、装置、设备及计算机可读存储介质
CN201910871503.9 2019-09-16

Publications (1)

Publication Number Publication Date
WO2021051532A1 true WO2021051532A1 (zh) 2021-03-25

Family

ID=69487560

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117104 WO2021051532A1 (zh) 2019-09-16 2019-11-11 数据压缩方法、装置、设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN110808738B (zh)
WO (1) WO2021051532A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114866487A (zh) * 2022-03-08 2022-08-05 国网江苏省电力有限公司南京供电分公司 一种海量电网调度数据采集与存储系统
CN117579079A (zh) * 2024-01-15 2024-02-20 每日互动股份有限公司 一种数据压缩的处理方法、装置、设备及介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111510154B (zh) * 2020-04-17 2023-07-21 环荣电子(惠州)有限公司 坐标数据压缩方法
CN115422142A (zh) * 2022-08-22 2022-12-02 北京羽乐创新科技有限公司 数据压缩方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090201180A1 (en) * 2008-02-07 2009-08-13 James Paul Schneider Compression for deflate algorithm
CN107592116A (zh) * 2017-09-21 2018-01-16 咪咕文化科技有限公司 一种数据压缩方法、装置及存储介质
CN108737976A (zh) * 2018-05-22 2018-11-02 南京大学 一种基于北斗短报文的压缩传输方法
JP2018195956A (ja) * 2017-05-16 2018-12-06 富士通株式会社 符号化プログラム、符号化装置および符号化方法

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5684478A (en) * 1994-12-06 1997-11-04 Cennoid Technologies, Inc. Method and apparatus for adaptive data compression
CN100385437C (zh) * 2005-11-10 2008-04-30 浙江中控技术股份有限公司 实时数据压缩方法
JP2008192031A (ja) * 2007-02-07 2008-08-21 Nec Corp 圧縮方法、圧縮装置、圧縮データ復元方法、圧縮データ復元装置、可視化方法および可視化装置
WO2009001174A1 (en) * 2007-06-28 2008-12-31 Smartimage Solutions, Sia System and method for data compression and storage allowing fast retrieval
US7444347B1 (en) * 2007-11-16 2008-10-28 International Business Machines Corporation Systems, methods and computer products for compression of hierarchical identifiers
US10169362B2 (en) * 2016-07-07 2019-01-01 Cross Commerce Media, Inc. High-density compression method and computing system
CN110019184B (zh) * 2017-09-04 2021-04-27 北京字节跳动网络技术有限公司 一种压缩和解压缩有序整数数组的方法
CN109903350B (zh) * 2017-12-07 2021-08-06 上海寒武纪信息科技有限公司 图像压缩方法及相关装置
US10735025B2 (en) * 2018-03-02 2020-08-04 Microsoft Technology Licensing, Llc Use of data prefixes to increase compression ratios
CN108880556B (zh) * 2018-05-30 2021-09-07 中国人民解放军战略支援部队信息工程大学 基于lz77的无损数据压缩方法、误码修复方法及编码器和解码器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090201180A1 (en) * 2008-02-07 2009-08-13 James Paul Schneider Compression for deflate algorithm
JP2018195956A (ja) * 2017-05-16 2018-12-06 富士通株式会社 符号化プログラム、符号化装置および符号化方法
CN107592116A (zh) * 2017-09-21 2018-01-16 咪咕文化科技有限公司 一种数据压缩方法、装置及存储介质
CN108737976A (zh) * 2018-05-22 2018-11-02 南京大学 一种基于北斗短报文的压缩传输方法

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114866487A (zh) * 2022-03-08 2022-08-05 国网江苏省电力有限公司南京供电分公司 一种海量电网调度数据采集与存储系统
CN114866487B (zh) * 2022-03-08 2024-03-05 国网江苏省电力有限公司南京供电分公司 一种海量电网调度数据采集与存储系统
CN117579079A (zh) * 2024-01-15 2024-02-20 每日互动股份有限公司 一种数据压缩的处理方法、装置、设备及介质
CN117579079B (zh) * 2024-01-15 2024-03-29 每日互动股份有限公司 一种数据压缩的处理方法、装置、设备及介质

Also Published As

Publication number Publication date
CN110808738B (zh) 2023-10-20
CN110808738A (zh) 2020-02-18

Similar Documents

Publication Publication Date Title
WO2021051532A1 (zh) 数据压缩方法、装置、设备及计算机可读存储介质
US10778246B2 (en) Managing compression and storage of genomic data
US7663511B2 (en) Dynamic character encoding
US8838550B1 (en) Readable text-based compression of resource identifiers
US9806741B1 (en) Character conversion
EP3229444B1 (en) Server and method for compressing data by server
WO2007118123A2 (en) Multiplexing binary encoding to facilitate compression
WO2021175040A1 (zh) 视频处理方法及相关装置
US20190034466A1 (en) Database archiving method and device for creating index information and method and device of retrieving archived database including index information
US20130063287A1 (en) Decoding encoded data
US10394763B2 (en) Method and device for generating pileup file from compressed genomic data
US10515092B2 (en) Structured record compression and retrieval
WO2018103490A1 (en) A method and system for compressing data
CN105811994A (zh) 一种计算机数据压缩处理系统
US20150379119A1 (en) Performing predicate evaluation on compressed character string of variable length
WO2000045274A1 (fr) Procede de transmission de donnees, support lisible par un ordinateur et appareil de transmission de donnees
CN105704215B (zh) 文件共享系统及相应的文件发送方法及装置
WO2017157038A1 (zh) 数据处理的方法、装置和设备
US8463759B2 (en) Method and system for compressing data
CN113342813B (zh) 键值数据处理方法、装置、计算机设备及可读存储介质
US20220360278A1 (en) Data compression techniques using partitions and extraneous bit elimination
CN113495651B (zh) 一种窗口控制方法和装置
US9928286B2 (en) Transforming character delimited values
CN106327538B (zh) 一种二维骨骼动画压缩方法及装置
CN111324587A (zh) Obj文件的数据的压缩方法、解析方法以及系统

Legal Events

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

Ref document number: 19945783

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19945783

Country of ref document: EP

Kind code of ref document: A1