A general implementation method and system of large model intelligent error correction front-end analysis
By using browser localStorage and standardized APIs, a universal parsing mechanism is achieved between large model error correction data and the front-end preview interface, solving the problem of poor interface adaptability, reducing development costs, and improving functional compatibility and user experience.
Patent Information
- Application Number
- CN202511524614.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-10-24
AI Technical Summary
In existing technologies, large model error correction data has poor compatibility with the front-end preview interface, resulting in high development costs, maintenance difficulties, and difficulty in achieving universal parsing and interaction in different preview interfaces.
By using the browser's localStorage event listener mechanism as a communication bridge, structured error correction data is written to localStorage, and a standardized API is defined to achieve cross-interface data transfer and parsing, shielding underlying differences and providing unified error correction mark rendering, file replacement and restoration operations.
Significantly reduces development and maintenance costs, improves functional compatibility and deployment efficiency, ensures consistent user experience, and supports rapid deployment of multiple projects and systems from multiple vendors.
Smart Images

Figure CN121009883B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary field of natural language processing and front-end development, and more specifically, to a general implementation method and system for intelligent error correction front-end parsing of large models. Background Technology
[0002] With the increasing application of large language models in text correction, users' demands for front-end visualization and interaction of correction results are growing. However, there is a significant "interface fragmentation" problem in the industry, where file preview interfaces developed by different projects (such as enterprise document management systems and online collaboration platforms) and different vendors (such as custom preview components based on Docx.js and PDF.js) differ in their DOM structure, text rendering logic, and interactive event binding methods.
[0003] These differences will make it difficult for the standard structured error correction data returned by the large model (which usually includes fields such as error location, error type, correction suggestions, and original text fragments) to be directly adapted to all preview interfaces. If separate parsing and adaptation code is developed for each interface, it will significantly increase development costs, reduce code reusability, and require multiple sets of adaptation logic to be updated simultaneously during subsequent maintenance, which will seriously affect the implementation efficiency and universality of the large model's intelligent error correction function. At the same time, in existing technologies, the interaction between the front end and the error correction data mostly relies on "customized interface development" and lacks a unified communication mechanism and a universal API. That is, some solutions achieve markup rendering by hard-coding the DOM nodes of specific preview interfaces, which cannot be compatible with new interfaces. Furthermore, some solutions ignore the universal adaptability of browser native capabilities such as localStorage and adopt complex cross-component communication schemes, which increases system complexity.
[0004] Therefore, there is an urgent need for a technical solution that can break through the limitations of interface differences and achieve universal integration of large model error correction data and front-end preview tags. Summary of the Invention
[0005] The purpose of this invention is to provide a general implementation method and system for front-end parsing of large model intelligent error correction, so as to overcome the defects of poor adaptability between large model error correction data and front-end preview interface and high development and maintenance costs in the prior art, and realize the general parsing, marking and interaction of error correction data in different preview interfaces.
[0006] The above-mentioned technical objective of the present invention is achieved through the following technical solution:
[0007] Firstly, this application provides a general implementation method for front-end parsing of intelligent error correction for large models, including the following specific steps:
[0008] Output the structured data after error correction according to the preset standard format;
[0009] After registering the Storage event listener function for localStorage in each file preview interface, the structured data is written into the localStorage with the fixed key value set.
[0010] When the Storage event listener function detects that a fixed key value has reached a preset condition, the corresponding file preview interface obtains the structured data and performs format validation on the structured data.
[0011] The system uses multiple pre-defined APIs to perform front-end parsing on the corresponding file preview interface for structured data that has passed format validation.
[0012] Based on the above technical solution, the present invention can be further improved as follows.
[0013] Furthermore, the aforementioned structured data includes at least a unique identifier for the error correction task, the original text fragment to be corrected, the start and end indices of the text to be corrected, the error type, the suggested correction text, and the error correction confidence level.
[0014] Furthermore, the aforementioned preset conditions are as follows:
[0015] Data with the fixed key value LLM_CORRECTION_DATA has changed.
[0016] Furthermore, the above format verification specifically includes:
[0017] Determine whether the structured data contains the unique identifier of the error correction task, the original text fragment to be corrected, the start and end indexes of the error to be corrected, the error type, the correction suggestion text, and the corresponding fields of the error correction confidence.
[0018] Furthermore, the aforementioned APIs include at least:
[0019] Based on structured data, locate the error position in the original text of the corresponding file preview interface and add a visual marker API;
[0020] Based on the structured data, the original text fragment to be corrected in the corresponding file preview interface is replaced with the correction suggestion text, and the API of the correction status is updated.
[0021] Based on the structured data, locate the text position of the specified error correction result in the corresponding file preview interface;
[0022] The API cancels the text replacement of the original text segment to be corrected with the suggested correction text, and restores the interface text in the corresponding file preview interface to its original state before correction.
[0023] Furthermore, the above methods also include:
[0024] Perform general adaptation and compatibility handling for multiple APIs.
[0025] Furthermore, the aforementioned general adaptation and compatibility handling for multiple APIs specifically includes:
[0026] DOM structure adaptation, event conflict avoidance, and browser compatibility handling.
[0027] Secondly, this application provides a general implementation system for intelligent error correction front-end parsing of large models, applicable to any one of the general implementation methods for intelligent error correction front-end parsing of large models in the first aspect, including:
[0028] The structured data output module is used to output the corrected structured data in a pre-defined standard format.
[0029] The structured data writing module is used to write structured data into the localStorage with a fixed key value after registering the localStorage event listener function in each file preview interface.
[0030] The structured data validation module is used to obtain structured data from the corresponding file preview interface and perform format validation on the structured data when the Storage event listener function detects that a fixed key value has reached a preset condition.
[0031] The data front-end parsing module is used to perform front-end parsing on the corresponding file preview interface of structured data that has passed format validation through multiple preset APIs.
[0032] Thirdly, this application provides an electronic device, including: at least one processor, at least one memory, and a data bus;
[0033] In this system, the processor and memory communicate with each other via a data bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method as described in any of the first aspects.
[0034] Fourthly, this application provides a non-transitory computer-readable storage medium, characterized in that the non-transitory computer-readable storage medium stores computer instructions that cause a computer to perform the method of any one of the first aspects.
[0035] Compared with the prior art, the present invention has at least the following beneficial effects:
[0036] 1. Significantly reduces development and maintenance costs; there is no need to develop separate error correction data parsing code for each preview interface. A single universal API can be adapted to all interfaces, greatly improving development efficiency. Subsequent maintenance only requires updating the API, without modifying multiple sets of interface code.
[0037] 2. Improve functional compatibility and deployment efficiency; based on browser native localStorage and common class name matching, it is compatible with preview interfaces developed by different technology stacks such as Vue, React, and native JS, solving the fragmentation problem of "one solution for each company" and enabling large model error correction function to be quickly deployed to multiple projects and multi-vendor systems.
[0038] 3. Optimize user experience; through standardized markup rendering, replacement / restoration, and positioning functions, ensure consistent user operation logic across different interfaces, avoiding operational confusion caused by interface differences. At the same time, the quick positioning function improves the efficiency of error correction in long documents. Furthermore, the extension interface reserved through the general API allows for the addition of new functions as needed, providing scalability. Attached Figure Description
[0039] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:
[0040] Figure 1 This is a flowchart illustrating the method implemented in an embodiment of the present invention.
[0041] Figure 2 This is an example diagram of the data writing format in an embodiment of the present invention;
[0042] Figure 3 This is an example diagram showing the format in which errors have been replaced in an embodiment of the present invention. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0044] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0045] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0046] In the description of the embodiments of the present invention, "multiple" means at least two.
[0047] Example 1: To address the problem that error correction data for large model correction results is difficult to directly adapt to all preview interfaces, severely impacting the efficiency and versatility of large model intelligent error correction functionality, this example provides a general implementation method for front-end parsing of large model intelligent error correction. It uses the browser's localStorage event listener mechanism as a universal communication bridge between "large model error correction data" and "front-end file preview interface." localStorage, with its native browser support, cross-tab communication, and simple and stable interface, serves as a universal data transmission carrier for preview interfaces developed with different technology stacks. The standardized API clarifies the format and logic of data interaction, ensuring that different preview interfaces only need to call a unified API to complete operations such as rendering error correction markers and replacing / restoring files. Therefore, by defining a standardized API interface, the underlying differences between different preview interfaces are shielded, achieving "one-time development, multi-interface compatibility" front-end parsing capabilities. Figure 1 As shown, the implementation method includes the following specific steps:
[0048] S1 outputs the structured data after error correction according to the preset standard format.
[0049] The structured data mentioned above includes at least a unique identifier for the error correction task, the original text fragment to be corrected, the start and end indices of the text to be corrected, the error type, the correction suggestion text, and the error correction confidence level.
[0050] S2, after registering the Storage event listener function of localStorage in each file preview interface, write the structured data into localStorage with a fixed key value set.
[0051] S3, when the Storage event listener function detects that a fixed key value has reached a preset condition, the corresponding file preview interface obtains the structured data and performs format validation on the structured data.
[0052] Specifically, the above format verification is as follows:
[0053] Determine whether the structured data contains the unique identifier of the error correction task, the original text fragment to be corrected, the start and end indexes of the error to be corrected, the error type, the correction suggestion text, and the corresponding fields of the error correction confidence.
[0054] The aforementioned preset conditions are specifically as follows:
[0055] Data with the fixed key value LLM_CORRECTION_DATA has changed.
[0056] S4 uses multiple pre-defined APIs to perform front-end parsing of structured data that has passed format validation in the corresponding file preview interface.
[0057] Optionally, the above APIs may include at least:
[0058] Based on structured data, locate the error position in the original text of the corresponding file preview interface and add a visual marker API;
[0059] Based on the structured data, the original text fragment to be corrected in the corresponding file preview interface is replaced with the correction suggestion text, and the API of the correction status is updated.
[0060] Based on the structured data, locate the text position of the specified error correction result in the corresponding file preview interface;
[0061] The API cancels the text replacement of the original text segment to be corrected with the suggested correction text, and restores the interface text in the corresponding file preview interface to its original state before correction.
[0062] Optionally, the above methods also include:
[0063] Perform general adaptation and compatibility processing for multiple APIs; specifically, this includes:
[0064] DOM structure adaptation, event conflict avoidance, and browser compatibility handling.
[0065] Example 2: Since localStorage possesses native browser support, cross-tab communication capabilities, and a simple and stable interface, it can serve as a universal data transfer carrier for preview interfaces and error correction data developed using different technology stacks. The browser's localStorage event listener mechanism acts as a universal communication bridge between "large model error correction data" and "front-end file preview interface." The standardized API clarifies the format and logic of data interaction, ensuring that different preview interfaces only need to call a unified API to complete operations such as rendering error correction markers and replacing / restoring files. Therefore, by defining a standardized API interface, the underlying differences between different preview interfaces are shielded, achieving "one-time development, multi-interface compatibility" front-end parsing capabilities. This implementation method includes the following specific steps:
[0066] S1, Standard structured output of large model error correction data; After the large model completes error correction on the doc text, it outputs structured data according to a preset standard format. The data fields of this structured data include at least:
[0067] correctionId is a unique identifier for the error correction task, used to associate multiple sets of error correction results for the same task.
[0068] textSegment, the original text segment to be corrected (the length of which matches the text segment rendered in the preview interface).
[0069] errorPos, the starting and ending indexes of the error in the original text;
[0070] errorType, the type of error (such as punctuation error, semantic contradiction, format deviation, missing space);
[0071] suggestion, revise the suggested text;
[0072] Confidence, or error correction confidence level, is used by the front end to determine whether to prioritize marking high-confidence results.
[0073] S2 is a general communication bridge built based on localStorage event listeners.
[0074] S21, the large model writes structured data to localStorage and sets a fixed key value (such as LLM_CORRECTION_DATA), while triggering a Storage event. See the example of its data writing format. Figure 2 ,exist Figure 2 The data includes fields such as correctionId, errorPos, textSegment, errorType, suggestion, and confidence.
[0075] S22, event listening and data reception for the front-end preview interface; all file preview interfaces (regardless of technology stack and DOM structure) uniformly register the Storage event listening function of localStorage. When the data with the fixed key value of LLM_CORRECTION_DATA changes, the data is automatically read and the format is validated (i.e., it is determined whether it contains the necessary fields in the above content). After the validation is successful, the subsequent API call logic is triggered.
[0076] S3 defines and implements general APIs; it can define 4 core general APIs, covering the key operations of error correction front-end parsing. All preview interfaces only need to call the API according to the unified specification to complete the interaction with error correction data.
[0077] S31, for API1, the original text lookup marker (findAndMarkOriginalText):
[0078] The function is to locate the error position in the original text in the preview interface based on the textSegment and errorPos returned by the large model, and add visual markers, such as red underlines and background highlights.
[0079] Input parameters: correctionId (associated error correction task), textSegment (original text segment to be corrected), and errorPos (error position index).
[0080] Implementation logic:
[0081] a. When the front-end preview interface calls this API, it first matches the corresponding original text fragment in the currently rendered text using textSegment (fuzzy matching is supported, and it is compatible with fragment inconsistencies caused by line breaks and space differences in the preview interface).
[0082] b. After a successful match, calculate the actual coordinates of the error location in the DOM node of the preview interface based on errorPos (combining font size, line height, and DOM offset).
[0083] c. Dynamically create a marker element at the corresponding position (such as <spancel="correction-mark"data-correction-id="COR_20250901_001">), and bind an event to display the suggestion when the mouse hovers over it.
[0084] S32, for API2, file replacement (replaceFileContent):
[0085] This feature replaces the error text in the preview interface with the suggested correction text from the larger model, while also updating the error correction status in localStorage.
[0086] Input parameters: correctionId, errorPos, suggestion;
[0087] Implementation logic:
[0088] a. Locate the DOM node text to be replaced in the preview interface based on errorPos;
[0089] b. Replace the text content (preserving the original formatting, such as font, color, bold, etc.);
[0090] c. Write replacement status data (key value: LLM_CORRECTION_STATUS) to localStorage, marking that the error corresponding to the correctionId has been replaced. Example format: Figure 3 As shown.
[0091] S33, for API3, file restoration (restoreOriginalContent):
[0092] This function undoes completed text replacements and restores the text in the preview interface to its original state before correction.
[0093] Input parameters: correctionId, replacedPos (replaced position);
[0094] Implementation logic:
[0095] a. Read the replacedPos and the original text fragment corresponding to LLM_CORRECTION_STATUS in localStorage (the replacement is first cached in LLM_CORRECTION_BACKUP in localStorage);
[0096] b. Locate the replaced DOM node based on replacedPos and restore the text to its original content;
[0097] c. Update the status of the correctionId in localStorage to "restored".
[0098] S34, for API4, file location (locateInFile):
[0099] This feature allows you to quickly locate the text position corresponding to a specified error correction result in the long document preview interface (such as scrolling to the page or paragraph where the error is located).
[0100] Input parameters: correctionId, textSegment, pageNum (the page number where the error occurs, optional);
[0101] Implementation logic:
[0102] a. If the input contains pageNum, control the preview interface to scroll to the corresponding page number;
[0103] b. If pageNum is not included, match the original text segment using textSegment and calculate the scroll height of the segment in the preview interface;
[0104] c. Call the preview interface's scrolling API (such as scrollTop) to scroll the error position to the center of the view and flash the marker element to alert the user.
[0105] S4, General API Adaptation and Compatibility Handling; To ensure the API works correctly in different preview interfaces, compatibility handling logic has been added:
[0106] DOM structure adaptation: The API internally adapts the DOM structure of different interfaces by "class name matching" (e.g., the class name of the preview text container is agreed to be preview-text-container) rather than hard-coding DOM node IDs.
[0107] To avoid event conflicts, interactive events bound to the API (such as hover events of marked elements) adopt event delegation and add namespaces (such as correction:mouseover) to avoid time conflicts with the preview interface itself.
[0108] Browser compatibility: Handle the differences in localStorage storage events across different browsers (such as Chrome, Firefox, and Safari) (e.g., fix the issue of delayed event triggering across tabs in Safari).
[0109] The following uses the example of Doc text correction in an enterprise document management system to illustrate the implementation steps of this invention in detail:
[0110] The implementation scenario is as follows: A company uses both vendor A's "online document preview component" (developed based on React) and vendor B's "local Doc preview plugin" (developed based on native JS), and needs to present the error correction results of the large model in a unified manner on both interfaces.
[0111] Step 1, Large Model Error Correction Data Standardization: After the large model corrects the Doc text "He is my... but also my...", the original result includes "missing spaces" errors. This is then converted to... Figure 2 The data shown is then written to localStorage.
[0112] Step 2, Preview Interface Listening and API Calls:
[0113] 2.1, Manufacturer A's React preview interface:
[0114] A general API script (llm-correction-api.js) is introduced, registering a storage event in the componentDidMount lifecycle. Upon detecting a change in LLM_CORRECTION_DATA, window.LLMCorrectionAPI.findAndMarkOriginalText({correctionId:"COR_20250901_002", textSegment: “He is mine... but also mine...", errorPos:{start:8,end:8}}). The API automatically matches text containers with class="preview-text-container" in the React interface, adds a red underline between "." and "but", and binds an event to display "It is recommended to add a space" when hovering.
[0115] 2.2, Manufacturer B's native JS preview interface:
[0116] Similarly, a common API is introduced, and a storage event is registered in the window.onload event; the same findAndMarkOriginalTextAPI is called. The API matches the text container with the same class name to achieve the same marking effect as the React interface, without needing to modify the native rendering logic of the plugin from vendor B.
[0117] Step 3, file replacement and restore operations:
[0118] When a user clicks on a marked element on Manufacturer A's interface, the preview interface calls window.LLMCorrectionAPI.replaceFileContent({correctionId:"COR_20250901_002",errorPos:{start:8,end:8},suggestion:“He is mine.... But also mine..."});
[0119] The API replaces the text with a version containing spaces and marks the status as "replaced" in localStorage's LLM_CORRECTION_STATUS, while caching the original text "He is my... but also my...." in LLM_CORRECTION_BACKUP.
[0120] If the user needs to undo the replacement, the preview interface calls window.LLMCorrectionAPI.restoreOriginalContent({correctionId: "COR_20250901_002", replacedPos: { start: 8, end: 8}}), and the API reads the backup text and restores it.
[0121] Step 4, long document location operation; For a 100-page long Doc document, if the error correction result is located on page 50, the preview interface calls window.LLMCorrectionAPI.locateInFile({ correctionId: "COR_20250901_003", pageNum: 50}); The API controls the preview interface to scroll to page 50, matches the corresponding text fragment, scrolls the error position to the center of the view, and makes the marked element flash 3 times to prompt the user.
[0122] Example 3: This application provides a general implementation system for intelligent error correction front-end parsing of large models, applied to the general implementation method for intelligent error correction front-end parsing of large models in Example 1, including:
[0123] The structured data output module is used to output the corrected structured data in a pre-defined standard format.
[0124] The structured data writing module is used to write structured data into the localStorage with a fixed key value after registering the localStorage event listener function in each file preview interface.
[0125] The structured data validation module is used to obtain structured data from the corresponding file preview interface and perform format validation on the structured data when the Storage event listener function detects that a fixed key value has reached a preset condition.
[0126] The data front-end parsing module is used to perform front-end parsing on the corresponding file preview interface of structured data that has passed format validation through multiple preset APIs.
[0127] Example 4: This application provides a general implementation system for intelligent error correction front-end parsing of large models, applied to a general implementation method for intelligent error correction front-end parsing of large models in Example 2. The corresponding system includes the following modules, each of which achieves data interaction and functional collaboration through localStorage and a general API:
[0128] The large model error correction data standardization module receives the original error correction results of the large model, converts them into standard structured data according to a preset format, and writes the LLM_CORRECTION_DATA data that meets the format requirements into localStorage.
[0129] The localStorage event communication module enables general communication between large model error correction data and the front-end preview interface, including:
[0130] The data writing unit is used to write structured data to localStorage and trigger storage events;
[0131] The event listener unit is used to register storage events in the preview interface, receive and verify data.
[0132] The general API core module implements four core APIs: findAndMarkOriginalText, replaceFileContent, restoreOriginalContent, and occupyInFile; it can include:
[0133] The API registration unit attaches APIs to a global object (such as window.LLMCorrectionAPI) for the preview interface to call;
[0134] The logic execution unit is used to implement the core business logic of each API (text matching, markup rendering, replacement / restoration, positioning, etc.).
[0135] The compatibility handling unit is used to handle issues such as differences in DOM structure and browser events.
[0136] The front-end preview interface adaptation module is used to integrate a common API into different preview interfaces, enabling visualization and interaction of error correction results. The function integration can be completed simply by importing the API script into the preview interface, without modifying the underlying rendering logic.
[0137] The error correction status management module manages the replacement / restore status and original text backup of error correction tasks through localStorage's LLM_CORRECTION_STATUS and LLM_CORRECTION_BACKUP; to ensure that the file restoration function is traceable and to avoid the loss of the original text after replacement.
[0138] Example 5: This application provides an electronic device, including: at least one processor, at least one memory, and a data bus;
[0139] The processor and memory communicate with each other via a data bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method as in Embodiment 1 or Embodiment 2.
[0140] Example 6: This application provides a non-transitory computer-readable storage medium, characterized in that the non-transitory computer-readable storage medium stores computer instructions, which cause the computer to execute the method of Example 1 or Example 2.
[0141] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0142] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0143] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0144] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0145] Those skilled in the art will understand that all or part of the steps in the above facts and methods can be implemented by a program instructing related hardware. The program or the program described therein can be stored in a computer-readable storage medium. When the program is executed, it includes the following steps: at this time, the corresponding method steps are introduced. The storage medium can be ROM / RAM, magnetic disk, optical disk, etc.
[0146] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A general implementation method for front-end parsing of intelligent error correction for large models, characterized in that, The specific steps include the following: Output the structured data after error correction according to the preset standard format; After registering the Storage event listener function for localStorage in each file preview interface, the structured data is written into localStorage with a fixed key value set. When the Storage event listener function detects that a fixed key value has reached a preset condition, the corresponding file preview interface obtains the structured data and performs format validation on the structured data. The structured data that has passed format validation is parsed in the corresponding file preview interface using multiple preset APIs. The preset conditions are specifically as follows: The data with the fixed key value of LLM_CORRECTION_DATA has changed; The multiple APIs mentioned include at least: Based on the structured data, locate the error position in the original text of the corresponding file preview interface and add a visual marker API; Based on the structured data, the original text fragment to be corrected in the corresponding file preview interface is replaced with the correction suggestion text, and the API of the correction status is updated. Based on the structured data, locate the text position of the specified error correction result in the corresponding file preview interface; The API cancels the text replacement of the original text segment to be corrected with the suggested correction text, and restores the interface text in the corresponding file preview interface to the original state before the correction. The method further includes: Perform general adaptation and compatibility processing on multiple APIs.
2. The general implementation method for front-end parsing of large-scale intelligent error correction according to claim 1, characterized in that, The structured data includes at least a unique identifier for the error correction task, the original text fragment to be corrected, the start and end indices of the text to be corrected, the error type, the suggested correction text, and the error correction confidence level.
3. The general implementation method for front-end parsing of large-scale intelligent error correction according to claim 2, characterized in that, The format verification specifically involves: Determine whether the structured data contains the unique identifier of the error correction task, the original text fragment to be corrected, the start and end indexes of the text to be corrected, the error type, the correction suggestion text, and the corresponding fields of the error correction confidence.
4. The general implementation method for front-end parsing of large-scale intelligent error correction according to claim 1, characterized in that, The process involves general adaptation and compatibility handling for multiple APIs, specifically including: DOM structure adaptation, event conflict avoidance, and browser compatibility handling.
5. A general implementation system for intelligent error correction front-end parsing of large models, applied to the general implementation method for intelligent error correction front-end parsing of large models according to any one of claims 1-4, characterized in that, include: The structured data output module is used to output the corrected structured data in a pre-defined standard format. The structured data writing module is used to write the structured data into the localStorage with a fixed key value after registering the Storage event listener function of localStorage in each file preview interface. The structured data validation module is used to obtain the structured data from the corresponding file preview interface and perform format validation on the structured data when the Storage event listener function detects that a fixed key value has reached a preset condition. The data front-end parsing module is used to perform front-end parsing on the structured data that has passed format validation in the corresponding file preview interface through multiple preset APIs.
6. An electronic device, characterized in that, include: At least one processor, at least one memory, and a data bus; The processor and the memory communicate with each other via the data bus. The memory stores program instructions that can be executed by the processor, which invokes the program instructions to perform the method as described in any one of claims 1-4.
7. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the method of any one of claims 1-4.
Citation Information
Patent Citations
Javascript event monitoring management method
CN103885757A
Data calling method and device and computer readable storage medium
CN112631558A