A tone input processing method and device based on key position mapping and a medium
Patent Information
- Application Number
- CN202610996091.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-10-09
AI Technical Summary
[0005]因此,本发明提供了一种基于键位映射的声调输入处理方法解决现有技术存在的声调输入未参与候选分选以及前字分选失败影响后一音节连续输入的问题
[0017]本发明有益效果为:通过声调键与字母键的释放顺序识别夹持字母归属,实现了声调输入过程中的精准键位分配;通过将双写字母同时写入前字分选位和后字首键位,实现了不增加额外按键的前字分选和后一音节起始;通过二字词表验证双写是否保留,并在验证失败时仅撤销前字分选位,实现了连续输入的容错和不中断。
Smart Images

Figure CN122884366A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of keyboard input technology, and in particular to a tone input processing method, device and medium based on key mapping. Background Technology
[0002] Keyboard Pinyin input falls under the category of character input and key encoding processing. It typically involves recognizing letter keys, function keys, and candidate selection keys via keyboard scan codes, then combining consecutive letters into Pinyin syllables. These syllables are then used in conjunction with a word database to generate candidate Chinese characters for display. For Chinese tone input, conventional methods include adding tone keys after the Pinyin syllables, or introducing auxiliary input methods such as component codes or stroke codes when there are many candidates, to improve the ability to distinguish homophones.
[0003] In continuous pinyin input, conventional methods often treat the tone key, the distinction key, and the first letter of the next syllable as independent input units. After the tone is input, additional distinction information still needs to be added, and the input rhythm is easily interrupted by the candidate selection. At the same time, when the previous character fails to be distinguished, the next syllable often needs to be reorganized or re-inputted, which affects the error tolerance of continuous input and the continuity of screen display. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a tone input processing method based on key mapping to solve the problems in the prior art where tone input does not participate in candidate sorting and the failure of the previous character sorting affects the continuous input of the next syllable.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] In a first aspect, the present invention provides a tone input processing method based on key mapping, comprising: receiving a keyboard scan code; establishing a double-write key position table, a syllable legal table, a Chinese character candidate table, and a two-character word table; receiving letter keys to generate the current syllable area; generating a sequence of clamped letters during the period from pressing to releasing a tone key; recording the tone value and release order; defining the letter key that was not released when the tone key was released and is closest to the release event as a double-write letter; generating a current tone-bearing syllable based on the current syllable area, tone value, and clamped letters; retrieving the current candidate character group from the Chinese character candidate table; writing the double-write letter into the previous character selection position and the next character first key position in the double-write temporary storage area; reducing the current candidate character group based on the previous character selection position; generating a next syllable area and a next tone-bearing syllable based on the next character first key position; retrieving the next candidate character group from the Chinese character candidate table; matching the reduced current candidate character group with the next candidate character group in the two-character word table; and displaying the matched syllable on the screen when a space key is received.
[0008] As a preferred embodiment of the tone input processing method based on key mapping described in this invention, the establishment of the clamp-on double-write key table, syllable legal table, Chinese character candidate table, and two-character word table includes: converting keyboard scan codes into key events; writing letter keys, tone keys, and space keys into the clamp-on double-write key table and establishing a mapping relationship between tone keys and tone values; generating a syllable legal table including a legal syllable field, a syllable first letter field, and a contiguous letter field based on the pinyin syllable library; generating a Chinese character candidate table based on the Chinese character pronunciation library and character shape field library; generating a two-character word table by writing the preceding character field, following character field, preceding character tone-indicated syllable field, following character tone-indicated syllable field, and word frequency sorting field based on two-character words; the key events include key number, key type, key character, press event identifier, and release event identifier; the Chinese character candidate table includes a pinyin field, tone field, and candidate field.
[0009] As a preferred embodiment of the tone input processing method based on key mapping described in this invention, the step of generating the clamping letter sequence and recording the tone value and release order includes: when a tone key press event is received, recording the corresponding tone value and tone key press event number, and starting the clamping letter sequence; when a letter key press event is received during the period from tone key press to release, writing the letter character, letter key number, press event number, release event number, and release status into the clamping letter sequence; when a tone key release event is received, writing the tone key release event number, and forming a release order record according to the order of tone key release events and letter key release events.
[0010] As a preferred embodiment of the tone input processing method based on key mapping described in this invention, the step of defining the letter key that was not released when the tone key was released and is closest to the release event as a double-written letter includes: when a tone key release event is received, searching for a letter record whose release state is not released from the clamped letter sequence; when there is at least one letter record whose release state is not released, sorting them according to the press event number from largest to smallest, selecting the first letter record in the sorted sequence as a double-written letter record, and determining the letter characters in the double-written letter record as double-written letters; when there is no letter record whose release state is not released, setting the double-written letter to null; for letter records whose release state is released, concatenating their letter characters with the current syllable area and querying the syllable legal table, marking them as the current syllable completion letter or the next syllable completion letter according to the query result.
[0011] As a preferred embodiment of the tone input processing method based on key mapping described in this invention, the candidate fields include: when the target Chinese character can be stably divided into components, the first letter of the pronunciation of the first component name and the first letter of the pronunciation of the last component name are obtained and written into the first letter field of the pronunciation of the first component and the first letter field of the pronunciation of the last component; when the target Chinese character cannot be stably divided into components, the first letter of the pronunciation of the first stroke name and the first letter of the pronunciation of the last stroke name are obtained and written into the first letter field of the pronunciation of the first stroke and the first letter field of the pronunciation of the last stroke; when the target Chinese character cannot stably obtain component names or stroke names, the first letter of the pinyin of the target Chinese character is written into the supplementary field.
[0012] As a preferred embodiment of the tone input processing method based on key mapping described in this invention, the step of reducing the current candidate character group according to the previous character selection position includes: when the current candidate character group includes only one Chinese character record, the previous character selection position is not enabled, and the first key position of the next character is retained as the starting letter of the next syllable area; when the current candidate character group includes multiple Chinese character records and there are double-written letters in the previous character selection position, the double-written letters are compared with the candidate fields of each Chinese character record in turn; if any candidate field of the Chinese character record is the same as the double-written letter, the Chinese character record is retained; if all candidate fields of the Chinese character record are different from the double-written letters, the Chinese character record is removed from the current candidate character group; when the double-written letter does not match any candidate field of any Chinese character record in the current candidate character group, the current candidate character group remains unchanged, and the double-written letter is retained only in the first key position of the next character.
[0013] As a preferred embodiment of the tone input processing method based on key mapping described in this invention, the step of generating the next syllable area and the next tone syllable based on the key position of the next character includes: when there is a letter character in the key position of the next character, the letter character is written to the first position of the next syllable area; when there is a pre-stored letter string for the next syllable, the pre-stored letter string for the next syllable is appended to the next syllable area according to the input order; continue to receive letter key press events and append the corresponding letter character to the next syllable area; when a new tone key press and release event is received, the next syllable area is combined with the new tone value to generate the next tone syllable; query the syllable legal table to determine whether the next syllable area matches a legal syllable field; if it matches, the next candidate character group is obtained by searching the Chinese character candidate table according to the next tone syllable; if it does not match, the next syllable area is retained and the two-character word table matching is stopped.
[0014] As a preferred embodiment of the tone input processing method based on key mapping described in this invention, the specific steps for matching the reduced current candidate character group with the next candidate character group in the two-character word list and displaying it on the screen when a space key is received are as follows: Read the previous character record in the reduced current candidate character group and the next character record in the next candidate character group to form a two-character combination; match the two-character combination with the previous character field and the next character field in the two-character word list; when the current character field and the next character field simultaneously match the same two-character word record, write the corresponding two-character word into the area to be displayed; when a two-character word exists in the area to be displayed and a space key is received, display the two-character word in the area to be displayed; when the two-character combination does not match, cancel the reduction of the current candidate character group by the previous character selection position, delete the previous character selection position in the double-write temporary storage area, and retain the next character first key position and the next syllable area.
[0015] In a second aspect, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, wherein when the computer program is executed by the processor, it implements any step of the key-mapped tone input processing method as described in the first aspect of the present invention.
[0016] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the tone input processing method based on key mapping as described in the first aspect of the present invention.
[0017] The beneficial effects of this invention are as follows: by identifying the belonging of the clamped letter through the release order of the tone key and the letter key, accurate key allocation is achieved in the tone input process; by writing double letters simultaneously into the first character selection position and the first character key position, the first character selection and the start of the next syllable are achieved without adding extra keys; by verifying whether double letters are retained through a two-character word list, and only canceling the first character selection position when the verification fails, error tolerance and uninterrupted continuous input are achieved. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of a tone input processing method based on key mapping.
[0020] Figure 2 A schematic diagram generated for clamping input.
[0021] Figure 3 This is a schematic diagram of double-write allocation and candidate reduction.
[0022] Figure 4 This is a diagram illustrating the linkage between adding and canceling content on the screen. Detailed Implementation
[0023] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0024] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0025] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0026] Reference Figures 1-4 This is one embodiment of the present invention, which provides a tone input processing method based on key mapping, including the following steps:
[0027] S1. Receive keyboard scan codes and establish a clamping double-write key table, a syllable legal table, a Chinese character candidate table, and a two-character word table.
[0028] It receives keyboard scan codes sent by the operating system's keyboard driver layer and converts the keyboard scan codes into key events according to the keyboard layout configuration file.
[0029] Among them, key events consist of key number, key type, key character, press event identifier, and release event identifier; key number is obtained by converting keyboard scan code, key type is determined by key function field in keyboard layout configuration file, key character is determined by character field of key number in current input layout, and press event identifier and release event identifier are determined by key action type in operating system keyboard event queue.
[0030] Specifically, the 26 English letter keys are registered as letter keys, the first, second, third, and fourth tone keys are registered as tone keys, the space key is registered as a space key, and the backspace key is registered as a delete key; tone keys are not limited to fixed physical locations; the keyboard scan codes for tone keys are written by the keyboard layout configuration file, which can configure tone keys in areas accessible to the left and right little fingers, or in areas separated by the space key; tone keys are identified only according to the mapping relationship between keyboard scan codes and tone values, without using the physical location of tone keys as a condition for subsequent processing.
[0031] Furthermore, press and release events are established for each tone key.
[0032] The press event occurs when the tone key is pressed down, and the release event occurs when the tone key is released.
[0033] The press event is used to start receiving subsequent clamped letters, and the release event is used to end receiving subsequent clamped letters.
[0034] Therefore, tone keys not only represent tone values, but can also form a clamping input range from the press event to the release event at the keyboard event level.
[0035] Furthermore, a table of valid syllables is generated from the Mandarin Pinyin syllable database.
[0036] Specifically, the system reads untoned syllables from the Pinyin syllable library, converts them into lowercase Latin letter strings, and removes apostrophes, spaces, and tone marks to form a valid syllable field. Each syllable record is written into the valid syllable field, the syllable first letter field, and the continuable letter field.
[0037] It should be noted that the valid syllable field is used to determine whether the current syllable area has formed a searchable syllable; the syllable first letter field is used to determine whether a certain letter can be used as the starting point of the next syllable; and the continuable letter field is used to determine whether the holding letter can be merged into the current syllable area.
[0038] As an example, when the syllable legality table contains two legal syllable fields, jian and jiang, if the current syllable area is jian and the clamping letter is g, it is possible to confirm that jiang is a legal syllable by querying the syllable legality table, thus allowing the clamping letter to be merged into the current syllable area.
[0039] Furthermore, a candidate table of Chinese characters is generated from the local Chinese character pronunciation database and character shape field database.
[0040] Specifically, the local Chinese character pronunciation database records the pinyin and tone for each Chinese character; the character shape field database records the name of the first component, the name of the last component, the name of the first stroke, and the name of the last stroke for each Chinese character.
[0041] reading a target Chinese character according to a Chinese character field first, then reading the pinyin and tone of the target Chinese character, and then reading the name of the first component and the name of the last component of the target Chinese character; when the target Chinese character can be stably split into components, obtaining the first letter of the pronunciation of the first component name and the first letter of the pronunciation of the last component name respectively, and writing the obtained first letters into a first component pronunciation initial field and a last component pronunciation initial field.
[0042] when the target Chinese character cannot be stably split into components, reading the name of the first stroke and the name of the last stroke of the target Chinese character, obtaining the first letter of the pronunciation of the first stroke name and the first letter of the pronunciation of the last stroke name respectively, and writing the obtained first letters into a first stroke pronunciation initial field and a last stroke pronunciation initial field.
[0043] preferably, the component names are radical names or common component names.
[0044] as an example, the first component name of 江 (river) is three-water-dot, its pronunciation is processed according to 水 (water), thus the first component pronunciation initial is s; the first component name of 姜 (ginger) is 羊 (goat), thus the first component pronunciation initial is y; the first stroke name of 生 (life) is 撇 (left-falling stroke), thus the first stroke pronunciation initial is p, the last stroke name of 生 (life) is 横 (horizontal stroke), thus the last stroke pronunciation initial is h.
[0045] for a Chinese character for which the first component name or the last component name cannot be stably obtained, writing the pinyin initial of the target Chinese character into a supplementary field at the position of an unstable split, so that each candidate Chinese character in a candidate Chinese character table has a candidate field that can be matched by a key position event.
[0046] it should be noted that a character shape field library is generated from a general Chinese character radical table, a common component table and a Chinese character stroke table; when the first component name and the last component name can be matched in the general Chinese character radical table or the common component table, it is determined that the target Chinese character can be stably split into components, and when they cannot be matched, the process proceeds to reading the first stroke name and the last stroke name.
[0047] further, a two-character word table is generated from a local lexicon.
[0048] specifically, reading two-character words from the local lexicon, splitting each two-character word into a preceding character and a following character, reading the pinyin and tone of the preceding character, and the pinyin and tone of the following character respectively, and writing the read information into two-character word records.
[0049] wherein, the two-character word records are further written with a preceding character field, a following character field, a preceding character syllable-with-tone field, a following character syllable-with-tone field and a word frequency sorting field.
[0050] it should be noted that the word frequency sorting field is obtained through the sorting sequence number of the two-character word in the local lexicon; when the local lexicon does not store the sorting sequence number, the word frequency sorting field is generated in descending order according to the occurrence frequency of the two-character word in the local lexicon.
[0051] In addition, the current syllable area, the letter sequence, the order record, the double-write temporary area, the current candidate word group, the next syllable area, the next candidate word group, and the area to be displayed are established in memory.
[0052] The current syllable area stores letters that were not entered during the period from the pressing to the release of the tone key; the clamping letter sequence stores letters received during the period from the pressing to the release of the tone key; the release sequence record stores the order of tone key release events and letter key release events; the double-write temporary storage area sets the previous character selection position and the next character first position; the current candidate character group stores the candidate Chinese characters retrieved from the current tone-indicated syllable; the next syllable area stores the next pinyin syllable formed starting from the next character first position; the next candidate character group stores the candidate Chinese characters retrieved from the next tone-indicated syllable; and the area to be displayed on the screen stores single characters or two-character words that are ready to be written to the text input position.
[0053] S2. Receive letter keys to generate the current syllable area, generate a clamping letter sequence during the period from pressing to releasing the tone key, record the tone value and release order, and define the letter key that was not released when the tone key was released and is closest to the release event as a double-written letter.
[0054] Furthermore, continuously monitor the operating system's keyboard event queue and write an event sequence number for each key event according to the order in which the key events enter the keyboard event queue.
[0055] The event sequence number indicates the order of the key event in the keyboard event queue, but does not indicate the duration of the key press.
[0056] When the key event is a letter key press event and no tone key is in the pressed and unreleased state, the letter character of the letter key is obtained from the double-write key table and appended to the current syllable area in the order of input.
[0057] The current syllable area stores the syllable string according to the order in which the letters entered, and also stores the key number and press event number of each letter.
[0058] When the key event is a tone key press event, the tone value of the tone key is obtained from the clamped double-write key table, the tone value and the tone key press event number are recorded, and the clamped letter sequence is enabled.
[0059] The system receives letter keys from the moment the tone key is pressed until the moment the tone key is released.
[0060] If a letter key press event is received after the tone key press event and before the tone key release event, the letter character of the letter key is written into the clamping letter sequence.
[0061] Each letter record in the clamped letter sequence is written with the letter character, letter key number, press event number, release event number, and release status.
[0062] When a letter key is not yet released, its release status is written as "not released"; after the letter key release event enters the keyboard event queue, the release status is changed to "released" and the release event sequence number is written.
[0063] When a tone key release event is received, the tone key release event number is written, and the reception of the clamped letter sequence ends.
[0064] Search for unreleased letter records in the clamped letter sequence; if there is at least one unreleased letter record, verify the tone key release event according to the release order record, and the letter key release event of the unreleased letter record is earlier than that of the unreleased letter record. Sort them in descending order of the press event number, select the first unreleased letter record as the double-written letter record, and determine the letter character in the double-written letter record as the double-written letter; if there is no unreleased letter record, write the double-written letter as an empty value.
[0065] Furthermore, for letter records in the clamped letter sequence whose release state is "released," letter characters are read in ascending order of press event number. The read letter characters are then concatenated with the syllable string in the current syllable area, and the syllable validity table is consulted. If a valid syllable starting with the concatenated string exists in the syllable validity table, or if the concatenated string itself is a complete valid syllable, the read letter character is marked as the completion letter for the current syllable. If no valid syllable starting with the concatenated string exists in the syllable validity table, and the concatenated string itself is not a complete valid syllable, the read letter character is marked as the completion letter for the next syllable.
[0066] Specifically, the release sequence record is arranged in ascending order of release event numbers, recording the order of tone key release events and the release events of each letter key in the sandwiched letter sequence. For letter records with letter key release events in the sandwiched letter sequence, the input method processing program confirms that the letter key release event precedes the tone key release event based on the release sequence record, and treats the letter record as a released letter record. For letter records without letter key release events in the sandwiched letter sequence and whose release status is not released, the input method processing program confirms that the tone key release event precedes the letter key release event based on the release sequence record, and treats the letter record as an unreleased letter record. The release sequence record does not use key duration, key interval, or input speed for judgment, but only uses the order of release events in the operating system's keyboard event queue, thereby avoiding misjudgment of double-written letters caused by differences in typing speed among different users.
[0067] As an example, if a user enters j, i, a, n in sequence, the current syllable is written as jian; if the user presses the first key and then enters g, and the g key is released before the first key, the release sequence record shows that the g release event is earlier than the first key release event, and g is marked as the letter for the current syllable completion; if the user enters j, i, a, n, g in sequence and then presses the first key, and then presses s during the first key press, and the first key is released before the s key, and s is still not released when the first key is released, s is identified as a double-written letter.
[0068] S3. Generate the current tone-bearing syllable based on the current syllable area, tone value, and holding letter. Search the Chinese character candidate table to obtain the current candidate character group. Write the double-written letter into the previous character selection position and the next character first key position in the double-written temporary storage area. Reduce the current candidate character group based on the previous character selection position.
[0069] Furthermore, the legality of the current syllable region is determined according to the syllable legality table.
[0070] When the current syllable area cannot form a valid pinyin syllable, the letter record marked as the current syllable completion letter is read from the clamping letter sequence, and the current syllable completion letter is appended to the current syllable area in ascending order of the pressed event number; after each appended current syllable completion letter, the syllable validity table is queried; when the appended current syllable area matches a valid syllable field in the syllable validity table, the appending of the current syllable completion letter stops, and the appended current syllable area is combined with the tone value to generate the current tone-added syllable.
[0071] When the current syllable region can form a valid Pinyin syllable and there are no double-written letters in the clamping letter sequence, the current syllable region is directly combined with the tone value to generate the current tone-added syllable. If there is a supplementary letter for the next syllable in the clamping letter sequence, the first supplementary letter of the next syllable is written to the first key of the next word, and the remaining supplementary letters of the next syllable are written into the pre-stored letter string of the next syllable in the input order. The pre-stored letter string of the next syllable is used to continue receiving the remaining letters of the next syllable and the tone value of the next word.
[0072] When the current syllable area can form a valid pinyin syllable and there are double-written letters in the letter sequence, the current syllable area is combined with the tone value to generate the current tone-bearing syllable; at the same time, a double-written temporary storage area is established, and the double-written letters are written to the previous character selection position and the next character first key position in the double-written temporary storage area; the previous character selection position retains the letter character, key position number and release order record of the double-written letter; the next character first key position retains the letter character and key position number of the same double-written letter; the previous character selection position participates in the reduction of the current candidate character group, and the next character first key position participates in the generation of the next syllable area.
[0073] Specifically, the current tone-indicated syllable consists of the toneless pinyin string and tone value in the current syllable area.
[0074] With the toneless pinyin string and the tone value used as retrieval conditions, Chinese character records with the same pinyin field and the same tone field are searched in the Chinese character candidate table, and the found Chinese character records are written into the current candidate Chinese character group; each Chinese character record in the current candidate Chinese character group retains the Chinese character field, the pinyin field, the tone field, the initial radical pronunciation first letter field, the final radical pronunciation first letter field, the initial stroke pronunciation first letter field and the final stroke pronunciation first letter field.
[0075] Further, when there is only one Chinese character record in the current candidate Chinese character group, the previous character sorting bit is not enabled, and the current candidate Chinese character group is maintained as a single candidate Chinese character group; if the double letter already exists, only the first key bit of the subsequent character is retained, so that the double letter continues to serve as the initial letter of the next syllable area and does not participate in the reduction of the current candidate Chinese character group any more.
[0076] When there are a plurality of Chinese character records in the current candidate Chinese character group and there is a double letter in the previous character sorting bit, the double letter is compared with the candidate field of each Chinese character record in the current candidate Chinese character group; the candidate fields are read in the order of the initial radical pronunciation first letter field, the final radical pronunciation first letter field, the initial stroke pronunciation first letter field and the final stroke pronunciation first letter field; if any candidate field of a Chinese character record is the same as the double letter, the Chinese character record is retained; if all candidate fields of a Chinese character record are not equal to the double letter, the Chinese character record is removed from the current candidate Chinese character group, so as to form a reduced current candidate Chinese character group.
[0077] As a preferred mode, when the double letter hits a plurality of candidate fields at the same time, the field hit level is determined according to the reading order of the initial radical pronunciation first letter field, the final radical pronunciation first letter field, the initial stroke pronunciation first letter field and the final stroke pronunciation first letter field, and the field hit level is written into the previous character sorting bit together; the field hit level is not used for independent output to screen, but is used to assist the subsequent two-word matching process to retain more stable candidate records when the reduced current candidate Chinese character group still contains a plurality of Chinese character records.
[0078] As an example, the current syllable area is jiang, the tone value is the first tone, jiang and the first tone are combined to form the current toned syllable, the current toned syllable is recorded as jiang1, and the current candidate Chinese character group such as 江 and 姜 is obtained by retrieval in the Chinese character candidate table; if the letter s is still not released when the tone key is released, the letter s is written into the previous character sorting bit and the first key bit of the subsequent character; s in the previous character sorting bit hits the initial radical pronunciation first letter field of 江, while the initial radical pronunciation first letter field of 姜 is y, so 江 is retained and 姜 is removed; meanwhile, s in the first key bit of the subsequent character continues to serve as the initial letter of the next syllable area.
[0079] Thus, the same letter key completes both the reduction of previous character candidates and the initiation of the next syllable in one tone key clamping process.
[0080] When there are multiple Chinese character records in the current candidate character group, but the double-written letter does not match any candidate field in the current candidate character group, the Chinese character record in the current candidate character group is not deleted, and the double-written letter is only retained in the first key position of the following character.
[0081] S4. Generate the next syllable area and the next tone syllable based on the first key position of the next character. Search the Chinese character candidate table to obtain the next candidate character group. Match the reduced current candidate character group with the next candidate character group in the two-character word table. If the match is successful and the space key is received, the character is displayed on the screen.
[0082] Furthermore, the next syllable area is generated based on the key position of the first character.
[0083] If a letter character exists in the first key of the following word, write the letter character in the first key of the following word to the first position of the next syllable area; if a letter character exists in the pre-stored letter string of the next syllable, append the pre-stored letter string of the next syllable to the next syllable area according to the input order.
[0084] Furthermore, continue listening to the keyboard event queue.
[0085] When a letter key press event is received and no new tone key press event is present, the letter character of the letter key is appended to the next syllable area.
[0086] When a new tone key is pressed, the new tone value is recorded. After the new tone key is released, the next syllable area is combined with the new tone value to generate the next tone syllable.
[0087] Specifically, the next tone syllable consists of the toneless pinyin string in the next syllable area and the new tone value. First, the syllable legal table is queried to confirm that the toneless pinyin string in the next syllable area can match the legal syllable field. When the toneless pinyin string in the next syllable area can match the legal syllable field, the toneless pinyin string in the next syllable area and the new tone value are used as search conditions to find Chinese character records with the same pinyin field and the same tone field in the Chinese character candidate table, and the found Chinese character records are written into the next candidate character group.
[0088] When the untone pinyin string in the next syllable area cannot match a valid syllable field, the letter characters in the next syllable area are retained, the two-word list matching is stopped, and the current candidate character group is displayed as a candidate window. At this time, the selection position of the first character in the double-write temporary area will no longer continue to reduce the current candidate character group, and the first character key position will still be retained in the next syllable area, so that the next syllable letter that the user has already entered will not be cleared.
[0089] After generating the next candidate character group, read the previous character record from the reduced current candidate character group and read the next character record from the next candidate character group. Combine the previous character record and the next character record into a two-character combination. Compare the two-character combination with the previous character field and the next character field in the two-character word table item by item. When the current character field and the next character field both match the same two-character word record, the two-character combination is written to the area to be displayed.
[0090] If the current candidate character group is reduced to only one previous character record after the previous character selection position, and this previous character record can only form a two-character word with one of the following character records in the next candidate character group, then the previous character selection position and the following character first key position in the double-write temporary storage area are retained, and the two-character word is written to the area to be displayed.
[0091] When the current candidate character group is reduced to only one previous character record after the previous character selection, and this previous character record can form multiple two-character words with multiple subsequent character records in the next candidate character group, the multiple two-character words are sorted according to the word frequency sorting field in the two-character word table. The two-character word with the highest ranking is written to the waiting area, and the remaining two-character words are written to the two-character word candidate window. When the space key is received, the two-character words in the waiting area are displayed. When the number selection key is received, the selected two-character words in the two-character word candidate window are displayed.
[0092] The area to be displayed records two-character words, the letter characters of the first character selection position, the letter characters of the first key position of the second character, the current tone syllable, and the next tone syllable.
[0093] If, after the current candidate character group is reduced by the previous character selection position, there are still multiple previous character records, and all of these previous character records can form a two-character word with the next character record in the next candidate character group, the input method processing program first reads the field hit level in the previous character selection position, and sorts the multiple previous character records in the order of the first letter of the pronunciation of the first component, the first letter of the pronunciation of the last component, the first letter of the pronunciation of the first stroke, and the first letter of the pronunciation of the last stroke. When the field hit levels of multiple previous character records are the same, a two-character word candidate window is generated according to the word frequency sorting field in the two-character word table.
[0094] If the previous character record formed after the current candidate character group is reduced by the previous character selection position cannot form a two-character word with any of the following character records in the next candidate character group, the reduction of the current candidate character group by the previous character selection position is canceled, and the previous character selection position in the double-write temporary storage area is deleted; at the same time, the first key position of the following character and the next syllable area are retained; after canceling the previous character selection position, the current candidate character group that has not been reduced is displayed as the candidate window, and the next syllable area continues to retain the already entered letter characters and the new tone value.
[0095] As an example, the current syllable with tone is jiang1, and the double-written letter is s. The s in the first character selection position reduces the current candidate character group and retains jiang. The s in the first character selection position generates the next syllable area. After the user continues to input han and presses the first key, the next syllable with tone is generated shan1, and the next candidate character group is searched. jiang is compared with the candidate characters in the next candidate character group in the two-character word list. When jiangshan exists in the two-character word list, the double-written temporary storage area is retained, and jiangshan is written to the area to be displayed. After the user presses the space bar, jiangshan is written to the text input position, and the current syllable area, the clamped letter sequence, the release sequence record, the double-written temporary storage area, the current candidate character group, the next syllable area, and the next candidate character group are cleared.
[0096] When a space key is received, the text is displayed in the following order: the area to be displayed, the two-character word candidate window, and the current candidate word group.
[0097] When a two-character word exists in the pending screen area, the two-character word in the pending screen area is displayed directly; when a candidate word exists in the two-character word candidate window, the selected two-character word in the two-character word candidate window is displayed; when a candidate character exists in the current candidate character group, the selected single character in the current candidate character group is displayed.
[0098] When the delete key is received, the double-write buffer is canceled first. After the double-write buffer is canceled, the reduction of the current candidate word group by the previous word selection position is canceled simultaneously, and the next syllable area formed by the next word first key is retained. When the delete key is received again, the last letter of the next syllable area is deleted. After the next syllable area is empty, the tone value is deleted. After the tone value is deleted, the last letter of the current syllable area is deleted.
[0099] It should be noted that the next syllable area is formed by using the key position of the first character, the next candidate character group is generated by using the next tone-bearing syllable, and the two-character word list is used to determine whether the double-written temporary storage area is retained. When the previous character reduced from the current character selection position can form a two-character word with the next candidate character group, the same double-written letter completes the selection of the previous character and the start of the next syllable. When the previous character reduced from the current character selection position cannot form a two-character word, only the previous character selection position is cancelled, and the next syllable area remains valid, thus ensuring that the key mapping processing in the continuous tone input process is coherent and can be rolled back.
[0100] This embodiment also provides a computer device applicable to the tone input processing method based on key mapping, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the tone input processing method based on key mapping as proposed in the above embodiment.
[0101] The computer device can be a terminal, comprising 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. 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.
[0102] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the key-mapped tone input processing method as proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0103] In summary, this invention identifies the assigned letter by the release order of the tone key and letter key, thus achieving precise key allocation during tone input; by simultaneously writing double letters into the first character selection position and the first character selection position, it achieves the selection of the first character and the start of the next syllable without adding extra keys; by verifying whether double letters are retained through a two-character word list, and only canceling the first character selection position when verification fails, it achieves error tolerance and uninterrupted continuous input.
[0104] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A tone input processing method based on key mapping, characterized in that: include: Receive keyboard scan codes and establish a clamping double-write key position table, a syllable legal table, a Chinese character candidate table, and a two-character word table; Receive letter keys to generate the current syllable area, generate a clamping letter sequence during the period from pressing to releasing the tone key, record the tone value and release order, and define the letter key that was not released when the tone key was released and was closest to the release event as a double letter. Generate the current tone-bearing syllable based on the current syllable area, tone value, and holding letter; retrieve the current candidate character group from the Chinese character candidate table; write the double-written letter into the previous character selection position and the next character first key position in the double-written temporary storage area; and reduce the current candidate character group based on the previous character selection position. The system generates the next syllable zone and the next tone syllable based on the first key position of the following character. It then retrieves the next candidate character group from the Chinese character candidate list. The reduced current candidate character group is matched with the next candidate character group in the two-character word list. If a match is found and the space key is received, the character is displayed on the screen.
2. The tone input processing method based on key mapping as described in claim 1, characterized in that, The establishment of the clamping double-write key table, syllable legal table, Chinese character candidate table, and two-character word table includes: Convert keyboard scan codes into key events; Write the letter keys, tone keys, and space keys into the clamp double-write key table, and establish the mapping relationship between tone keys and tone values; Generate a syllable legal table based on the Pinyin syllable library, including a legal syllable field, a syllable first letter field, and a field for possible continuation letters; Generate a candidate table of Chinese characters based on the Chinese character pronunciation database and the character shape field database; Generate a two-character word table by writing the words into the preceding character field, the following character field, the preceding character syllable with tone field, the following character syllable with tone field, and the word frequency sorting field. The key events include key number, key type, key character, press event identifier, and release event identifier; The Chinese character candidate table includes a pinyin field, a tone field, and a candidate field.
3. The tone input processing method based on key mapping as described in claim 1, characterized in that, The process of generating the clamping letter sequence and recording the tone value and release order includes: When a tone key press event is received, the corresponding tone value and tone key press event number are recorded, and the clamping letter sequence is started. When a letter key press event is received during the period from the press to the release of a tone key, the letter character, letter key number, press event sequence number, release event sequence number, and release status are written into the clamped letter sequence. When a tone key release event is received, the tone key release event number is written, and a release sequence record is formed according to the order of tone key release events and letter key release events.
4. The tone input processing method based on key mapping as described in claim 3, characterized in that, The step of defining the letter key that was not released when the tone key was released and is closest to the release event as a double-written letter includes: When a tone key release event is received, the letter record in the clamped letter sequence that is in an unreleased state is searched. When there is at least one letter record in the release state that is not released, sort them in descending order according to the press event number, select the first letter record in the sort as the double-written letter record, and determine the letter characters in the double-written letter record as double-written letters. If there are no letter records in the unreleased state, set the double-written letter to null. For a letter record whose release status is "released", concatenate its letter character with the current syllable area and query the syllable validity table. Based on the query result, mark it as the complete letter of the current syllable or the complete letter of the next syllable.
5. The tone input processing method based on key mapping as described in claim 2, characterized in that, The candidate fields include: When the target Chinese character can be stably split into components, obtain the first letter of the pronunciation of the first component name and the first letter of the pronunciation of the last component name, and write them into the first letter field of the first component pronunciation and the first letter field of the last component pronunciation. When the target Chinese character cannot be stably split into components, obtain the first letter of the pronunciation of the first stroke name and the first letter of the pronunciation of the last stroke name, and write them into the first letter field of the first stroke pronunciation and the first letter field of the last stroke pronunciation. When the component name or stroke name of the target Chinese character cannot be reliably obtained, the first letter of the pinyin of the target Chinese character is written into the supplementary field.
6. The tone input processing method based on key mapping as described in claim 1, characterized in that, The step of reducing the current candidate word group based on the preceding character segmentation includes: When the current candidate character group contains only one Chinese character record, the previous character selection position is not enabled, and the first key of the next character is reserved as the starting letter of the next syllable area; When the current candidate character group includes multiple Chinese character records and there are double-written letters in the previous character selection position, the double-written letters are compared with the candidate fields of each Chinese character record in turn; If any candidate field of a Chinese character record is the same as a double-written letter, then the Chinese character record is retained; If all candidate fields of a Chinese character record are different from double-written letters, then remove the Chinese character record from the current candidate character group; When the double-written letter does not match any candidate field of any Chinese character record in the current candidate character group, the current candidate character group remains unchanged, and the double-written letter is only retained in the first key position of the following character.
7. The tone input processing method based on key mapping as described in claim 1 or 6, characterized in that, The process of generating the next syllable zone and the next tone syllable based on the key position of the following word includes: When there is a letter character in the first key of the next word, write the letter character to the first position of the next syllable area; If a pre-stored letter string for the next syllable exists, append the pre-stored letter string for the next syllable to the next syllable area according to the input order; Continue to receive letter key press events and append the corresponding letter character to the next syllable area; When a new tone key is pressed and released, the next syllable area is combined with the new tone value to generate the next tone syllable. The system queries the syllable legality table to determine if the next syllable region matches a legal syllable field. If it matches, it retrieves the next candidate character group from the Chinese character candidate table based on the next syllable with tone. If it does not match, it retains the next syllable region and stops matching the two-character word table.
8. The tone input processing method based on key mapping as described in claim 1, characterized in that, The specific steps for matching the reduced current candidate character group with the next candidate character group in the two-character word list and displaying it on the screen when a space key is received are as follows: Read the previous character record from the current candidate character group and the next character record from the next candidate character group after the reduction, and form a two-character combination; Match the two-character combination with the first and last character fields of the two-character word list; When the current word field and the next word field both match the same two-character word record, the corresponding two-character word will be written to the area to be displayed. When a two-character word exists in the area to be displayed and a space bar is received, the two-character word in the area to be displayed will be displayed. When the two-character combination does not match, cancel the reduction of the current candidate character group by the previous character selection position, delete the previous character selection position in the double-write temporary storage area, and retain the first key position of the next character and the next syllable area.
9. 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 tone input processing method based on key mapping as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the tone input processing method based on key mapping as described in any one of claims 1 to 8.