Webpage text processing method and device and computer program product
By traversing and searching and highlighting keywords in the browser, combining multiple algorithms, the problems of complex text processing and personalized display requirements in the existing technology are solved, and a more efficient and flexible text processing and management experience is achieved.
Patent Information
- Application Number
- CN202411059032.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-11-22
AI Technical Summary
The prior art cannot meet the growth of users' demand for complex text processing and personalized displays, and lacks flexibility and deep interactivity.
Provide a web page text processing method, by obtaining the keywords to be marked, traversing and searching in the browser and highlighting, combining various algorithms such as MFCC, NLP, Brute Force, Rabin-Karp, Regular Expressions, OCR, Boyer -Moore and KMP algorithms to realize keyword recognition and highlighting, and provide statistics and customization functions.
It improves the efficiency and flexibility of users to find interesting content on web pages, meets the needs of complex text processing and personalized display, and provides statistical and visual analysis functions of keywords.
Smart Images

Figure CN119003916A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network information processing, and in particular to a method, device and computer program product for processing text of a web page. Background Art
[0002] In the current Internet browsing experience, users often need to understand and review the text content on web pages. Existing technologies include basic text selection and annotation functions, but these functions are usually limited to simple text operations, lack flexibility and deep interactivity, and cannot meet the growing needs of users for complex text processing and personalized display. Summary of the invention
[0003] The main purpose of the present application is to provide a method, device and computer program product for text processing of a web page, so as to at least solve the problem that the prior art cannot meet the growing needs of users for complex text processing and personalized display.
[0004] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a text processing method for a web page is provided, comprising: obtaining keywords to be highlighted; traversing the web pages of the browser to search for the keywords; and when the keywords are found, highlighting and displaying the keywords in the web pages of the browser.
[0005] Optionally, after traversing the web pages of the browser to search for the keyword, the method further includes: when the keyword is found, counting the number of times the keyword is found in the web pages of the browser; and displaying the number of times the keyword is found in a first display box, wherein the first display box is a display box in the web pages of the browser.
[0006] Optionally, after traversing the web page of the browser and searching for the keyword, the method further includes: when the keyword is found, obtaining the position of the keyword in the web page of the browser; and displaying the position of the keyword in a second display box, wherein the second display box is a display box in the web page of the browser.
[0007] Optionally, obtaining keywords to be highlighted includes: obtaining sound information, wherein the sound information is collected by a sound collector; constructing a first model, wherein the first model is trained by a first algorithm using multiple sets of training data, and each set of training data in the multiple sets of training data includes historical sound information obtained within a historical time period, and historical keywords corresponding to the historical sound information, wherein the first algorithm is one or more of an MFCC algorithm, a KeywordDetection algorithm, and an NLP algorithm; and inputting the sound information into the first model to obtain the keyword corresponding to the sound information.
[0008] Optionally, obtaining the keyword to be highlighted includes: obtaining the focus position of the target object's line of sight based on eye tracking technology; obtaining the gaze time of the target object at the focus position; and determining that the text at the focus position is the keyword when the gaze time is greater than a preset duration.
[0009] Optionally, in the case where the web page includes text, traversing the web pages in the browser to search for the keyword includes: constructing a second model, wherein the second model is trained by a second algorithm using multiple sets of training data, each set of training data in the multiple sets of training data includes historical keywords obtained within a historical time period, and historical first query results corresponding to the historical keywords, wherein the second algorithm is one or more of a Brute Force algorithm, a Rabin-Karp algorithm, and a Regular Expressions algorithm; inputting the keyword into the second model to obtain a first query result corresponding to the keyword.
[0010] Optionally, when the web page includes a picture, traverse the web page in the browser to find the keyword, including: constructing a third model, wherein the third model is trained by a third algorithm using multiple sets of training data, each set of training data in the multiple sets of training data includes historical keywords obtained within a historical time period, and historical second query results corresponding to the historical keywords, wherein the third algorithm is one or more of an OCR algorithm, a Boyer-Moore algorithm, and a KMP algorithm; inputting the keyword into the third model to obtain the second query result corresponding to the keyword.
[0011] Optionally, when the keyword is found, the keyword in the web page of the browser is highlighted and displayed, including: when the first keyword is found, the first keyword in the web page is highlighted and displayed in a first color, wherein the first keyword is the keyword obtained by the Nth traversal, and N≥1; when the second keyword is found, the second keyword in the web page is highlighted and displayed in a second color, wherein the second keyword is the keyword obtained by the N+1th traversal, the first color and the second color are different, and the first keyword in the first color and the second keyword in the second color can be displayed at the same time.
[0012] According to another aspect of the present application, a text processing device for a web page is provided, comprising: a first acquisition unit, used to acquire keywords to be highlighted; a search unit, used to traverse the web pages of the browser to search for the keywords; and a first display unit, used to highlight and display the keywords in the web pages of the browser when the keywords are found.
[0013] According to another aspect of the present application, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the steps of any one of the methods for processing text of a web page are implemented.
[0014] By applying the technical solution of the present application, if a user wants to find content of interest, he or she can enter keywords in advance. In this way, after quickly finding the keywords of interest to the user on the web page, the keywords will be highlighted and displayed. This is more user-friendly, more flexible and interactive, and can meet the user's various needs for online text processing and management. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0016] Figure 1 A hardware structure block diagram of a mobile terminal for executing a text processing method for a web page provided in an embodiment of the present application is shown;
[0017] Figure 2 A schematic diagram of a flow chart of a method for processing text on a web page provided according to an embodiment of the present application is shown;
[0018] Figure 3 A structural block diagram of a text processing device for a web page provided according to an embodiment of the present application is shown.
[0019] The above drawings include the following reference numerals:
[0020] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0021] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0022] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] As introduced in the background technology, the existing technology cannot meet the growing needs of users for complex text processing and personalized display. To solve the above problems, the embodiments of the present application provide a web page text processing method, device and computer program product.
[0025] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0026] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a method for processing text on a web page according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0027] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the display method of device information in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The above-mentioned specific examples of the network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0028] In this embodiment, a text processing method for a web page running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0029] Figure 2 FIG. 1 is a flow chart of a method for processing text on a web page according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0030] Step S201, obtaining keywords to be highlighted;
[0031] Specifically, keywords can be obtained through a plug-in activation mechanism. Users activate the plug-in through a predefined keyboard shortcut. After activation, an interactive dialog box pops up on the browser page.
[0032] For the interactive dialog box, there are three areas:
[0033] Text input area: users enter the text keywords to be highlighted here;
[0034] Confirm button and close button area: After the user enters a keyword, click the confirm button to start searching the page and highlight the matching text; the close button is used to close the dialog box;
[0035] Recommended keyword area: Based on the analysis of the user's browsing history and current web page content, automatically recommend keywords that need to be highlighted.
[0036] Specifically, the key steps are as follows: Collect user browsing history, extract keywords from user browsing history, extract words from titles or URLs and record their frequency of occurrence. Analyze the current web page content, traverse the text content on the web page, extract all words on the page, and count the frequency of occurrence of each word. Calculate the relevance of keywords, use the TF-IDF (term frequency-inverse document frequency) algorithm, calculate the relevance score of each word, and select keywords that need to be highlighted. Recommend keywords and recommend highly relevant words to users in the form of a list.
[0037] Specifically, for the user interface (UI) and user experience (UX) layers, the interactive dialog box is located above the browser interface and displayed as a floating window. The text input area, confirmation button, close button, and recommended keyword area are reasonably laid out inside the dialog box, allowing users to easily input and operate.
[0038] Step S202, traversing the web pages of the browser to search for the above keywords;
[0039] Specifically, for text recognition, after the user confirms the keyword, the matching text in the web page can be automatically identified by parsing the DOM structure. That is, after the user confirms the input keyword, the web page DOM tree is parsed to locate and highlight the matching text.
[0040] Step S203: When the keyword is found, the keyword in the web page of the browser is highlighted and displayed.
[0041] Specifically, when highlighting (i.e., highlighting) text, the color can be automatically adjusted according to the background color of the web page to ensure the readability of the highlighted text. The highlight color is randomly generated, and users can customize the color on the settings page. That is, the algorithm is used to calculate the best highlight color to ensure text readability, while allowing users to customize color settings.
[0042] Through this embodiment, if the user wants to find content of interest, the user can enter keywords in advance. In this way, after quickly finding the keywords of interest to the user on the web page, the keywords will be highlighted and displayed. This is more user-friendly, more flexible and interactive, and can meet the user's various needs for online text processing and management.
[0043] Specifically, this solution is a browser-based text highlighting solution, whose main functions include inputting and managing highlight keywords through an interactive dialog box, automatically highlighting matching text, and providing users with statistics and custom settings functions.
[0044] Specifically, the text recognition and highlighting are introduced in detail below. The steps are as follows:
[0045] 1. Get the keywords entered by the user;
[0046] First, obtain the keywords that need to be highlighted from the text input area entered by the user.
[0047] 2. Parse the DOM structure;
[0048] Get the entire text content of the current web page. This is done by traversing the DOM tree.
[0049] 3. Find and highlight keywords;
[0050] During the DOM traversal process, find and highlight keywords. In order not to destroy the existing DOM structure, highlighting is achieved by creating a wrapping element.
[0051] The specific code is as follows:
[0052]
[0053]
[0054]
[0055] The above code is developed by the inventor to find and highlight specific text in a given DOM node tree. The algorithm can treat text nodes and HTML element nodes differently (including special elements such as INPUT, TEXTAREA, SELECT, IFRAME, etc.), and dynamically wrap the matching text in <mark>label to highlight it.
[0056] The above code is explained below. The main idea of the code is:
[0057] ①、Processing text nodes:
[0058] Check node type: determine whether the current node is a text node (nodeType === 3).
[0059] Match Text: Use RegExp to match the node's data according to the specified text (case-sensitive matching).
[0060] Replace text: If a match is found, create a Element and replace the matched text with <mark>The HTML for the tag.
[0061] Replace a node: Use a new The contained HTML replaces the original text node.
[0062] Store highlighted nodes: contain highlighted text The nodes are stored in the array highlightedNodes.
[0063] ②、Processing element nodes:
[0064] Check node type: determine whether the current node is an element node (nodeType === 1) and is not SCRIPT, STYLE, MARK, or TEXTAREA.
[0065] Special handling of different types of elements:
[0066] For INPUT and TEXTAREA: Check if the value attribute contains the text to be matched. <mark>Replace and replace the original INPUT or TEXTAREA element with the div containing the highlighted text. Store the div node containing the highlighted text.
[0067] For SELECT: traverse the options of the SELECT element. If the text of the option contains the text to be matched, set the style.backgroundColor of the option to highlight it. Store the highlighted option element.
[0068] For TD and TH: Recursively call highlightText to process all child nodes.
[0069] For IFRAME: recursively call highlightText to process the contentDocument.body.childNodes of the IFRAME.
[0070] For LI: Recursively call highlightText, processing all child nodes.
[0071] For other elements: iterate over the child nodes and recursively call highlightText to process all child nodes.
[0072] The main functions of the algorithm developed above are: recursively search and highlight matching text in the entire DOM tree. It can handle multiple types of nodes, including text nodes and specific elements (such as form elements, table cells, embedded boxes, etc.). The highlighted results are dynamically inserted into the DOM, and these highlighted nodes can be tracked and stored.
[0073] The main advantages of the algorithm developed above are as follows:
[0074] ⑴ Compatibility and comprehensiveness: This algorithm can not only highlight the content in text nodes, but also process the text in the input box, the options in the selection box, and the content in the embedded box (iframe). It takes into account many different types of DOM elements.
[0075] ⑵ Recursive processing: By calling itself recursively, the algorithm can go deep into nested sub-elements to ensure that each node is checked and processed. This recursive traversal method ensures the comprehensiveness of the highlighting operation.
[0076] ⑶ Dynamic replacement and state saving: Dynamically create and replace nodes to achieve real-time update of highlighted text. Save highlighted nodes in an array to facilitate subsequent operations (such as clearing highlights). This mechanism improves the flexibility of the algorithm and user experience.
[0077] (4) Fine-grained control: The processing methods of different types of elements are refined through conditional branches, such as different processing of INPUT, TEXTAREA, SELECT and other elements, and special processing of table cells and list items. This ensures that the highlighting operation has accuracy and precise control.
[0078] 4. Automatically adjust highlight color according to background color;
[0079] Ensure color readability while highlighting. You can choose an appropriate highlight color by calculating the contrast ratio of the background color.
[0080] The specific code is as follows:
[0081]
[0082] The above code is explained below. The main idea of the code is:
[0083] Ⅰ. Initialize the character set:
[0084] Define a string `letters = '89ABCDEF'`, which contains the hexadecimal characters of the light color system. The character range of the hexadecimal color value is usually `0-9` and `AF`, but we only select the characters in the light color range (`8,9,A,B,C,D,E,F`).
[0085] Ⅱ. Initialize the color string:
[0086] Create a string `color='#'` with an initial value of `#`, which will be used as a prefix for the final color value.
[0087] III. Constructing color values:
[0088] Use a for loop to execute 6 times, because a hexadecimal color value consists of 6 characters (for example, #RRGGBB).
[0089] In each loop: Generate a random floating point number between 0 and 1 using Math.random(). Multiply by 8 (because the character set is 8 long) and round the result down to an integer using Math.floor(Math.random()*8) . Use this integer as an index to pick a character from the letters string and append it to the color string.
[0090] IV. Return color value:
[0091] After the loop ends, the generated color value string `color` is returned.
[0092] The main advantages of the algorithm developed above are as follows:
[0093] The algorithm is very concise and has a clear goal, which is to generate light colors. It is very convenient to call, just call `getRandomLightColor()` to get a random light color value.
[0094] Controlling the color range. By using a specific character set (containing only characters in the light color range), the algorithm effectively limits the generated colors to the light color range. This makes it very practical when designing light-colored UI elements.
[0095] Efficiency. The algorithm has a time complexity of O(1). Since there are only six fixed loops, no matter how many times it is run, the speed is very fast and will not cause performance bottlenecks.
[0096] Randomness and diversity. Each call can generate a different light color, ensuring the diversity of the output color. At the same time, because the characters are randomly selected, the color will not be repeated and monotonous during use.
[0097] During the specific implementation process, after traversing the web pages of the browser and searching for the above-mentioned keywords, the above-mentioned method also includes the following steps: when the above-mentioned keywords are found, counting the number of times the above-mentioned keywords are found in the above-mentioned web pages of the above-mentioned browser; and displaying the above-mentioned number of times the above-mentioned keywords are found in a first display box, wherein the above-mentioned first display box is a display box in the above-mentioned web page of the above-mentioned browser.
[0098] In this solution, the number of times a specific keyword appears in a web page of a browser is counted, and the statistical result is displayed in the first display frame, which can help users quickly find important information in the page, save time and improve efficiency.
[0099] In a specific application, on a news website, users want to quickly find relevant reports about a certain event. By using this function, users can enter keywords, and the browser will automatically count the number of times the keyword appears on the page and display it in a convenient display box. Users can judge which reports are most relevant to the event they are looking for based on the number of times displayed, so as to quickly find the information they need. This can save users time and improve the efficiency of finding information.
[0100] In order to further help users quickly find content of interest, after traversing the web pages of the browser and searching for the above-mentioned keywords, the above-mentioned method also includes the following steps: when the above-mentioned keywords are found, obtaining the position of the above-mentioned keywords in the above-mentioned web pages of the above-mentioned browser; displaying the above-mentioned position of the above-mentioned keywords in a second display box, wherein the above-mentioned second display box is a display box in the above-mentioned web page of the above-mentioned browser.
[0101] In this solution, the position of a keyword in a web page is obtained in the browser and displayed in the form of a second display frame, which can help users quickly find content they are interested in and improve the efficiency of browsing web pages.
[0102] In a specific application, a user searches for a keyword in a webpage containing a lot of text, but the keyword appears in a long position on the page, and the user may need to spend some time to find it. The webpage provides a display box to mark the location of the keyword, so that the user can directly locate the location of the keyword, saving search time and improving user experience.
[0103] As mentioned above, you can count and display the keywords in charts. You can count the number of times each input text appears on the web page. The statistical results are displayed in a dedicated area of the dialog box. The statistical results are directly displayed in the dialog box, and an export function is provided. Generate a chart to show the distribution of highlighted keywords on different web pages. Users can export the statistical results to various data formats such as CSV or PDF. Generate a chart of the distribution of highlighted keywords based on the statistical results to intuitively display the occurrence of keywords.
[0104] Specifically, by setting up the basic framework of the browser extension, the keyword statistics function is implemented, and the keyword distribution map is generated on different web pages. More specifically, initialize the project, create a basic file structure, including `manifest.json`, `popup.html`, `popup.js`, `content.js` and `background.js`, and define the basic information and permissions of the extension in `manifest.json`, such as the use of `tabs`, `storage`, `activeTab` and other permissions. Write `manifest.json. Extract the web page content and count the number of keyword occurrences. Extract all the text content in the web page in `content.js`, count the number of occurrences of each keyword, and display the statistical results in a dedicated area. Store keyword statistics, draw charts, and use Chart.js or other chart libraries to draw keyword distribution maps.
[0105] In the above solution, multi-page keyword distribution analysis can be realized. Most existing tools can only analyze the keyword distribution on a single page, while this solution can display the distribution trend and changes of keywords across multiple pages, providing a more comprehensive perspective. It realizes the combination of real-time and historical data, not only showing the keyword statistics of the current page, but also combining browsing history data, which is more authoritative and useful. It can realize visual analysis, presenting the keyword distribution through charts, which is not only user-friendly, but also can intuitively show the distribution differences of keywords on different web pages to assist decision-making. It can realize an interactive interface, where users can freely enter keywords and immediately obtain analysis results. This interactivity greatly improves the user experience. It can achieve scalability, and by storing and retrieving data, it makes it easier to expand subsequent functions, such as adding keyword trend prediction functions and adding more data analysis dimensions.
[0106] In the specific implementation process, obtaining the keywords to be highlighted can be achieved through the following steps: obtaining sound information, wherein the sound information is collected by a sound collector; constructing a first model, wherein the first model is trained by a first algorithm using multiple sets of training data, and each set of training data in the multiple sets of training data includes historical sound information obtained within a historical time period and historical keywords corresponding to the historical sound information, wherein the first algorithm is one or more of the MFCC algorithm, the Keyword Detection algorithm, and the NLP algorithm; inputting the sound information into the first model to obtain the keywords corresponding to the sound information.
[0107] In this solution, the MFCC (Mel-frequency cepstral coefficients) algorithm, the Keyword Detection algorithm and the NLP (Natural Language Processing) algorithm are used to identify keywords in sound information. The MFCC algorithm is a commonly used sound feature extraction algorithm that can convert sound signals into a series of feature vectors for sound recognition tasks. The Keyword Detection algorithm is an algorithm used to detect the presence of specific keywords or phrases in sound signals, and is usually used for speech recognition or voice search. The NLP algorithm is an algorithm used to process and analyze natural language text, which can help identify the semantic content in sound information. Combining these three algorithms can help identify keywords in sound information, thereby achieving more accurate sound recognition and voice search, so that users do not need to manually enter keywords themselves, and can directly use voice input and identify keywords through the first model, which can improve user experience and interaction efficiency.
[0108] In a specific application, there is a voice assistant device, and the user can control the device to perform corresponding operations by speaking designated keywords, such as "power system", "power equipment", etc. By using the MFCC algorithm to extract sound features, the Keyword Detection algorithm to detect whether the keyword appears in the sound signal, and the NLP algorithm to analyze the semantic content of the keyword, the voice assistant can accurately identify the user's instructions and perform corresponding operations. In this way, a more intelligent and convenient voice interaction experience can be achieved.
[0109] MFCC algorithm, Keyword Detection algorithm and NLP algorithm can be combined and applied in the field of speech recognition. First, MFCC algorithm can be used to extract the features of speech signals and convert speech signals into feature vector representation. Then, Keyword Detection algorithm can be used to identify the presence of specific keywords or phrases in speech signals, thereby realizing keyword detection function. Finally, NLP algorithm can be used to process and understand speech recognition results, such as converting recognized text into natural language representation, performing semantic analysis and language model building.
[0110] When used in combination, the MFCC algorithm can be used to extract features from speech signals, then the KeywordDetection algorithm can be used to identify keywords or phrases, and finally the NLP algorithm can be used to process and analyze the recognition results. This combination can achieve more accurate and efficient speech recognition and understanding, and help improve the performance of the speech recognition system and user experience.
[0111] In the specific implementation process, the keywords to be highlighted can be obtained through the following steps: based on the eye tracking technology, the focus position of the target object's line of sight is obtained; the gaze time of the above-mentioned target object at the above-mentioned focus position is obtained; when the above-mentioned gaze time is greater than the preset duration, it is determined that the text at the above-mentioned focus position is the above-mentioned keyword.
[0112] In this solution, eye tracking technology is used to obtain the target object's gaze position and gaze duration. When the target object stays at a certain position for more than a preset time, the text at that position is identified as a keyword. In this way, users do not need to input text manually. For users with physical disabilities, attention can be collected directly through eye tracking, and the content that users are interested in and the keywords they want can be obtained, thereby improving the user experience.
[0113] Specifically, a specialized eye tracking device, such as an eye tracker or an infrared eye tracker, is used to capture the eye movement trajectory of the subject. Before eye tracking is performed, the device needs to be calibrated to ensure that the eye movement trajectory is accurately captured. Calibration usually involves asking the subject to look at a series of points or graphics on the device. Once the device is calibrated, data collection can begin. By recording the eye movement trajectory, the focus position of the subject's gaze can be obtained. Finally, by analyzing the collected data, the focus position of the target object's gaze can be determined. This usually involves comparing and analyzing the eye movement data with other information about the experimental conditions or the observed object.
[0114] In a specific implementation, the preset duration may be 5 seconds, 10 seconds, or 1 minute, etc., and may also be any other feasible preset duration.
[0115] In some embodiments, when the web page includes text, traversing the web page in the browser to find the keyword can be specifically achieved through the following steps: constructing a second model, wherein the second model is trained by a second algorithm using multiple sets of training data, and each set of training data in the multiple sets of training data includes historical keywords obtained within a historical time period and historical first query results corresponding to the historical keywords, wherein the second algorithm is one or more of a Brute Force algorithm, a Rabin-Karp algorithm, and a Regular Expressions algorithm; inputting the keyword into the second model to obtain the first query result corresponding to the keyword.
[0116] In this solution, the Brute Force algorithm, Rabin-Karp algorithm and Regular Expressions algorithm are used to build the second model. The second model is used to search the web pages of the browser to find the keywords that the user wants to find and return the first query results. The Brute Force algorithm is a simple and direct search algorithm that compares the search terms with the content of the web page one by one, and is suitable for small-scale search tasks. The Rabin-Karp algorithm is a string matching algorithm that uses hash functions to quickly compare search terms and substrings of web page content, and is suitable for large-scale search tasks. The Regular Expressions algorithm is a pattern matching algorithm that matches text by defining rules and can identify specific patterns or formats. By combining these three algorithms, search efficiency can be improved, search time can be reduced, and the keywords that users want can be found more accurately.
[0117] The Brute Force algorithm is a simple and direct string matching algorithm that compares each character in the text with each character in the pattern one by one. When the match fails, it moves to the next position for comparison. The time complexity of this algorithm is O(n*m), where n is the length of the text and m is the length of the pattern.
[0118] The Rabin-Karp algorithm is a string matching algorithm based on hash values. It calculates the hash value of each substring of length m in the text, and then compares it with the hash value of the pattern. When the hash values are the same, the characters are compared one by one to avoid the time consumption of comparing characters one by one. The time complexity of this algorithm is O(n+m), where n is the length of the text and m is the length of the pattern.
[0119] The Regular Expressions algorithm is a general algorithm for matching string patterns. It can express complex matching rules and can flexibly perform pattern matching. This algorithm can be combined with the Brute Force and Rabin-Karp algorithms to improve matching efficiency. For example, the Rabin-Karp algorithm is used in Regular Expressions to calculate the hash value, and then compare each character one by one.
[0120] In some embodiments, when the web page includes pictures, traversing the web page in the browser to find the above-mentioned keywords can be specifically achieved through the following steps: constructing a third model, wherein the third model is trained by a third algorithm using multiple sets of training data, and each set of training data in the multiple sets of training data includes historical keywords obtained within a historical time period, and historical second query results corresponding to the historical keywords, wherein the third algorithm is one or more of the OCR algorithm, Boyer-Moore algorithm, and KMP algorithm; inputting the above-mentioned keywords into the third model to obtain the second query results corresponding to the above-mentioned keywords.
[0121] In this solution, the web page contains pictures, but the information that the user wants to find may be in the pictures. The OCR algorithm (optical character recognition) can be used to recognize the text in the picture, and then a string matching algorithm such as the Boyer-Moore algorithm or the KMP algorithm is used to build a third model, traverse the web page, find the keywords that the user wants, and finally get the third query result. This can help users find the information they need more conveniently in web pages containing pictures, and improve the accuracy and efficiency of the search.
[0122] Specifically, if a user wants to search for the keyword "Apple" on a webpage containing an image, the user can use the OCR algorithm to recognize the text in the image and use the string matching algorithm to search on the webpage to find all the content containing the keyword "Apple". In this way, the user can find the information he needs more easily.
[0123] The OCR algorithm, Boyer-Moore algorithm and KMP algorithm are all string matching algorithms that can be combined for applications such as text recognition and search. First, the OCR algorithm is used to identify the text content in the image and convert the text content into a string form. Then, the Boyer-Moore algorithm and KMP algorithm are used to perform string matching and search. The Boyer-Moore algorithm is an efficient string matching algorithm that uses the bad character rule and the good suffix rule to quickly locate and match strings. The KMP algorithm is a string search algorithm based on prefix matching. It constructs the next array by preprocessing the pattern string to speed up the matching process. When combining the OCR algorithm, the Boyer-Moore algorithm and the KMP algorithm, the OCR algorithm can be used to extract the text content first, and then the Boyer-Moore algorithm or the KMP algorithm can be used to search and match specific keywords or pattern strings. This can achieve rapid search and recognition of text content and improve the efficiency and accuracy of text processing.
[0124] In the specific implementation process, when the above-mentioned keyword is found, the above-mentioned keyword in the above-mentioned web page of the above-mentioned browser is highlighted and displayed, which can be achieved through the following steps: when the first keyword is found, the above-mentioned first keyword in the above-mentioned web page is highlighted and displayed with a first color, wherein the above-mentioned first keyword is the above-mentioned keyword obtained by the Nth traversal, and N≥1; when the second keyword is found, the above-mentioned second keyword in the above-mentioned web page is highlighted and displayed with a second color, wherein the above-mentioned second keyword is the above-mentioned keyword obtained by the N+1th traversal, the above-mentioned first color is different from the above-mentioned second color, and the above-mentioned first keyword in the above-mentioned first color and the above-mentioned second keyword in the above-mentioned second color can be displayed at the same time.
[0125] In this solution, if the user searches for multiple keywords, the keywords the user wants to search for can be displayed in different colors, so that the user can search for multiple keywords, thereby improving the user experience.
[0126] Specifically, in general displays, each keyword is searched once and highlighted once, but if the user wants to highlight two keywords at the same time, it is impossible to do so. Therefore, in this solution, if the keyword found in the first traversal is "electricity", it can be displayed in green, and the keyword found in the second traversal is "cost", it can be displayed in red. The green "electricity" and the red "cost" are displayed at the same time, so that the user can view these two keywords at the same time.
[0127] In addition, this solution can also achieve compatibility and optimization, using JavaScript to implement it, and is compatible with all mainstream browsers (such as Chrome, Firefox, Safari, Edge, etc.). After optimization, it does not affect the web page loading speed and other functions.
[0128] In addition, this solution can also implement user-defined settings. Users can customize shortcut keys to activate dialog boxes and set shortcut keys for other operations. Support personalized configuration, such as multi-language support, interface theme switching, logging and recovery, etc. Can maintain user shortcut keys, color selection and other personalized settings. Can support users to choose different languages and interface themes to improve user experience.
[0129] For multi-language support, the first step is language file preparation. A JSON file is prepared for each supported language, containing all the texts that need to be translated. The second step is to detect the user language and load the corresponding language file according to the language setting of the user's browser or the language selected by the user. After that, the language file is loaded. The corresponding JSON file is loaded according to the detected language. After that, the translation is applied, traversing the DOM elements and replacing the text with the corresponding translation. This solution can reduce the initial loading time and memory usage by dynamically loading the language file.
[0130] For interface theme switching, the first step is to prepare the theme style and prepare a CSS file for each theme. The second step is to load the theme style and dynamically load the corresponding CSS file according to the user's selection. After that, the user's selection is saved and the user's selected theme is saved to local storage so that it can be applied the next time it is loaded. This solution achieves efficient theme switching and persistence by dynamically loading CSS files and storing user selections locally. The saved theme is automatically applied when the user returns to improve the user experience.
[0131] For log recording, the first step is to record user operations and record corresponding log information when users perform operations. The second step is to save logs and save log information to local storage or send it to the server. The third step is to save logs and save log information to local storage or send it to the server.
[0132] For the recovery function, the first is to save the state, saving the current state when the user performs important operations. The second is to restore the state, restoring the saved state when the user needs it. This solution can quickly restore to a specific state by saving state snapshots, improving the reliability of the system.
[0133] In addition, this solution can also achieve data security and privacy protection. The communication and data storage within the plug-in use encryption technology to ensure the privacy and security of keywords and highlight data. No user data is collected, and all processing is performed in the local browser. Ensure the security of storage and transmission of data and protect user privacy.
[0134] In addition, this solution can also achieve synchronization with external applications, and can synchronize and exchange data with external applications (such as note-taking software and project management tools) through API. Synchronize and exchange data with external applications to achieve seamless connection with note-taking software and project management tools.
[0135] The overall process of this solution is briefly described as follows: the user activates the plug-in through the shortcut key, and a dialog box pops up. The user enters the keyword to be highlighted in the dialog box, checks the recommended keywords, and confirms the input. Identify matching text in the web page and highlight the color. Real-time statistics of the number of keyword occurrences are displayed in a dedicated area. Users can choose to export statistical results or view charts. Users can make various personalized configurations through the settings page, such as custom highlight colors, shortcut keys, etc. All processing and data storage are in the local browser to ensure user privacy and data security. The plug-in synchronizes with external applications through APIs to maintain data consistency. Through the above technical solutions, this solution realizes efficient, flexible and user-friendly text highlighting and management functions, while ensuring data security and privacy protection.
[0136] Specifically, the present solution can also provide a browser-based text highlighting plug-in, including an interactive dialog box activated by a keyboard shortcut, which displays text with high frequency errors in the power dispatching and distribution network industry by default. The dialog box includes a text input area, a confirmation button, a close button, and further includes a recommended keyword area, which automatically recommends keywords that may need to be highlighted based on the analysis results of user behavior and web page content. After the text is entered, the plug-in can automatically identify and highlight the matching text in the web page, and the highlight color can be automatically adjusted according to the background color of the web page to ensure readability. The highlight color is randomly generated, and can also be customized by the user through a dialog box or a plug-in setting page. The plug-in provides statistics on the number of occurrences of each input text in the page, and can generate a chart to show the distribution of highlighted keywords on different web pages. The statistical results are displayed in a dedicated area in the dialog box, and support exporting the statistical results to multiple data formats, such as CSV, PDF, etc. The plug-in is implemented as JavaScript code compatible with all mainstream browsers, and is optimized so as not to affect the loading speed and other functions of the web page. Users can customize shortcut keys to activate the dialog box, and can customize shortcut keys for other plug-in operations. When highlighting text, it does not affect other functions of the web page, and the addition of highlighted elements does not change the DOM structure of the web page. The plug-in can be personalized through simple configuration, including multi-language support, interface theme switching, logging and recovery functions. The plug-in uses encryption technology for internal communication and storage data to ensure the privacy and security of keywords and highlight data. The plug-in can also synchronize with external applications, such as note-taking software and project management tools, and exchange data through API.
[0137] The main functions of this solution are as follows:
[0138] Smart highlighting function: The plug-in automatically identifies and highlights matching key text on the web page through the text input area and intelligent matching algorithm, allowing you to quickly locate required content when reading and searching for information.
[0139] User-friendliness, with interactive dialog boxes and custom shortcut keys, provides personalized settings and operation methods, allowing users to easily use and manage highlight plug-ins.
[0140] The statistics and analysis functions support counting the number of times each input text appears on the page and provide visual statistical results to help users better understand the key information and distribution of web page content.
[0141] Cross-browser compatibility: the plug-in is implemented as JavaScript code that is compatible with all major browsers, so users can enjoy the same highlighting function and experience in different browsers.
[0142] Personalized configuration and security protection provide personalized setting functions, support multiple highlight color selection and configuration, and use encryption technology to protect the privacy and security of user-entered keywords and highlight data.
[0143] The function of synchronizing with external applications supports data synchronization with external applications, such as note-taking software, project management tools, etc., and exchanges data through API to improve work efficiency and information integration.
[0144] It does not affect the functions of the web page. When the plug-in highlights text, it does not affect other functions of the web page. It also ensures that the addition of the plug-in does not change the DOM structure of the web page, maintaining the normal operation of the web page and user experience.
[0145] Through the above advantages, this solution provides users with a convenient, intelligent and personalized text highlighting plug-in, which effectively improves the user's operating efficiency and experience when browsing web pages, searching for information and performing text analysis.
[0146] Specifically, the purpose of this solution is to provide a convenient, intelligent, and personalized text highlighting plug-in, which aims to improve the user experience and efficiency when browsing web pages, searching for information, and performing text analysis. Through this plug-in, users can quickly locate content of interest and highlight it, while supporting statistics and analysis of the occurrence of keywords on the page, providing personalized settings and operation methods, and safely protecting the privacy of user input data, while supporting data synchronization with external applications, thereby helping users to better manage and utilize text information and improve work efficiency and information integration. Overall, the present invention aims to provide a multifunctional, user-friendly text highlighting plug-in to meet users' various needs for online text processing and management.
[0147] The embodiment of the present application also provides a text processing device for a web page. It should be noted that the text processing device for a web page of the embodiment of the present application can be used to execute the text processing method for a web page provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0148] The following is an introduction to the text processing device for a web page provided in an embodiment of the present application.
[0149] Figure 3 is a structural block diagram of a text processing device for a web page according to an embodiment of the present application. Figure 3 As shown, the device comprises:
[0150] A first acquisition unit 10, used to acquire keywords to be highlighted;
[0151] A search unit 20 is used to traverse the web pages of the browser to search for the above keywords;
[0152] The first display unit 20 is used for highlighting and displaying the keyword in the web page of the browser when the keyword is found.
[0153] Through this embodiment, if the user wants to find content of interest, the user can enter keywords in advance. In this way, after quickly finding the keywords of interest to the user on the web page, the keywords will be highlighted and displayed. This is more user-friendly, more flexible and interactive, and can meet the user's various needs for online text processing and management.
[0154] During the specific implementation process, the above-mentioned device also includes a statistical unit and a second display unit. The statistical unit is used to traverse the web page of the browser, and after searching for the above-mentioned keyword, when the above-mentioned keyword is found, count the number of times the above-mentioned keyword is found in the above-mentioned web page of the above-mentioned browser; the second display unit is used to display the above-mentioned number of times the above-mentioned keyword is found in the above-mentioned web page of the above-mentioned browser in a first display box, wherein the above-mentioned first display box is a display box in the above-mentioned web page of the above-mentioned browser.
[0155] In this solution, the number of times a specific keyword appears in a web page of a browser is counted, and the statistical result is displayed in the first display frame, which can help users quickly find important information in the page, save time and improve efficiency.
[0156] In order to further help users quickly find content of interest, the above-mentioned device also includes a second acquisition unit and a third display unit. The second acquisition unit is used to traverse the web page of the browser, search for the above-mentioned keyword, and after finding the above-mentioned keyword, obtain the position of the above-mentioned keyword in the above-mentioned web page of the above-mentioned browser; the third display unit is used to display the above-mentioned position of the above-mentioned keyword in a second display box, wherein the above-mentioned second display box is a display box in the above-mentioned web page of the above-mentioned browser.
[0157] In this solution, the position of a keyword in a web page is obtained in the browser and displayed in the form of a second display frame, which can help users quickly find content they are interested in and improve the efficiency of browsing web pages.
[0158] In the specific implementation process, the first acquisition unit includes a first acquisition module, a first construction module and a first processing module. The first acquisition module is used to acquire sound information, wherein the sound information is collected by a sound collector; the first construction module is used to construct a first model, wherein the first model is trained by a first algorithm using multiple sets of training data, and each set of training data in the multiple sets of training data includes historical sound information acquired within a historical time period and historical keywords corresponding to the historical sound information, wherein the first algorithm is one or more of an MFCC algorithm, a KeywordDetection algorithm, and an NLP algorithm; the first processing module is used to input the sound information into the first model to obtain the keywords corresponding to the sound information.
[0159] In this solution, the MFCC (Mel-frequency cepstral coefficients) algorithm, the Keyword Detection algorithm and the NLP (Natural Language Processing) algorithm are used to identify keywords in sound information. The MFCC algorithm is a commonly used sound feature extraction algorithm that can convert sound signals into a series of feature vectors for sound recognition tasks. The Keyword Detection algorithm is an algorithm used to detect the presence of specific keywords or phrases in sound signals, and is usually used for speech recognition or voice search. The NLP algorithm is an algorithm used to process and analyze natural language text, which can help identify the semantic content in sound information. Combining these three algorithms can help identify keywords in sound information, thereby achieving more accurate sound recognition and voice search, so that users do not need to manually enter keywords themselves, and can directly use voice input and identify keywords through the first model, which can improve user experience and interaction efficiency.
[0160] During the specific implementation process, the first acquisition unit includes a second acquisition module, a third acquisition module and a determination module. The second acquisition module is used to obtain the focus position of the target object's line of sight based on eye tracking technology; the third acquisition module is used to obtain the gaze time of the above-mentioned target object at the above-mentioned focus position; and the determination module is used to determine that the text at the above-mentioned focus position is the above-mentioned keyword when the above-mentioned gaze time is greater than a preset duration.
[0161] In this solution, eye tracking technology is used to obtain the target object's gaze position and gaze duration. When the target object stays at a certain position for more than a preset time, the text at that position is identified as a keyword. In this way, users do not need to input text manually. For users with physical disabilities, attention can be collected directly through eye tracking, and the content that users are interested in and the keywords they want can be obtained, thereby improving the user experience.
[0162] In some embodiments, when the web page includes text, the search unit includes a second construction module and a second processing module, the second construction module is used to construct a second model, wherein the second model is trained by a second algorithm using multiple sets of training data, each set of training data in the multiple sets of training data includes historical keywords obtained within a historical time period, and historical first query results corresponding to the historical keywords, wherein the second algorithm is one or more of a Brute Force algorithm, a Rabin-Karp algorithm, and a Regular Expressions algorithm; the second processing module is used to input the keywords into the second model to obtain the first query results corresponding to the keywords.
[0163] In this solution, the Brute Force algorithm, Rabin-Karp algorithm and Regular Expressions algorithm are used to build the second model. The second model is used to search the web pages of the browser to find the keywords that the user wants to find and return the first query results. The Brute Force algorithm is a simple and direct search algorithm that compares the search terms with the content of the web page one by one, and is suitable for small-scale search tasks. The Rabin-Karp algorithm is a string matching algorithm that uses hash functions to quickly compare search terms and substrings of web page content, and is suitable for large-scale search tasks. The Regular Expressions algorithm is a pattern matching algorithm that matches text by defining rules and can identify specific patterns or formats. By combining these three algorithms, search efficiency can be improved, search time can be reduced, and the keywords that users want can be found more accurately.
[0164] In some embodiments, when the web page includes pictures, the search unit includes a third construction module and a third processing module, and the third construction module is used to construct a third model, wherein the third model is trained by a third algorithm using multiple sets of training data, and each set of training data in the multiple sets of training data includes historical keywords obtained within a historical time period and historical second query results corresponding to the historical keywords, wherein the third algorithm is one or more of the OCR algorithm, the Boyer-Moore algorithm, and the KMP algorithm; the third processing module is used to input the keywords into the third model to obtain the second query results corresponding to the keywords.
[0165] In this solution, the web page contains pictures, but the information that the user wants to find may be in the pictures. The OCR algorithm (optical character recognition) can be used to recognize the text in the picture, and then a string matching algorithm such as the Boyer-Moore algorithm or the KMP algorithm is used to build a third model, traverse the web page, find the keywords that the user wants, and finally get the third query result. This can help users find the information they need more conveniently in web pages containing pictures, and improve the accuracy and efficiency of the search.
[0166] During the specific implementation process, the first display unit includes a first display module and a second display module. The first display module is used to highlight and display the first keyword in the above web page with a first color when the first keyword is found, wherein the first keyword is the keyword obtained by the Nth traversal, and N≥1; the second display module is used to highlight and display the second keyword in the above web page with a second color when the second keyword is found, wherein the second keyword is the keyword obtained by the N+1th traversal, the first color is different from the second color, and the first keyword in the first color and the second keyword in the second color can be displayed at the same time.
[0167] In this solution, if the user searches for multiple keywords, the keywords the user wants to search for can be displayed in different colors, so that the user can search for multiple keywords, thereby improving the user experience.
[0168] The text processing device for the web page includes a processor and a memory. The first acquisition unit, the search unit and the first display unit are stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.
[0169] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the existing technology cannot meet the growing needs of users for complex text processing and personalized display by adjusting kernel parameters.
[0170] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0171] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the text processing method of the web page.
[0172] An embodiment of the present invention provides a processor, and the processor is used to run a program, wherein the program executes the text processing method of the web page when running.
[0173] The embodiment of the present invention provides a device, the device includes a processor, a memory and a program stored in the memory and executable on the processor, and the processor implements at least the steps of the text processing method of the web page when executing the program. The device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0174] A computer program product includes a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the text processing method of the web page in each embodiment of the present application are implemented.
[0175] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0176] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0177] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0178] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0180] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0181] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0182] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0183] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.
[0184] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0185] 1) The text processing method of the web page of the present application allows users to enter keywords in advance if they want to find content of interest. In this way, the keywords of interest to the user can be quickly found on the web page and highlighted. This method is more user-friendly, more flexible and interactive, and can meet users' various needs for online text processing and management.
[0186] 2) The text processing device of the web page of the present application can input keywords in advance if the user wants to find the content of interest. In this way, after quickly finding the keywords of interest to the user on the web page, the keywords will be highlighted and displayed. This is more user-friendly, more flexible and interactive, and can meet the user's various needs for online text processing and management.
[0187] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.< / mark> < / mark> < / mark>
Claims
1. A method for processing text on a web page, characterized in that: include: Get the keywords to be highlighted; Traverse the web pages of the browser to search for the keyword; When the keyword is found, the keyword in the web page of the browser is highlighted.
2. The method according to claim 1, characterized in that After traversing the web pages of the browser and searching for the keyword, the method further includes: In the case where the keyword is found, counting the number of times the keyword is found in the web page of the browser; The number of times the keyword is used is displayed in a first display frame, wherein the first display frame is a display frame in the web page of the browser.
3. The method according to claim 1, characterized in that After traversing the web pages of the browser and searching for the keyword, the method further includes: When the keyword is found, obtaining the position of the keyword in the webpage of the browser; The position of the keyword is displayed in a second display frame, wherein the second display frame is a display frame in the web page of the browser.
4. The method according to claim 1, characterized in that: Get the keywords to be highlighted, including: Acquiring sound information, wherein the sound information is collected by a sound collector; Constructing a first model, wherein the first model is obtained by training with a first algorithm using multiple sets of training data, each set of training data in the multiple sets of training data includes historical sound information obtained in a historical time period and historical keywords corresponding to the historical sound information, wherein the first algorithm is one or more of an MFCC algorithm, a Keyword Detection algorithm, and an NLP algorithm; The sound information is input into the first model to obtain the keyword corresponding to the sound information.
5. The method according to claim 1, characterized in that Get the keywords to be highlighted, including: According to the eye tracking technology, the focus position of the target object's sight is obtained; Acquire the gaze time of the target object at the focus position; When the gaze time is greater than a preset time, the text at the focus position is determined to be the keyword.
6. The method according to claim 1, characterized in that In the case where the web page includes text, traversing the web pages of the browser to search for the keyword includes: Constructing a second model, wherein the second model is obtained by training with a second algorithm using multiple sets of training data, each set of training data in the multiple sets of training data includes historical keywords obtained within a historical time period and historical first query results corresponding to the historical keywords, wherein the second algorithm is one or more of a Brute Force algorithm, a Rabin-Karp algorithm, and a Regular Expressions algorithm; The keyword is input into the second model to obtain a first query result corresponding to the keyword.
7. The method according to claim 1, characterized in that In the case where the web page includes a picture, traversing the web pages of the browser to search for the keyword includes: Constructing a third model, wherein the third model is obtained by training a third algorithm using multiple sets of training data, each set of training data in the multiple sets of training data includes historical keywords obtained in a historical time period and historical second query results corresponding to the historical keywords, wherein the third algorithm is one or more of an OCR algorithm, a Boyer-Moore algorithm, and a KMP algorithm; The keyword is input into the third model to obtain a second query result corresponding to the keyword.
8. The method according to claim 1, characterized in that In the case where the keyword is found, highlighting the keyword in the webpage of the browser includes: In the case where a first keyword is found, the first keyword in the webpage is highlighted and displayed in a first color, wherein the first keyword is the keyword obtained by the Nth traversal, where N≥1; When the second keyword is found, the second keyword in the web page is highlighted and displayed in a second color, wherein the second keyword is the keyword obtained by the N+1th traversal, the first color and the second color are different, and the first keyword in the first color and the second keyword in the second color can be displayed at the same time.
9. A text processing device for a web page, characterized in that: include: A first acquisition unit, used for acquiring keywords to be highlighted; A search unit, used to traverse the web pages of the browser to search for the keyword; The first display unit is used to highlight and display the keyword in the web page of the browser when the keyword is found.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the text processing method of a web page described in any one of claims 1 to 8 are implemented.
