Chinese character sequence determination method and device, equipment and medium

By obtaining the Chinese character code, using the character code and the pinyin array to determine the pinyin position serial number, and directly taking the value to sort the Chinese characters, the time complexity of O(1) is achieved, and the efficient sorting of Chinese characters in pinyin order is realized.

CN120781799APending Publication Date: 2025-10-14TRANSWARP TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510894749.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-14

AI Technical Summary

Technical Problem

The existing technology is inefficient in sorting Chinese characters by pinyin, especially for rare characters and dialect characters, which are not included, resulting in low efficiency in traversing Chinese characters.

Method used

By obtaining the Chinese character code, using the character code array and the pinyin array to determine the pinyin position serial number, directly taking the value to sort the Chinese characters, the positioning of the pinyin order is achieved.

Benefits of technology

It achieves efficient sorting of Chinese characters in phonetic order, reduces the time required for phonetic symbol query, achieves time complexity of O(1), and realizes technical efficacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120781799A_ABST
    Figure CN120781799A_ABST
Patent Text Reader

Abstract

The invention discloses a Chinese character sequence determination method and device, equipment and a medium, and relates to the technical field of computers. The Chinese character sequence determination method comprises the following steps: obtaining Chinese character codes of Chinese characters to be sorted; according to the Chinese character codes, the character code array and the pinyin array, determining pinyin position serial numbers of the Chinese characters to be sequenced; and sorting the to-be-sorted Chinese characters according to the pinyin position serial numbers. According to the method, values are directly obtained from the corresponding character code arrays and the pinyin arrays through Chinese character codes, the pinyin position serial numbers of the to-be-sorted Chinese characters are determined, the character code values and the pinyin arrays are mapped, the pinyin positions of the to-be-sorted Chinese characters are efficiently positioned, and therefore efficient sorting of the Chinese characters according to the pinyin sequence is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and medium for determining the order of Chinese characters. Background Art

[0002] Pinyin sorting plays an important role in improving data accessibility and user experience, especially in scenarios involving large amounts of Chinese text processing. For example, when searching for Chinese records stored in a database, pinyin sorting can help quickly locate the target record.

[0003] The existing technology can use the phonetic sequence table to traverse the Chinese characters to be sorted and determine their corresponding sorting positions. The phonetic sequence table includes most commonly used Chinese characters, but some rare characters and dialect characters may not be included. In addition, the method of traversing Chinese characters using the phonetic sequence table is inefficient. Summary of the Invention

[0004] The present invention provides a method, device, equipment and medium for determining the sequence of Chinese characters, so as to realize the rapid determination and sorting of Chinese character phonetic symbols.

[0005] According to a first aspect of the present invention, there is provided a method for determining the order of Chinese characters, comprising:

[0006] Get the Chinese character encoding of the Chinese characters to be sorted;

[0007] Determine the pinyin position sequence number of the Chinese characters to be sorted according to the Chinese character code, character code array and pinyin array;

[0008] The Chinese characters to be sorted are sorted according to the pinyin position serial numbers.

[0009] According to a second aspect of the present invention, there is provided a device for determining a sequence of Chinese characters, comprising:

[0010] The encoding acquisition module is used to obtain the Chinese character encoding of the Chinese characters to be sorted;

[0011] A sequence number determination module, configured to determine the pinyin position sequence number of the Chinese character to be sorted according to the Chinese character code, the character code array and the pinyin array;

[0012] The Chinese character sorting module is used to sort the Chinese characters to be sorted according to the pinyin position serial numbers.

[0013] According to a third aspect of the present invention, there is provided an electronic device, comprising:

[0014] at least one processor; and

[0015] a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the Chinese character sequence determination method described in any embodiment of the present invention.

[0017] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the Chinese character sequence determination method described in any embodiment of the present invention when executed.

[0018] According to a fifth aspect of the present invention, an embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the Chinese character sequence determination method of any embodiment of the present invention.

[0019] The technical solution of the embodiment of the present invention obtains the Chinese character codes of the Chinese characters to be sorted; determines the pinyin position sequence number of the Chinese characters to be sorted based on the Chinese character codes, the character code array, and the pinyin array; and sorts the Chinese characters to be sorted based on the pinyin position sequence number. By directly obtaining values ​​from the corresponding character code array and pinyin array using the Chinese character codes, the pinyin position sequence number of the Chinese characters to be sorted is determined, and the character code values ​​are mapped to the pinyin array to achieve efficient positioning of the pinyin position of the Chinese characters to be sorted, thereby achieving efficient sorting of Chinese characters in pinyin order.

[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 is a flow chart of a method for determining the order of Chinese characters provided according to the first embodiment of the present invention;

[0023] Figure 2 This is an example flow chart of a method for determining the order of Chinese characters provided according to the first embodiment of the present invention;

[0024] Figure 32 is a schematic structural diagram of a device for determining the sequence of Chinese characters according to a second embodiment of the present invention;

[0025] Figure 4 It is a schematic structural diagram of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] Example 1

[0029] Figure 1 A flowchart of a method for determining the order of Chinese characters is provided for the first embodiment of the present invention. This embodiment is applicable to the case where Chinese characters are arranged in order according to pinyin. The method can be executed by a Chinese character order determination device, which can be implemented in the form of hardware and / or software. The Chinese character order determination device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0030] S110, obtaining the Chinese character codes of the Chinese characters to be sorted.

[0031] In this embodiment, the Chinese characters to be sorted can be understood as Chinese characters to be sorted in alphabetical order, for example, when performing statistics, Chinese characters need to be sorted in alphabetical order. Chinese character encoding can be understood as a method that allows computers to accurately identify, store and process.

[0032] Specifically, the user can select Chinese characters to be sorted as the Chinese characters to be sorted, for example, select Chinese characters in a column in a table to be sorted in phonetic order, and the processor can obtain the Chinese character codes of the Chinese characters to be sorted.

[0033] S120, determining the pinyin position sequence numbers of the Chinese characters to be sorted according to the Chinese character codes, the character code array and the pinyin array.

[0034] In this embodiment, the character code array can be understood as representing the mapping relationship between the Chinese character code and the coordinates of the pinyin array to which it belongs. The pinyin array can be understood as representing the mapping relationship between the Chinese character code and the pinyin, where the pinyin is arranged in order. The pinyin position serial number can be understood as representing the position of the pinyin in the pinyin array in the form of a serial number.

[0035] Specifically, the processor may determine the pinyin array coordinates corresponding to the Chinese character code based on the mapping relationship between the Chinese character code in the character code array and the pinyin array coordinates. The processor may determine the pinyin position number of the Chinese character to be sorted in the pinyin array based on the mapping relationship between the Chinese character code in the pinyin array and the pinyin.

[0036] S130, sorting the Chinese characters to be sorted according to the pinyin position serial numbers.

[0037] Specifically, the processor can sort the Chinese characters to be sorted according to the order of the pinyin position numbers. Since there are multiple Chinese characters (i.e. homophones) corresponding to one pinyin, their pinyin position numbers may be the same, the encoding array corresponding to the pinyin position number can be traversed, that is, all the Chinese character encodings under the pinyin are traversed in order, so that the first traversed homophone is regarded as the Chinese character in the front order, and the other is regarded as the Chinese character in the back order, and the loop is ended to realize the pinyin sorting of the Chinese characters to be sorted.

[0038] For example, let's compare the two rare Chinese character sequences of "濝" (qí) and "斉" (qí). We obtain the pinyin array pinyin_1006

[130] (where 1006 is the pinyin position number, 130 represents the number of all Chinese characters contained in this pinyin, and the whole represents the array corresponding to the qí sound). That is, this pinyin has a total of 130 homophones. When traversing pinyin_1006, when the loop reaches the 18th time, "斉" is matched first. At this time, the processor can determine that "斉" must be in front of "濝". At this time, there is no need to traverse back to find "濝" and jump out of the loop.

[0039] The technical solution of the embodiment of the present invention obtains the Chinese character codes of the Chinese characters to be sorted; determines the pinyin position sequence number of the Chinese characters to be sorted based on the Chinese character codes, the character code array, and the pinyin array; and sorts the Chinese characters to be sorted based on the pinyin position sequence number. By directly obtaining values ​​from the corresponding character code array and pinyin array using the Chinese character codes, the pinyin position sequence number of the Chinese characters to be sorted is determined, and the character code values ​​are mapped to the pinyin array to achieve efficient positioning of the pinyin position of the Chinese characters to be sorted, thereby achieving efficient sorting of Chinese characters in pinyin order.

[0040] Furthermore, based on the above embodiment, the steps of determining the pinyin position sequence numbers of the Chinese characters to be sorted according to the Chinese character codes, the character code array and the pinyin array can be refined as follows:

[0041] According to the Chinese character code and the character code array, determine the pinyin array coordinates corresponding to the Chinese character code; based on the pinyin array coordinates, determine the target pinyin array to which the pinyin array coordinates belong from the pre-built pinyin index array; traverse the target pinyin array to determine the pinyin position serial number of the Chinese characters to be sorted.

[0042] In this embodiment, the pinyin array coordinates can be understood as representing the position in the pinyin array. The pinyin index array can be understood as representing the index relationship between the pinyin array coordinates and the pinyin array. The target pinyin array can be understood as the array where the phonetic symbols of the Chinese characters to be sorted are located.

[0043] Specifically, the processor can traverse the character encoding array according to the Chinese character encoding to determine the pinyin array coordinates corresponding to the Chinese character encoding. Based on the pinyin array coordinates, the processor can determine the target pinyin array to which the pinyin array coordinates belong from a pre-built pinyin index array; and traverse the target pinyin array to determine the pinyin position sequence number of the Chinese character to be sorted.

[0044] Furthermore, based on the above embodiment, the coordinates of the pinyin array corresponding to the Chinese character encoding can be determined according to the Chinese character encoding and the character encoding array, including:

[0045] If the Chinese character encoding is a four-byte encoding, the pinyin array coordinates corresponding to the Chinese character encoding are determined based on the pre-built four-byte Chinese character distribution map and the four-byte character encoding array; otherwise, the pinyin array coordinates corresponding to the Chinese character encoding are determined based on the character encoding array of other bytes.

[0046] In the present embodiment, the four-byte (4bytes) encoding can be understood as a unit consisting of four consecutive bytes. The pre-built four-byte Chinese character distribution map can be understood as a map for characterizing the distribution interval of the four-byte Chinese characters, for example, it can be divided into seven intervals, including the start code and the end code of each interval, and the number of Chinese character codes contained in the interval. The four-byte character encoding array can be understood as a mapping array that only includes the four-byte Chinese character encoding. The character encoding array of other bytes can be understood as a mapping array that includes the Chinese character encoding of other bytes except the four bytes, for example, it can include one-byte and two-byte Chinese character encodings.

[0047] Specifically, the processor may first determine the number of bytes in the Chinese character encoding. If the Chinese character encoding is a four-byte encoding, the processor may first determine the encoding sequence number to which the Chinese character encoding belongs based on a pre-built four-byte Chinese character distribution map, and then determine the pinyin array coordinates corresponding to the encoding sequence number in the four-byte character encoding array. If the Chinese character encoding is not a four-byte encoding, the processor may determine the pinyin array coordinates corresponding to the Chinese character encoding in character encoding arrays of other bytes.

[0048] Among them, based on the above embodiment, the step of determining the pinyin array coordinates corresponding to the Chinese character code according to the pre-constructed four-byte Chinese character distribution map and the four-byte character code array can be refined as follows:

[0049] In the pre-built four-byte Chinese character distribution map, determine the starting code value of the interval to which the Chinese character code belongs and the number of codes in the preceding interval; determine the position sequence number based on the starting code value, the Chinese character code and the number of codes; and search in the four-byte character code array based on the position sequence number to determine the pinyin array coordinates corresponding to the Chinese character code.

[0050] In this embodiment, the starting code value can be understood as the code value representing the first Chinese character code in the interval to which the Chinese character code belongs. The preceding interval can be understood as all intervals preceding the interval to which the character belongs. The number of codes can be understood as the total number of Chinese character codes contained in the preceding interval. The position number can be understood as the serial number used to represent the position in the four-byte character code array.

[0051] Specifically, the processor can first determine the interval to which the Chinese character code belongs in the pre-built four-byte Chinese character distribution map, and determine the starting code value of the interval to which the Chinese character code belongs and the number of codes in the preceding interval. The processor can determine the position number based on the starting code value, the Chinese character code, and the number of codes. The processor can then search the four-byte character code array based on the position number to determine the pinyin array coordinates corresponding to the Chinese character code.

[0052] For example, if you want to query the Chinese character whose Chinese character code is 0x95328236, first determine that it is four bytes, then you need to take a value from the four-byte character code array code_4bytes. From the pre-built four-byte Chinese character distribution map, it can be determined that it belongs to the third interval of the seven intervals, with a starting code value of 0x95328236. The number of codes in the first interval is 6530, and the number of codes in the second interval is 66. Then, by 0x95328236-0x95328236+6530+66, you get 6596, that is, the position number is 6596, code_4bytes

[6596] =470, and taking the value of the 6596th bit in code_4bytes gives 470.

[0053] The embodiment of the present invention designs character code arrays of other bytes, four-byte character code arrays and pinyin arrays. First, the pinyin array coordinate value is taken from the corresponding character code array based on the number of bytes of the Chinese character code, and then the pinyin array value of the target pinyin array is taken out according to the pinyin array coordinate value based on the pinyin index array. Finally, the target pinyin array is traversed to determine the pinyin position sequence number of the Chinese character code, thereby realizing the mapping between the character code value and the pinyin array. The overall query is only traversed in the target pinyin array of the last phonetic symbol, which greatly reduces the time required for the query of the phonetic symbol, thereby realizing the efficient sorting of Chinese characters in pinyin order, and the time complexity of the operation process is only O(1).

[0054] As a first optional embodiment of the first embodiment, the steps of constructing the pinyin array include:

[0055] Obtain a pre-built pinyin standard; create a pinyin array based on the order of each phonetic symbol in the pinyin standard and the Chinese character encoding and quantity of each phonetic symbol, the pinyin array containing a mapping relationship between the phonetic symbol and the corresponding Chinese character encoding.

[0056] In this embodiment, the pre-built pinyin standard can be understood as a standard file that sets the pinyin of Chinese characters. In this file, all the pinyin of Chinese characters can be seen. Each line in the file represents a phonetic symbol (i.e., a homophone), and they are arranged in order. For example, there are a total of 1665 lines, i.e., 1665 phonetic symbols. The phonetic symbol is the pinyin that represents the pronunciation of each Chinese character.

[0057] Specifically, the processor can obtain a pre-built pinyin standard, and can read each phonetic symbol in the pinyin standard in sequence through a scripting language or other means, and generate a corresponding number of one-dimensional arrays according to the order of the phonetic symbols, and write the mapping relationship between the Chinese character code and each phonetic symbol into the one-dimensional array to obtain a pinyin array.

[0058] For example, the 1665 pinyin arrays contain a total of 20988 two-byte and 66913 four-byte Chinese characters, excluding one byte of ASCII, which always comes before the Chinese characters. The uint data type is used here, occupying approximately 340KB of storage space.

[0059] For example, uint pinyin_1[3] = {B0A2, BAC7, EFB9}; corresponds to the Chinese character encoding of "阿、呵及锕", where 1 indicates the order and [3] indicates the number of Chinese characters under the phonetic symbol. uint pinyin_2[1] = {E0C4}; corresponds to the GB18030-2022 encoding of the Chinese character "嗄". uint pinyin_3[1] = {B0A1}; corresponds to the GB18030-2022 encoding of the Chinese character "啊".

[0060] In a first optional embodiment of the first embodiment of the present invention, a mapping relationship between Chinese character codes and phonetic symbols is constructed in an array form, so as to facilitate a quick query of subsequent phonetic symbol sorting.

[0061] As a second optional embodiment of the first embodiment, the steps of constructing the character code array include:

[0062] Obtain a pre-generated character statistics table, which counts the character statistics according to the coding area, character source, coding range, number of codes, number of graphic characters and number of Chinese characters; generate a mapping relationship between the first code and the first pinyin array coordinate in the character coding array of other bytes according to the first codes in the coding areas other than the four-byte area in the coding area and the first pinyin array coordinates in the pinyin array; generate a mapping relationship between the non-Chinese characters in the preset non-Chinese character area and the preset value in the character coding array of other bytes according to the preset non-Chinese character area, the number of arrays occupied by the preset non-Chinese character area and the preset value; generate a mapping relationship between the second code and the second pinyin array coordinates in the four-byte data coding array according to the number of codes corresponding to the four-byte area and each second code and the second pinyin array coordinates in the pinyin array.

[0063] In this embodiment, the character statistics table can be understood as a statistics table formed to facilitate the generation of a character encoding array. The character statistics table performs statistics according to encoding area, character source, encoding range, encoding number, graphic character number and Chinese character number.

[0064] For example, let's take a specific character statistics table as an example:

[0065] Table 1 Character statistics

[0066]

[0067] In this embodiment, other coding areas can be understood as other coding areas other than the four-byte area, such as the single-byte area and the double-byte area in the table above. The first code is used to characterize the codes in the other coding areas. The first pinyin array coordinates can be understood as the coordinates of the first code in the pinyin array. The preset non-Chinese character area can be understood as other characters other than Chinese characters, such as graphic characters, ASCII codes, custom or reserved extended characters, etc. The number of arrays can be understood as the number of preset non-Chinese characters, which can be counted separately according to different types. The preset value can be understood as a value set to distinguish between preset non-Chinese characters and Chinese characters. Different values ​​can be set according to different types of preset non-Chinese characters, for example, the preset value of the ASCII code is 0, the image is -1, etc. The second code is used to characterize the code of the four-byte area to distinguish it from the first code. The second pinyin array coordinates can be understood as the coordinates of the first code in the pinyin array to distinguish it from the first pinyin array coordinates.

[0068] Specifically, the processor can generate a mapping relationship between the first code and the first pinyin array coordinates in the character code array of other bytes based on the first codes in the other coding areas except the four-byte area in the coding area and the first pinyin array coordinates in the pinyin array. According to the preset non-Chinese character area, the number of arrays occupied by the preset non-Chinese character area and the preset value, the mapping relationship between the non-Chinese characters in the preset non-Chinese character area and the preset value in the character code array of other bytes is generated. According to the number of codes corresponding to the four-byte area and each second code and the second pinyin array coordinates in the pinyin array, the mapping relationship between the second code and the second pinyin array coordinates in the four-byte data code array is generated.

[0069] For example, the processor can place Chinese characters encoded with one byte and two bytes in a one-dimensional array to generate a character encoding array for the other bytes (for example, it can be represented by shortcode_1_2bytes), as follows: shortcode_1_2bytes

[65536] = {0,0,0...607,1159,1382...-1,-1...789,54,635...-1,-1...485,782,648,1...-1,-1,-1...}. The first value 1 is at position 2130 of the array, which will be used in the following examples. Because the combined code bits of the single-byte and double-byte areas of the encoding standard only use about 25,000, an array size of 65536 is sufficient. The array has 127 zeros at the beginning, indicating ASCII. Since ASCII code has no pinyin, it can be represented by a preset value of 0. For example, the decimal value of the ASCII code 'x' is 120, so code_1_2bytes

[120] = 0. The -1 in the array indicates that the code position is currently undefined or is a graphic, not a Chinese character. It may be expanded in the future, so -1 is used as a placeholder. For example, the decimal value corresponding to 0xA1A1 in the encoding standard is 41377, which is a graphic symbol, so code_1_2bytes

[41377] = -1; the decimal value corresponding to 0xF8A1 in GB18030 is 63649, which is a user-defined area, so code_1_2bytes

[63649] = -1. Other values ​​greater than 0 represent the pinyin array corresponding to the pinyin of the Chinese character at the code position. For example, the first three Chinese characters in the encoding standard (sorted by encoding value) are 丂, 丄, and 丅, and their information is as follows: the hexadecimal code of the Chinese character 丂 is 8140, the decimal code is 33088, the pinyin is kao (third tone), and the pinyin array is pinyin_607; the hexadecimal code of the Chinese character 丄 is 8141, the decimal code is 33089, the pinyin is shang (fourth tone), and the pinyin array is pinyin_1159; the hexadecimal code of the Chinese character 丅 is 8142, the decimal code is 33090, the pinyin is xia (fourth tone), and the pinyin array is pinyin_1382; therefore, code_1_2bytes

[33088] =607, and the pinyin array coordinate is 607.

[0070] A second optional embodiment of the first embodiment of the present invention constructs a mapping relationship between Chinese character codes of different bytes and different character types and pinyin array coordinates in an array form, which facilitates the subsequent rapid query of the pinyin array coordinates.

[0071] As a third optional embodiment of the first embodiment, based on the above embodiment, it further includes:

[0072] Generate a pinyin index array based on the address of the pinyin array and the number of pinyins.

[0073] In this embodiment, the address can be understood as the address for recording the pinyin array. The number of pinyin is the number of all phonetic symbols included, such as 1665 in the above example.

[0074] Specifically, the processor generates a one-dimensional pinyin index array based on the number of pinyins, which is used to record the addresses of all pinyin arrays. For example, it can be uint*pinyin_index

[1665] = {pinyin_1, pinyin_2, ... pinyin_1665}, where 1665 represents the number and pinyin_1-pinyin_1665 represents the address of each array.

[0075] A third optional embodiment of the first embodiment of the present invention facilitates the rapid determination of the subsequent target pinyin array by establishing an index between the pinyin array address and the pinyin array coordinates.

[0076] For example, the steps of this method can be demonstrated with a specific example. Figure 2 This is an example flow chart of a method for determining the order of Chinese characters provided in the first embodiment of the present invention. Figure 2 As shown, the steps may include:

[0077] S201, obtaining the Chinese character codes of the Chinese characters to be sorted;

[0078] S202, whether the Chinese character encoding is four bytes; if so, jump to step S203, if not, jump to step S204;

[0079] S203, based on the pre-built four-byte Chinese character distribution map, determine the corresponding pinyin array coordinates from the four-byte character code array (code_4bytes);

[0080] S204, determine the corresponding pinyin array coordinates from the character code array (code_1_2bytes) of other bytes;

[0081] S205, locate the target pinyin array from the pinyin index array (pinyin_indx) according to the pinyin array coordinates;

[0082] S206, traverse the target pinyin array, find its position under the phonetic symbol, obtain the pinyin position sequence number of the Chinese characters to be sorted, and obtain the order of the Chinese characters to be sorted.

[0083] For example, the Chinese character to be queried is "阿", the processor can first obtain the code B0A2 of the Chinese character to be queried "阿", which is 2130 in decimal, and judge that it is two bytes, then take the value 1 of the 2130th bit from code_1_2bytes. It can be seen from the generated pinyin index array pinyin_index that the pinyin array corresponding to 1 is pinyin_1. Traverse the pinyin_1 array and find the code B0A2 of "阿". It is found that it is in the first position. At this time, it is determined that the phonetic order of the Chinese character is the first position of the first phonetic symbol in Chinese.

[0084] Example 2

[0085] Figure 3 This is a schematic diagram of the structure of a Chinese character sequence determination device provided by the second embodiment of the present invention. Figure 3 As shown, the device includes:

[0086] The code acquisition module 31 is used to obtain the Chinese character codes of the Chinese characters to be sorted;

[0087] A sequence number determination module 32 is used to determine the pinyin position sequence number of the Chinese character to be sorted according to the Chinese character code, character code array and pinyin array;

[0088] The Chinese character sorting module 33 is used to sort the Chinese characters to be sorted according to the pinyin position serial numbers.

[0089] The technical solution of the embodiment of the present invention obtains the Chinese character codes of the Chinese characters to be sorted; determines the pinyin position sequence number of the Chinese characters to be sorted based on the Chinese character codes, the character code array, and the pinyin array; and sorts the Chinese characters to be sorted based on the pinyin position sequence number. By directly obtaining values ​​from the corresponding character code array and pinyin array using the Chinese character codes, the pinyin position sequence number of the Chinese characters to be sorted is determined, and the character code values ​​are mapped to the pinyin array to achieve efficient positioning of the pinyin position of the Chinese characters to be sorted, thereby achieving efficient sorting of Chinese characters in pinyin order.

[0090] Furthermore, the sequence number determination module 32 includes:

[0091] A first determining unit, configured to determine the pinyin array coordinates corresponding to the Chinese character code according to the Chinese character code and the character code array;

[0092] A second determining unit is configured to determine, based on the pinyin array coordinates, a target pinyin array to which the pinyin array coordinates belong from a pre-built pinyin index array;

[0093] The third determining unit is used to traverse the target pinyin array to determine the pinyin position sequence number of the Chinese characters to be sorted.

[0094] The first determining unit includes:

[0095] A first determining subunit is configured to determine, if the Chinese character encoding is a four-byte encoding, the pinyin array coordinates corresponding to the Chinese character encoding according to a pre-built four-byte Chinese character distribution map and a four-byte character encoding array;

[0096] The second determining subunit is used to determine the pinyin array coordinates corresponding to the Chinese character encoding based on the character encoding array of other bytes.

[0097] The first determining subunit is specifically configured to:

[0098] In the pre-constructed four-byte Chinese character distribution map, determining the starting code value of the interval to which the Chinese character code belongs and the number of codes in the preceding interval;

[0099] Determine the position number according to the starting code value, the Chinese character code and the code quantity;

[0100] The pinyin array coordinates corresponding to the Chinese character code are determined by searching in the four-byte character code array according to the position serial number.

[0101] Optionally, the device further includes: a first building module.

[0102] The first building block is specifically used for:

[0103] Get pre-built pinyin standards;

[0104] According to the order of each phonetic symbol in the phonetic standard and the Chinese character code and quantity contained in each phonetic symbol, a phonetic array is established, and the phonetic array contains a mapping relationship between the phonetic symbol and the corresponding Chinese character code.

[0105] Optionally, the device further includes: a second building module.

[0106] The second building block is specifically configured to:

[0107] Obtaining a pre-generated character statistics table, wherein the character statistics table is based on coding area, character source, coding range, coding number, graphic character number, and Chinese character number;

[0108] Generate a mapping relationship between the first code in the character code array of other bytes and the first pinyin array coordinates according to each first code in the other code areas except the four-byte area in the code area and the first pinyin array coordinates to which they belong in the pinyin array;

[0109] Generate a mapping relationship between each non-Chinese character in the preset non-Chinese character area and the preset value in the character code array of other bytes according to the preset non-Chinese character area, the number of arrays occupied by the preset non-Chinese character area and the preset value;

[0110] According to the number of codes corresponding to the four-byte area and each second code and the second pinyin array coordinates in the pinyin array, a mapping relationship between the second code in the four-byte data code array and the second pinyin array coordinates is generated.

[0111] Optionally, the device further includes: a third building module.

[0112] The third building block is specifically configured to:

[0113] Generate a pinyin index array according to the address of the pinyin array and the number of pinyins.

[0114] The Chinese character sequence determination device provided in the embodiment of the present invention can execute the Chinese character sequence determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0115] Example 3

[0116] Figure 4 A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0117] like Figure 4 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., which is communicatively connected to the at least one processor 41. The memory stores a computer program that can be executed by the at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 into the random access memory (RAM) 43. Various programs and data required for the operation of the electronic device 40 can also be stored in the RAM 43. The processor 41, ROM 42, and RAM 43 are connected to each other via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0118] Multiple components in the electronic device 40 are connected to the I / O interface 45, including an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a magnetic disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0119] Processor 41 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 41 executes the various methods and processes described above, such as the method for determining the order of Chinese characters.

[0120] In some embodiments, the Chinese character order determination method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the Chinese character order determination method described above can be performed. Alternatively, in other embodiments, the processor 41 can be configured to perform the Chinese character order determination method in any other appropriate manner (for example, by means of firmware).

[0121] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0122] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0123] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0124] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0125] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0126] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0127] In one embodiment, the present invention further includes a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the method for determining the order of Chinese characters of any embodiment of the present invention.

[0128] The computer program product may be implemented by writing computer program code for performing the operations of the present invention in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0129] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0130] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A method for determining the order of Chinese characters, characterized in that: include: Get the Chinese character encoding of the Chinese characters to be sorted; Determine the pinyin position sequence number of the Chinese characters to be sorted according to the Chinese character code, character code array and pinyin array; The Chinese characters to be sorted are sorted according to the pinyin position serial numbers.

2. The method according to claim 1, characterized in that The step of determining the pinyin position sequence numbers of the Chinese characters to be sorted according to the Chinese character codes, the character code array, and the pinyin array comprises: Determine the pinyin array coordinates corresponding to the Chinese character code according to the Chinese character code and the character code array; Based on the pinyin array coordinates, determining the target pinyin array to which the pinyin array coordinates belong from a pre-built pinyin index array; Traverse the target pinyin array to determine the pinyin position sequence number of the Chinese characters to be sorted.

3. The method according to claim 2, characterized in that The step of determining the pinyin array coordinates corresponding to the Chinese character code according to the Chinese character code and the character code array includes: If the Chinese character code is a four-byte code, determining the pinyin array coordinates corresponding to the Chinese character code according to a pre-built four-byte Chinese character distribution map and a four-byte character code array; Otherwise, the pinyin array coordinates corresponding to the Chinese character encoding are determined according to the character encoding arrays of other bytes.

4. The method according to claim 3, characterized in that The method of determining the pinyin array coordinates corresponding to the Chinese character code according to the pre-built four-byte Chinese character distribution map and the four-byte character code array includes: In the pre-constructed four-byte Chinese character distribution map, determining the starting code value of the interval to which the Chinese character code belongs and the number of codes in the preceding interval; Determine the position number according to the starting code value, the Chinese character code and the code quantity; The pinyin array coordinates corresponding to the Chinese character code are determined by searching in the four-byte character code array according to the position serial number.

5. The method according to claim 1, wherein The steps of constructing the pinyin array include: Get pre-built pinyin standards; According to the order of each phonetic symbol in the phonetic standard and the Chinese character code and quantity contained in each phonetic symbol, a phonetic array is established, and the phonetic array contains a mapping relationship between the phonetic symbol and the corresponding Chinese character code.

6. The method according to claim 5, characterized in that The steps of constructing the character encoding array include: Obtaining a pre-generated character statistics table, wherein the character statistics table is based on coding area, character source, coding range, coding number, graphic character number, and Chinese character number; Generate a mapping relationship between the first code in the character code array of other bytes and the first pinyin array coordinates according to each first code in the other code areas except the four-byte area in the code area and the first pinyin array coordinates to which they belong in the pinyin array; Generate a mapping relationship between each non-Chinese character in the preset non-Chinese character area and the preset value in the character code array of other bytes according to the preset non-Chinese character area, the number of arrays occupied by the preset non-Chinese character area and the preset value; According to the number of codes corresponding to the four-byte area and each second code and the second pinyin array coordinates in the pinyin array, a mapping relationship between the second code in the four-byte data code array and the second pinyin array coordinates is generated.

7. The method according to claim 5, characterized in that Also includes: Generate a pinyin index array according to the address of the pinyin array and the number of pinyins.

8. A device for determining the order of Chinese characters, characterized in that: include: The encoding acquisition module is used to obtain the Chinese character encoding of the Chinese characters to be sorted; A sequence number determination module, configured to determine the pinyin position sequence number of the Chinese characters to be sorted according to the Chinese character code, the character code array and the pinyin array; The Chinese character sorting module is used to sort the Chinese characters to be sorted according to the pinyin position serial numbers.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the Chinese character sequence determination method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the Chinese character sequence determination method according to any one of claims 1 to 7 when executed.