Data storage method, computer equipment, readable storage medium and program product
By inserting delimiters to process unstable strings during data storage and generating delimiter index information for storage, the problems of unstable storage and inefficiency caused by unstable strings are solved, and efficient and stable data storage and self-repair are achieved.
Patent Information
- Application Number
- CN202510877758.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-10
AI Technical Summary
In the prior art, during the data storage process, the existence of unstable strings leads to unstable storage, and the method of replacing unstable strings requires additional storage of replacement dictionaries and position information, which takes up a large amount of storage space and reduces storage efficiency.
By inserting the first delimiter at the start and end positions of the unstable string and inserting the second delimiter in the unstable string, a target string is formed, and delimiter index information is generated for storage, avoiding direct storage of the unstable string and reducing the amount of delimiter index information required for data recovery.
It improves the stability and efficiency of data storage, reduces storage space requirements, realizes self-repair capabilities, avoids external storage dependence, and improves data recovery efficiency.
Smart Images

Figure CN120762589A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a data storage method, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In the era of big data, stable data storage is crucial. During big data storage, raw data often needs to be converted into a base-X string, such as binary or quaternary. However, if the converted string contains certain string patterns, it can easily lead to unstable string storage and even data corruption.
[0003] Related technologies primarily improve data storage stability by replacing unstable strings. Specifically, when an unstable string is found in a string, the system replaces it with a corresponding safe string, records the replacement position and length, and maintains a replacement dictionary to store the mapping between unstable and safe strings.
[0004] However, the replacement operation in the related art requires additional storage of the replacement dictionary and the location information of each security string, which requires a large storage space. In addition, for each unstable string, encoding and decoding based on the replacement dictionary are required during storage and recovery, resulting in low storage efficiency. Summary of the Invention
[0005] Based on this, it is necessary to provide a data storage method, computer device, computer-readable storage medium and computer program product that can save storage space and improve storage efficiency in response to the above technical problems.
[0006] In a first aspect, the present application provides a data storage method, comprising:
[0007] Get the original data, encode the original data to get the initial character string;
[0008] When an unstable character string is identified from the initial character string, a first separator is inserted into the starting position and the ending position of the unstable character string, and a second separator is inserted between any two adjacent characters in the unstable character string to form a target character string;
[0009] Generate delimiter index information based on a preset delimiter index rule, a first delimiter, and a second delimiter;
[0010] The delimiter index information is written into a preset index position of the target character string, and the target character string including the delimiter index information is written into a preset storage position.
[0011] In one embodiment, after writing the target character string into the preset storage location, the method further includes:
[0012] Reading a target character string from a preset storage location and extracting separator index information from a preset index position of the target character string;
[0013] Locate each first delimiter and each second delimiter from the target character string based on the delimiter index information;
[0014] Removing each first delimiter and each second delimiter from the target character string to form a character string to be decoded;
[0015] Perform base-decoding on the string to be decoded to obtain the original data.
[0016] In one embodiment, the unstable string includes at least one of an exact match unstable string and a fuzzy match unstable string; before inserting a first delimiter at a start position and an end position of the unstable string, respectively, and inserting a second delimiter between any two adjacent characters in the unstable string to form a target string, the method further includes:
[0017] Obtaining an exact matching unstable string list, where the exact matching unstable string list includes at least one exact matching unstable string;
[0018] In response to an edit distance specifying operation, obtaining a specified target edit distance;
[0019] Based on the target edit distance, the corresponding fuzzy matching unstable string of each exact matching unstable string is detected, and a list of fuzzy matching unstable strings is generated, wherein the edit distance between the fuzzy matching unstable string and the corresponding exact matching unstable string is less than the target edit distance;
[0020] According to the exact matching unstable string list, an exact matching unstable string is identified from the initial string, and according to the fuzzy matching unstable string list, a fuzzy matching unstable string is identified from the initial string.
[0021] In one embodiment, before inserting a first delimiter at the start and end of the unstable character string, and inserting a second delimiter between any two adjacent characters in the unstable character string to form the target character string, the method further includes:
[0022] Generate a second delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, and an initial string;
[0023] A first delimiter is generated according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, an initial string, and a second delimiter.
[0024] In one embodiment, generating the second delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, and an initial string includes:
[0025] Generation step: Generate all permutation and combination strings corresponding to the preset character length;
[0026] If all permutation and combination strings do not meet the preset second delimiter condition, increase the preset character length, and return to the generation step until at least one permutation and combination string meets the preset second delimiter condition, wherein the preset second delimiter condition is determined based on a preset exact match unstable string list, a preset fuzzy match unstable string list, a preset delimiter index rule, and an initial character string;
[0027] In the case where at least one permutation and combination string meets the preset second delimiter condition, determining one of the permutation and combination strings meeting the preset second delimiter condition as the second delimiter;
[0028] Generate a first delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, an initial string, and a second delimiter, including:
[0029] In the case where multiple permutation and combination strings meet the preset second delimiter condition, one of the permutation and combination strings meeting the preset second delimiter condition is determined as the first delimiter, wherein the first delimiter is different from the second delimiter;
[0030] If one permutation and combination string satisfies the preset second delimiter condition, increasing the preset character length, and returning to the generation step until at least one permutation and combination string satisfies the preset first delimiter condition, wherein the preset first delimiter condition includes the preset second delimiter condition and a supplementary condition, and the supplementary condition is determined based on the second delimiter;
[0031] When the permutation and combination string meets the preset first separator condition, the permutation and combination string is determined as the first separator.
[0032] In one embodiment, the preset second delimiter condition includes:
[0033] The permutation and combination string is not any exact match unstable string in the preset exact match unstable string list;
[0034] The permutation and combination string is not a substring of any exact matching unstable string in the preset exact matching unstable string list;
[0035] The permutation and combination string is not any fuzzy matching unstable string in the preset fuzzy matching unstable string list;
[0036] The permutation and combination string is not a substring of any fuzzy matching unstable string in the preset fuzzy matching unstable string list;
[0037] The permutation and combination string is not a substring of the initial string;
[0038] The permutation and combination string does not match the preset delimiter index rule;
[0039] Supplementary conditions include:
[0040] The permutation and combination string is not the mother string of the second separator.
[0041] In one embodiment, the preset delimiter index rule includes arranging the first delimiter and the second delimiter according to a repetition pattern and a preset index arrangement order; generating delimiter index information based on the preset delimiter index rule, the first delimiter, and the second delimiter includes:
[0042] Arrange the first delimiter into a first initial index string according to a repeating pattern, and arrange the second delimiter into a second initial index string according to a repeating pattern;
[0043] Arrange the first initial index string and the second initial index string according to a preset index arrangement order to generate a separator index string;
[0044] The delimiter index string is determined as the delimiter index information.
[0045] In a second aspect, the present application further provides a data storage device, comprising:
[0046] The acquisition module is used to obtain the original data, encode the original data into binary format, and obtain the initial character string;
[0047] an inserting module for, when an unstable character string is identified from the initial character string, inserting a first delimiter at a starting position and an ending position of the unstable character string, respectively, and inserting a second delimiter between any two adjacent characters in the unstable character string, to form a target character string;
[0048] A generating module, configured to generate delimiter index information based on a preset delimiter index rule, a first delimiter, and a second delimiter;
[0049] The writing module is used to write the delimiter index information into a preset index position of the target character string, and write the target character string containing the delimiter index information into a preset storage position.
[0050] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0051] Get the original data, encode the original data to get the initial character string;
[0052] When an unstable character string is identified from the initial character string, a first separator is inserted into the starting position and the ending position of the unstable character string, and a second separator is inserted between any two adjacent characters in the unstable character string to form a target character string;
[0053] Generate delimiter index information based on a preset delimiter index rule, a first delimiter, and a second delimiter;
[0054] The delimiter index information is written into a preset index position of the target character string, and the target character string including the delimiter index information is written into a preset storage position.
[0055] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0056] Get the original data, encode the original data to get the initial character string;
[0057] When an unstable character string is identified from the initial character string, a first separator is inserted into the starting position and the ending position of the unstable character string, and a second separator is inserted between any two adjacent characters in the unstable character string to form a target character string;
[0058] Generate delimiter index information based on a preset delimiter index rule, a first delimiter, and a second delimiter;
[0059] The delimiter index information is written into a preset index position of the target character string, and the target character string including the delimiter index information is written into a preset storage position.
[0060] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:
[0061] Get the original data, encode the original data to get the initial character string;
[0062] When an unstable character string is identified from the initial character string, a first separator is inserted into the starting position and the ending position of the unstable character string, and a second separator is inserted between any two adjacent characters in the unstable character string to form a target character string;
[0063] Generate delimiter index information based on a preset delimiter index rule, a first delimiter, and a second delimiter;
[0064] The delimiter index information is written into a preset index position of the target character string, and the target character string including the delimiter index information is written into a preset storage position.
[0065] The above-mentioned data storage method, computer device, computer-readable storage medium and computer program product first obtain original data, perform base encoding on the original data to obtain an initial character string, and do not directly store the base encoded initial character string. Instead, when an unstable character string is identified from the initial character string, a first delimiter is inserted into the starting position and the ending position of the unstable character string respectively, and a second delimiter is inserted between any two adjacent characters in the unstable character string to form a target character string. By inserting the delimiters, the unstable initial character string is converted into a stable target character string; then, based on a preset delimiter index rule, the first delimiter and the second delimiter, delimiter index information is generated, and the delimiter index information is written into a preset index position of the target character string to obtain a stable target character string containing delimiter information, and the target character string is written into a preset storage position. In this way, on the one hand, by inserting delimiters, the storage instability that may be caused by direct storage of unstable character strings can be effectively avoided, thereby improving the stability of data storage; on the other hand, compared with the method of replacing unstable strings, by inserting and reusing delimiters, the amount of data of the delimiter index information required for data recovery can be effectively reduced, so that the delimiter index information can be stored in situ, thereby enabling data recovery through self-repair, effectively saving storage space and improving storage efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0067] Figure 1 A schematic diagram of a flow chart of a data storage method in one embodiment;
[0068] Figure 2 1 is a flow chart of a data self-repair process in one embodiment;
[0069] Figure 3 1 is a flow chart of a process for identifying unstable character strings in one embodiment;
[0070] Figure 4 A schematic diagram of a flow chart of a separator generation process in one embodiment;
[0071] Figure 5is a structural block diagram of a data storage device in one embodiment;
[0072] Figure 6 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0073] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0074] In an exemplary embodiment, Figure 1 As shown, a data storage method is provided. This embodiment uses the method applied to a terminal as an example, wherein the terminal may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. It is understandable that the method can also be applied to servers, and can also be applied to systems including terminals and servers, and implemented through the interaction between the terminals and servers. In this embodiment, the method includes the following steps S10-S40. Among them:
[0075] Step S10: obtaining original data, performing base encoding on the original data, and obtaining an initial character string.
[0076] The original data may refer to data to be stored that has not been encoded or converted in any way. The original data may be in the form of text, binary stream, numerical value, image, audio, etc.
[0077] Base encoding refers to the process of converting raw data into a string representation according to base X rules, where the base X can be binary or quaternary.
[0078] The initial string may refer to a string obtained by base encoding the original data. It is understood that the characters used in base encoding may include at least one of numbers and letters, so the initial string after base encoding may consist of at least one of numbers and letters.
[0079] Exemplarily, in response to a data storage event, original data to be stored is acquired, and according to a preset X-ary rule, the acquired original data is base-encoded to convert the original data into an initial character string.
[0080] Step S20 , when an unstable character string is identified from the initial character string, a first separator is inserted into the starting position and the ending position of the unstable character string, and a second separator is inserted between any two adjacent characters in the unstable character string to form a target character string.
[0081] Unstable strings can refer to string patterns that are prone to data corruption, read errors, or storage media failures under specific storage systems or encoding environments. Unstable strings may be considered unstable due to hardware limitations, encoding and decoding rules, or physical storage characteristics.
[0082] Since the initial string obtained after base encoding may or may not contain unstable strings, if the initial string obtained after base encoding contains unstable strings, these unstable strings may cause the initial string to become unstable and easily damaged during subsequent storage. Therefore, these unstable strings can be stabilized.
[0083] In the related art, unstable character strings are usually completely replaced with stable security strings. This requires not only recording the length of the replaced security string, but also storing a replacement dictionary containing the original unstable character string and the replaced security string. For each replaced security string, its location needs to be recorded, and for different unstable character strings, different corresponding relationships need to be recorded. As the number of unstable character strings increases, the amount of data in the replacement dictionary increases greatly. In this way, not only the required storage space increases greatly, but also the amount of calculation during data recovery increases, and the efficiency of data storage and data recovery also decreases. In the case where the storage space required for the replacement dictionary is too large, it may not be stored on-site, but needs to be stored in other external storage space. It cannot be self-repaired during data recovery, which further reduces the efficiency of data storage and data recovery.
[0084] A delimiter can refer to a character or string that can clearly mark a specific location of specific content in data for structural segmentation or safe isolation.
[0085] The first delimiter is used to mark the starting position and the ending position of the unstable string. The second delimiter is used to separate any two adjacent characters in the unstable string. By inserting the first delimiter and the second delimiter, the unstable string can be converted into a stable target string. And for multiple identical or different unstable strings, only the first delimiter and the second delimiter need to be inserted. Therefore, no matter how many unstable strings are in the initial string, or whether these unstable strings are the same, only the information of the first delimiter and the second delimiter needs to be recorded to achieve data recovery. The storage space required for the information of the two delimiters is small, so it can be stored in situ and can be self-repaired during data recovery. In this way, the efficiency of data storage and data recovery can be effectively improved.
[0086] Exemplarily, after base encoding, unstable strings can be first identified from the initial string; if at least one unstable string is identified from the initial string, the starting position and the ending position of each unstable string can be located, and a first separator can be inserted into the starting position and the ending position of each unstable string respectively, and a second separator can be inserted between any two adjacent characters in each unstable string to form a target string; if no unstable string is identified from the initial string, the initial string can be directly determined as a storage unit and written into a preset storage location.
[0087] In some feasible implementations, the method of identifying unstable character strings may include: listing unstable character strings or characteristic information of unstable character strings in advance through experiments or manufacturer documents; when actually storing data, comparing the initial character string with the listed unstable character strings or characteristic information of unstable character strings to detect whether the initial character string contains an unstable character string.
[0088] In other feasible implementations, the method of identifying unstable character strings may include: pre-training a machine learning model with historical data to learn to identify unstable character strings, and when actually storing data, using the trained machine learning model to identify unstable character strings from initial character strings.
[0089] Step S30 : generating delimiter index information based on a preset delimiter index rule, the first delimiter, and the second delimiter.
[0090] The delimiter index information may refer to information used to locate the pre-inserted first delimiter and the pre-inserted second delimiter in the character string.
[0091] The delimiter index rule may refer to a rule for generating delimiter index information, which may be specifically determined based on actual conditions and test results, etc., and is not limited in this embodiment.
[0092] In some feasible implementations, the delimiter index rule may be to arrange the first delimiter and the second delimiter in a predetermined string pattern; the delimiter index information may be formed by arranging the first delimiter and the second delimiter according to the predetermined string pattern. For example, the delimiter index rule may be to arrange the first delimiter and the second delimiter in sequence according to a repeating pattern, and the repeating pattern may be the first delimiter + the first delimiter + the second delimiter + the second delimiter. In this way, when recovering data, the delimiter index information can be obtained, and the first delimiter and the second delimiter can be extracted from the delimiter index information according to the preset string pattern; then, from the character string in which the first delimiter and the second delimiter are pre-inserted, the pre-inserted first delimiter and the second delimiter are detected and located, these pre-inserted first delimiters and the second delimiter are deleted, and then base decoding is performed to restore the original data.
[0093] In other feasible implementations, the delimiter index rule can record the insertion position information of each first delimiter and each second delimiter; the delimiter index information can include the insertion position information of all first delimiters and second delimiters. In this way, during data recovery, the delimiter index information can be obtained, and the pre-inserted first and second delimiters can be located and deleted based on the delimiter index information. Then, the original data can be restored by performing base-1 decoding.
[0094] As an example, when the delimiter index rule does not depend on the insertion position of the first delimiter and the second delimiter, but only depends on the first delimiter and the second delimiter themselves, after an unstable character string is identified from the initial character string, the first delimiter and the second delimiter can be converted into delimiter index information according to the preset delimiter index rule before, after, or synchronously with the insertion of the delimiter.
[0095] As another example, in a case where the delimiter index rule depends on the insertion positions of the first delimiter and the second delimiter, after or synchronously with the insertion of the delimiter, information required for the delimiter index rule is determined based on the first delimiter and the second delimiter, and then delimiter index information is generated based on the preset delimiter index rule and at least one of the first delimiter, the second delimiter, and the information required for the delimiter index rule. For example, assuming that the information required for the delimiter index rule includes the insertion position information of the first delimiter and the second delimiter, the insertion position information of the first delimiter and the second delimiter can be converted into delimiter index information based on the preset delimiter index rule.
[0096] Step S40 , writing the separator index information into a preset index position of the target character string, and writing the target character string including the separator index information into a preset storage position.
[0097] The index position may refer to a position in the target string for writing the delimiter index information. As an example, the index position may be the head of the target string. During subsequent data recovery, the delimiter index information may be found from the head of the storage unit.
[0098] Illustratively, after obtaining the delimiter index information, the delimiter index information may be written into a preset index position of the target character string, and then the target character string after the delimiter index information is written may be written into a preset storage position in the memory.
[0099] In the above data storage method, first, original data is obtained and base-coded to obtain an initial string. The base-coded initial string is not directly stored. Instead, when an unstable string is identified from the initial string, a first delimiter is inserted into the starting position and the ending position of the unstable string, and a second delimiter is inserted between any two adjacent characters in the unstable string to form a target string. By inserting the delimiters, the unstable initial string is converted into a stable target string. Then, based on a preset delimiter index rule, the first delimiter and the second delimiter, delimiter index information is generated, the delimiter index information is written into the preset index position of the target string, and a stable target string containing the delimiter information is obtained. The target string is written into the preset storage position. In this way, on the one hand, by inserting the delimiter, the storage instability that may be caused by directly storing the unstable string can be effectively avoided, thereby improving the stability of data storage. On the other hand, compared with the method of replacing the unstable string, by inserting and reusing the delimiter, the amount of delimiter index information required for data recovery can be effectively reduced, so that the delimiter index information can be stored in situ, so that data recovery can be performed through self-repair, effectively saving storage space and improving storage efficiency.
[0100] In an exemplary embodiment, Figure 2 As shown, after the target character string is written into the preset storage location, the data storage method further includes steps S50 to S80.
[0101] Step S50 , reading a target character string from a preset storage location, and extracting separator index information from a preset index position of the target character string.
[0102] It should be noted that achieving stable data storage is not enough; the stably stored string must also be able to be restored to the original data. Traditional methods often rely on algorithms that are different from the data storage and externally stored information for data recovery.
[0103] This embodiment proposes a self-repair method. Self-repair means that the algorithm can repair stored data without relying on other external algorithms or externally stored data. Instead, it relies solely on the algorithm itself and its stored information to repair the stored data. Self-repair places higher demands on the algorithm and is more difficult.
[0104] For example, after any target string is written to the preset storage location, if the user needs to retrieve the original data corresponding to the target string, the user needs to first read the target string from the preset storage location and extract the delimiter index information from the preset index location of the target string.
[0105] Step S60: Locate each first delimiter and each second delimiter in the target character string based on the delimiter index information.
[0106] Exemplarily, after extracting the separator index information, relevant information of the first separator and the second separator can be further extracted from the separator index information, and then, based on the relevant information of the first separator and the second separator, all the first separators and the second separators are located in sequence from the target character string.
[0107] In some feasible implementations, the order in which the target character string is scanned during the process of locating the first and second delimiters may be the same as the order in which the initial character string is scanned during the process of identifying the unstable character string from the initial character string. For example, if the initial character string is scanned from left to right during the process of identifying the unstable character string, the initial character string may also be scanned from left to right during the process of searching for and locating the first and second delimiters in the target character string to avoid misidentification of the delimiters due to the different order.
[0108] Step S70: remove each first delimiter and each second delimiter from the target character string to form a character string to be decoded.
[0109] The character string to be decoded may refer to a character string that does not contain a separator and can be used to restore the original data through base-1 decoding.
[0110] Exemplarily, the located first delimiter and the second delimiter are deleted from the target character string to restore the character string to be decoded.
[0111] Step S80: Decode the character string to be decoded to obtain the original data.
[0112] Exemplarily, after the character string to be decoded is restored, the character string to be decoded can be decoded according to the same X-base rule as the base encoding to restore the original data, thereby completing the self-repair process.
[0113] In this embodiment, the data storage method of inserting separators has self-repair capabilities and does not require external interaction during data recovery. It can effectively improve the efficiency of data storage and recovery while ensuring the stability of data storage.
[0114] In an exemplary embodiment, Figure 3 As shown, the unstable string includes at least one of an exact match unstable string and a fuzzy match unstable string; before inserting a first delimiter at the start position and the end position of the unstable string, and inserting a second delimiter between any two adjacent characters in the unstable string to form a target string, the data storage method further includes steps 302 to 308. Among them:
[0115] Step 302: Obtain an exact matching unstable string list, where the exact matching unstable string list includes at least one exact matching unstable string.
[0116] It's important to note that string matching typically involves two modes: exact matching and fuzzy matching. Exact matching typically requires the string to be matched to be completely identical to the pattern, including character order, length, and content, with no discrepancies allowed. Fuzzy matching, on the other hand, typically allows for a certain degree of discrepancy between the string to be matched and the pattern, and determines whether a match exists based on a similarity metric. Similarity metrics such as edit distance and Hamming distance can be used. Fuzzy matching offers greater fault tolerance and flexibility, but it's also more likely to match unstable strings, leading to unstable and potentially corrupted data storage.
[0117] The exact match unstable string list is used to store exact match unstable strings. Exact match unstable strings may refer to specific string patterns that must be completely and precisely matched during data storage or transmission, which may cause data corruption or system abnormalities.
[0118] For example, before performing unstable character string recognition, a list of exactly matching unstable strings may be obtained first.
[0119] Step 304 : In response to the edit distance specification operation, obtain a specified target edit distance.
[0120] Illustratively, before unstable character string recognition is performed, if an edit distance specifying operation is detected, the target edit distance specified in the edit distance specifying operation may be acquired.
[0121] It is understandable that the edit distance specification operation is triggered by the user and can be performed before, after, or simultaneously with obtaining the exact matching unstable string list, and this embodiment does not impose any limitation on this.
[0122] In some feasible implementations, the target edit distance may be set with an initial value. When unstable character string recognition is required, if no user-initiated edit distance specification operation is detected, the terminal may automatically trigger the edit distance specification operation after obtaining the initial character string, specifying the preset initial value of the target edit distance as the target edit distance.
[0123] Step 306 : Based on the target edit distance, detect the fuzzy matching unstable string corresponding to each exact matching unstable string and generate a fuzzy matching unstable string list, wherein the edit distance between the fuzzy matching unstable string and the corresponding exact matching unstable string is less than the target edit distance.
[0124] The fuzzy matching unstable string list is used to store fuzzy matching unstable strings. A fuzzy matching unstable string may refer to a string pattern that can be fuzzily matched to an exact matching unstable string.
[0125] Fuzzy matching unstable strings can be determined based on fuzzy matching rules. In some feasible implementations, the fuzzy matching rule states that two string patterns whose edit distance is less than the template edit distance can be fuzzily matched to be the same string pattern. In this case, for each exact matching unstable string, all string patterns whose edit distance from the exact matching unstable string is less than the target edit distance can be determined as fuzzy matching unstable strings.
[0126] The edit distance may represent the minimum number of single-character edit operations required to transform one string into another, where single-character edit operations may include insertion, deletion, and substitution. For example, a target edit distance of 1 means that one string can be transformed into another through a single single-character edit operation.
[0127] For example, after determining the exact match unstable string list and the target edit distance, for each exact match unstable string in the exact match unstable string list, all fuzzy match unstable strings that are similar to the exact match unstable string and whose differences do not exceed the target edit distance can be generated, and these fuzzy match unstable strings can be arranged to form a fuzzy match unstable string list. For example, assuming that the binary exact match unstable string is 1010 and the target edit distance is 1, the generated fuzzy match unstable strings may include: strings generated by replacing one character, 0010, 1110, 1000, 1011; strings generated by deleting one character, 010, 100, 110, 101; and strings generated by adding one character, 01010, 11010, 10010, 10110, 10100.
[0128] Step 308, identifying the exact match unstable string from the initial string according to the exact match unstable string list, and identifying the fuzzy match unstable string from the initial string according to the fuzzy match unstable string list.
[0129] Exemplarily, after determining the exact match unstable string list, the exact match unstable string can be identified from the initial string according to the exact match unstable string list; after determining the fuzzy match unstable string list, the fuzzy match unstable string can be identified from the initial string according to the fuzzy match unstable string list.
[0130] In the embodiment, by identifying the exact match unstable string and the fuzzy match unstable string, and inserting the separator into the exact match unstable string and the fuzzy match unstable string, the stability of data storage in the fuzzy match mode can be effectively ensured.
[0131] In an exemplary embodiment, as shown in FIG. 4, before inserting the first separator into the start position and the end position of the unstable string, and inserting the second separator between any two adjacent characters in the unstable string to form the target string, the data storage method further includes steps 402 to 404. Wherein: Figure 4
[0132] Step 402, generating the second separator according to the preset exact match unstable string list, the preset fuzzy match unstable string list, the preset separator indexing rule and the initial string.
[0133] It should be noted that in the case of a large number of character types, the separator can be selected to be different from the characters in the initial string. However, usually the total number of characters is limited, and in the case of applying the initial string to all types of characters, the character types in the separator will be the same as at least part of the character types in the initial string. In this case, the separator itself can also cause instability.
[0134] Exemplarily, the generation condition or constraint condition of the second separator can be formulated based on the preset exact match unstable string list, the preset fuzzy match unstable string list, the preset separator indexing rule and the initial string, and then the second separator is generated based on the generation condition or constraint condition of the second separator.
[0135] In some feasible implementations, the generation conditions or constraints of the second delimiter may include: the second delimiter is not any exact match unstable string in the preset exact match unstable string list; the second delimiter is not a substring of any exact match unstable string in the preset exact match unstable string list; the second delimiter is not any fuzzy match unstable string in the preset fuzzy match unstable string list; the second delimiter is not a substring of any fuzzy match unstable string in the preset fuzzy match unstable string list; the second delimiter is not a substring of the initial string; the second delimiter does not match the preset delimiter index rule.
[0136] In other feasible implementations, the generation conditions or constraints of the second separator may include: the similarity between the second separator and any unstable string in the preset exact match unstable string list and the preset fuzzy match unstable string list is lower than a preset similarity threshold; the matching degree between the second separator and the preset separator index rule is lower than a preset matching threshold; the similarity with any substring of the initial string is lower than a preset similarity threshold.
[0137] Step 404 : Generate a first delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, an initial string, and a second delimiter.
[0138] Exemplarily, the generation conditions or constraints of the first separator can be formulated based on a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset separator index rule, an initial string and a second separator, and then the first separator can be generated based on the generation conditions or constraints of the first separator.
[0139] In some feasible implementations, the generation conditions or constraints of the first delimiter may include: the first delimiter is not any exact match unstable string in the preset exact match unstable string list; the first delimiter is not a substring of any exact match unstable string in the preset exact match unstable string list; the first delimiter is not any fuzzy match unstable string in the preset fuzzy match unstable string list; the first delimiter is not a substring of any fuzzy match unstable string in the preset fuzzy match unstable string list; the first delimiter is not a substring of the initial string; the first delimiter does not match the preset delimiter index rule; the first delimiter is not the mother string of the second delimiter.
[0140] In other feasible implementations, the generation conditions or constraints of the first separator may include: the similarity between the first separator and any unstable string in the preset exact match unstable string list and the preset fuzzy match unstable string list is lower than a preset similarity threshold; the matching degree between the first separator and the preset separator index rule is lower than the preset matching threshold; the similarity with any substring of the initial string is lower than the preset similarity threshold; and the similarity with the second separator is lower than the preset similarity threshold.
[0141] It is understandable that, in order to avoid instability caused by the delimiter, the generation conditions and constraints of the first delimiter and the second delimiter can be exactly the same. However, if the first delimiter and the second delimiter are contained in a relationship, it is difficult to clearly distinguish between the first delimiter and the second delimiter when identifying them, which can easily lead to misidentification. Therefore, after determining the second delimiter, the generation conditions or constraints of the first delimiter can be determined based on the second delimiter to avoid confusion between the two.
[0142] In this embodiment, when determining the delimiter, full consideration is given to the precise matching unstable string, fuzzy matching unstable string, delimiter index rules and related information of the initial string, which can effectively reduce the instability caused by the delimiter and further improve the stability of data storage and recovery.
[0143] In an exemplary embodiment, generating the second delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, and an initial string includes steps 4021 to 4023. In which:
[0144] Step 4021, generation step: generating all permutation and combination strings corresponding to the preset character length.
[0145] It should be noted that there may be multiple delimiters that meet the generation conditions or constraints of the delimiter, but the more characters a delimiter contains, the more storage space the delimiter consumes and the lower the recognition efficiency of the delimiter.
[0146] The preset character length can be determined according to actual needs and is not limited in this embodiment. In some feasible implementations, the preset character length can be 1 or 2. The preset character length of 1 or 2 can cover more possible permutation and combination strings and can guide the algorithm to start from a small number of characters to screen feasible second separators, thereby reducing the storage space occupied by the separators.
[0147] For example, we can first obtain a number of characters corresponding to a preset character length from the characters used in the base encoding, perform permutations and combinations, and obtain all feasible permutation and combination strings.
[0148] Step 4022: When all permutation and combination strings do not meet the preset second separator condition, increase the preset character length and return to the generation step until at least one permutation and combination string meets the preset second separator condition, wherein the preset second separator condition is determined based on the preset exact match unstable string list, the preset fuzzy match unstable string list, the preset separator index rule and the initial character string.
[0149] Among them, the preset second delimiter condition is determined based on a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule and an initial character string, and can be determined in advance based on experience or test results, etc. This embodiment does not limit this.
[0150] For example, after obtaining all feasible permutation and combination strings, each permutation and combination string can be compared with the preset second delimiter condition in turn. If none of the permutation and combination strings meet the preset second delimiter condition, the preset character length is increased by a preset length increment, and then the generation step is returned to detect whether a longer permutation and combination string meets the preset second delimiter condition. This cycle is repeated until at least one permutation and combination string that meets the preset second delimiter condition is found. In some feasible embodiments, the preset length increment can be 1.
[0151] Step 4023: When at least one permutation and combination string satisfies the preset second delimiter condition, one of the permutation and combination strings that satisfies the preset second delimiter condition is determined as the second delimiter.
[0152] Exemplarily, when one or more permutation and combination strings meeting the preset second delimiter condition are found, one of the permutation and combination strings meeting the preset second delimiter condition is determined as the second delimiter.
[0153] Generate a first delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, an initial string, and a second delimiter, including steps 4041 to 4043, wherein:
[0154] Step 4041: When multiple permutation and combination strings meet the preset second delimiter condition, one of the permutation and combination strings meeting the preset second delimiter condition is determined as a first delimiter, wherein the first delimiter is different from the second delimiter.
[0155] For example, when multiple permutation and combination strings that meet the preset second separator condition are found, one of them may be determined as the second separator, and another one of them may be determined as the first separator.
[0156] Step 4042: When a permutation and combination string satisfies the preset second delimiter condition, the preset character length is increased, and the generation step is returned to be executed until at least one permutation and combination string satisfies the preset first delimiter condition, wherein the preset first delimiter condition includes the preset second delimiter condition and the supplementary condition, and the supplementary condition is determined based on the second delimiter.
[0157] For example, when a permutation and combination string that satisfies the preset second delimiter condition is found, the permutation and combination string is preferentially determined as the second delimiter, and the first delimiter is further screened. Since the preset first delimiter condition includes the preset second delimiter condition, a permutation and combination string that does not satisfy the preset second delimiter condition will also not satisfy the preset first delimiter condition. Since only one permutation and combination string corresponding to the current candidate character satisfies the preset second delimiter condition, the generation step can be returned to detect whether a longer permutation and combination string can satisfy the preset first delimiter condition. This cycle is repeated until at least one permutation and combination string that satisfies the preset first delimiter condition is found.
[0158] Step 4043: If the permutation and combination string meets the preset first delimiter condition, the permutation and combination string is determined as the first delimiter.
[0159] Exemplarily, when one or more permutation and combination strings meeting the preset first separator condition are found, one of the permutation and combination strings meeting the preset first separator condition is determined as the first separator.
[0160] In this embodiment, on the one hand, by starting the delimiter condition matching from a shorter permutation and combination string and gradually increasing the length of the permutation and combination string, the storage space consumption of the first delimiter and the second delimiter can be effectively reduced. On the other hand, by partially unifying the first delimiter condition and the second delimiter condition, the second delimiter screening process essentially also completes a partial screening of the first delimiter, thereby effectively improving the screening efficiency of the first delimiter and the second delimiter, thereby improving the overall efficiency of data storage.
[0161] In an exemplary embodiment, the preset second delimiter condition includes:
[0162] The permutation and combination string is not any exact match unstable string in the preset exact match unstable string list;
[0163] The permutation and combination string is not a substring of any exact matching unstable string in the preset exact matching unstable string list;
[0164] The permutation and combination string is not any fuzzy matching unstable string in the preset fuzzy matching unstable string list;
[0165] The permutation and combination string is not a substring of any fuzzy matching unstable string in the preset fuzzy matching unstable string list;
[0166] The permutation and combination string is not a substring of the initial string;
[0167] The permutation and combination string does not match the preset delimiter index rule;
[0168] Supplementary conditions include:
[0169] The permutation and combination string is not the mother string of the second separator.
[0170] In order to avoid the instability of the delimiter itself, the second delimiter and the first delimiter can be constrained so as not to be an exact matching unstable string or a fuzzy matching unstable string.
[0171] In order to prevent the inserted delimiter from forming an unstable string with adjacent characters, the second delimiter and the first delimiter can be constrained so as not to be a substring of an exact match unstable string or a fuzzy match unstable string.
[0172] To improve the accuracy of identifying and deleting delimiters during data recovery and avoid accidental deletion of data, the second delimiter and the first delimiter can be constrained not to be substrings of the initial string.
[0173] In order to improve the accuracy of delimiter identification during data recovery and avoid incorrect delimiter identification, the second delimiter and the first delimiter can be constrained so as not to satisfy the preset delimiter index rule. In some feasible implementations, the preset delimiter index rule is to arrange the first delimiter and the second delimiter in sequence according to a repeating pattern, where the repeating pattern can be first delimiter + first delimiter + second delimiter + second delimiter. In this case, the repeating pattern should not appear in the permutation combination string.
[0174] In order to clearly distinguish the first separator from the second separator and avoid confusion that may cause errors in the data recovery process, the first separator may be constrained not to be the parent string of the second separator.
[0175] In an exemplary embodiment, the preset delimiter index rule includes arranging the first delimiter and the second delimiter according to a repetition pattern and a preset index arrangement order; generating delimiter index information based on the preset delimiter index rule, the first delimiter, and the second delimiter, including steps S31 to S33.
[0176] Step S31 : Arrange the first delimiters into a first initial index string according to a repeating pattern, and arrange the second delimiters into a second initial index string according to a repeating pattern.
[0177] The repetition pattern may refer to a form in which a substring appears repeatedly in a character string.
[0178] For example, the first delimiters may be arranged in a repeating pattern to form a first initial index string, and simultaneously, the second delimiters may be arranged in a repeating pattern to form a second initial index string. For example, assuming the first delimiter is ab and the second delimiter is bc, the first initial index string may be abab and the second initial index string may be bcbc.
[0179] Step S32 : Arrange the first initial index string and the second initial index string according to a preset index arrangement order to generate a separator index string.
[0180] The preset index arrangement order may refer to the arrangement order of the first initial index string and the second initial index string in the separator index string.
[0181] Exemplarily, the first initial index character string and the second initial index character string may be arranged according to a preset index arrangement order to obtain a separator index character string.
[0182] Step S33: Determine the delimiter index character string as delimiter index information.
[0183] Exemplarily, the obtained delimiter index character string may be determined as delimiter index information.
[0184] In this embodiment, delimiter index information is generated according to a repetitive pattern, which not only allows the first delimiter and the second delimiter to be quickly and accurately identified and extracted during the data recovery process, but also has a simple algorithm and consumes little storage space, thereby effectively improving data recovery efficiency.
[0185] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0186] Based on the same inventive concept, the embodiments of the present application also provide a data storage device for implementing the data storage method described above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more data storage device embodiments provided below can refer to the limitations of the data storage method described above, which will not be repeated here.
[0187] In one exemplary embodiment, as shown in Figure 5 A data storage device is provided, comprising: an acquisition module 502, an insertion module 504, a generation module 506 and a writing module 508, wherein:
[0188] The acquisition module 502 is configured to acquire original data, and perform base encoding on the original data to obtain an initial string;
[0189] The insertion module 504 is configured to, in a case where an unstable string is identified from the initial string, insert a first delimiter into a start position and an end position of the unstable string respectively, and insert a second delimiter between any two adjacent characters in the unstable string to form a target string;
[0190] The generation module 506 is configured to generate delimiter index information based on a preset delimiter index rule, the first delimiter and the second delimiter;
[0191] The writing module 508 is configured to write the delimiter index information into a preset index position of the target string, and write the target string containing the delimiter index information into a preset storage position.
[0192] In one exemplary embodiment, the data storage device further comprises a self-repairing module, which is further configured to:
[0193] read the target string from the preset storage position, and extract the delimiter index information from the preset index position of the target string;
[0194] based on the delimiter index information, locate each first delimiter and each second delimiter in the target string;
[0195] remove each first delimiter and each second delimiter from the target string to form a to-be-decoded string;
[0196] perform base decoding on the to-be-decoded string to obtain the original data.
[0197] In an exemplary embodiment, the unstable string includes at least one of an exact match unstable string and a fuzzy match unstable string; the data storage device further includes a recognition module, which, before inserting a first delimiter at a start position and an end position of the unstable string, respectively, and inserting a second delimiter between any two adjacent characters in the unstable string to form a target string, is further configured to:
[0198] Obtaining an exact matching unstable string list, where the exact matching unstable string list includes at least one exact matching unstable string;
[0199] In response to an edit distance specifying operation, obtaining a specified target edit distance;
[0200] Based on the target edit distance, the corresponding fuzzy matching unstable string of each exact matching unstable string is detected, and a list of fuzzy matching unstable strings is generated, wherein the edit distance between the fuzzy matching unstable string and the corresponding exact matching unstable string is less than the target edit distance;
[0201] According to the exact matching unstable string list, an exact matching unstable string is identified from the initial string, and according to the fuzzy matching unstable string list, a fuzzy matching unstable string is identified from the initial string.
[0202] In an exemplary embodiment, the data storage device further includes a delimiter determination module, which is further configured to: insert a first delimiter into the starting position and the ending position of the unstable character string, respectively, and insert a second delimiter between any two adjacent characters in the unstable character string to form the target character string;
[0203] Generate a second delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, and an initial string;
[0204] A first delimiter is generated according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, an initial string, and a second delimiter.
[0205] In an exemplary embodiment, the delimiter determination module is further configured to:
[0206] Generation step: Generate all permutation and combination strings corresponding to the preset character length;
[0207] If all permutation and combination strings do not meet the preset second delimiter condition, increase the preset character length, and return to the generation step until at least one permutation and combination string meets the preset second delimiter condition, wherein the preset second delimiter condition is determined based on a preset exact match unstable string list, a preset fuzzy match unstable string list, a preset delimiter index rule, and an initial character string;
[0208] In the case where at least one permutation and combination string meets the preset second delimiter condition, determining one of the permutation and combination strings meeting the preset second delimiter condition as the second delimiter;
[0209] Generate a first delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, an initial string, and a second delimiter, including:
[0210] In the case where multiple permutation and combination strings meet the preset second delimiter condition, one of the permutation and combination strings meeting the preset second delimiter condition is determined as the first delimiter, wherein the first delimiter is different from the second delimiter;
[0211] If one permutation and combination string satisfies the preset second delimiter condition, increasing the preset character length, and returning to the generation step until at least one permutation and combination string satisfies the preset first delimiter condition, wherein the preset first delimiter condition includes the preset second delimiter condition and a supplementary condition, and the supplementary condition is determined based on the second delimiter;
[0212] When the permutation and combination string meets the preset first separator condition, the permutation and combination string is determined as the first separator.
[0213] In an exemplary embodiment, the preset second delimiter condition includes:
[0214] The permutation and combination string is not any exact match unstable string in the preset exact match unstable string list;
[0215] The permutation and combination string is not a substring of any exact matching unstable string in the preset exact matching unstable string list;
[0216] The permutation and combination string is not any fuzzy matching unstable string in the preset fuzzy matching unstable string list;
[0217] The permutation and combination string is not a substring of any fuzzy matching unstable string in the preset fuzzy matching unstable string list;
[0218] The permutation and combination string is not a substring of the initial string;
[0219] The permutation and combination string does not match the preset delimiter index rule;
[0220] Supplementary conditions include:
[0221] The permutation and combination string is not the mother string of the second separator.
[0222] In an exemplary embodiment, the preset delimiter index rule includes arranging the first delimiter and the second delimiter according to a repetition pattern and a preset index arrangement order; the generating module 506 is further configured to:
[0223] Arrange the first delimiter into a first initial index string according to a repeating pattern, and arrange the second delimiter into a second initial index string according to a repeating pattern;
[0224] Arrange the first initial index string and the second initial index string according to a preset index arrangement order to generate a separator index string;
[0225] The delimiter index string is determined as the delimiter index information.
[0226] Each module in the aforementioned data storage device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0227] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, a mobile cellular network, near-field communication (NFC), or other technologies. When executed by the processor, the computer program implements a data storage method. The display unit of the computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0228] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0229] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0230] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0231] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0232] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0233] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of a non-volatile memory and a volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0234] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0235] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A data storage method, characterized in that: The method comprises: Obtaining original data, performing base encoding on the original data to obtain an initial character string; When an unstable character string is identified from the initial character string, inserting a first separator into a starting position and an ending position of the unstable character string respectively, and inserting a second separator between any two adjacent characters in the unstable character string to form a target character string; Generate delimiter index information based on a preset delimiter index rule, the first delimiter, and the second delimiter; The delimiter index information is written into a preset index position of the target character string, and the target character string including the delimiter index information is written into a preset storage position.
2. The method according to claim 1, characterized in that After writing the target character string into a preset storage location, the method further includes: Reading the target character string from a preset storage location, and extracting separator index information from a preset index position of the target character string; Locating each first separator and each second separator from the target character string based on the separator index information; Removing each of the first delimiters and each of the second delimiters from the target character string to form a character string to be decoded; The character string to be decoded is subjected to base-1 decoding to obtain original data.
3. The method according to claim 1, characterized in that The unstable character string includes at least one of an exact matching unstable character string and a fuzzy matching unstable character string; before inserting a first delimiter into a starting position and an ending position of the unstable character string, respectively, and inserting a second delimiter between any two adjacent characters in the unstable character string to form a target character string, the method further includes: Acquire an exact matching unstable string list, where the exact matching unstable string list includes at least one exact matching unstable string; In response to an edit distance specifying operation, obtaining a specified target edit distance; Based on the target edit distance, detecting the fuzzy matching unstable string corresponding to each of the exact matching unstable strings, and generating a fuzzy matching unstable string list, wherein the edit distance between the fuzzy matching unstable string and the corresponding exact matching unstable string is less than the target edit distance; According to the exact matching unstable string list, an exact matching unstable string is identified from the initial string, and according to the fuzzy matching unstable string list, a fuzzy matching unstable string is identified from the initial string.
4. The method according to claim 1, wherein Before inserting a first delimiter into the starting position and the ending position of the unstable character string, and inserting a second delimiter between any two adjacent characters in the unstable character string to form a target character string, the method further includes: Generate a second delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, and the initial string; A first separator is generated according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset separator index rule, the initial character string and the second separator.
5. The method according to claim 4, characterized in that The generating of the second delimiter according to the preset exact matching unstable string list, the preset fuzzy matching unstable string list, the preset delimiter index rule and the initial string includes: Generation step: Generate all permutation and combination strings corresponding to the preset character length; In the case that all the permutation and combination strings do not meet the preset second delimiter condition, increasing the preset character length, and returning to the generation step until at least one of the permutation and combination strings meets the preset second delimiter condition, wherein the preset second delimiter condition is determined based on a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, and the initial character string; In the case where at least one of the permutation and combination strings meets the preset second delimiter condition, determining one of the permutation and combination strings meeting the preset second delimiter condition as the second delimiter; The step of generating the first delimiter according to a preset exact matching unstable string list, a preset fuzzy matching unstable string list, a preset delimiter index rule, the initial string, and the second delimiter includes: In the case where a plurality of the permutation and combination strings satisfy the preset second delimiter condition, determining one of the permutation and combination strings that satisfies the preset second delimiter condition as the first delimiter, wherein the first delimiter is different from the second delimiter; If one of the permutation and combination strings satisfies the preset second delimiter condition, increasing the preset character length and returning to the generation step until at least one of the permutation and combination strings satisfies the preset first delimiter condition, wherein the preset first delimiter condition includes a preset second delimiter condition and a supplementary condition, and the supplementary condition is determined based on the second delimiter; In the case that the permutation and combination string meets the preset first separator condition, the permutation and combination string is determined as the first separator.
6. The method according to claim 5, characterized in that The preset second delimiter conditions include: The permutation and combination string is not any exact matching unstable string in the preset exact matching unstable string list; The permutation and combination string is not a substring of any exact matching unstable string in the preset exact matching unstable string list; The permutation and combination string is not any fuzzy matching unstable string in the preset fuzzy matching unstable string list; The permutation and combination string is not a substring of any fuzzy matching unstable string in the preset fuzzy matching unstable string list; The permutation and combination string is not a substring of the initial string; The permutation and combination string does not match the preset delimiter index rule; The supplementary conditions include: The permutation and combination string is not the mother string of the second separator.
7. The method according to any one of claims 1 to 6, characterized in that The preset delimiter index rule includes arranging the first delimiter and the second delimiter according to a repetition pattern and a preset index arrangement order; The generating of delimiter index information based on a preset delimiter index rule, the first delimiter, and the second delimiter includes: Arranging the first delimiters into a first initial index string according to a repeating pattern, and arranging the second delimiters into a second initial index string according to a repeating pattern; Arrange the first initial index string and the second initial index string according to a preset index arrangement order to generate a separator index string; The delimiter index character string is determined as delimiter index information.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
