Disclosure of Invention
The embodiment of the invention aims to provide a compression method, a compression device, a compression medium and electronic equipment for a multi-option form, and further solves one or more problems that in the related technology, the operation difficulty of a user is high and the entry is easy to report errors to at least a certain extent.
Additional features and advantages of the invention will be set forth in the detailed description which follows, or may be learned by practice of the invention.
According to a first aspect of the embodiments of the present invention, there is provided a data splicing method, including:
acquiring multi-option item form information, wherein the multi-option item form information comprises: character information of the item and a selection result of the item;
carrying out first sequencing on items in the multi-option item form information according to the character information of the items, and determining an item sequencing list;
performing second sorting on the item selection results according to the item arrangement sequence in the item arrangement list, and determining item selection result sorting information;
and compressing the sorting information of the selection results, and outputting the compression results obtained after compression.
In an embodiment of the present invention, the first sorting the items in the multi-choice item form information according to the character information of the items, and determining the item sorting list includes:
and sorting the character information of the items according to a preset character string sorting rule to determine a project sorting list.
In an embodiment of the present invention, before performing the second sorting on the selection results of the items according to the item arrangement order in the item ordered list, the method further includes:
detecting the multi-option item form;
when the selection result of the option in the multi-option item form is detected to be selected, the selection result of the option is identified by binary digit 1;
when the selection result of the option in the multi-choice item form is detected to be unselected, the selection result of the option is identified by a binary digit 0.
In an embodiment of the present invention, the second sorting the selection results of the items according to the item arrangement order in the item ordered list, and determining the sorting information of the selection results of the items includes:
traversing each item in the item ranking list to determine a selection result of each item;
and sequencing the binary digits of the item selection results according to the item sequence in the item sequence list, and determining the sequencing information of the item binary digit selection results.
In an embodiment of the present invention, the compressing the sorting information of the selection result includes:
sequentially splitting the sorting information of the selection results of the binary digital identifiers according to a preset splitting rule to obtain each splitting result;
carrying out hexadecimal conversion on each split result according to the split sequence to obtain the sorting information of the selection results of the hexadecimal digital identifiers;
and determining the sorting information of the selection results identified by the hexadecimal numbers as compression results.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for compressing a multiple-choice item form, including:
the acquisition module is used for acquiring the form information of the multiple-choice items, wherein the form information of the multiple-choice items comprises: character information of the item and a selection result of the item;
the first ordering module is used for carrying out first ordering on the items in the multi-choice item form information according to the character information of the items to determine an item ordering list;
the second sorting module is used for carrying out second sorting on the selection results of the items according to the item arrangement sequence in the item arrangement list and determining the sorting information of the item selection results;
and the compression module is used for compressing the sorting information of the selection results and outputting the compression results obtained after compression.
In an embodiment of the present invention, the first sorting module is specifically configured to:
and sorting the character information of the items according to a preset character string sorting rule to determine a project sorting list.
In one embodiment of the present invention, further comprising:
the identification module is used for detecting the multi-option form; when the selection result of the option in the multi-option item form is detected to be selected, the selection result of the option is identified by binary digit 1; when the selection result of the option in the multi-choice item form is detected to be unselected, the selection result of the option is identified by a binary digit 0.
In an embodiment of the invention, the second sorting module is specifically configured to:
traversing each item in the item ranking list to determine a selection result of each item;
and sequencing the binary digits of the item selection results according to the item sequence in the item sequence list, and determining the sequencing information of the item binary digit selection results.
In an embodiment of the present invention, the compression module is specifically configured to:
sequentially splitting the sorting information of the selection results of the binary digital identifiers according to a preset splitting rule to obtain each splitting result; carrying out hexadecimal conversion on each split result according to the split sequence to obtain the sorting information of the selection results of the hexadecimal digital identifiers; and determining the sorting information of the selection results identified by the hexadecimal numbers as compression results.
According to a third aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, the program, when executed by a processor, implementing the method for compressing a multiple choice item form according to the first aspect of the embodiments.
According to a fourth aspect of embodiments of the present invention, there is provided an electronic apparatus, including: one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement a method of compressing a multiple choice item form as in the first aspect of the embodiments described above.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a compression method, a device, a medium and electronic equipment of a multi-option form, which comprises the following steps: acquiring multi-option item form information, wherein the multi-option item form information comprises: character information of the item and a selection result of the item; carrying out first sequencing on items in the multi-option item form information according to the character information of the items, and determining an item sequencing list; performing second sorting on the item selection results according to the item arrangement sequence in the item arrangement list, and determining item selection result sorting information; and compressing the sorting information of the selection results, and outputting the compression results obtained after compression. The technical scheme of the embodiment of the invention can compress the characters of the multiple-choice item form by utilizing the attribute information of the plug-in, thereby improving the warehousing efficiency of a large number of multiple-choice item forms and reducing the probability of warehousing error report.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations or operations have not been shown or described in detail to avoid obscuring aspects of the invention.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
FIG. 1 schematically illustrates a flow diagram of a method for compressing a multiple choice item form according to one embodiment of the invention.
Referring to fig. 1, a method for compressing a multiple-choice item form according to an embodiment of the present invention includes the following steps:
in step S110, multi-choice item form information is acquired.
In an embodiment of the present invention, the multi-choice item form information includes: character information of the item and a selection result of the item.
In an embodiment of the present invention, the multi-line item form information may be a pull-down multi-selection menu, which includes names of the items and selection results of the items, in the background service, the names of the items may be represented by character strings (combination of letters and/or numbers), and the selection results of the items may be represented by numbers 0 and 1 respectively to indicate the selection results of the items that are not selected and the items that are selected.
In step S120, the items in the multi-choice item form information are first sorted according to the character information of the items, and an item sorting list is determined.
In an embodiment of the present invention, the character information of the items is sorted according to a preset character string sorting rule, and an item sorting list is determined.
In one embodiment of the present invention, the ordering of the character information of the items according to the preset character string ordering rule is to arrange the character strings of the items in the alphabetical and numeric order in the forward direction, so as to ensure that the relative positions of the character strings are fixed and do not change, and provide a guarantee for the subsequent compression and decompression algorithms.
In one embodiment of the present invention, the preset string ordering rule may be a Unicode string ordering rule.
In step S130, the selection results of the items are second sorted according to the item arrangement order in the item arrangement list, and item selection result sorting information is determined.
In one embodiment of the invention, before the second sorting of the selection results of the items according to the item sorting order in the item sorting list, the multi-choice item form is detected; when the selection result of the option in the multi-option item form is detected to be selected, the selection result of the option is identified by binary digit 1; when the selection result of the option in the multi-choice item form is detected to be unselected, the selection result of the option is identified by a binary digit 0.
In one embodiment of the invention, each item in the item ordered list is traversed, and the selection result of each item is determined; and sequencing the binary digits of the item selection results according to the item sequence in the item sequence list, and determining the sequencing information of the item binary digit selection results.
In an embodiment of the present invention, the method for performing the second sorting on the selection result of the item is used in relation to a multi-selection pull-down control, and the purpose of the method is to return to a calling end to perform a warehousing operation after the content of the control is selected, and the implementation may be a get method, specifically, by monitoring the selection of the selection control, after the user selects the selection, the code attribute inside the selection control is marked as 1(code is 1), and the unselected code attribute is marked as 0(code is 0) by default, after the user finishes all selections, the get method is called to cycle through all the selections, the code attributes are checked and the values are sequentially arranged and returned, the sequentially arranged selection result sorting information (for example, 10101010) is obtained, and then the selection result sorting information is compressed and other subsequent operations are returned to the calling end.
In step S140, the selection result ranking information is compressed, and the compression result obtained after the compression is output.
In one embodiment of the invention, according to a preset splitting rule, sequentially splitting the sorting information of the selection results of the binary number identifiers to obtain each splitting result; carrying out hexadecimal conversion on each split result according to the split sequence to obtain the sorting information of the selection results of the hexadecimal digital identifiers; and determining the sorting information of the selection results identified by the hexadecimal numbers as compression results.
In an embodiment of the invention, firstly, the sorting information of the selection result of the binary number identifier is converted into binary integer, secondly, the binary integer is converted into the sorting information of the selection result of the hexadecimal number identifier, and finally, the sorting information of the selection result of the hexadecimal number identifier is returned to the server for warehousing by calling a value method.
In one embodiment of the present invention, hexadecimal is commonly used in the computer field, because it is less difficult to convert 4 bits (bits) into individual 16-ary digits, wherein 1 byte can be expressed as 2 continuous 16-system digits, every four digits of the sorting information of the selection result marked by the binary digits can be expressed separately, for example, when the sorting information of the selection result identified by the binary number is 1110011011001100, it can be split into 1110, 0110, 1100, 1100 four cells, each cell can be replaced by a character if represented hexadecimal, the character representation of which is equivalent to its original 1/4, the compression ratio is 75%, based on which the compression of a long character string into a short character string can be realized, when entering is carried out, the probability of entering errors caused by overlong character strings is reduced, and the specific algorithm implementation can be as follows:
from the decimal point, the left and right sides are segmented according to 'four bits one segment', wherein, the complement of less than four bits is 0, then, the binary number of the four bits of each segment corresponds to a hexadecimal number, and the conversion relation of binary system to hexadecimal is as follows:
0000–0;
0001–1;
0010–2;
0011–3;
0100–4;
0101–5;
0110–6;
0111–7;
1000–8;
1001–9;
1010–A;
1011–B;
1100–C;
1101–D;
1110–E;
1111–F;
in one embodiment of the present invention, an initialization array length 16 reshape character array may be: {0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111}.
In one embodiment of the present invention, for a given binary string "101101", first, every four characters in the binary string are divided into groups, less than four characters are padded with 0, and the string is counted from right to left in groups of four, the first group: 1101, by the second group, only two characters 0 and 1 are present, which are padded with 0, the result after padding is: 0010, matching according to the corresponding conversion relationship to obtain the hexadecimal ordering information: and 2D.
FIG. 2 is a schematic diagram illustrating a binary to hexadecimal conversion of a multiple choice item form in accordance with one embodiment of the present invention.
Referring to fig. 2, the multiple choice item form includes 16 items, where 9 selected items and 7 unselected items are available, and the selection result of binary number identifiers of the multiple choice item form can be obtained according to the sequence from top to bottom: 1110011011001100, 4 bits grouping from right to left yields: 1110, 0110, 1100, 1100; and matching according to the corresponding conversion relation to obtain hexadecimal sequencing information: e6CC, for the compression result, when the character length of each value is 2 bits and the original value is 01, 02, 03, 06, 07, 08, 09(20 characters), the compression result is E6CC (4 characters), and the compression ratio (4)/20 is 20%; when tested in all 1 items 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15 (character 45), the compressibility was 4/45% of about 8.99%; in the character length of 1, the selection items are less than 4, and the compression rate is 400%; when the compression ratio is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16(38 characters), the compression ratio is 4/38-10.52%; therefore, when the multi-choice item form is too long in the value of the drop-down value, or too many in the check items, the compression storage is applicable, and when the check value is less, the compression can be considered to be closed.
In an embodiment of the present invention, the set method may be adopted to restore the selection result ranking information of the compressed hexadecimal number identifiers, specifically, after the control is used to call the selection result ranking information (e.g. AA) of the hexadecimal number identifiers, the selection result ranking information is restored to the code in the binary form (e.g. 10101010), and then, the control item is selected according to the position of the control item, such as 11011 of the restored binary code, the set method marks them in order with the label marked as selected by 1 and unselected by 0, to restore the user's selection on the multiple choice item form, the set method is the inverse process of the get method, and specific contents may refer to the content related to.
The following describes an embodiment of the apparatus of the present invention, which can be used to perform the above-mentioned compression method for multi-choice forms of the present invention.
FIG. 3 schematically shows a block diagram of an apparatus for compressing a multiple choice item form according to an embodiment of the invention.
Referring to fig. 3, an apparatus 300 for compressing a multiple-choice item form according to an embodiment of the present invention includes:
an obtaining module 301, configured to obtain form information of multiple options, where the form information of multiple options includes: character information of the item and a selection result of the item;
the first ordering module 302 is configured to perform first ordering on items in the multi-choice item form information according to character information of the items, and determine an item ordering list;
the second sorting module 303 is configured to perform second sorting on the selection results of the items according to the item arrangement order in the item arrangement list, and determine item selection result sorting information;
and the compression module 304 is configured to compress the sorting information of the selection result, and output a compression result obtained after compression.
In an embodiment of the present invention, the first sorting module 302 is specifically configured to:
and sorting the character information of the items according to a preset character string sorting rule to determine a project sorting list.
In one embodiment of the present invention, further comprising:
an identification module 305, configured to detect a multi-choice item form; when the selection result of the option in the multi-option item form is detected to be selected, the selection result of the option is identified by binary digit 1; when the selection result of the option in the multi-choice item form is detected to be unselected, the selection result of the option is identified by a binary digit 0.
In an embodiment of the present invention, the second sorting module 303 is specifically configured to:
traversing each item in the item ranking list to determine a selection result of each item;
and sequencing the binary digits of the item selection results according to the item sequence in the item sequence list, and determining the sequencing information of the item binary digit selection results.
In an embodiment of the present invention, the compressing module 304 is specifically configured to:
sequentially splitting the sorting information of the selection results of the binary digital identifiers according to a preset splitting rule to obtain each splitting result; carrying out hexadecimal conversion on each split result according to the split sequence to obtain the sorting information of the selection results of the hexadecimal digital identifiers; and determining the sorting information of the selection results identified by the hexadecimal numbers as compression results.
For details that are not disclosed in the embodiment of the apparatus of the present invention, please refer to the above-mentioned compression method of the multiple choice item form of the first aspect of the present invention for the details that are not disclosed in the embodiment of the apparatus of the present invention.
Referring now to FIG. 4, a block diagram of a computer system 400 suitable for use with the electronic device implementing an embodiment of the invention is shown. The computer system 400 of the electronic device shown in fig. 4 is only an example, and should not bring any limitation to the function and the scope of use of the embodiments of the present invention.
As shown in fig. 4, the computer system 400 includes a Central Processing Unit (CPU)401 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for system operation are also stored. The CPU401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411. The above-described functions defined in the system of the present application are executed when the computer program is executed by a Central Processing Unit (CPU) 401.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the method for compressing the multiple choice item form as in the above embodiments.
For example, the electronic device described above may implement as shown in fig. 1: step S110, obtaining form information of multiple options; step S120, performing first sequencing on items in the multi-choice item form information according to the character information of the items, and determining an item sequencing list; step 130, performing second sorting on the selection results of the items according to the item arrangement sequence in the item arrangement list, and determining item selection result sorting information; and 140, compressing the sorting information of the selection results and outputting the compression results obtained after compression.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the invention. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiment of the present invention.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.