Method, apparatus, computer device, and storage medium for character-to-pinyin conversion
Patent Information
- Application Number
- HK42023069078
- Authority / Receiving Office
- HK · HK
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2041-06-28
AI Technical Summary
Traditional text-to-pinyin conversion schemes suffer from slow conversion speeds due to the large number of characters in the dictionary file and the slow search speed.
By obtaining the Unicode corresponding to the text to be converted, finding the offset value of the target separator code in the bit vector of the Pinyin dictionary, and based on the offset value and the target pronunciation number code, querying the target Pinyin identifier code in the Pinyin identifier code vector of the Pinyin dictionary to determine the Pinyin of the text to be converted.
It improves the speed of text-to-pinyin conversion, reduces storage space requirements, is suitable for low-performance platforms, and expands application scenarios.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, computer device, and storage medium for converting text to pinyin. Background Technology
[0002] With the development of computer technology, in some application scenarios, it is necessary to pre-convert text into pinyin so that the corresponding text can be found when pinyin is input. For example, in input method applications, when inputting pinyin, the system can find the corresponding text based on the input pinyin and display the found text as candidate text. In traditional text-to-pinyin schemes, a dictionary file containing text and pinyin is first obtained and written into memory. Then, each text to be converted is searched out one by one in the dictionary file in memory, and the pinyin that matches the text to be converted is found. Because the dictionary file contains a large number of texts, the search speed is slow, resulting in a slow text-to-pinyin conversion speed. Summary of the Invention
[0003] Therefore, it is necessary to provide a method, apparatus, computer device, and storage medium for converting text to pinyin that can improve the conversion speed, in order to address the aforementioned technical problems.
[0004] A method for converting text to pinyin, the method comprising:
[0005] Obtain the Unicode corresponding to the text to be converted;
[0006] Based on the Unicode, the offset value of the target separator code corresponding to the character to be converted in the bit vector of the Pinyin dictionary is found; the bit vector is composed of the character codes corresponding to each character; the character codes include the separator code and the pronunciation number code of the character;
[0007] In the bit vector, the target pronunciation number code of the character to be converted is queried according to the offset value;
[0008] Based on the offset value and the target pronunciation code, the target pinyin identifier code corresponding to the text to be converted is queried in the pinyin identifier code vector of the pinyin dictionary;
[0009] The pinyin of the text to be converted is determined based on the target pinyin identifier code.
[0010] A device for converting text to pinyin, the device comprising:
[0011] The acquisition module is used to obtain the Unicode corresponding to the text to be converted.
[0012] The lookup module is used to find the offset value of the target separator code corresponding to the character to be converted in the bit vector of the pinyin dictionary based on the Unicode; the bit vector is composed of the character codes corresponding to each character; the character codes include the separator code and the pronunciation number code of the character;
[0013] The query module is used to query the target pronunciation number code of the text to be converted in the bit vector according to the offset value;
[0014] The query module is also used to query the target pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector of the pinyin dictionary based on the offset value and the target pronunciation quantity code;
[0015] The determination module is used to determine the pinyin of the text to be converted based on the target pinyin identifier code.
[0016] In one embodiment, the lookup module is further configured to:
[0017] Obtain the Unicode of the first character in the Unicode table to which the Unicode belongs;
[0018] Determine the difference between the Unicode and the Unicode of the first character;
[0019] Based on the difference, the offset value of the target separator code corresponding to the text to be converted in the bit vector of the pinyin dictionary is determined.
[0020] In one embodiment, the query module is further configured to:
[0021] In the bit vector, the next separator code following the target separator code is determined based on the offset value;
[0022] Query the number of pronunciations between the target separator code and the next separator code;
[0023] The obtained pronunciation quantity code is determined as the target pronunciation quantity code of the text to be converted.
[0024] In one embodiment, the target pronunciation quantity code is used to represent the quantity of the pronunciation of the text to be converted; the query module is also used for
[0025] In the bit vector, the cumulative code length of all text codes preceding the target separator code is determined based on the offset value;
[0026] The position of the pinyin identifier code corresponding to the character to be converted in the pinyin identifier code vector is determined based on the difference between the accumulated code length value and the offset value.
[0027] In the Pinyin identification code vector, the target Pinyin identification code corresponding to the text to be converted and matching the target pronunciation number code is queried based on the position.
[0028] In one embodiment, the determining module is further configured to:
[0029] The Pinyin Identifier Code Table is used to query the Pinyin corresponding to the target Pinyin Identifier Code; the Pinyin Identifier Code Table is a table constructed with the Pinyin Identifier Code as the key and the Pinyin corresponding to the Pinyin Identifier Code as the value.
[0030] The obtained pinyin is used as the pinyin of the text to be converted.
[0031] In one embodiment, the acquisition module is further configured to:
[0032] Get the words to be converted;
[0033] The words to be converted are segmented to obtain the text to be converted;
[0034] Obtain the Unicode corresponding to each character to be converted in the word to be converted;
[0035] The device further includes:
[0036] The combination module is used to combine the pinyin corresponding to each character in the word to be converted to obtain the pinyin combination corresponding to the word to be converted.
[0037] In one embodiment, the word to be converted is obtained from a commonly used vocabulary list; the apparatus further includes:
[0038] The generation module, when it obtains the pinyin combinations corresponding to other words to be converted in the commonly used word list, generates a pinyin word list based on the pinyin combinations corresponding to the other words to be converted, the pinyin combinations corresponding to the words to be converted, and each word to be converted in the commonly used word list.
[0039] In one embodiment, the apparatus further includes:
[0040] The acquisition module is also used to acquire the target pinyin entered in the input method interface;
[0041] The search module is also used to search for candidate words that match the target pinyin in the pinyin word list;
[0042] A display module is used to display the candidate words in the input method interface;
[0043] The selection module is configured to select the candidate word specified by the selection operation in response to a selection operation on the candidate words displayed in the input method interface.
[0044] In one embodiment, the apparatus further includes:
[0045] The determining module is used to determine a virtual memory address that matches the file disk address in the process address space; the pinyin dictionary is stored in the disk storage area corresponding to the file disk address.
[0046] The copy module is used to copy the Pinyin dictionary from the disk storage area corresponding to the file disk address to the memory buffer corresponding to the virtual memory address;
[0047] A reading module is used to read the pinyin dictionary from the memory buffer.
[0048] In one embodiment, the text is a character corresponding to a Unicode code point in a Unicode table; the device further includes:
[0049] The determining module is further configured to determine the character encoding corresponding to the character and to determine the pinyin identifier code corresponding to the character;
[0050] A synthesis module is used to synthesize the bit vector based on the character encoding corresponding to the character; and to generate the pinyin identifier vector based on the pinyin identifier code corresponding to the character;
[0051] The generation module is further configured to generate the pinyin dictionary based on the bit vector and the pinyin identifier code vector.
[0052] In one embodiment, the determining module is further configured to:
[0053] Determine the separator code corresponding to the text;
[0054] The pronunciation count code corresponding to the character is determined based on the number of pronunciations of the character.
[0055] Based on the separator code and pronunciation quantity code corresponding to the character, the character encoding corresponding to the character is generated.
[0056] In one embodiment, the determining module is further configured to:
[0057] Determine the pinyin of the text;
[0058] Look up the pinyin identifier code corresponding to the pinyin of the character in the pinyin identifier code table.
[0059] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program performing the following steps:
[0060] Obtain the Unicode corresponding to the text to be converted;
[0061] Based on the Unicode, the offset value of the target separator code corresponding to the character to be converted in the bit vector of the Pinyin dictionary is found; the bit vector is composed of the character codes corresponding to each character; the character codes include the separator code and the pronunciation number code of the character;
[0062] In the bit vector, the target pronunciation number code of the character to be converted is queried according to the offset value;
[0063] Based on the offset value and the target pronunciation code, the target pinyin identifier code corresponding to the text to be converted is queried in the pinyin identifier code vector of the pinyin dictionary;
[0064] The pinyin of the text to be converted is determined based on the target pinyin identifier code.
[0065] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0066] Obtain the Unicode corresponding to the text to be converted;
[0067] Based on the Unicode, the offset value of the target separator code corresponding to the character to be converted in the bit vector of the Pinyin dictionary is found; the bit vector is composed of the character codes corresponding to each character; the character codes include the separator code and the pronunciation number code of the character;
[0068] In the bit vector, the target pronunciation number code of the character to be converted is queried according to the offset value;
[0069] Based on the offset value and the target pronunciation code, the target pinyin identifier code corresponding to the text to be converted is queried in the pinyin identifier code vector of the pinyin dictionary;
[0070] The pinyin of the text to be converted is determined based on the target pinyin identifier code.
[0071] The aforementioned method, apparatus, computer device, and storage medium for converting text to Pinyin works by finding the offset value of the target separator code corresponding to the text to be converted in the bit vector of the Pinyin dictionary. Based on the offset value and the target pronunciation number code of the text to be converted, the target Pinyin identifier code corresponding to the text to be converted is queried in the Pinyin identifier code vector of the Pinyin dictionary, and the Pinyin of the text to be converted is determined according to the target Pinyin identifier code. Therefore, it is not necessary to store all the characters and their corresponding Pinyin in the Pinyin dictionary, and it can quickly convert the file to Pinyin. Moreover, since the constructed Pinyin dictionary only contains the bit vector composed of the character codes corresponding to each character and the Pinyin identifier code vector of the characters, the target Pinyin identifier code of the text to be converted can be quickly found to determine the Pinyin during text conversion, improving the speed of text-to-Pinyin conversion. In addition, the Pinyin dictionary has a small data size and occupies little storage space, and can be used normally even on low-performance platforms, increasing the applicable scenarios. Attached Figure Description
[0072] Figure 1 This is an application environment diagram of a text-to-pinyin method in one embodiment;
[0073] Figure 2 This is a flowchart illustrating a method for converting text to pinyin in one embodiment;
[0074] Figure 3 This is a schematic diagram of a pinyin dictionary in one embodiment;
[0075] Figure 4 This is a schematic diagram of text encoding in one embodiment;
[0076] Figure 5 This is a schematic diagram of a Pinyin identifier code table in one embodiment;
[0077] Figure 6 This is a schematic diagram of a unified code table in one embodiment;
[0078] Figure 7 This is a schematic diagram of the target separator code and the target pronunciation quantity code in the bit vector of one embodiment;
[0079] Figure 8 This is a flowchart illustrating a method for querying a target pinyin identifier in one embodiment;
[0080] Figure 9 This is a schematic diagram of a pinyin word list in one embodiment;
[0081] Figure 10 This is a schematic diagram of the input method interface in one embodiment;
[0082] Figure 11 This is a schematic diagram of the process address space and disk storage area in one embodiment;
[0083] Figure 12 This is a flowchart illustrating a method for generating a pinyin dictionary in one embodiment;
[0084] Figure 13 This is a flowchart illustrating a method for converting text to pinyin in one embodiment;
[0085] Figure 14 This is a structural block diagram of a text-to-pinyin conversion device in one embodiment;
[0086] Figure 15 A structural block diagram of a text-to-pinyin conversion device in another embodiment;
[0087] Figure 16 This is an internal structural diagram of a computer device in one embodiment;
[0088] Figure 17 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation
[0089] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0090] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, as well as machine learning / deep learning, autonomous driving, and intelligent transportation.
[0091] The solutions provided in this application relate to natural language processing technology in artificial intelligence, and are specifically illustrated through the following embodiments:
[0092] The text-to-pinyin method provided in this application can be applied to, for example... Figure 1In the application environment shown. The application environment includes a computer device 102. The computer device 102 acquires the Unicode corresponding to the text to be converted, searches for the offset value of the target separation code corresponding to the text to be converted in the bit vector of the pinyin dictionary based on the Unicode. The bit vector is formed by combining character codes corresponding to each character, and the character codes include the separation code and the pronunciation number code of the character. In the bit vector, the computer device 102 queries the target pronunciation number code of the text to be converted according to the offset value, queries the target pinyin identification code corresponding to the text to be converted in the pinyin identification code vector of the pinyin dictionary based on the offset value and the target pronunciation number code, and determines the pinyin of the text to be converted according to the target pinyin identification code.
[0093] Wherein, the computer device 102 may be a terminal or a server. When the computer device 102 is a terminal, the terminal may be a smartphone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto.
[0094] When the computer device 102 is a server, the server may be an independent physical server, or a server cluster composed of a plurality of service nodes in a blockchain system, and a peer-to-peer (P2P, Peer To Peer) network is formed among the service nodes. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP).
[0095] In addition, the server may also be a cloud server that provides basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), as well as big data and artificial intelligence platforms.
[0096] In one embodiment, as Figure 2 shown, a method for converting text to pinyin is provided, which is described by taking the application of the method to Figure 1 the computer device therein as an example, and includes the following steps:
[0097] S202, acquiring the Unicode corresponding to the text to be converted.
[0098] Wherein, the text to be converted is text that needs to be converted into pinyin, such as Chinese characters. The text to be converted may be a single character or multiple characters. For example, the text to be converted is "大", and for another example, the text to be converted is "大\小\上\下".
[0099] Wherein, Unicode is a character encoding used on computers. In Unicode, each character in each language has a uniform and unique binary encoding. For example, the Unicode of the character "一" is "4E00", and for another example, the Unicode of the character "万" is "4E07". A computer device can encode the text to be converted according to UTF-8, UTF-16 or UTF-32 encoding schemes to obtain the Unicode corresponding to the text to be converted.
[0100] In one embodiment, a computer device acquires a common word list, performs word segmentation processing on words in the common word list, and obtains text to be converted. Wherein, the word segmentation processing splits words into individual characters. For example, "Happy Birthday" is split into "生", "日", "快" and "乐".
[0101] S204, based on Unicode, find the offset value of the target separator code corresponding to the text to be converted in the bit vector of the Pinyin dictionary; the bit vector is formed by combining character codes corresponding to each character; the character code includes a separator code and a pronunciation number code of the character.
[0102] Wherein, the Pinyin dictionary is a dictionary that uses the character codes in the bit vector as keys and the Pinyin identification codes in the Pinyin identification code vector as values, and the character code of each character matches the Pinyin identification code of the character. When the character is a polyphonic character, since the number of pronunciations of the character is multiple, each character code of the character matches multiple Pinyin identification codes. For example, as Figure 3 shown, the Pinyin dictionary includes a Pinyin identification code vector and a bit vector. The Pinyin identification code vector is formed by combining the Pinyin identification codes corresponding to each character, and the bit vector is formed by combining the character codes corresponding to each character. For example, as Figure 3 shown, in the Pinyin dictionary, the character code corresponding to character 0 is "1 0", and the corresponding Pinyin identification code is "19"; the character code corresponding to character 2 is "1 0 0", and the corresponding Pinyin identification codes are "56" and "17".
[0103] Wherein, the bit vector is a vector formed by combining the character codes corresponding to each character. For example, if the character codes corresponding to character A, character B, and character C are "10", "100", and "1000" respectively, the character codes corresponding to character A, character B, and character C are sequentially connected, and the combined bit vector is "101001000". The computer device can arrange the character codes corresponding to the characters in order according to the arrangement order of the Unicode of the characters in the Unicode table, and combine to obtain the bit vector of the Pinyin dictionary.
[0104] Wherein, the text code is a code word obtained by encoding text according to a preset encoding rule, and includes a separator code and a pronunciation number code of the text. The separator code is a code symbol used to mark the start of a text code, which can be a character or a character string; the character can be a number, a letter or a special character, and the character string can be a combination of at least one of numbers, letters or special characters. For example, the separator code can be "1", or "EE", or the character string "OX00", etc. The pronunciation number code is a code used to indicate the number of pronunciations of the text. For example, if the pronunciation number code is "0 0", it indicates that the number of pronunciations of the text is 2.
[0105] Wherein, the offset value is a numerical value used to indicate the number of separator codes before the target separator code in the bit vector. For example, if there are 3 separator codes before the target separator code in the bit vector, the offset value of the target separator code in the bit vector of the pinyin dictionary is 3.
[0106] In one embodiment, a computer device encodes text according to a preset encoding rule to obtain a pronunciation number code and a separator code corresponding to the text. Wherein, for example, the preset encoding rule may use the number of preset characters to represent the number of pronunciations of the text. For example, using three "0"s to represent that the number of pronunciations of text A is 3, the computer device encodes the pronunciation number code of text A as "000"; alternatively, the preset encoding rule may also use a number to represent the number of pronunciations of the text. For example, using the number "2" to represent that the number of pronunciations of text A is 2, the computer device encodes the pronunciation number code of text A as "2"; alternatively, the preset encoding rule may also use a binary code to represent the number of pronunciations of the text. For example, using "011" to represent that the number of pronunciations of text A is 3, the computer device encodes the pronunciation number code of text A as "011". In addition, for example, the preset encoding rule may use a preset character different from the pronunciation number code to represent the separator code of the text.
[0107] For example, the computer device encodes the separator code of each text as "1", and encodes the pronunciation number code of each text as different numbers of "0"s, wherein the number of "0"s represents the number of pronunciations of the text. For example Figure 4 As shown, the text code corresponding to the Chinese character "大" is "10", where "1" is the separator code corresponding to "大", and "0" is the pronunciation number code corresponding to "大". Since the pronunciation number code of "大" consists of one 0, the number of pronunciations of "大" is 1; the text code corresponding to the Chinese character "茜" is 100, where "1" is the separator code corresponding to "茜", and "00" is the pronunciation number code corresponding to "茜". Since the pronunciation number code of "茜" consists of two 0s, the number of pronunciations of "茜" is 2.
[0108] For another example, the computer device encodes the separator code of each character as "E", encodes the pronunciation number code of each character as a decimal number, and uses the decimal number to represent the number of pronunciations of the character. For example, the character code corresponding to the character "大" is "E1", where "E" is the separator code corresponding to the character "大", "1" is the pronunciation number code corresponding to the character "大", and the number of pronunciations of the character "大" is 1; the character code corresponding to the character "茜" is "E2", where "E" is the separator code corresponding to the character "茜", "2" is the pronunciation number code corresponding to the character "茜", and the number of pronunciations of the character "茜" is 2.
[0109] S206, in the bit vector, query the target pronunciation number code of the character to be converted according to the offset value.
[0110] Wherein, the target pronunciation number code is a code symbol used to represent the number of pronunciations of the character to be converted.
[0111] In one embodiment, S206 specifically includes: in the bit vector, the computer device first finds the separator code in the character code of the character to be converted according to the offset value, and then queries the target pronunciation number code of the character to be converted according to the position of the separator code. For example, as Figure 3 shown, assuming that the offset value is 2, since the number of separator codes before character 2 is 2, the computer device first finds the separator code corresponding to character 2 according to the offset value, and then queries the pronunciation number code "00" after the separator. It should be noted that, Figure 3 the character 0 therein represents the 0th character, and so on.
[0112] In one embodiment, the computer device can query the target pronunciation number code of the character to be converted by methods such as paging search, binary search, and Fibonacci search. Wherein, for the paging search method, the computer device stores the character codes of characters in a plurality of data pages, and then searches for the target pronunciation number code of the character to be converted in each data page respectively. For the binary search method, the computer device stores the character codes of characters in an ordered storage structure, and then queries the target pronunciation number code of the character to be converted by the binary search method during query. For the Fibonacci search method, the computer device searches for the target pronunciation number code of the character to be converted among the character codes of each character stored in order according to the Fibonacci sequence. S208, based on the offset value and the target pronunciation number code, query the target pinyin identification code corresponding to the character to be converted in the pinyin identification code vector of the pinyin dictionary.
[0113] The pinyin identification code vector is a vector composed of the pinyin identification codes corresponding to each character. For example, if the pinyin identification codes corresponding to characters A, B, and C are "19", "45", and "60" respectively, then the pinyin identification code vector formed by concatenating the pinyin identification codes corresponding to characters A, B, and C in sequence is "19 45 60".
[0114] The pinyin identifier is a numerical identifier corresponding to the pinyin. For example, the pinyin identifier for "yi" is "19", and the pinyin identifier for "qian" is "20". Furthermore, the pinyin identifier can be a 16-digit number, which can represent up to 65,535 pinyin syllables.
[0115] The target pinyin identifier is a numerical identifier corresponding to the pinyin of the text to be converted. When the text to be converted is a polyphonic character, there are multiple target pinyin identifiers corresponding to the text to be converted.
[0116] Since a pinyin dictionary uses character codes from a bit vector as keys and pinyin identifiers from a pinyin identifier vector as values, the character code corresponding to each character in the bit vector matches the pinyin identifier in the pinyin identifier vector. Computer devices can look up the target pinyin identifier corresponding to the character to be converted in the pinyin identifier vector of the pinyin dictionary based on the offset value in the character code and the target pronunciation code. For example, ... Figure 3 As shown, assuming an offset value of 2 and a target pronunciation count code of "00", it indicates that the number of pronunciations of the text to be converted is 2. The computer device finds two consecutive pinyin identifier codes "56" and "17" starting from the third pinyin identifier code in the pinyin identifier code vector. "56" and "17" are the target pinyin identifier codes corresponding to the text to be converted.
[0117] S210, determine the pinyin of the text to be converted based on the target pinyin identifier code.
[0118] In one embodiment, the computer device determines the pinyin corresponding to the target pinyin identifier and uses the determined pinyin as the pinyin of the text to be converted. For example, if the target pinyin identifier is "19", the computer device determines that the pinyin corresponding to "19" is "yi", and the pinyin of the text to be converted is "yi".
[0119] In one embodiment, S210 specifically includes: the computer device querying the pinyin corresponding to the target pinyin identifier in the pinyin identifier table; wherein the pinyin identifier table is a table constructed with the pinyin identifier as the key and the pinyin corresponding to the pinyin identifier as the value; and using the queried pinyin as the pinyin of the text to be converted.
[0120] For example, such as Figure 5As shown, the pinyin identification code table includes pinyin identification codes and pinyin corresponding to the pinyin identification codes. If the target pinyin identification code is "18", the computer device queries the pinyin corresponding to "18" in the pinyin identification code table as "xi", and the computer device determines that the pinyin of the text to be converted is "xi".
[0121] In the above embodiment, by looking up the offset value of the target separation code corresponding to the text to be converted in the bit vector of the pinyin dictionary, based on the offset value and the target pronunciation number code of the text to be converted, the target pinyin identification code corresponding to the text to be converted is queried in the pinyin identification code vector of the pinyin dictionary, and the pinyin of the text to be converted is determined according to the target pinyin identification code, so that it is not necessary to store all characters and corresponding pinyin in the pinyin dictionary, and the file to be converted can still be quickly converted into pinyin. Moreover, in the constructed pinyin dictionary, since it only includes a bit vector composed of character codes corresponding to each character and a pinyin identification code vector of characters, when converting characters, the target pinyin identification code of the text to be converted can be quickly found to determine the pinyin, which improves the speed of character-to-pinyin conversion. In addition, the pinyin dictionary has a small data volume and occupies less storage space, it can be used normally even on low-performance platforms, which expands applicable scenarios.
[0122] In one embodiment, S204 specifically includes: acquiring the Unicode of the first character in the Unicode table to which Unicode belongs; determining the difference between the Unicode of the text to be converted and the Unicode of the first character; based on the difference, determining the offset value of the target separation code corresponding to the text to be converted in the bit vector of the pinyin dictionary.
[0123] Wherein, the Unicode table is a code table obtained by encoding various characters and texts according to the Unicode encoding method. The Unicode table includes characters and Unicodes corresponding to the characters, and according to the arrangement order of the characters, the order of Unicodes corresponding to the characters increases progressively. For example, as Figure 6 shown in the Unicode table, the Unicode corresponding to the character "一" is "4E00", the Unicode corresponding to the character "丁" is "4E02", and the Unicode corresponding to the character "翠" is "7FE0". In the Unicode table, the Unicode of the first character is "4E00", which corresponds to the character "一".
[0124] Since the Unicode codes corresponding to characters in the Unicode Conversion Table increase in ascending order according to the characters' arrangement, the difference between the Unicode code of the character to be converted and the Unicode code of the first character represents the character's order in the Unicode Conversion Table. The bit vector of the Pinyin dictionary can be obtained by arranging the character codes corresponding to the characters according to their order in the Unicode Conversion Table using a computer device. Each character's character code includes a separator code. Therefore, the order of the character to be converted in the Unicode Conversion Table is the same as the order of the target separator code among all separator codes in the bit vector. Thus, the difference between the Unicode code of the character to be converted and the Unicode code of the first character represents the offset of the target separator code in the bit vector of the Pinyin dictionary.
[0125] In the above embodiments, the computer device determines the offset value of the target separator code of the text to be converted in the bit vector of the pinyin dictionary based on the difference between the Unicode of the text to be converted and the Unicode of the first character. According to the offset value, the character code corresponding to the text to be converted can be directly determined in the bit vector, so that the target pronunciation quantity code contained in the character code can be queried. In order to query the target pinyin identifier code corresponding to the text to be converted based on the offset value and the target pronunciation quantity code, and determine the pinyin of the text to be converted according to the target pinyin identifier code, it is beneficial to improve the speed of querying the pinyin corresponding to the text to be converted, thereby improving the speed of text to pinyin conversion.
[0126] In one embodiment, S206 specifically includes: determining the next separator code after the target separator code in the bit vector based on the offset value; querying the pronunciation quantity code between the target separator code and the next separator code; and determining the obtained pronunciation quantity code as the target pronunciation quantity code of the text to be converted.
[0127] Computer devices use separator codes to separate the character codes corresponding to different characters. The separator code indicates the starting position of the character code, followed by the pronunciation code of the character. For example, ... Figure 7 As shown, "10010001010010" is a bit vector composed of the character codes corresponding to five characters. The "1" is a separator code, marking the starting position of the character code for a given character. The different numbers of "0"s following the "1" represent the pronunciation count code for that character; the number of "0"s indicates the number of pronunciations for that character. If the offset value is 1, the computer first determines the first separator code in the bit vector after the first separator code as the target separator code based on the offset value. Then, it searches the bit vector for the next separator code after the target separator code. The pronunciation count code between the target separator code and the next separator code is the target pronunciation count code.
[0128] In one embodiment, S206 is followed by: determining the number of pronunciations of the text to be converted based on the target pronunciation number code of the text to be converted.
[0129] Since the pronunciation count code is an encoding used to represent the number of pronunciations of a character, the number of pronunciations of the character to be converted can be determined based on the target pronunciation count code. For example, when the pronunciation count code represents the number of pronunciations of a character using the number of preset characters, the computer device queries the target pronunciation count code for the number of preset characters to determine the number of pronunciations of the character to be converted.
[0130] In the above embodiments, the computer device queries the pronunciation count code between the target separator code and the next separator code, and then determines the number of pronunciations of the text to be converted based on the target pronunciation count code. When the text to be converted is a polyphonic character, the computer device can find multiple target pinyin identifier codes corresponding to the text to be converted based on the target pronunciation count code, thereby quickly determining multiple pinyins of the text to be converted based on the target pinyin identifier codes. This can be applied to application scenarios of converting polyphonic characters to pinyin.
[0131] In one embodiment, the target pronunciation quantity code is used to represent the number of pronunciations of the text to be converted; such as Figure 8 As shown, S208 further includes the following steps:
[0132] S802, in the bit vector, determines the cumulative code length of all text codes before the target separator code based on the offset value.
[0133] The code length of a character encoding is the sum of the lengths of the separator codes and the pronunciation count codes, with each separator code and each pronunciation count code having a length of one. For example, the character encoding "100" has one separator code "1" and two pronunciation count codes "00", so its code length is 3. The cumulative code length value is the sum of the code lengths of the character encodings corresponding to each character. For example, if the bit vector is "10010001010010", and the offset value is 2, then there are two separator codes before the target separator code. The target separator code is the third "1" in the bit vector, and all character encodings before the target separator code are "1001000". Therefore, the cumulative code length value is 7.
[0134] S804: Determine the position of the pinyin identifier code corresponding to the character to be converted in the pinyin identifier code vector based on the difference between the accumulated code length value and the offset value.
[0135] Here, since the offset value represents the number of separator codes preceding the target separator code, the difference between the accumulated code length and the offset value is the number of pronunciation count codes preceding the target separator code. Because each pronunciation count code has a matching pinyin identifier code in the pinyin identifier code vector, the position of the pinyin identifier code corresponding to the text to be converted within the pinyin identifier code vector can be determined based on this difference. For example, as... Figure 3As shown, if the offset value is 2, there are two separator codes before the target separator code. If the code length accumulation value is 4, the difference between the code length accumulation value and the offset value is 2. That is, there are two pinyin identifier codes in the pinyin identifier code vector before the pinyin identifier code corresponding to the text to be converted. The pinyin identifier code corresponding to the text to be converted is located at the position starting from the 3rd pinyin identifier code in the pinyin identifier code vector.
[0136] S806, in the Pinyin identifier code vector, query the target Pinyin identifier code corresponding to the text to be converted and which matches the target pronunciation number code based on the position.
[0137] When the text to be converted is a polyphonic character, there are multiple target pinyin identifier codes corresponding to the text to be converted. The computer device queries the position of the pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector, and then obtains the target pinyin identifier code that matches the target pronunciation number code based on the position.
[0138] When the text to be converted is a polyphonic character, the text to be converted corresponds to multiple target pinyin identifier codes. This position can be the starting position of the pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector. S806 may specifically include: the computer device determines the first pinyin identifier code corresponding to the text to be converted based on the position, and then, starting from the first pinyin identifier code, sequentially queries other pinyin identifier codes besides the first pinyin identifier code corresponding to the text to be converted according to the number of identifier codes determined by the target pronunciation quantity code, and uses the first pinyin identifier code and other pinyin identifier codes as the target pinyin identifier code.
[0139] In the above embodiments, the computer device first determines the accumulated code length value, then determines the position of the pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector based on the difference between the accumulated code length value and the offset value, and finally queries the target pinyin identifier code corresponding to the text to be converted that matches the target pronunciation number code based on the position. Thus, when the text to be converted is a polyphonic character, all target pinyin identifier codes corresponding to the text to be converted can be quickly determined, which not only improves the efficiency of text to pinyin conversion, but can also be applied to application scenarios where the text to be converted is a polyphonic character.
[0140] In one embodiment, S202 specifically includes: obtaining the word to be converted; performing word segmentation on the word to be converted to obtain the text to be converted; obtaining the Unicode corresponding to each text to be converted in the word to be converted; and combining the pinyin corresponding to each text to be converted in the word to obtain the pinyin combination corresponding to the word to be converted.
[0141] Wherein, the word to be converted is a word or phrase including a plurality of characters to be converted. For example, the word to be converted may be a word in a common word list. The common word list may be composed of names in address books, high-frequency words input through an input method, etc. Word segmentation processing is to split the word into individual characters to be converted. For example, the computer device splits the word to be converted "Happy Birthday" into four characters to be converted: "Sheng", "Ri", "Kuai" and "Le", then obtains the unicode corresponding to each character to be converted separately, and searches for the offset value of the target separation code corresponding to the character to be converted in the bit vector of the Pinyin dictionary based on the unicode of each character to be converted. In the bit vector, the computer device queries the target pronunciation number code of each character to be converted according to the offset value, queries the target Pinyin identification code corresponding to each character to be converted in the Pinyin identification code vector of the Pinyin dictionary based on the offset value of each character to be converted and the target pronunciation number code, and finally determines the Pinyin of each character to be converted according to each target Pinyin identification code.
[0142] In one embodiment, combining the Pinyins corresponding to each character to be converted in the word to be converted by the computer device includes the following steps: the computer device forms Pinyin sets from the Pinyins corresponding to each character to be converted, then calculates the Cartesian product of each Pinyin set, combines the Pinyins corresponding to each character to be converted in the word to be converted based on the obtained Cartesian product, and obtains the Pinyin combination corresponding to the word to be converted. For example, when there are two characters to be converted A and B in the word to be converted, the Pinyin set formed by the Pinyins of character A to be converted is X, and the Pinyin set formed by the Pinyins of character B to be converted is Y, then the computer device calculates the Cartesian product of X and Y according to formula (1), and combines the Pinyins corresponding to each character to be converted in the word to be converted based on the obtained Cartesian product to obtain the Pinyin combination corresponding to the word to be converted. Wherein, x is the Pinyin in Pinyin set X, y is the Pinyin in Pinyin set Y, and X×Y is the Cartesian product of X and Y.
[0143] X×Y={(x,y)|x∈X∩y∈Y} (1)
[0144] In the above embodiment, the computer device performs word segmentation processing on the word to be converted to obtain characters to be converted, acquires the unicode corresponding to each character to be converted, and obtains the Pinyin of each character to be converted based on the unicode of each character to be converted. Then, the Pinyins of each character to be converted are combined to obtain the Pinyin combination corresponding to the word to be converted. Thereby, the computer device can quickly combine to obtain the Pinyin combination corresponding to the word to be converted according to the Pinyin of each character to be converted.
[0145] In one embodiment, the word to be converted is obtained from a common word list. When the Pinyin combinations corresponding to other words to be converted in the common word list are obtained, a Pinyin word list is generated based on the Pinyin combinations corresponding to other words to be converted, the Pinyin combination corresponding to the current word to be converted, and each word to be converted in the common word list.
[0146] Among them, the pinyin word list is a word list composed of words from the commonly used word list and their corresponding pinyin combinations. For example, such as Figure 9 As shown, the pinyin vocabulary list includes words and their corresponding pinyin combinations. The computer device generates the pinyin vocabulary list based on each word to be converted from the commonly used vocabulary list and its corresponding pinyin combinations.
[0147] After retrieving the words to be converted from a commonly used vocabulary list, the computer device performs word segmentation on these words to obtain the text to be converted. Then, it obtains the Unicode corresponding to each text and, based on the Unicode of each text, looks up the offset value of the target separator code in the bit vector of the pinyin dictionary. In the bit vector, the computer device queries the target pronunciation quantity code for each text based on the offset value. Then, based on the offset value and the target pronunciation quantity code, it queries the pinyin identifier code vector in the pinyin dictionary for the target pinyin identifier code corresponding to each text. Based on the target pinyin identifier code, it determines the pinyin for each text. Finally, the computer device combines the pinyin of each text to obtain the pinyin combination corresponding to the text. Based on all the text to be converted in the commonly used vocabulary list and the corresponding pinyin combinations, the computer device generates a pinyin vocabulary list.
[0148] In the above embodiments, the computer device generates a pinyin word list based on the pinyin combinations corresponding to other words to be converted, the pinyin combinations corresponding to the words to be converted, and each word to be converted in the commonly used word list. Therefore, when acquiring pinyin, the computer device can query the pinyin word list for candidate words corresponding to the acquired pinyin, allowing the computer device to quickly input the word corresponding to the pinyin based on the candidate words.
[0149] In one embodiment, the target pinyin input in the input method interface is obtained; a candidate word matching the target pinyin is searched in the pinyin word list; the candidate word is displayed in the input method interface; and in response to a selection operation of selecting the candidate word displayed in the input method interface, the candidate word specified by the selection operation is selected.
[0150] The input method interface can be an interface for inputting text using various input methods. For example... Figure 10 As shown, the target pinyin entered in the input method interface can be the pinyin entered in the text input box of the input method. When the computer device obtains the target pinyin, it searches for candidate words that match the target pinyin in the pinyin dictionary. The computer device can search for candidate words that match the target pinyin in the pinyin dictionary using methods such as pagination search, binary search, and Fibonacci search.
[0151] The selection operation is the operation of selecting a specified candidate word from multiple candidate words. For example, it can be an operation of clicking on the candidate words displayed on the touch screen, or it can be a click operation triggered by an input device such as a mouse.
[0152] After the computer device selects the candidate word specified by the selection operation, the candidate word can be displayed in the text input box of the input method interface.
[0153] In the above embodiments, the computer device acquires the target Pinyin input in the input method interface, searches for candidate words matching the target Pinyin in the Pinyin word list, and then displays the candidate words in the input method interface. In response to a selection operation on the candidate words displayed in the input method interface, the computer device selects the candidate word specified by the selection operation. Thus, the computer device can quickly select a specified candidate word when acquiring the target Pinyin input in the input method interface, improving the efficiency of inputting words based on Pinyin, and thus improving the efficiency of word input in the input method.
[0154] In one embodiment, prior to S204, the method further includes: determining a virtual memory address in the process address space that matches the file disk address; storing a pinyin dictionary in the disk storage area corresponding to the file disk address; copying the pinyin dictionary from the disk storage area corresponding to the file disk address to the memory buffer corresponding to the virtual memory address; and reading the pinyin dictionary from the memory buffer.
[0155] The process address space refers to the address space corresponding to the operating system process. For example... Figure 11 As shown, the process address space includes multiple contiguous memory buffers such as the heap, stack, BSS (Block Started by Symbol) data segment, initial data segment, and text data segment. Computer devices can represent these memory buffers in the process address space using the `vm_area_struct` structure. The disk storage area is the area on the disk where the pinyin dictionary is stored. The address of the storage area for the pinyin dictionary on the disk is the file's disk address.
[0156] In the process address space, a computer device determines the virtual memory address that matches the file disk address by calling a mapping function (mmap function), which maps the file disk address to the process address space, and then determines the virtual memory address that matches the file disk address based on the address returned by the mapping function.
[0157] When a computer device accesses a virtual memory address, the operating system kernel initiates a data copy request to copy the Pinyin dictionary stored in the disk storage area corresponding to the file's disk address to the memory buffer corresponding to the virtual memory address. The computer device calls the data copy function (nopage function) to copy the Pinyin dictionary stored in the disk storage area to the memory buffer, and then reads the Pinyin dictionary from the memory buffer.
[0158] If the computer device changes the content of the pinyin dictionary stored in the memory buffer, the computer device synchronizes the modified content to the disk storage area, and performs synchronous modification on the pinyin dictionary stored in the disk storage area. The computer device can call a synchronization function (msync function) to synchronize the modified content to the disk storage area through the msync function.
[0159] In the above embodiment, the computer device first determines the virtual memory address matching the file disk address to establish a mapping relationship between the file disk address and the virtual memory address, and then can obtain the pinyin dictionary stored in the disk by accessing the memory buffer corresponding to the virtual memory address, which improves the efficiency of reading the pinyin dictionary, thereby enabling the computer device to quickly load the dictionary file of the pinyin dictionary.
[0160] In one embodiment, the characters are characters corresponding to Unicode in the Unicode table; for Figure 12 shown, before S204, the following steps are further included:
[0161] S1202, determining the character encoding corresponding to the character, and determining the pinyin identification code corresponding to the character.
[0162] In one embodiment, S1202 specifically includes: the computer device acquires characters corresponding to Unicode in the Unicode table, then determines the character encoding and pinyin identification code corresponding to each character. The computer device can encode each character corresponding to Unicode in the Unicode table according to a preset encoding rule to obtain the character encoding corresponding to each character, and the character encoding can include a separator code and a pronunciation number code.
[0163] In one embodiment, determining the character encoding corresponding to the character specifically includes: the computer device determining the separator code corresponding to the character; determining the pronunciation number code corresponding to the character according to the number of pronunciations of the character; generating the character encoding corresponding to the character based on the separator code and the pronunciation number code corresponding to the character.
[0164] The computer device can determine a preset flag bit or a preset character string as the separator code corresponding to the character. For example, the computer device can determine "1" as the separator code corresponding to the character, or can also determine "EE" as the separator code corresponding to the character, or can also determine the character string "OX00" as the separator code corresponding to the character.
[0165] The computer device can use the number of preset symbols to represent the number of pronunciations corresponding to the character, and determine the pronunciation number code corresponding to the character based on the number of pronunciations of the character. For example, the computer device can use the number of "0"s to represent the number of pronunciations corresponding to the character. For example, the character "茜" has two pronunciations, which are "qian" and "xi" respectively, then the computer device determines "00" as the pronunciation number code corresponding to the character "茜".
[0166] After the computer device obtains the separator code and the pronunciation number code corresponding to the character, the method further comprises: sequentially connecting the separator code corresponding to the character and the pronunciation number code, and splicing to obtain the character code corresponding to the character. For example, the computer device determines that the separator code corresponding to the character "茜" is "1", determines that the pronunciation number code corresponding to the character "茜" is "00", sequentially connects "1" and "00", and splices to obtain the character code "100" corresponding to the character "茜".
[0167] In one embodiment, determining the pinyin identification code corresponding to the character comprises: determining the pinyin of the character; querying a pinyin identification code corresponding to the pinyin of the character in a pinyin identification code table.
[0168] The computer device first determines the pinyin of the character, then queries the pinyin identification code corresponding to the pinyin of the character in the pinyin identification code table. For example, the computer device determines that the pinyin of the character "茜" is "qian" and "xi", then the computer device queries the pinyin identification codes corresponding to "qian" and "xi" in the pinyin identification code table, which are "20" and "18" respectively.
[0169] S1204, synthesizing a bit vector based on the character codes corresponding to the characters; and generating a pinyin identification code vector based on the pinyin identification codes corresponding to the characters.
[0170] Wherein, the step that the computer device synthesizes the bit vector based on the character codes corresponding to the characters may specifically comprise: the computer device sequentially connects the character codes corresponding to each character according to the order of each character in a unicode table to synthesize the bit vector. That is, starting from the second character in the unicode table, the computer device arranges the character code corresponding to the current character after the character code corresponding to the previous character until the last character in the unicode table, and the sequentially arranged character codes form the bit vector.
[0171] Wherein, the step that the computer device generates the pinyin identification code vector based on the pinyin identification codes corresponding to the characters may specifically comprise: the computer device sequentially connects the pinyin identification codes corresponding to each character according to the arrangement order of each character in a unicode table to synthesize the bit vector. That is, starting from the second character in the unicode table, the computer device arranges the pinyin identification code corresponding to the current character after the pinyin identification code corresponding to the previous character until the last character in the unicode table, and the sequentially arranged pinyin identification codes form the pinyin identification code vector.
[0172] S1206, generating a pinyin dictionary according to the bit vector and the pinyin identification code vector.
[0173] The computer device generates the pinyin dictionary by using the character codes in the bit vector as keys and the pinyin identification codes in the pinyin identification code vector as values.
[0174] In one embodiment, the computer device may store the pinyin dictionary in a dictionary file. The computer device may store the bit vector and the pinyin identifier vector in the same dictionary file, or it may store the bit vector and the pinyin identifier vector separately in two dictionary files.
[0175] In the above embodiments, the computer device determines the character encoding of the text and the corresponding Pinyin identifier code for each character. The computer device synthesizes a bit vector based on the character encoding of the text; and generates a Pinyin identifier code vector based on the corresponding Pinyin identifier code. Finally, the computer device generates a Pinyin dictionary based on the bit vector and the Pinyin identifier code vector. When the computer device acquires the text to be converted, it can determine the offset value of the target separator code corresponding to the text to be converted in the bit vector of the Pinyin dictionary based on the Unicode corresponding to the text to be converted, and determine the target pronunciation quantity code corresponding to the text to be converted, and finally determine the Pinyin of the text to be converted. Thus, the computer device can directly determine the target Pinyin identifier code corresponding to the text to be converted in the Pinyin dictionary based on the offset value and the target pronunciation quantity code, and then determine the Pinyin of the text to be converted based on the target Pinyin identifier code, improving the speed of determining the Pinyin corresponding to the text to be converted, thereby improving the speed of text-to-Pinyin conversion. Furthermore, since the pinyin dictionary consists of a bit vector and a pinyin identifier code vector, the amount of data in the character encoding in the bit vector and the pinyin identifier code in the pinyin identifier code vector is relatively small. Therefore, the pinyin dictionary has a small amount of data and occupies less memory space, making it suitable for mobile terminals with limited memory.
[0176] In one embodiment, such as Figure 13 As shown, the method for converting text to pinyin includes the following steps:
[0177] S1302, The computer device determines the character encoding of each character corresponding to a Unicode code in the Unicode table, and determines the pinyin identifier code corresponding to the character.
[0178] S1304, The computer device synthesizes a bit vector based on the text encoding corresponding to the text; and generates a pinyin identification code vector based on the pinyin identification code corresponding to the text.
[0179] S1306, The computer device generates a Pinyin dictionary based on the bit vector and the Pinyin identifier code vector.
[0180] S1308, the computer device retrieves the words to be converted from the common vocabulary list and performs word segmentation on the words to be converted to obtain the text to be converted.
[0181] S1310, The computer device obtains the Unicode corresponding to the text to be converted.
[0182] S1314, The computer device uses Unicode to find the offset value of the target separator code corresponding to the text to be converted in the bit vector of the Pinyin dictionary.
[0183] S1316, The computer device queries the target pronunciation number code of the text to be converted based on the offset value in the bit vector.
[0184] S1318, The computer device queries the pinyin identifier vector of the pinyin dictionary for the target pinyin identifier code corresponding to the text to be converted, based on the offset value and the target pronunciation quantity code.
[0185] S1320, The computer equipment determines the pinyin of the text to be converted based on the target pinyin identifier code.
[0186] S1322, The computer device combines the pinyin corresponding to each character to be converted in the word to be converted to obtain the pinyin combination corresponding to the word to be converted.
[0187] S1324 When the computer device obtains the pinyin combinations corresponding to other words to be converted in the commonly used word list, it generates a pinyin word list based on the pinyin combinations corresponding to other words to be converted, the pinyin combinations corresponding to the words to be converted, and each word to be converted in the commonly used word list.
[0188] S1324, The computer device obtains the target pinyin entered in the input method interface, searches for candidate words that match the target pinyin in the pinyin word list, and displays the candidate words in the input method interface.
[0189] S1326, the computer device, in response to a selection operation that selects candidate words displayed in the input method interface, selects the candidate word specified by the selection operation.
[0190] The specific steps in S1302 to S1326 above can be found by referring to Figure 2 Example.
[0191] In one embodiment, the computer device on the mobile terminal... Figure 2 The text-to-pinyin methods of the embodiments, namely PYPINYIN, PINYIN4J, and TINYPINYIN, were tested, and the test results are shown in Table 1. The mobile terminal uses a 2.6GHz 4x Cortex-A76 central processing unit. As shown in Table 1, Figure 2 The solution described in this embodiment consumes less memory, making it suitable for mobile terminals with limited memory, and it supports applications with polyphonic characters. The pinyin dictionary file is only 51KB, occupying minimal storage space, and its loading time is less than 1ms, improving the efficiency of loading the dictionary file. In the solution for converting text to pinyin that supports polyphonic characters, Figure 2 The solution in this embodiment converts text or words into pinyin quickly, thus improving the speed of text-to-pinyin conversion.
[0192] Table 1
[0193]
[0194] It should be understood that, although Figure 2 , 8 The steps in flowcharts 12 and 13 are shown sequentially as indicated by the arrows; however, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order requirement for the execution of these steps, and they can be executed in other orders. Furthermore, Figure 2 , 8 At least some of the steps in 1, 12, and 13 may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.
[0195] In one embodiment, such as Figure 14 As shown, a device for converting text to pinyin is provided. This device can be a software module, a hardware module, or a combination of both, integrated into a computer device. Specifically, the device includes: an acquisition module 1402, a search module 1404, a query module 1406, and a determination module 1408, wherein:
[0196] Module 1402 is used to obtain the Unicode corresponding to the text to be converted;
[0197] The lookup module 1404 is used to find the offset value of the target separator code corresponding to the character to be converted in the bit vector of the pinyin dictionary based on the Unicode; the bit vector is composed of the character codes corresponding to each character; the character codes include the separator code and the pronunciation number code of the character;
[0198] Query module 1406 is used to query the target pronunciation number code of the text to be converted based on the offset value in the bit vector;
[0199] The query module 1406 is also used to query the target pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector of the pinyin dictionary based on the offset value and the target pronunciation quantity code;
[0200] The determination module 1408 is used to determine the pinyin of the text to be converted based on the target pinyin identifier code.
[0201] In the above embodiments, by finding the offset value of the target separator code corresponding to the text to be converted in the bit vector of the pinyin dictionary, and based on the offset value and the target pronunciation number code of the text to be converted, the target pinyin identifier code corresponding to the text to be converted is queried in the pinyin identifier code vector of the pinyin dictionary, and the pinyin of the text to be converted is determined according to the target pinyin identifier code. Therefore, it is not necessary to store all the characters and their corresponding pinyin in the pinyin dictionary, and the file to be converted can be quickly converted into pinyin. Moreover, since the constructed pinyin dictionary only contains the bit vector composed of the character codes corresponding to each character and the pinyin identifier code vector of the character, the target pinyin identifier code of the text to be converted can be quickly found to determine the pinyin when converting text, which improves the speed of text to pinyin conversion. In addition, the data volume of this pinyin dictionary is small, and the storage space occupied is also small. It can be used normally even on low-performance platforms, increasing the applicable scenarios.
[0202] In one embodiment, the lookup module 1404 is further configured to:
[0203] Retrieve the Unicode of the first character in the Unicode table to which the Unicode belongs;
[0204] Determine the difference between the Unicode code and the Unicode code of the first character;
[0205] Based on the difference, the offset value of the target separator code corresponding to the text to be converted in the bit vector of the Pinyin dictionary is determined.
[0206] In one embodiment, the query module 1406 is further configured to:
[0207] In the bit vector, the next delimiter code after the target delimiter code is determined based on the offset value;
[0208] Query the number of sounds between the target separator and the next separator;
[0209] The obtained pronunciation quantity code is determined as the target pronunciation quantity code of the text to be converted.
[0210] In one embodiment, the target pronunciation quantity code is used to represent the quantity of pronunciations of the text to be converted; the query module 1406 is also used for
[0211] In the bit vector, the cumulative code length of all text codes preceding the target separator is determined based on the offset value;
[0212] The position of the pinyin identifier code corresponding to the character to be converted in the pinyin identifier code vector is determined based on the difference between the accumulated code length value and the offset value.
[0213] In the Pinyin identification code vector, the target Pinyin identification code that matches the target pronunciation number code is found based on the location of the text to be converted.
[0214] In one embodiment, the determining module 1408 is further configured to:
[0215] Look up the pinyin corresponding to the target pinyin identifier in the pinyin identifier table; the pinyin identifier table is a table built with pinyin identifier as the key and the pinyin corresponding to the pinyin identifier as the value;
[0216] Use the pinyin obtained from the query as the pinyin of the text to be converted.
[0217] In one embodiment, such as Figure 15 As shown, the acquisition module 1402 is also used for:
[0218] Get the words to be converted;
[0219] The words to be converted are segmented to obtain the text to be converted.
[0220] Obtain the Unicode corresponding to each character in the word to be converted;
[0221] The device also includes:
[0222] The combination module 1410 is used to combine the pinyin corresponding to each character to be converted in the word to be converted, so as to obtain the pinyin combination corresponding to the word to be converted.
[0223] In one embodiment, the word to be converted is obtained from a commonly used vocabulary; the apparatus further includes:
[0224] The generation module 1412, when obtaining the pinyin combinations corresponding to other words to be converted in the common word list, is used to generate a pinyin word list based on the pinyin combinations corresponding to other words to be converted, the pinyin combinations corresponding to the words to be converted, and each word to be converted in the common word list.
[0225] In one embodiment, the apparatus further includes:
[0226] The acquisition module 1402 is also used to acquire the target Pinyin input in the input method interface;
[0227] The search module 1404 is also used to search for candidate words that match the target pinyin in the pinyin dictionary;
[0228] Display module 1414 is used to display candidate words on the input method interface;
[0229] The selection module 1416 is used to select the candidate word specified by the selection operation in response to a selection operation on the candidate words displayed in the input method interface.
[0230] In one embodiment, the apparatus further includes:
[0231] The determination module 1408 is used to determine the virtual memory address that matches the file disk address in the process address space; the disk storage area corresponding to the file disk address stores the pinyin dictionary;
[0232] Copy module 1418 is used to copy the Pinyin dictionary from the disk storage area corresponding to the file disk address to the memory buffer corresponding to the virtual memory address;
[0233] The reading module 1420 is used to read the pinyin dictionary from the memory buffer.
[0234] In one embodiment, the text is a character corresponding to a Unicode code point in a Unicode table; the apparatus further includes:
[0235] The determination module 1408 is also used to determine the text code corresponding to the text and the pinyin identification code corresponding to the text;
[0236] The synthesis module 1422 is used to synthesize a bit vector based on the text encoding corresponding to the text; and to generate a pinyin identifier vector based on the pinyin identifier code corresponding to the text.
[0237] The generation module 1412 is also used to generate a pinyin dictionary based on the bit vector and the pinyin identifier code vector.
[0238] In one embodiment, the determining module 1408 is further configured to:
[0239] Determine the separator code corresponding to the text;
[0240] The pronunciation code corresponding to a character is determined based on the number of pronunciations of that character.
[0241] Based on the separator code and pronunciation quantity code corresponding to the character, the corresponding character encoding is generated.
[0242] In one embodiment, the determining module 1408 is further configured to:
[0243] Determine the pinyin of the characters;
[0244] Look up the pinyin identifier code corresponding to the pinyin of the text in the pinyin identifier code table.
[0245] For specific limitations regarding the text-to-pinyin conversion device, please refer to the limitations of the text-to-pinyin conversion method above, which will not be repeated here. Each module in the aforementioned text-to-pinyin conversion device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independently of it, or they can be stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0246] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 16 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores text-to-phonetic data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a text-to-phonetic conversion method.
[0247] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 17 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a method for converting text to Pinyin. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0248] Those skilled in the art will understand that Figure 16 , 17 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0249] In one embodiment, a computer device is also provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: obtaining the Unicode corresponding to the text to be converted; based on the Unicode, finding the offset value of the target separator code corresponding to the text to be converted in the bit vector of the pinyin dictionary; the bit vector is composed of the character codes corresponding to each character; the character codes include separator codes and pronunciation quantity codes of the characters; in the bit vector, querying the target pronunciation quantity code of the text to be converted according to the offset value; based on the offset value and the target pronunciation quantity code, querying the target pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector of the pinyin dictionary; and determining the pinyin of the text to be converted according to the target pinyin identifier code.
[0250] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining the Unicode of the first character in the Unicode table to which the Unicode belongs; determining the difference between the Unicode and the Unicode of the first character; and determining the offset value of the target separator code corresponding to the character to be converted in the bit vector of the phonetic dictionary based on the difference.
[0251] In one embodiment, when the processor executes the computer program, it further performs the following steps: in the bit vector, determining the next separator code after the target separator code based on the offset value; querying the pronunciation count code between the target separator code and the next separator code; and determining the obtained pronunciation count code as the target pronunciation count code of the text to be converted.
[0252] In one embodiment, the target pronunciation quantity code is used to represent the number of pronunciations of the text to be converted; when the processor executes the computer program, it also performs the following steps: in the bit vector, based on the offset value, the code length accumulation value of all text codes before the target separator code is determined; based on the difference between the code length accumulation value and the offset value, the position of the pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector is determined; in the pinyin identifier code vector, based on the position, the target pinyin identifier code corresponding to the text to be converted and matching the target pronunciation quantity code is queried.
[0253] In one embodiment, when the processor executes the computer program, it further performs the following steps: querying the pinyin corresponding to the target pinyin identifier in the pinyin identifier table; the pinyin identifier table is a table constructed with pinyin identifier as the key and the pinyin corresponding to the pinyin identifier as the value; and using the queried pinyin as the pinyin of the text to be converted.
[0254] In one embodiment, when the processor executes a computer program, it further performs the following steps: acquiring the word to be converted;
[0255] The process involves segmenting the word to be converted to obtain the text to be converted; obtaining the Unicode corresponding to each text to be converted in the word to be converted; and combining the Pinyin corresponding to each text to be converted in the word to obtain the Pinyin combination corresponding to the word to be converted.
[0256] In one embodiment, the words to be converted are obtained from a commonly used vocabulary list; when the processor executes the computer program, it also implements the following steps: when the pinyin combination corresponding to other words to be converted in the commonly used vocabulary list is obtained, a pinyin vocabulary list is generated based on the pinyin combination corresponding to other words to be converted, the pinyin combination corresponding to the words to be converted, and each word to be converted in the commonly used vocabulary list.
[0257] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining the target pinyin input in the input method interface; searching for candidate words that match the target pinyin in the pinyin dictionary; displaying the candidate words in the input method interface; and selecting the candidate word specified by the selection operation in response to a selection operation that selects the candidate words displayed in the input method interface.
[0258] In one embodiment, when the processor executes a computer program, it further performs the following steps: in the process address space, determining a virtual memory address that matches the file disk address; the pinyin dictionary is stored in the disk storage area corresponding to the file disk address; copying the pinyin dictionary from the disk storage area corresponding to the file disk address to the memory buffer corresponding to the virtual memory address; and reading the pinyin dictionary from the memory buffer.
[0259] In one embodiment, the text is a character corresponding to a Unicode code in the Unicode table; when the processor executes the computer program, it also performs the following steps: determining the text encoding corresponding to the text and determining the pinyin identifier code corresponding to the text; synthesizing a bit vector based on the text encoding corresponding to the text; and generating a pinyin identifier code vector based on the pinyin identifier code corresponding to the text; and generating a pinyin dictionary based on the bit vector and the pinyin identifier code vector.
[0260] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the separator code corresponding to the character; determining the pronunciation quantity code corresponding to the character based on the number of pronunciations of the character; and generating the character code corresponding to the character based on the separator code and the pronunciation quantity code.
[0261] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the pinyin of the text; and querying the pinyin identifier table for the pinyin of the text.
[0262] 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, it performs the following steps: obtaining the Unicode corresponding to the text to be converted; based on the Unicode, finding the offset value of the target separator code corresponding to the text to be converted in the bit vector of the pinyin dictionary; the bit vector is composed of the character codes corresponding to each character; the character codes include separator codes and pronunciation quantity codes of the characters; in the bit vector, querying the target pronunciation quantity code of the text to be converted according to the offset value; based on the offset value and the target pronunciation quantity code, querying the target pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector of the pinyin dictionary; and determining the pinyin of the text to be converted according to the target pinyin identifier code.
[0263] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: obtaining the Unicode of the first character in the Unicode table to which the Unicode belongs; determining the difference between the Unicode and the Unicode of the first character; and determining the offset value of the target separator code corresponding to the character to be converted in the bit vector of the phonetic dictionary based on the difference.
[0264] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: in the bit vector, determining the next separator code after the target separator code based on the offset value; querying the pronunciation count code between the target separator code and the next separator code; and determining the obtained pronunciation count code as the target pronunciation count code of the text to be converted.
[0265] In one embodiment, the target pronunciation quantity code is used to represent the number of pronunciations of the text to be converted; when the computer program is executed by the processor, it also performs the following steps: in the bit vector, the code length accumulation value of all text codes before the target separator code is determined based on the offset value; the position of the pinyin identifier code corresponding to the text to be converted in the pinyin identifier code vector is determined based on the difference between the code length accumulation value and the offset value; in the pinyin identifier code vector, the target pinyin identifier code corresponding to the text to be converted and matching the target pronunciation quantity code is queried based on the position.
[0266] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: querying the pinyin corresponding to the target pinyin identifier in the pinyin identifier table; the pinyin identifier table is a table constructed with pinyin identifiers as keys and pinyin corresponding to the pinyin identifiers as values; and using the queried pinyin as the pinyin of the text to be converted.
[0267] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: obtaining the word to be converted; performing word segmentation on the word to be converted to obtain the text to be converted; obtaining the Unicode corresponding to each text to be converted in the word to be converted; and combining the Pinyin corresponding to each text to be converted in the word to obtain the Pinyin combination corresponding to the word to be converted.
[0268] In one embodiment, the words to be converted are obtained from a commonly used vocabulary list; when the computer program is executed by the processor, it also performs the following steps: when the pinyin combinations corresponding to other words to be converted in the commonly used vocabulary list are obtained, a pinyin vocabulary list is generated based on the pinyin combinations corresponding to other words to be converted, the pinyin combinations corresponding to the words to be converted, and each word to be converted in the commonly used vocabulary list.
[0269] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: obtaining the target pinyin input in the input method interface; searching for candidate words that match the target pinyin in the pinyin dictionary; displaying the candidate words in the input method interface; and selecting the candidate word specified by the selection operation in response to a selection operation that selects the candidate words displayed in the input method interface.
[0270] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: in the process address space, determining a virtual memory address that matches the file disk address; the pinyin dictionary is stored in the disk storage area corresponding to the file disk address; copying the pinyin dictionary from the disk storage area corresponding to the file disk address to the memory buffer corresponding to the virtual memory address; and reading the pinyin dictionary from the memory buffer.
[0271] In one embodiment, the text is a character corresponding to a Unicode code in the Unicode table; when the computer program is executed by the processor, it further implements the following steps: determining the text encoding corresponding to the text and determining the pinyin identifier code corresponding to the text; synthesizing a bit vector based on the text encoding corresponding to the text; and generating a pinyin identifier code vector based on the pinyin identifier code corresponding to the text; and generating a pinyin dictionary based on the bit vector and the pinyin identifier code vector.
[0272] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the separator code corresponding to the text; determining the pronunciation quantity code corresponding to the text based on the number of pronunciations of the text; and generating the text code corresponding to the text based on the separator code and the pronunciation quantity code.
[0273] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the pinyin of the text; and querying the pinyin identifier table for the pinyin of the text.
[0274] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.
[0275] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0276] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 specification.
[0277] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for converting text to pinyin, characterized in that, The method includes: Obtain the Unicode corresponding to the text to be converted; Based on the Unicode, the offset value of the target separator code corresponding to the character to be converted in the bit vector of the Pinyin dictionary is found; the bit vector is composed of the character codes corresponding to each character; the character codes include the separator code and the pronunciation number code of the character corresponding to the character code; In the bit vector, the target pronunciation quantity code of the character to be converted is queried according to the offset value; the target pronunciation quantity code is used to represent the number of pronunciations of the character to be converted. In the bit vector, the cumulative code length of all character codes preceding the target separator code is determined based on the offset value; The position of the pinyin identifier code corresponding to the character to be converted in the pinyin identifier code vector is determined based on the difference between the accumulated code length value and the offset value. In the Pinyin identification code vector, the target Pinyin identification code corresponding to the text to be converted and matching the target pronunciation quantity code is queried based on the position; The pinyin of the text to be converted is determined based on the target pinyin identifier code.
2. The method according to claim 1, characterized in that, The step of finding the offset value of the target separator code corresponding to the text to be converted in the bit vector of the pinyin dictionary based on the Unicode includes: Obtain the Unicode of the first character in the Unicode table to which the Unicode belongs; Determine the difference between the Unicode and the Unicode of the first character; Based on the difference, the offset value of the target separator code corresponding to the text to be converted in the bit vector of the pinyin dictionary is determined.
3. The method according to claim 1, characterized in that, The step of querying the target pronunciation code of the text to be converted based on the offset value in the bit vector includes: In the bit vector, the next separator code following the target separator code is determined based on the offset value; Query the number of pronunciations between the target separator code and the next separator code; The obtained pronunciation quantity code is determined as the target pronunciation quantity code of the text to be converted.
4. The method according to claim 1, characterized in that, The step of determining the pinyin of the text to be converted based on the target pinyin identifier code includes: The Pinyin Identifier Code Table is used to query the Pinyin corresponding to the target Pinyin Identifier Code; the Pinyin Identifier Code Table is a table constructed with the Pinyin Identifier Code as the key and the Pinyin corresponding to the Pinyin Identifier Code as the value. The obtained pinyin is used as the pinyin of the text to be converted.
5. The method according to claim 1, characterized in that, The process of obtaining the Unicode corresponding to the text to be converted includes: Get the words to be converted; The words to be converted are segmented to obtain the text to be converted; Obtain the Unicode corresponding to each character to be converted in the word to be converted; The method further includes: combining the pinyin corresponding to each character to be converted in the word to be converted to obtain the pinyin combination corresponding to the word to be converted.
6. The method according to claim 5, characterized in that, The words to be converted are obtained from a commonly used vocabulary list; the method further includes: When the pinyin combinations corresponding to other words to be converted in the commonly used word list are obtained, a pinyin word list is generated based on the pinyin combinations corresponding to the other words to be converted, the pinyin combinations corresponding to the words to be converted, and each word to be converted in the commonly used word list.
7. The method according to claim 6, characterized in that, The method further includes: Get the target Pinyin input in the input method interface; Search the pinyin word list for candidate words that match the target pinyin; The candidate words are displayed on the input method interface; In response to a selection operation that selects candidate words displayed in the input method interface, the candidate word specified by the selection operation is selected.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: In the process address space, a virtual memory address matching the file disk address is determined; the Pinyin dictionary is stored in the disk storage area corresponding to the file disk address. Copy the Pinyin dictionary from the disk storage area corresponding to the file disk address to the memory buffer corresponding to the virtual memory address; Read the Pinyin dictionary from the memory buffer.
9. The method according to any one of claims 1 to 7, characterized in that, Each character is a character corresponding to a Unicode code point in the Unicode table; the method further includes: Determine the character code corresponding to each character, and determine the pinyin identifier code corresponding to each character; The bit vector is synthesized based on the character encoding corresponding to each character; and the pinyin identification code vector is generated based on the pinyin identification code corresponding to each character. The pinyin dictionary is generated based on the bit vector and the pinyin identifier code vector.
10. The method according to claim 9, characterized in that, Determining the character encoding corresponding to each character includes: Determine the separator code corresponding to each character; The pronunciation count code for each character is determined based on the number of pronunciations for each character. Based on the separator code and pronunciation quantity code corresponding to each character, the character code corresponding to each character is generated.
11. The method according to claim 9, characterized in that, The process of determining the pinyin identifier code corresponding to each character includes: Determine the pinyin for each character; Look up the pinyin identifier code corresponding to the pinyin of each character in the pinyin identifier code table.
12. A device for converting text to pinyin, characterized in that, The device includes: The acquisition module is used to obtain the Unicode corresponding to the text to be converted. The lookup module is used to find the offset value of the target separator code corresponding to the character to be converted in the bit vector of the pinyin dictionary based on the Unicode; the bit vector is composed of the character codes corresponding to each character; the character codes include the separator code and the pronunciation number code of the character corresponding to the character code; A query module is used to query the target pronunciation quantity code of the character to be converted in the bit vector according to the offset value; the target pronunciation quantity code is used to represent the number of pronunciations of the character to be converted; in the bit vector, the code length accumulation value of all character codes before the target separator code is determined based on the offset value; the position of the corresponding Pinyin identifier code of the character to be converted in the Pinyin identifier code vector is determined based on the difference between the code length accumulation value and the offset value; in the Pinyin identifier code vector, the target Pinyin identifier code corresponding to the character to be converted and matching the target pronunciation quantity code is queried based on the position; The determination module is used to determine the pinyin of the text to be converted based on the target pinyin identifier code.
13. The apparatus according to claim 12, characterized in that, The lookup module is also used to obtain the Unicode of the first character in the Unicode table to which the Unicode belongs; and to determine the difference between the Unicode and the Unicode of the first character; Based on the difference, the offset value of the target separator code corresponding to the text to be converted in the bit vector of the pinyin dictionary is determined.
14. The apparatus according to claim 12, characterized in that, The query module is further configured to: determine the next separator code after the target separator code in the bit vector based on the offset value; query the pronunciation quantity code between the target separator code and the next separator code; and determine the obtained pronunciation quantity code as the target pronunciation quantity code of the text to be converted.
15. The apparatus according to claim 12, characterized in that, The determining module is also used to query the pinyin corresponding to the target pinyin identifier in the pinyin identifier table; the pinyin identifier table is a table constructed with pinyin identifier as the key and the pinyin corresponding to the pinyin identifier as the value; The obtained pinyin is used as the pinyin of the text to be converted.
16. The apparatus according to claim 12, characterized in that, The acquisition module is also used to acquire the word to be converted; perform word segmentation on the word to be converted to obtain the text to be converted; and acquire the Unicode corresponding to each text to be converted in the word to be converted. The device further includes a combination module, used to combine the pinyin corresponding to each character to be converted in the word to be converted, to obtain the pinyin combination corresponding to the word to be converted.
17. The apparatus according to claim 16, characterized in that, The words to be converted are obtained from a commonly used word list; the device also includes a generation module, which is used to generate a pinyin word list based on the pinyin combinations corresponding to other words to be converted in the commonly used word list, the pinyin combinations corresponding to the words to be converted, and each word to be converted in the commonly used word list when the pinyin combinations corresponding to other words to be converted in the commonly used word list are obtained.
18. The apparatus according to claim 17, characterized in that, The acquisition module is also used to acquire the target pinyin entered in the input method interface; The search module is also used to search for candidate words that match the target pinyin in the pinyin word list; The device also includes a display module for displaying the candidate words on the input method interface; The device further includes a selection module for selecting a candidate word specified by the selection operation in response to a selection operation that selects a candidate word displayed in the input method interface.
19. The apparatus according to any one of claims 12 to 18, characterized in that, The determining module is further configured to determine a virtual memory address that matches the file disk address in the process address space; the pinyin dictionary is stored in the disk storage area corresponding to the file disk address. The device further includes a copying module for copying the pinyin dictionary from the disk storage area corresponding to the file disk address to the memory buffer corresponding to the virtual memory address; The device also includes a reading module for reading the pinyin dictionary from the memory buffer.
20. The apparatus according to any one of claims 12 to 18, characterized in that, Each character is a character corresponding to a Unicode in the Unicode table; the determining module is also used to determine the character encoding corresponding to each character and to determine the pinyin identifier code corresponding to each character. The device further includes a synthesis module, used to synthesize the bit vector based on the character encoding corresponding to each character; and to generate the pinyin identification code vector based on the pinyin identification code corresponding to each character. The device further includes a generation module for generating the pinyin dictionary based on the bit vector and the pinyin identifier code vector.
21. The apparatus according to claim 20, characterized in that, The determining module is also used to determine the separator code corresponding to each character; determine the pronunciation quantity code corresponding to each character based on the number of pronunciations of each character; and generate the character code corresponding to each character based on the separator code and pronunciation quantity code corresponding to each character.
22. The apparatus according to claim 20, characterized in that, The determining module is also used to determine the pinyin of each character; and to query the pinyin identifier code corresponding to the pinyin of each character in the pinyin identifier code table.
23. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 11.
24. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 11.
25. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 11.
