CN115981485A - Key processing method, device and medium - Google Patents

Key processing method, device and medium Download PDF

Info

Publication number
CN115981485A
CN115981485A CN202111199216.1A CN202111199216A CN115981485A CN 115981485 A CN115981485 A CN 115981485A CN 202111199216 A CN202111199216 A CN 202111199216A CN 115981485 A CN115981485 A CN 115981485A
Authority
CN
China
Prior art keywords
thread
key
cloud
candidate
candidate item
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111199216.1A
Other languages
Chinese (zh)
Inventor
李晓帆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sogou Technology Development Co Ltd
Original Assignee
Beijing Sogou Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sogou Technology Development Co Ltd filed Critical Beijing Sogou Technology Development Co Ltd
Priority to CN202111199216.1A priority Critical patent/CN115981485A/en
Publication of CN115981485A publication Critical patent/CN115981485A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Input From Keyboards Or The Like (AREA)

Abstract

The embodiment of the invention provides a key processing method, a key processing device and a key processing medium, wherein the method specifically comprises the following steps: under the condition that a pressing event of a key is detected, a first thread determines a key value corresponding to the key and sends the key value to a second line Cheng Fasong; and the second thread acquires a corresponding candidate item according to the key value. The embodiment of the invention can improve the key processing efficiency.

Description

Key processing method, device and medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a key processing method, a key processing device and a key processing medium.
Background
Currently, a keyboard is generally used as an input device for a terminal such as a computer, a mobile phone, and a personal digital assistant. In the case that a user triggers a key in a keyboard, the operating system generally transmits a corresponding virtual-key-code to the input method program; and after receiving the virtual key code, the input method program converts the virtual key code into a specific character in the current language environment.
The existing key processing scheme is that after a key lifting event is detected, an input method program processes the key, and the corresponding processing process specifically includes: and identifying key values, acquiring candidate items, displaying the candidate items and the like.
The inventor finds that in the process of implementing the embodiment of the invention, a long time is needed from the time when the user lifts the key to the time when the user presents the candidate, so that the key processing efficiency is low.
Disclosure of Invention
How to improve the key processing efficiency is a technical problem to be solved by those skilled in the art. In view of the above problems. In view of the above problems, embodiments of the present invention are proposed to provide a key processing method, apparatus and medium that overcome or at least partially solve the above problems.
In order to solve the above problem, an embodiment of the present invention discloses a key processing method, including:
under the condition that a pressing event of a key is detected, a first thread determines a key value corresponding to the key and sends the key value to a second line Cheng Fasong;
and the second thread acquires a corresponding candidate item according to the key value.
On the other hand, the embodiment of the invention discloses a key processing device, which comprises:
the key identification module is used for determining a key value corresponding to a key under the condition that a pressing event of the key is detected by utilizing a first thread;
a key value sending module, configured to send the key value to a second line Cheng Fasong via a first thread; and
and the candidate item acquisition module is used for acquiring a corresponding candidate item according to the key value by using a second thread.
Optionally, the apparatus further comprises:
and the notification module is used for sending a cancellation notification to the second thread by using the first thread under the condition of detecting the preset operation of the key.
Optionally, the apparatus further comprises:
and the candidate item display module is used for acquiring the corresponding candidate item from the second thread by using the first thread under the condition that the lifting event of the key is detected, and displaying the candidate item.
Optionally, the apparatus further comprises:
and the cloud request sending module is used for sending a cloud request to a server by using a first thread, wherein the cloud request carries the key value.
Optionally, the apparatus further comprises:
the cloud data interaction module is used for receiving cloud data returned by the server by the first thread and sending the cloud data to the second thread Cheng Fasong so that the second thread can analyze the cloud data into corresponding cloud candidates.
Optionally, the apparatus further comprises:
and the cloud candidate display module is used for acquiring the corresponding cloud candidate from the second thread by the first thread and displaying the cloud candidate.
In another aspect, an embodiment of the present invention discloses a device for key processing, which includes a memory and one or more programs, where the one or more programs are stored in the memory, and when the program is executed by the one or more processors, the steps of the foregoing method are implemented.
One or more machine-readable media having stored thereon instructions that, when executed by one or more processors, cause an apparatus to perform the foregoing methods are disclosed.
The embodiment of the invention has the following advantages:
the embodiment of the invention utilizes an asynchronous thread mode to process the key-press under the condition of detecting the press event of the key-press. Typically, this continues for a duration, such as a duration of 70ms (milliseconds), from key press to key lift. According to the embodiment of the invention, the key processing is carried out under the condition that the pressing event of the key is detected, so that the duration corresponding to the period from the pressing of the key to the lifting of the key can be saved, and the key processing efficiency can be improved.
In addition, the embodiment of the invention utilizes an asynchronous thread mode to carry out key processing. The first thread is used for carrying out key value identification, and the second thread is used for obtaining the candidate items. The asynchronous thread mode can reduce waiting time, so that the key processing efficiency can be improved.
Drawings
FIG. 1 is a schematic illustration of an application environment for an input method of an embodiment of the present invention;
FIG. 2 is a flow chart of the steps of an input method of an embodiment of the present invention;
FIG. 3 is a flow chart of the steps of an input method of an embodiment of the present invention;
FIG. 4 is a flowchart illustrating steps of a method for processing a key according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating steps of a method for processing a key according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating steps of a method for rendering a candidate according to an embodiment of the present invention;
fig. 7 is a block diagram of a key processing apparatus according to an embodiment of the present invention;
FIG. 8 is a block diagram of an apparatus 1300 for key processing according to an embodiment of the present invention; and
fig. 9 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The inventor finds that the triggering operation of the key is usually various in the process of implementing the embodiment of the invention, such as short-press operation, long-press operation, sliding operation and the like; moreover, different trigger operations generally correspond to different response modes. For example, a short press operation corresponds to the input of a character. For another example, in the case of using a 9-key keyboard, a long-press operation is performed on the selection of a corresponding character, for example, the candidate character corresponding to the key "2" specifically includes: A. b, C, 2, a, b, c, etc. As another example, the lateral sliding operation corresponds to movement of a cursor, and so on.
Since different triggering operations are executed on the same key, different response modes are usually caused, and therefore, in order to improve the accuracy of key response, the conventional technology generally considers that the complete triggering operation of the key starts from the pressing of the key and ends with the lifting of the key. Therefore, the conventional technology processes the complete trigger operation according to the corresponding response mode after detecting the corresponding complete trigger operation of pressing and lifting the key. However, in practical applications, there is a time period from the pressing to the lifting of the key, and the time period causes a delay in the response to the trigger operation, resulting in a low key processing efficiency.
In order to solve the technical problem of how to improve the key processing efficiency, an embodiment of the present invention provides a key processing scheme, which specifically includes: the method comprises the steps that a first thread determines a key value corresponding to a key under the condition that a pressing event of the key is detected, and sends the key value to a second thread; and the second thread acquires a corresponding candidate item according to the key value.
The embodiment of the invention utilizes an asynchronous thread mode to process the key-press under the condition of detecting the press event of the key-press. Typically, this continues for a duration, such as a duration of 70ms (milliseconds), from key press to key lift. According to the embodiment of the invention, the key processing is carried out under the condition that the pressing event of the key is detected, so that the duration corresponding to the time from the key pressing to the key lifting can be saved, and the key processing efficiency can be improved.
In addition, the embodiment of the invention utilizes an asynchronous thread mode to carry out key processing. The first thread is used for carrying out key value identification, and the second thread is used for obtaining the candidate items. The asynchronous thread mode can reduce waiting time, so that the key processing efficiency can be improved.
The request processing method provided by the embodiment of the present invention can be applied to the application environment shown in fig. 1, as shown in fig. 1, the client 100 and the server 200 are located in a wired or wireless network, and the client 100 and the server 200 perform data interaction through the wired or wireless network.
Optionally, the client 100 may run on a terminal, which specifically includes but is not limited to: smart phones, tablet computers, e-book readers, MP3 (moving Picture Experts Group Audio Layer III) players, MP4 (moving Picture Experts Group Audio Layer IV) players, laptop portable computers, car-mounted computers, desktop computers, set-top boxes, smart televisions, wearable devices, and the like. The client 100 may correspond to a website, or APP (Application). The client 100 may correspond to an application program such as an input method APP.
The server in the embodiment of the invention can be a cloud server (cloud). The cloud is a simple, efficient, safe and reliable computing service with elastically-telescopic processing capacity. The resource information of the cloud end has dynamic property, so that the processing capacity of the cloud end can be elastically stretched.
The embodiment of the invention can be applied to input method programs of keyboard symbols, handwriting, voice and other input modes. Taking the keyboard symbol input mode as an example, the user may perform text input through the code character string, and the input string may refer to the code character string input by the user. In the field of input methods, for input method programs in, for example, chinese, japanese, korean, or other languages, an input string input by a user may be generally converted into a candidate for the corresponding language. Hereinafter, the description will be mainly given by taking Chinese as an example, and other languages such as Japanese and Korean may be referred to each other. It is to be understood that the above-mentioned chinese input methods may include, but are not limited to, full pinyin, simple pinyin, strokes, five strokes, etc., and the embodiment of the present invention is not limited to a specific input method program corresponding to a certain language.
Taking the input of chinese as an example, the types of the encoding character string may include: pinyin strings, character strings (such as pencils, etc.). Taking english input as an example, the types of the encoding strings may include: alphabetic strings, and the like.
In practical applications, for the input mode of keyboard symbols, a user may input the input string through a physical keyboard or a virtual keyboard. For example, for a terminal with a touch screen, a virtual keyboard may be set in the input interface to perform input of an input string by triggering virtual keys included in the virtual keyboard. Optionally, examples of the virtual keyboard may include: a 9-key keyboard, a 26-key keyboard, etc. Moreover, it can be understood that, in addition to the virtual keys corresponding to the letters, the input interface may also be provided with symbol keys, numeric keys, and function keys such as a chinese-english switching key, or may also be provided with toolbar keys, and it can be understood that the specific keys included in the input interface are not limited in the embodiments of the present invention.
According to some embodiments, the input string may include, but is not limited to: a key symbol or a combination of a plurality of key symbols input by a user through a key. The key symbol may specifically include: pinyin, strokes, kana, etc.
In the embodiment of the invention, the candidate item can be used for representing one or more characters provided by the input method program and to be selected by the user. The candidate item can be a character of a language such as a Chinese character, an English character, a Japanese character and the like, and can also be a symbol combination in the forms of a character, an Emoji, a picture and the like. The above-mentioned characters include but are not limited to drawings composed of lines, symbols, and words, for example, examples of the above-mentioned characters may include: ": p ",": o ",": etc.
The candidates may include: local candidates, and/or cloud candidates. The local candidate may be a candidate provided by the client. In practical application, the client can search in a local word bank according to the input string to obtain a local candidate. For example, the local candidates corresponding to the input string "meilijianh" may include: "charm will", "beauty hard", "beauty" etc.
The cloud candidate may be a candidate provided by the server. The cloud candidate may be an associative candidate or a non-associative candidate that matches the input string. For example, if the input string is "meilijianh", the non-associative candidate corresponding to the input string may include "Mei Lijian hua", and the like. In another example, if the input string is "meiijianh", the corresponding association candidate may include "united states of america" or the like. It is to be understood that the embodiment of the present invention does not limit the specific cloud candidates and the specific determination manner of the cloud candidates.
Example one
Referring to fig. 2, a flowchart illustrating steps of a key processing method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 201, under the condition that a first thread detects a pressing event of a key, determining a key value corresponding to the key;
step 202, the first thread sends the key value to the second thread;
step 203, the second thread acquires a corresponding candidate item according to the key value;
the embodiment of the present invention may be executed by a client of an input method program, and it should be understood that a specific execution subject of the method shown in fig. 2 is not limited in the embodiment of the present invention.
In step 201, the pressing event of the key firstly enters into the message queue of the operating system, and then is sent to the input method program by the operating system. In particular, in the embodiment of the present invention, the first thread may receive a key depression event sent by the operating system.
The information corresponding to the pressing event of the key may include: virtual key codes of the keys. Examples of virtual keys may include: unicode (Unicode). Unicode is a type of character encoding used on computers. It sets uniform and unique binary code for each character in each language to meet the requirements of cross-language and cross-platform text conversion and processing.
The first thread may determine a key value corresponding to the key by using a key value recognition technology. The key value can represent the input character or function corresponding to the key.
In practical applications, the triggering operation of the key usually has multiple types, such as a short-press operation, a long-press operation, a sliding operation, and the like. Wherein, different trigger operations generally correspond to different response modes. For example, a short press operation corresponds to the input of an input string. For another example, in the context of a 9-keypad, a long press operation may be performed to select a corresponding character, for example, the candidate character corresponding to the key "2" specifically includes: A. b, C, 2, a, b, c, etc. As another example, the lateral sliding operation corresponds to movement of a cursor, and so on.
The inventor finds that the input string can be obtained by short-press operation in the process of implementing the embodiment of the invention, and the input string needs to be converted into a candidate item when the input string is obtained. The input string is generally unavailable for the long press operation and the slide operation, so that the long press operation and the slide operation do not have corresponding candidates.
Therefore, the embodiment of the invention can identify the key value of the key according to the target triggering operation corresponding to the candidate item. The target trigger operation may characterize the trigger operation that can result in the input string and that can convert the candidate. For example, the target trigger operation corresponding to the candidate may be a short press operation. It can be understood that different input method programs may provide different target trigger operations, and the specific target trigger operation is not limited in the embodiment of the present invention.
In an example of the present invention, in a case of using a 9-key keyboard, a pressing event for a key "2" is detected, and assuming that key value recognition is performed on the key according to a short-press operation, a resulting key value recognition result may include: a. b, C, A, B, C, etc.
In practical application, after obtaining a key value corresponding to a key, the first thread may send the key value to the second thread, so that the second thread determines the key value corresponding to the key. And the second thread may determine the input string corresponding to the key value by using a candidate item obtaining technology, and may further obtain a corresponding candidate item.
Assuming that key "2" corresponds to the first position of the input string, the determined input string may include: "a", "B", "C", "A", "B", "C", etc.; further, candidate items corresponding to the input string, such as "o", "a", "bar", and the like, may be obtained by using a thesaurus search, and the like.
Assuming that key "3" corresponds to the first position of the input string and key "2" corresponds to the second position of the input string, the determined input string may include: "da", "fa", "e", "d", "f", etc.; further, the candidate items corresponding to the input string, such as "big", "send", "hit", "answer", etc., may be obtained by utilizing a thesaurus search, etc.
It is understood that the candidate acquisition technique is known to those skilled in the art and will not be described herein.
In step 203, the second thread may send the candidate to the first thread after acquiring the corresponding candidate. For example, the second thread may cache the candidates and send a cache address to the first thread to cause the first thread to read the candidates from the cache according to the cache address.
In some embodiments of the present invention, the method may further include: the first thread presents the candidate item to present the candidate item to the user. The embodiment of the invention saves the corresponding duration from the key pressing to the key lifting, thereby improving the presenting speed of the candidate items.
It should be noted that the candidate items presented to the user may be updated according to the update of the pressing event of the key. For example, the input string "meilijianh" needs to be obtained by 10 press events, which may result in 10 input strings. In this way, in the input process of the input string "meilijianh", the first thread may first display the candidate item corresponding to the first input string, and after receiving the candidate item corresponding to the second input string sent by the second thread, the first thread may update the candidate item corresponding to the first input string to the candidate item corresponding to the second input string.
In summary, the key pressing method according to the embodiment of the present invention performs key pressing processing in an asynchronous thread manner when a key pressing event is detected. Typically, the duration from key press to key lift typically lasts for a certain duration, such as a duration of 70ms (milliseconds). According to the embodiment of the invention, the key processing is carried out under the condition that the pressing event of the key is detected, so that the duration corresponding to the time from the key pressing to the key lifting can be saved, and the key processing efficiency can be improved.
In addition, the embodiment of the invention utilizes an asynchronous thread mode to carry out key processing. The first thread is used for carrying out key value identification, and the second thread is used for obtaining the candidate items. The asynchronous thread mode can reduce the waiting time, so the key processing efficiency can be improved.
Example two
Referring to fig. 3, a flowchart illustrating steps of a key processing method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 301, under the condition that a first thread detects a press event of a key, determining a key value corresponding to the key;
step 302, the first thread sends the key value to the second thread;
303, the second thread acquires a corresponding candidate item according to the key value;
step 304, the first thread sends a cancellation notice to the second thread when detecting the preset operation of the key.
In the embodiment of the invention, the first thread sends a cancellation notice to the second thread when detecting the preset operation of the key. The preset operation may be an event conflicting with the candidate retrieval, and the cancellation notification may be used to notify the second thread to cancel the candidate retrieval.
In a particular implementation, the preset operation may conflict with a target trigger operation corresponding to the candidate acquisition. For example, the preset operation may be a long press operation, a slide operation, or the like. In practical application, the short-press operation or the long-press operation can be identified according to the duration corresponding to the key event; alternatively, the short-press operation or the sliding operation may be recognized according to whether the key event corresponds to the trace movement. It is understood that the embodiment of the present invention does not limit the specific preset operation and the specific identification manner of the preset operation.
After receiving the cancel notification, the second thread may cancel the candidate item acquisition corresponding to the key value of this time.
For example, when a 9-key keyboard is used by a first thread, a pressing event for a key "2" is detected, and a corresponding first key value is sent to a second thread, where the first key value specifically includes: "a", "B", "C", "A", "B", "C", etc.; and subsequently, continuously monitoring the pressing time of the key 2, and determining that the triggering operation is as follows according to the pressing time: if the key "2" is pressed for a long time, a cancel notification may be sent to the second thread, so that the second thread Cheng Quxiao obtains the candidate corresponding to the first key value. In this case, the second key value (e.g., "b") corresponding to the long-press operation may be determined, and the second key value may be assigned to the second line Cheng Fasong, so that the second line Cheng Zhihang may obtain the candidate corresponding to the second key value.
For example, when a 9-key keyboard is used by a first thread, a pressing event for a key "2" is detected, and a corresponding key value is sent to a second thread, where the key value specifically includes: "a", "B", "C", "A", "B", "C", etc.; and continuously monitoring the track of the finger on the screen subsequently, and determining that the triggering operation is as follows according to the track: for the sliding operation of the key "2", a cancellation notification may be sent to the second thread, so that the second thread Cheng Quxiao obtains the candidate corresponding to the first key value. In this case, the slide operation can be used to move the cursor, so the candidate acquisition operation may not be performed.
EXAMPLE III
Referring to fig. 4, a flowchart illustrating steps of a key processing method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 401, when detecting a pressing event of a key, a first thread determines a key value corresponding to the key;
step 402, the first thread sends the key value to the second thread;
step 403, the first thread sends a cloud request to the server, where the cloud request may carry the key value;
step 404, the second thread obtains a corresponding candidate item according to the key value.
In the embodiment of the invention, after determining the key value, the first thread may further send a cloud request to the server, where the cloud request may carry the key value, so that the server obtains the corresponding cloud candidate according to the cloud request. In general, a certain time delay is required from sending a cloud request to a server to receiving a cloud candidate returned by the server. The method comprises the steps that under the condition that a pressing event of a key is detected, a key value is determined and a cloud request containing the key value is sent; the duration corresponding to the key press-down time to the key lift-up time can be saved, so that the cloud candidate acquisition efficiency can be improved.
The local input method is limited by the memory capacity and CPU capacity of the local computer, and uses a word stock and a language model with smaller scale, so that the input accuracy of local candidates is limited. The cloud input method is an input method based on a cloud computing technology, and has incomparable advantages compared with the traditional input method by virtue of strong storage and operation capabilities of a server cluster: the advantages of a larger and updated word bank and a more advanced language model enable the accuracy of cloud candidates to be remarkably improved. Therefore, the cloud candidate is provided on the basis of the local candidate, and the accuracy of the candidate can be improved.
In a specific implementation, the method may further include: the first thread receives cloud data returned by the server and sends the cloud data to a second thread Cheng Fasong, so that the second thread can analyze the cloud data into corresponding cloud candidates. The cloud data may be data for encapsulating the cloud candidate (encapsulated data for short), and the second thread may analyze the encapsulated data to obtain a corresponding cloud candidate.
Further, the method may further include: the first thread acquires corresponding cloud candidates from the second thread and displays the cloud candidates.
Example four
Referring to fig. 5, a flowchart illustrating steps of a key processing method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 501, determining a key value corresponding to a key by a first thread under the condition that a pressing event of the key is detected;
step 502, the first thread sends the key value to the second thread;
step 503, the first thread sends a cloud request to the server, where the cloud request may carry the key value;
step 504, the second thread acquires a corresponding candidate item according to the key value;
step 505, the first thread presents the first candidate item according to the candidate item sent by the second thread, or updates the presented candidate item;
step 506, the first thread sends cloud data returned by the server to the second thread, so that the second thread analyzes the cloud data into cloud candidates;
in step 507, the first thread updates the presented candidate according to the cloud candidate of the second line Cheng Fasong.
EXAMPLE five
Referring to fig. 6, a flowchart illustrating steps of a candidate item drawing method according to an embodiment of the present invention is shown, and specifically may include the following steps:
601, the first thread determines the type of a candidate item;
step 602, if the type of the candidate item is a preset language type, the first thread determines a drawing width corresponding to the candidate item according to the width information of the single character and the number of characters contained in the candidate item;
step 603, the first thread draws the candidate item according to the drawing width;
step 604, if the type of the candidate item is a mixed type, the first thread sends character information of a single character contained in the candidate item to the third thread;
step 605, the third thread determines width information corresponding to the single characters contained in the candidate items according to the character information of the single characters contained in the candidate items, and fuses the width information corresponding to all the single characters contained in the candidate items to obtain drawing widths corresponding to the candidate items;
step 606, the first thread obtains a drawing width corresponding to the candidate item from the third thread, and draws the candidate item according to the drawing width.
The current input method program usually executes key value recognition, candidate item acquisition, candidate item display and other processing after detecting a key triggering event. The presenting of the candidate items specifically includes: the drawing width of the candidate item is calculated firstly, and then the candidate item is drawn according to the drawing width.
The inventor finds that the calculation of the drawing width in the traditional technology is long in time consumption in the process of implementing the embodiment of the invention; the case where the rendering timing arrives but the rendering width is not calculated is often present. Therefore, the calculation of the drawing width in the conventional technology takes a long time, so that the drawing efficiency and the presentation efficiency of the candidate item are low. In some cases, the problem of stuttering of the refresh of candidates may also arise.
The embodiment of the invention determines the drawing width corresponding to the candidate item by using the processing mode matched with the type so as to improve the determination efficiency of the drawing width. In the case of improving the determination efficiency of the drawing width, the drawing efficiency and the presentation efficiency of the candidates can be improved.
In step 601, the type of the candidate may be determined according to the type of the character contained in the candidate. In other words, the type of the candidate may characterize the type of characters contained by the candidate.
According to one implementation, the types of candidates may include: and presetting language types. In this case, the language corresponding to the character included in the candidate item is the predetermined language. The preset languages may include: chinese, japanese, korean, etc. For example, the type of the candidate "hello" is a chinese type.
According to another implementation, the types of candidates may include: and mixing types of the preset languages and the preset characters.
In a case where the predetermined language is the first predetermined language, the predetermined character may include: and a character of a second predetermined language. For example, the first predetermined language is Chinese, the second predetermined language is English, etc.
Alternatively, the preset characters may include: symbols such as punctuation marks, numeric symbols, and the like. Alternatively, the preset characters may include: numbers, and the like.
In the embodiment of the invention, the processing mode can be used for processing the types of the candidate items so as to determine the corresponding drawing width; in other words, the processing manner may be a calculation method of the rendering width.
In practical application, a matched processing mode can be provided for the type of the candidate item so as to improve the determination speed of the drawing width.
According to an implementation manner, the processing manner corresponding to the preset language type may be: and an overall processing mode, wherein the overall processing mode can determine the drawing width by taking the characters contained in the candidate as a whole. The width information corresponding to the single characters of the preset languages is uniform. For example, the width information corresponding to the Chinese word or Japanese word or Korean word is uniform. The width information corresponding to the english characters is not uniform, for example, the width information corresponding to the english characters in upper and lower case forms is different. Alternatively, the width information corresponding to different english characters in lower case format is also different, for example, the width information of the lower case "a" is different from that of the lower case "l". Therefore, english does not fall into the category of the predetermined language.
Accordingly, the determining the drawing width corresponding to the candidate item may specifically include: and under the condition that the type of the candidate item is a preset language type, determining the drawing width corresponding to the candidate item according to the width information of the single character and the number of characters contained in the candidate item.
In a specific implementation, a first mapping relationship between a single character of a preset language and width information may be stored in advance. Further, the drawing width may be determined based on the product p of the width information w1 and the number N of characters. For example, the product p may be taken as the drawing width, or the drawing width and the like may be determined from the product p and a preset interval. The predetermined character may represent the interval I between adjacent single characters within the candidate. For example, the product of the preset interval and the number of intervals may be added on the basis of the product p to obtain the drawing width. Wherein the number of intervals may be the number of characters minus 1.
According to another implementation manner, the processing manner corresponding to the mixing type may be: the character-by-character processing mode may be to determine the drawing widths of the single characters included in the candidate items one by one.
Accordingly, the determining the drawing width corresponding to the candidate item may specifically include: determining width information corresponding to a single character contained in the candidate item under the condition that the type of the candidate item is a mixed type; and fusing the width information corresponding to all the single characters contained in the candidate items to obtain the drawing width corresponding to the candidate items.
In a specific implementation, the second mapping relationship between the single character and the width information may be stored in advance. In the second mapping relationship, the single character may be represented by a virtual key code, and examples of the virtual key code may include: unicode (Unicode). Unicode is a type of character encoding used on computers. It sets uniform and unique binary code for each character in each language to meet the requirements of cross-language and cross-platform text conversion and processing. Of course, the embodiment of the present invention does not limit the specific representation of the single character.
In practical application, the search may be performed in the second mapping relationship according to the single character included in the candidate item, so as to obtain the corresponding width information w2. Further, the width information corresponding to all the single characters contained in the candidate items may be fused, and the corresponding fusion mode may include: summing, and the like. The interval I between adjacent single characters may also be considered in the fusion process.
In summary, the processing manner corresponding to the preset language type may be: and an overall processing mode, wherein the overall processing mode can determine the drawing width by taking the characters contained in the candidate as a whole. The overall processing mode can rapidly determine the drawing width corresponding to the candidate item according to the width information of the single character and the number of characters contained in the candidate item, so as to improve the calculation speed of the drawing width.
The processing mode corresponding to the mixing type may be: the character-by-character processing mode may be to determine the drawing widths of the single characters included in the candidate items one by one. Since the character-by-character processing method needs to consume a certain calculation time, the processing can be performed in an asynchronous thread mode so as to improve the calculation speed of the drawing width.
It should be noted that, for simplicity of description, the method embodiments are described as a series of motion combinations, but those skilled in the art should understand that the present invention is not limited by the described motion sequences, because some steps may be performed in other sequences or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no moving act is required as an embodiment of the invention.
Device embodiment
Referring to fig. 7, a block diagram of a key processing apparatus according to an embodiment of the present invention is shown, which may specifically include:
a key identification module 701, configured to determine, by using a first thread, a key value corresponding to a key when a key pressing event is detected;
a key value sending module 702, configured to send the key value to the second line Cheng Fasong via the first thread; and
the candidate item obtaining module 703 is configured to obtain, by using the second thread, a corresponding candidate item according to the key value.
Optionally, the apparatus may further include:
and the notification module is used for sending a cancellation notification to the second thread by using the first thread under the condition of detecting the preset operation of the key.
Optionally, the apparatus may further include:
and the candidate item display module is used for acquiring the corresponding candidate item from the second thread by using the first thread under the condition that the lifting event of the key is detected, and displaying the candidate item.
Optionally, the apparatus may further include:
and the cloud request sending module is used for sending a cloud request to the server by using the first thread, wherein the cloud request carries the key value.
Optionally, the apparatus may further include:
and the cloud data interaction module is used for receiving the cloud data returned by the server by the first thread and sending the cloud data to the second thread so that the second thread can analyze the cloud data into corresponding cloud candidates.
Optionally, the apparatus may further include:
and the cloud candidate display module is used for acquiring the corresponding cloud candidate from the second thread by the first thread and displaying the cloud candidate.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are all described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same and similar between the embodiments may be referred to each other.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 8 is a block diagram illustrating an apparatus 1300 for key processing in accordance with an example embodiment. For example, apparatus 1300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and so forth.
Referring to fig. 8, the apparatus 1300 may include one or more of the following components: a processing component 1302, a memory 1304, a power component 1306, a multimedia component 1308, an audio component 1310, an input/output (I/O) interface 1312, a sensor component 1314, and a communications component 1316.
The processing component 1302 generally controls overall operation of the device 1300, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 1302 may include one or more processors 1320 to execute instructions to perform all or part of the steps of the methods described above. Further, processing component 1302 can include one or more modules that facilitate interaction between processing component 1302 and other components. For example, the processing component 1302 may include a multimedia module to facilitate interaction between the multimedia component 1308 and the processing component 1302.
The memory 1304 is configured to store various types of data to support operation at the device 1300. Examples of such data include instructions for any application or method operating on device 1300, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1304 may be implemented by any type or combination of volatile or non-volatile memory devices 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 memory, flash memory, magnetic or optical disks.
Power supply component 1306 provides power to the various components of device 1300. The power components 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 1300.
The multimedia component 1308 includes a screen between the device 1300 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide motion action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1308 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 1300 is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 1310 is configured to output and/or input audio signals. For example, the audio component 1310 includes a Microphone (MIC) configured to receive an external audio signal when the apparatus 1300 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 1304 or transmitted via the communication component 1316. In some embodiments, the audio component 1310 also includes a speaker for outputting audio signals.
The I/O interface 1312 provides an interface between the processing component 1302 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1314 includes one or more sensors for providing various aspects of state assessment for the device 1300. For example, the sensor assembly 1314 may detect an open/closed state of the device 1300, the relative positioning of components, such as a display and keypad of the apparatus 1300, the sensor assembly 1314 may also detect a change in position of the apparatus 1300 or a component of the apparatus 1300, the presence or absence of user contact with the apparatus 1300, orientation or acceleration/deceleration of the apparatus 1300, and a change in temperature of the apparatus 1300. The sensor assembly 1314 may include a proximity sensor configured to detect the presence of a nearby object in the absence of any physical contact. The sensor assembly 1314 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 1316 is configured to facilitate communications between the apparatus 1300 and other devices in a wired or wireless manner. The apparatus 1300 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1316 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1316 also includes a Near Field Communications (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 1300 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 1304 comprising instructions, executable by the processor 1320 of the apparatus 1300 to perform the method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium in which instructions, when executed by a processor of a terminal, enable the terminal to perform a key processing method, the method comprising: the method comprises the steps that under the condition that a pressing event of a key is detected by a first thread, a key value corresponding to the key is determined, and the key value is sent to a second line Cheng Fasong; and the second thread acquires a corresponding candidate item according to the key value.
Fig. 9 is a schematic structural diagram of a server in an embodiment of the present invention. The server 1900, which may vary widely in configuration or performance, may include one or more Central Processing Units (CPUs) 1922 (e.g., one or more processors) and memory 1932, one or more storage media 1930 (e.g., one or more mass storage devices) that store applications 1942 or data 1944. Memory 1932 and storage medium 1930 can be, among other things, transient or persistent storage. The program stored in storage medium 1930 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a server. Further, a central processor 1922 may be arranged to communicate with the storage medium 1930 to execute a series of instruction operations in the storage medium 1930 on the server 1900.
The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input/output interfaces 1958, one or more keyboards 1956, and/or one or more operating systems 1941, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. The invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is only limited by the appended claims
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and should not be taken as limiting the scope of the present invention, which is intended to cover any modifications, equivalents, improvements, etc. within the spirit and scope of the present invention.
The key processing method, the key processing apparatus, the apparatus for key processing, and the machine-readable medium provided in the embodiments of the present invention are described in detail above, and specific examples are applied herein to explain the principles and embodiments of the present invention, and the descriptions of the above embodiments are only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (14)

1. A key processing method is characterized by comprising the following steps:
under the condition that a pressing event of a key is detected, a first thread determines a key value corresponding to the key and sends the key value to a second line Cheng Fasong;
and the second thread acquires a corresponding candidate item according to the key value.
2. The method of claim 1, further comprising:
the first thread sends a cancellation notification to the second thread when detecting a preset operation of a key.
3. The method of claim 1, further comprising:
and the first thread acquires the corresponding candidate item from the second thread under the condition that the lifting event of the key is detected, and displays the candidate item.
4. The method of claim 1, further comprising:
and the first thread sends a cloud request to a server, wherein the cloud request carries the key value.
5. The method of claim 4, further comprising:
the first thread receives cloud data returned by the server and sends the cloud data to a second thread Cheng Fasong, so that the second thread can analyze the cloud data into corresponding cloud candidates.
6. The method of claim 5, further comprising:
the first thread acquires corresponding cloud candidates from the second thread and displays the cloud candidates.
7. A key processing apparatus, comprising:
the key identification module is used for determining a key value corresponding to a key under the condition that a pressing event of the key is detected by using a first thread;
a key value sending module, configured to send the key value to the second line Cheng Fasong via the first thread; and
and the candidate item acquisition module is used for acquiring the corresponding candidate item according to the key value by using the second thread.
8. The apparatus of claim 7, further comprising:
and the notification module is used for sending a cancellation notification to the second thread by using the first thread under the condition of detecting the preset operation of the key.
9. The apparatus of claim 7, further comprising:
and the candidate item display module is used for acquiring the corresponding candidate item from the second thread by using the first thread under the condition of detecting the lifting event of the key and displaying the candidate item.
10. The apparatus of claim 7, further comprising:
and the cloud request sending module is used for sending a cloud request to a server by using a first thread, wherein the cloud request carries the key value.
11. The apparatus of claim 10, further comprising:
the cloud data interaction module is used for receiving cloud data returned by the server by the first thread and sending the cloud data to the second thread Cheng Fasong so that the second thread can analyze the cloud data into corresponding cloud candidates.
12. The apparatus of claim 11, further comprising:
and the cloud candidate display module is used for acquiring the corresponding cloud candidate from the second thread by the first thread and displaying the cloud candidate.
13. An apparatus for key processing, comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory, and wherein the one or more programs, when executed by the one or more processors, implement the steps of the method of any of claims 1 to 6.
14. One or more machine readable media having instructions stored thereon that, when executed by one or more processors, cause an apparatus to perform the method of any of claims 1-6.
CN202111199216.1A 2021-10-14 2021-10-14 Key processing method, device and medium Pending CN115981485A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111199216.1A CN115981485A (en) 2021-10-14 2021-10-14 Key processing method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111199216.1A CN115981485A (en) 2021-10-14 2021-10-14 Key processing method, device and medium

Publications (1)

Publication Number Publication Date
CN115981485A true CN115981485A (en) 2023-04-18

Family

ID=85958640

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111199216.1A Pending CN115981485A (en) 2021-10-14 2021-10-14 Key processing method, device and medium

Country Status (1)

Country Link
CN (1) CN115981485A (en)

Similar Documents

Publication Publication Date Title
CN101593080B (en) Identification of candidate characters for text input
USRE46139E1 (en) Language input interface on a device
US8908973B2 (en) Handwritten character recognition interface
CN107688399B (en) Input method and device and input device
CN107918496B (en) Input error correction method and device for input error correction
US10241670B2 (en) Character entry apparatus and associated methods
CN109783244B (en) Processing method and device for processing
CN108536653B (en) Input method, input device and input device
CN110795014A (en) Data processing method and device and data processing device
CN108073291B (en) Input method and device and input device
CN109542244B (en) Input method, device and medium
CN111258691B (en) Input method interface processing method, device and medium
CN115981485A (en) Key processing method, device and medium
CN113407099A (en) Input method, device and machine readable medium
CN115981486A (en) Input method, device and medium
CN112764551A (en) Vocabulary display method and device and electronic equipment
CN110456919B (en) Data processing method, device and device for data processing
CN109388328B (en) Input method, device and medium
CN113805707A (en) Input method, input device and input device
CN114967939B (en) Input method, device and medium
CN114442816B (en) Association prefetching method and device for association prefetching
CN113703588B (en) Input method, device and device for inputting
CN113407039A (en) Input method, device and machine readable medium
CN112286597B (en) Interface processing method and device for interface processing
CN110716653B (en) Method and device for determining association source

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40084584

Country of ref document: HK