CN113050808B - Method and device for highlighting target text in input box - Google Patents

Method and device for highlighting target text in input box Download PDF

Info

Publication number
CN113050808B
CN113050808B CN202110437160.2A CN202110437160A CN113050808B CN 113050808 B CN113050808 B CN 113050808B CN 202110437160 A CN202110437160 A CN 202110437160A CN 113050808 B CN113050808 B CN 113050808B
Authority
CN
China
Prior art keywords
text
input
input box
current
target text
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.)
Active
Application number
CN202110437160.2A
Other languages
Chinese (zh)
Other versions
CN113050808A (en
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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110437160.2A priority Critical patent/CN113050808B/en
Publication of CN113050808A publication Critical patent/CN113050808A/en
Application granted granted Critical
Publication of CN113050808B publication Critical patent/CN113050808B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/02Input arrangements using manually operated switches, e.g. using keyboards or dials
    • G06F3/023Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes
    • G06F3/0233Character input methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The present disclosure provides a method, an apparatus, an electronic device, a computer readable storage medium and a computer program product for highlighting a target text in an input box, and relates to the technical field of text processing, in particular to the technical field of text input. The implementation scheme is as follows: setting the rich text container to be editable based on the editable properties of the rich text container of the input box; acquiring a current character to be displayed in an input box; determining a current analysis unit, wherein the current analysis unit comprises a current character; extracting a text to be matched comprising the current character from the current analysis unit; and in response to the preset target text word stock comprising target text matched with the text to be matched, displaying a rich text style of the target text in the input box so as to highlight the target text in the input box. The technical scheme of the embodiment of the disclosure can improve the accuracy and response speed of highlighting the target text in the input box.

Description

Method and device for highlighting target text in input box
Technical Field
The present disclosure relates to the field of text processing, and in particular, to the field of text input technology, and more particularly, to a method, an apparatus, an electronic device, a computer readable storage medium, and a computer program product for highlighting a target text in an input box.
Background
Some browsers in the related art may support highlighting target text when a web page is presented. However, for the input box of the browser, a function of highlighting the target text in a certain style during the text input process has not been realized yet, and the function is yet to be further developed. In addition, for some other application software with text input function, there is a similar functional deficiency when inputting text in an input box.
How to accurately and timely highlight the target text in the input box is a technical problem to be solved at present.
The approaches described in this section are not necessarily approaches that have been previously conceived or pursued. Unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section. Similarly, the problems mentioned in this section should not be considered as having been recognized in any prior art unless otherwise indicated.
Disclosure of Invention
The present disclosure provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for highlighting target text in an input box.
According to an aspect of the present disclosure, there is provided a method of highlighting a target text in an input box, including:
setting the rich text container to be editable based on the editable properties of the rich text container of the input box;
acquiring a current character to be displayed in an input box;
determining a current analysis unit, wherein the current analysis unit comprises a current character;
extracting a text to be matched comprising the current character from the current analysis unit;
and in response to the preset target text word stock comprising target text matched with the text to be matched, displaying a rich text style of the target text in the input box so as to highlight the target text in the input box.
According to another aspect of the present disclosure, there is provided an apparatus for highlighting a target text in an input box, including:
a trigger unit configured to set the rich text container to be editable based on an editable property of the rich text container of the input box;
an acquisition unit configured to acquire a current character to be displayed in an input box;
a determining unit configured to determine a current analyzing unit including a current character;
an extraction unit configured to extract a text to be matched including a current character from the current analysis unit; a kind of electronic device with high-pressure air-conditioning system
And a display output unit configured to display a rich text style of the target text in the input box in response to the preset target text word stock including the target text matched with the text to be matched, so as to highlight the target text in the input box.
According to yet another aspect of the present disclosure, there is provided an electronic device including a memory; and a processor coupled to the memory, the processor configured to perform the aforementioned method based on instructions stored in the memory.
According to yet another aspect of the present disclosure, a computer readable storage medium is provided, wherein the computer program, when executed by a processor, implements the aforementioned method.
According to yet another aspect of the present disclosure, a computer program product is provided, wherein the computer program, when executed by a processor, implements the aforementioned method.
According to one or more embodiments of the present disclosure, the implementation of the scheme uses one input box container, that is, a rich text container with editable properties, which can overcome technical problems caused by two-layer presentation of related technologies and improve accuracy and timeliness of highlighting target text in an input box, compared with related technologies known to the inventor. The current analysis unit is used as the minimum analysis unit for carrying out matching verification on the text to be matched, and each time the matching verification on the text to be matched is carried out on the current analysis unit, the calculation amount of the system can be greatly reduced, and therefore the speed and the accuracy of the matching verification can be improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The accompanying drawings illustrate exemplary embodiments and, together with the description, serve to explain exemplary implementations of the embodiments. The illustrated embodiments are for exemplary purposes only and do not limit the scope of the claims. Throughout the drawings, identical reference numerals designate similar, but not necessarily identical, elements.
FIG. 1 illustrates a flow chart of a method of highlighting target text in an input box according to some embodiments of the present disclosure;
FIG. 2 illustrates an example one of highlighting target text in an input box according to some embodiments of the present disclosure;
FIG. 3 illustrates an example two of highlighting target text in an input box according to some embodiments of the present disclosure;
FIG. 4 illustrates a block diagram of an apparatus for highlighting target text in an input box according to some embodiments of the present disclosure;
fig. 5 illustrates a block diagram of an electronic device, according to some embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the present disclosure, the use of the terms "first," "second," and the like to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of the elements, unless otherwise indicated, and such terms are merely used to distinguish one element from another. In some examples, a first element and a second element may refer to the same instance of the element, and in some cases, they may also refer to different instances based on the description of the context.
The terminology used in the description of the various examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context clearly indicates otherwise, the elements may be one or more if the number of the elements is not specifically limited. Furthermore, the term "and/or" as used in this disclosure encompasses any and all possible combinations of the listed items.
The input boxes of most current browsers do not support the function of highlighting target text in a certain pattern at the same time as text input, e.g., the search input boxes of browsers do not support highlighting target text therein at the same time as text input. In addition, some other application software having a text input function has similar functional shortfalls when inputting text in an input box.
The object of highlighting the target text in the input box can be basically achieved by the related technology known by the inventor, wherein the object is realized by two layers of a text input layer and a text highlighting layer positioned below the text input layer, the text input layer is responsible for receiving text input, the target text is displayed as transparent, and the text highlighting layer is responsible for highlighting the target text. The related art requires that the presentation of the text input layer and the text highlighting layer must be kept consistent, otherwise the problem of mismatch of the two presentations within the input box is easily present. For example, when entering the enter key line feed in the input box, there may be a case where the text input layer cursor moves one line, while the text of the text highlighting layer moves two or more lines. Therefore, the matching accuracy of highlighting the target text is low, and the response speed is low, so that the actual experience is affected. In addition, the development cost of the related art is relatively high due to the fact that two layers of display are performed in advance.
Based on the above, the embodiments of the present disclosure provide a method, an apparatus, an electronic device, a computer readable storage medium and a computer program product for highlighting a target text in an input box, so as to achieve the purpose of accurately and timely highlighting the target text in the input box, and enrich the functions of application software.
The technical scheme of the embodiment of the disclosure can be applied to various application software comprising text input boxes, including but not limited to browser software of webpage version or APP (Application) version, map software, communication platform software, video and audio software, news software and the like. The application software is not limited to be in a networking running state, and may be in an offline running state, for example. For example, the input box is an input box of a browser in an offline running state or a networking running state.
In the disclosed embodiments, the input box may be a single line text input box, such as a single line text input box using the < input > element. Furthermore, the input box may also be a multi-line text input box, such as a multi-line text input box using < textarea > elements.
Highlighting the target text in the input box it is understood that the target text is displayed in the input box in one or more rich text styles such that it is significantly different from the plain text styles of the rest of the text in the input box, the rich text styles including, but not limited to, at least one of highlighting, bolding, tilting, underlining, border, effects, and shading.
As shown in fig. 1, some embodiments of the present disclosure provide a method of highlighting a target text in an input box, the method including the following steps S101 to S105.
In step S101, the rich text container is set to be editable based on the editable property of the rich text container of the input box.
In step S102, a current character to be displayed in an input box is acquired.
In step S103, a current analysis unit is determined, the current analysis unit including a current character.
In step S104, a text to be matched including the current character is extracted from the current analysis unit.
In step S105, in response to the preset target text word stock including the target text matching the text to be matched, a rich text style of the target text is displayed in the input box to highlight the target text in the input box.
When the text to be matched is consistent with the content of a certain target text in the target text word stock, the text to be matched is considered to be matched with the target text. Thus, a rich text style of the target text, i.e., a rich text style of the text to be matched, is displayed in the input box.
The technical scheme of the embodiment of the disclosure is realized based on the editable property of the rich text container of the input box. After the rich text container is set to be editable, the current analysis unit is used as the minimum analysis unit, the text to be matched extracted from the current analysis unit is subjected to matching verification with a preset target text word stock, and the target text (i.e. the text to be matched) after the rich text conversion is displayed in an input box in response to the fact that the target text word stock comprises the target text matched with the text to be matched, namely the matching verification of the text to be matched is passed, so that the aim of highlighting the target text in the input box is fulfilled. Compared with the prior art known by the inventor, the technical problem caused by two-layer display of the related art can be reduced, so that the defects of the related art can be overcome, and the accuracy and timeliness of highlighting the target text in the input box can be improved.
In the embodiment of the disclosure, the current analysis unit, i.e. the latest analysis unit, is used as the smallest analysis unit for performing matching verification on the text to be matched. In the process of inputting text into an input box, the system divides analysis units according to preset grammar rules, such as space, punctuation, line feed and the like. Each time the matching verification of the text to be matched is aimed at the current analysis unit, the calculation amount of the system can be greatly reduced, and therefore the speed and accuracy of the matching verification can be improved. In some embodiments, the current analysis unit is, for example, a temporary Token (Token) that adds an in-line tag (span).
In the embodiment of the present disclosure, since the rich text container has an editable property, the rich text container may be set to be editable. The element attributes of the rich text container of the input box may be different for different applications, but all need to have editable attributes (content ditables). For example, for a browser, the rich text container is specifically a document object model (Document Object Model, DOM), while for other applications, the rich text container may also be a TextView container, etc.
Returning to fig. 1, in some embodiments, this step S101 includes: in response to the input box being triggered to display, the rich text container is set editable.
For example, in response to a browser search engine being turned on, a search input box is displayed with the document object model having editable properties in hypertext markup language (html) set to editable, i.e., an editable mode is turned on. When the content table= "true" of html is set, the editable mode of the document object model is started.
For example, in response to a text entry box of the browser's communication platform being opened, its corresponding document object model is set editable.
In some embodiments, the method of highlighting the target text in the input box further comprises: after step S101, before step S102, a start event is entered for the rich text container binding, the default behavior of displaying plain text at the input box is stopped, and an end event is entered for the rich text container binding.
The input start event and the input end event may be triggered by any one of an input device such as a physical keyboard, a virtual keyboard, a voice input device, and a handwriting input device. For example, an input start event, such as a keyboard press event (keydown), an input end event, such as a keyboard release event (keyup), is triggered by the physical keyboard or the virtual keyboard.
Before the rich text container is set editable, the input box defaults to displaying the input text in plain text style within the input box. After the rich text container is set editable, this default behavior is blocked.
Returning to fig. 1, in some embodiments, based on the binding of the events described above, step S102 includes:
in response to an input end event being triggered, intercepting a current character to be displayed in the input box that is input by the input device directly to the input box, or intercepting a current character to be displayed in the input box that is input by the input device through an input normal input box. The current character may be one or more characters, which may be chinese characters, english characters, or other language characters.
Taking an example of inputting an english character "k" (an english character) to an input box by means of a physical keyboard or a virtual keyboard, when the keyboard is sprung up, a keyboard release event is triggered, and in a related art, the input box does not have a function of highlighting a target text, and the english character "k" is directly displayed in a plain text style. In contrast, in the embodiment of the present disclosure, in response to the keyboard release event, the english character "k" is intercepted and stored in the current analysis unit, instead of being directly displayed in the input box at step S102.
Taking the example of inputting Chinese characters "us" (two Chinese characters) by an input normal input box via an entity keyboard or a virtual keyboard, in the pinyin input method state, when each pinyin letter in "word" is continuously input, a keyboard pressing event and a keyboard releasing event are triggered a plurality of times. When the last letter "n" is entered, the word choice column presents a number of candidate words, in which the word "we" also appears. In response to receiving the candidate word selection, e.g., receiving the candidate sequence number "1" corresponding to "we", the last keyboard release event is triggered. In one related art, the input box does not have the function of highlighting the target text, and the chinese character "we" will be displayed directly in plain text style. In the embodiment of the present disclosure, in response to the last keyboard release event in the input method state, the chinese character "we" is intercepted and stored in the current analysis unit instead of being directly displayed in the input box at step S102.
Returning to fig. 1, in some embodiments of the present disclosure, the current analysis unit is a current lexical analysis unit, and step S103 includes at least one of the following steps A, B, C.
In step A, a current lexical analysis unit is created in response to the current character being input to the input box for the first time, and the current character is stored in the current lexical analysis unit.
For example, when the first chinese character "i am" is input to the input box, a lexical analysis unit having a number of 01, for example, which is the latest lexical analysis unit, i.e., the current lexical analysis unit, has been created before the chinese character "i am" is displayed in the input box. The number 01 and the following number 02 are only used to distinguish two lexical analysis units, and do not represent actual settings.
In step B, in response to the current character being input to the input box for the first time and the current character being input continuously with the previous character already displayed in the input box, the current character is stored in the current lexical analysis unit containing the previous character.
For example, the first Chinese character "I" has been input through the Chinese input normal input box, the character "I" is displayed in the input box and stored in the lexical analysis unit numbered 01 (also the current lexical analysis unit), and when the Chinese character "I" continues to be input through the Chinese input normal input box, the system determines that the current character "I" and the last character "I" are consecutively input, so that the character "I" is also stored in the lexical analysis unit numbered 01 before the character "I" is displayed in the input box.
In step C, in response to the current character being input to the input box for the non-first time, and the current character and the last character already displayed in the input box being non-continuous inputs, a current lexical analysis unit is created, and the current character is stored in the current lexical analysis unit.
In some embodiments, the current character and the previous character are determined to be non-consecutive inputs in response to a non-character input operation, such as a space operation, a line feed operation, a delete operation, or the like, that is unrelated to character input, following an input operation of the previous character, prior to an input operation of the current character.
For example, the chinese character "we love spring" has been input to the input box through the chinese input method, the character "we love spring" is displayed in the input box and stored in the lexical analysis unit numbered 01, when a space is input thereafter, then the chinese character "summer" is input through the chinese input method, the system determines that the current character and the previous character are non-consecutively input according to the preset grammar rule, thus creating a lexical analysis unit numbered 02 again, and storing the chinese character "summer" in the lexical analysis unit numbered 02. The lexical analysis unit with the number 02 is the latest lexical analysis unit, namely the current lexical analysis unit. The lexical analysis unit numbered 01 is no longer used as the current lexical analysis unit.
Returning to fig. 1, in some embodiments of the present disclosure, in step S104, the current lexical analysis unit is subjected to word segmentation according to a certain grammar rule, and then a text to be matched including the current character is extracted therefrom.
Taking the current lexical analysis unit numbered 01, which includes five Chinese characters "we love spring", as an example, it is assumed that "day" is the current character input through the Chinese input normal to the input box but not yet displayed in the input box, and "we love spring" has been displayed in the input box but is displayed in a plain text style since there is no target text therein. In step S104, the current lexical analysis unit numbered 01 is divided into words, for example, "we", "love", "spring", according to a certain grammar rule, and then the text "spring" to be matched including the current character "day" is extracted therefrom.
In some embodiments of the present disclosure, the disclosed method further comprises: after step S104, before step S105, it is determined whether a target text matching the text to be matched is included in the preset target text word stock by a character string matching algorithm. For example, it is determined whether the target text word stock includes a target text that matches the text to be matched "spring".
The specific manner of the string matching algorithm is not limited, and includes, but is not limited to, a naive algorithm, a Rabin-Karp algorithm, a KMP algorithm, a Boyer-Moore algorithm, a Sunday algorithm, a regular expression algorithm and the like. The preset target text word stock can be stored in a server or terminal equipment, can be manually input with a setting, and can be automatically updated according to a program setting, for example, the target text word stock is dynamically updated according to network hotwords.
Returning to fig. 1, in step S105, in response to the preset target text word stock including the target text matching the text to be matched, a rich text style of the target text is displayed in the input box to highlight the target text in the input box.
For example, as shown in fig. 2, the character "spring" is continuously input through the chinese input method state, and if it is determined that the target text "spring" is included in the target text thesaurus, a highlighting background is added thereto while the target text "spring" is displayed in the input box, i.e., the highlighted target text "spring" is directly displayed in the input box at step S105.
For another example, as shown in fig. 3, some english characters "spring" are already displayed in the input box, these english characters are stored in the current analysis unit, and when the english character "g" is continuously input, this english character "g" is intercepted and stored in the current analysis unit, in step S104 "spring" is extracted as the text to be matched, and in response to the target text word stock including the target text "spring", in step S105, while the character "g" is displayed in the input box, some english characters "spring" are already displayed in the input box, and the background is also highlighted.
In some embodiments of the present disclosure, the method of highlighting the target text in the input box further comprises: after step S104, in response to the current analysis unit not including the target text, a plain text style of the current character is displayed in the input box. For example, the current character "summer" is still displayed in plain text style in the input box because it is not the target text.
As shown in fig. 4, the embodiment of the present disclosure further provides an apparatus 400 for highlighting a target text in an input box, including:
a trigger unit 401 configured to set the rich text container to be editable based on the editable attribute of the rich text container of the input box;
an acquisition unit 402 configured to acquire a current character to be displayed in an input box;
a determining unit 403 configured to determine a current analyzing unit including a current character;
an extracting unit 404 configured to extract a text to be matched including the current character from the current analyzing unit; a kind of electronic device with high-pressure air-conditioning system
And a display output unit 405 configured to display a rich text style of the target text in the input box in response to the preset target text word stock including the target text matched with the text to be matched, so as to highlight the target text in the input box.
As described above, the method and apparatus for highlighting a target text in an input box according to the embodiments of the present disclosure can improve the accuracy and response speed of highlighting a target text in an input box.
As shown in fig. 5, a block diagram of an electronic device 500 of the present disclosure applied to a server or a client is a structural diagram, which is an example of a hardware device that may be applied to aspects of the present disclosure. Electronic device 500 is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the electronic device 500 includes a computing unit 501 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 may also be stored. The computing unit 501, ROM 502, and RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Various components in the device 500 are connected to the I/O interface 505, including: an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. The input unit 506 may be any type of device capable of inputting information to the electronic device 500, the input unit 506 may receive input numeric or character information and generate key signal inputs related to user settings and/or function control of the electronic device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a trackpad, a trackball, a joystick, a microphone, and/or a remote control. The output unit 507 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, video/audio output terminals, vibrators, and/or printers. Storage unit 508 may include, but is not limited to, magnetic disks, optical disks. The communication unit 509 allows the electronic device 500 to exchange information/data with other devices over a computer network such as the internet and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and/or chipsets, such as bluetooth (TM) devices, 1302.11 devices, wiFi devices, wiMax devices, cellular communication devices, and/or the like.
The computing unit 501 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the respective methods and processes described above, for example, a method of highlighting a target text in an input box. For example, in some embodiments, the method of highlighting target text in an input box may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 500 via the ROM 502 and/or the communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the method of highlighting target text in an input box described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the method of highlighting the target text in the input box in any other suitable way (e.g., by means of firmware).
The disclosed embodiments also provide a non-transitory computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method steps of any of the embodiments described above.
According to another aspect of the present disclosure, there is also provided a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the method steps of any of the embodiments described above.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
Although embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it is to be understood that the foregoing methods, systems, and apparatus are merely exemplary embodiments or examples, and that the scope of the present invention is not limited by these embodiments or examples but only by the claims following the grant and their equivalents. Various elements of the embodiments or examples may be omitted or replaced with equivalent elements thereof. Furthermore, the steps may be performed in a different order than described in the present disclosure. Further, various elements of the embodiments or examples may be combined in various ways. It is important that as technology evolves, many of the elements described herein may be replaced by equivalent elements that appear after the disclosure.

Claims (15)

1. A method of highlighting target text in an input box, comprising:
setting the rich text container to be editable based on the editable properties of the rich text container of the input box;
binding an input start event for the rich text container, stopping displaying default behavior of the plain text in the input box, and binding an input end event for the rich text container;
acquiring a current character to be displayed in an input box;
determining a current analysis unit, wherein the current analysis unit comprises a current character;
extracting a text to be matched comprising the current character from the current analysis unit;
judging whether a preset target text word stock comprises a target text matched with a text to be matched;
responding to the fact that a preset target text word stock comprises target text matched with the text to be matched, and displaying a rich text style of the target text in an input box so as to highlight the target text in the input box; and
and displaying the plain text style of the current character in the input box in response to the fact that the preset target text word stock does not comprise target text matched with the text to be matched.
2. The method of claim 1, wherein,
the current analysis unit is a current lexical analysis unit;
determining a current analysis unit, comprising: and responding to the current character input to the input box for the first time, creating a current lexical analysis unit, and storing the current character into the current lexical analysis unit.
3. The method of claim 1, wherein,
the current analysis unit is a current lexical analysis unit;
determining a current analysis unit, comprising: and in response to the current character being input to the input box for the non-first time and the current character being input continuously with the previous character already displayed in the input box, storing the current character into a current lexical analysis unit containing the previous character.
4. The method of claim 1, wherein,
the current analysis unit is a current lexical analysis unit;
determining a current analysis unit, comprising: and in response to the current character being input to the input box for the non-first time, and the current character and the last character already displayed in the input box being input discontinuously, creating a current lexical analysis unit, and storing the current character in the current lexical analysis unit.
5. The method of claim 4, wherein,
determining the current analysis unit further comprises: in response to a non-character input operation existing after an input operation of a previous character and before an input operation of a current character, determining that the current character and the previous character are non-continuous inputs.
6. The method of claim 1, wherein determining whether the target text matching the text to be matched is included in the preset target text word stock comprises:
and judging whether a preset target text word stock comprises a target text matched with the text to be matched or not through a character string matching algorithm.
7. The method of claim 1, wherein,
acquiring a current character to be displayed in an input box, including: in response to an input end event being triggered, intercepting a current character to be displayed in the input box that is input by the input device directly to the input box, or intercepting a current character to be displayed in the input box that is input by the input device through an input normal input box.
8. The method of claim 1, wherein,
setting the rich text container to be editable includes: in response to the input box being triggered to display, the rich text container is set editable.
9. The method according to any one of claims 1-8, wherein,
the rich text style includes at least one of highlighting, bolding, tilting, underlining, borders, effects, and shading.
10. The method according to any one of claims 1-8, wherein,
the input boxes include a single line text input box or multiple lines of text input boxes.
11. The method according to any one of claims 1-8, wherein,
the input box includes an input box of a browser in an offline run state or a networking run state, and the rich text container includes a document object model.
12. The method according to any one of claims 1-8, wherein,
the preset target text word stock is stored in a server or terminal equipment.
13. An apparatus for highlighting target text in an input box, comprising:
a trigger unit configured to set the rich text container to be editable based on an editable property of the rich text container of the input box, and to bind an input start event for the rich text container, stop displaying a default behavior of plain text at the input box, and bind an input end event for the rich text container;
an acquisition unit configured to acquire a current character to be displayed in an input box;
a determining unit configured to determine a current analyzing unit including a current character;
an extraction unit configured to extract a text to be matched including a current character from the current analysis unit; and
the display output unit is configured to judge whether a target text matched with the text to be matched is included in a preset target text word stock, display a rich text style of the target text in the input box in response to the target text matched with the text to be matched is included in the preset target text word stock so as to highlight the target text in the input box, and display a plain text style of the current character in the input box in response to the target text matched with the text to be matched is not included in the preset target text word stock.
14. An electronic device, comprising:
a memory; and
a processor coupled to the memory, the processor configured to perform the method of any one of claims 1 to 12 based on instructions stored in the memory.
15. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the method according to any of claims 1 to 12.
CN202110437160.2A 2021-04-22 2021-04-22 Method and device for highlighting target text in input box Active CN113050808B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110437160.2A CN113050808B (en) 2021-04-22 2021-04-22 Method and device for highlighting target text in input box

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110437160.2A CN113050808B (en) 2021-04-22 2021-04-22 Method and device for highlighting target text in input box

Publications (2)

Publication Number Publication Date
CN113050808A CN113050808A (en) 2021-06-29
CN113050808B true CN113050808B (en) 2023-11-28

Family

ID=76519931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110437160.2A Active CN113050808B (en) 2021-04-22 2021-04-22 Method and device for highlighting target text in input box

Country Status (1)

Country Link
CN (1) CN113050808B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114063855A (en) * 2021-11-12 2022-02-18 北京字跳网络技术有限公司 Content input method, device, equipment and medium of instant communication software
CN114741632A (en) * 2022-03-31 2022-07-12 网易有道信息技术(北京)有限公司 Method for displaying keywords in webpage and related product thereof
CN114925656B (en) * 2022-06-14 2023-01-24 北京新唐思创教育科技有限公司 Rich text display method, device, equipment and storage medium
CN115328381B (en) * 2022-08-05 2023-09-05 深圳乐播科技有限公司 Page pushing method, device and server

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102915328A (en) * 2012-09-04 2013-02-06 新浪网技术(中国)有限公司 Method for editing rich text and rich text editor
CN111274760A (en) * 2020-01-09 2020-06-12 北京字节跳动网络技术有限公司 Rich text data processing method and device, electronic equipment and computer storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7890852B2 (en) * 2003-06-26 2011-02-15 International Business Machines Corporation Rich text handling for a web application

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102915328A (en) * 2012-09-04 2013-02-06 新浪网技术(中国)有限公司 Method for editing rich text and rich text editor
CN111274760A (en) * 2020-01-09 2020-06-12 北京字节跳动网络技术有限公司 Rich text data processing method and device, electronic equipment and computer storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
A Simple Architecture for Digital Games on Demand Using Low Performance Resources under a Cloud Computing Paradigm;Diego Cordeiro Barboza等;《 IEEE Xplore》;全文 *
基于中文文本的编辑距离算法的改进;王芳;王继荣;杨晓东;李军;;青岛大学学报(自然科学版)(03);全文 *

Also Published As

Publication number Publication date
CN113050808A (en) 2021-06-29

Similar Documents

Publication Publication Date Title
CN113050808B (en) Method and device for highlighting target text in input box
US9043300B2 (en) Input method editor integration
US10325018B2 (en) Techniques for scheduling language models and character recognition models for handwriting inputs
JP2015532753A (en) Character input method, system and apparatus
EP3113174A1 (en) Method for building a speech feature library, method, apparatus, and device for speech synthesis
CN114595686B (en) Knowledge extraction method, and training method and device of knowledge extraction model
US9811505B2 (en) Techniques to provide processing enhancements for a text editor in a computing environment
US9626354B2 (en) Systems and methods for using tone indicator in text recognition
CN112685671A (en) Page display method, device, equipment and storage medium
US9658988B2 (en) Systems and methods to segment text for layout and rendering
US20140236568A1 (en) Input method to support multiple languages
US9892193B2 (en) Using content found in online discussion sources to detect problems and corresponding solutions
WO2014154088A1 (en) Adjusting information prompting in input method
CN114490986B (en) Computer-implemented data mining method, device, electronic equipment and storage medium
US10049087B2 (en) User-defined context-aware text selection for touchscreen devices
CN114239505A (en) Method, device and equipment for cleaning hidden characters in word document
KR102575504B1 (en) Entity recognition for enhanced document productivity
CN114239562A (en) Method, device and equipment for identifying program code blocks in document
KR20220024251A (en) Method and apparatus for building event library, electronic device, and computer-readable medium
KR102158544B1 (en) Method and system for supporting spell checking within input interface of mobile device
CN114443802A (en) Interface document processing method and device, electronic equipment and storage medium
CN113723120B (en) Display method and device of reference information and electronic equipment
CN116244740B (en) Log desensitization method and device, electronic equipment and storage medium
CN115270757A (en) Text recognition method and device, electronic equipment and storage medium
JP2017097451A (en) Information processing method, information processing program, and information processing device

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
GR01 Patent grant
GR01 Patent grant