Document annotation method and device, computer equipment and storage medium

By generating prompt word templates and location mapping tables through a large language model, document annotation is processed automatically, solving the problems of subjectivity and inefficiency in manual review and achieving efficient and objective review of document annotations.

CN121881998APending Publication Date: 2026-04-17BEIJING CREDIBLE HUATAI TECHNICAL SERVICE CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING CREDIBLE HUATAI TECHNICAL SERVICE CO LTD
Filing Date
2025-11-18
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

The existing document review methods mainly rely on manual review, which has problems such as strong subjectivity, unstable quality, and low review efficiency.

Method used

By using a pre-defined large language model to generate prompt word templates, combining document analysis to generate a suggestion list, constructing a mapping table between characters and the physical location of text, determining annotation keywords, and inserting modification suggestions into the document based on the location mapping table, automatic annotation is achieved.

Benefits of technology

It improves the objectivity and efficiency of the review results, solves the problems of subjectivity and quality instability in manual review, and realizes the automation and efficient review of document annotations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121881998A_ABST
    Figure CN121881998A_ABST
Patent Text Reader

Abstract

The invention relates to a document annotation method and device, computer equipment and a storage medium. The method comprises the following steps: automatically generating modification suggestions corresponding to different document keywords in a to-be-annotated document according to a review target by utilizing a preset large language model, filtering a plurality of document keywords to obtain a plurality of annotation keywords, and then annotating the to-be-annotated document on the basis of a position mapping table between each character and a text physical position, according to the method, the logic description position of each annotation keyword is converted into the text physical position, and the modification suggestion is inserted in the annotation form according to the text physical position of each annotation keyword, so that document annotation automation is realized, and compared with manual auditing, the objectivity of an auditing result is improved, the auditing quality and the auditing efficiency are improved, and the auditing efficiency is improved. Therefore, the problems of high subjectivity, unstable quality and low auditing efficiency of the existing manual document auditing are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a document annotation method, apparatus, computer device, and storage medium. Background Technology

[0002] Existing document review methods mainly rely on manual review or rule engine review. However, manual reading and annotation are not only inefficient, but also suffer from strong subjectivity, unstable quality, and low review efficiency. Summary of the Invention

[0003] This application provides a document annotation method, apparatus, computer equipment, and storage medium to solve the problems of strong subjectivity, unstable quality, and low efficiency in existing manual document review.

[0004] Firstly, this application provides a document annotation method, the method comprising: Upon receiving a document to be annotated, a pre-defined large language model is used to generate a prompt word template based on the user-input review objectives and the document to be annotated. The document to be annotated is then analyzed in conjunction with the prompt word template to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, a description of the review objectives, and output format constraints. The suggestion list includes multiple modification suggestions, each corresponding to a document keyword in the document to be annotated and the logical description position of the document keyword. The document keyword can be any phrase in the document to be annotated. Construct a position mapping table between each character and the physical location of the text in the document to be annotated; Based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list, multiple annotation keywords are determined, wherein the annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords; Based on the location mapping table, the logical description location of each of the annotation keywords is converted into the text physical location; In the document to be annotated, modification suggestions corresponding to each of the annotation keywords are inserted in the form of annotations according to the text physical location of each annotation keyword, and the annotated document is obtained and output.

[0005] Optionally, constructing the position mapping table between each character in the document to be annotated and its physical location includes: Each text paragraph in the document to be annotated is divided into multiple text blocks, and the first mapping relationship between each text block and its corresponding text paragraph is recorded; Determine the character offset of each character in each text block, and establish a second mapping relationship between each character and its corresponding text block; Establish a third mapping relationship between the character offset of each character and the text unit; Based on the first mapping relationship, the second mapping relationship, the third mapping relationship, and the physical location of the text corresponding to each text unit, a position mapping table between each character and the physical location of the text in the document to be annotated is determined.

[0006] Optionally, the step of determining multiple annotation keywords based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list includes: In the document to be annotated, search for the document keywords corresponding to each modification suggestion in the suggestion list, and record the number of times each document keyword appears and the length of the phrase; Determine the nesting relationships between the keywords in each document; Based on the frequency of occurrence of each document keyword, the phrase length, and the nesting relationship between the document keywords, conflict filtering is performed on multiple document keywords to obtain multiple annotation keywords.

[0007] Optionally, the step of performing conflict filtering on multiple document keywords based on the frequency of occurrence of each document keyword, phrase length, and nesting relationship between the document keywords, to obtain multiple annotation keywords, including: When the first document keyword appears more than once, the first document keyword that appears first is determined as the first candidate keyword based on the order in which the first document keywords appear, wherein the first document keyword can be any one of the document keywords; Based on the nesting relationship between the document keywords, a second document keyword that has a nesting relationship with the first candidate keyword is determined; When the number of keywords in the second document is not zero, the first candidate keywords and the second document keywords are sorted in descending order according to the phrase length, and the keyword at the beginning is used as the annotation keyword.

[0008] Optionally, after determining the second document keyword that has a nested relationship with the first candidate keyword based on the nesting relationship between the various document keywords, the method further includes: When the number of keywords in the second document is zero, the first candidate keyword is used as the annotation keyword.

[0009] Optionally, the step of inserting modification suggestions corresponding to each of the annotation keywords in the document to be annotated, according to the textual physical location of each annotation keyword, in the form of annotations, to obtain and output the annotated document includes: Based on the textual physical location of each of the aforementioned annotation keywords, determine the target text paragraph to which each of the aforementioned annotation keywords belongs; Call the document service interface to clear the target text paragraph containing the annotation keywords in the document to be annotated; The ordinary text characters that make up the target text paragraph are rewritten in the original text style of the target text paragraph in sequence, wherein the ordinary text characters are characters other than the annotation keywords; The annotation keywords belonging to the target text paragraph are rewritten as independent fragments according to the original text style, and modification suggestions corresponding to the annotation keywords are inserted according to the annotation method corresponding to the document format of the document to be annotated. During the rewriting process, the original style attributes of each character are determined through a position mapping table to ensure that the reconstructed text maintains the original formatting consistency. When the annotation status of each of the aforementioned annotation keywords is "annotation successful", the annotated document is obtained and output.

[0010] Optionally, upon obtaining the document to be annotated, a preset large language model is used to generate a prompt word template based on the user-input review objectives and the document to be annotated. The document to be annotated is then analyzed using the prompt word template to generate a suggestion list, including: When a document to be annotated is obtained, a prompt word template is generated based on the user's input review objectives and the document to be annotated using a preset large language model. The document to be annotated is then analyzed in conjunction with the prompt word template to generate an annotation list. The annotation list is validated using a format validator to obtain the validation result; If the verification result is successful, the annotation list will be used as the suggestion list.

[0011] Secondly, this application provides a document annotation device, the device comprising: The structured suggestion module is used to generate a prompt word template based on the user-input review objectives and the document to be annotated when a document to be annotated is obtained, using a preset large language model. The prompt word template is then used to analyze the document to be annotated to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, review objective descriptions, and output format constraints. The suggestion list includes multiple modification suggestions, each corresponding to a document keyword in the document to be annotated and the logical description position of the document keyword. The document keyword can be any phrase in the document to be annotated. The position mapping engine module is used to construct a position mapping table between each character and the physical location of the text in the document to be annotated. The keyword positioning module is used to determine multiple annotation keywords based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list. The annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords. The location mapping engine module is also used to convert the logical description location of each of the annotation keywords into a text physical location based on the location mapping table; The annotation writing module is used to insert modification suggestions corresponding to each annotation keyword in the document to be annotated according to the text physical location of each annotation keyword, in the form of annotations, and to obtain and output the annotated document.

[0012] Thirdly, this application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described document annotation method.

[0013] Fourthly, this application also provides a computer storage medium storing computer-executable instructions for executing the above-described document annotation method.

[0014] Compared with the prior art, the technical solution provided in this application has the following advantages: The method provided in this application, upon obtaining a document to be annotated, utilizes a preset large language model to generate a prompt word template based on the user-inputted review objective and the document to be annotated. It then analyzes the document to be annotated using the prompt word template to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, a review objective description, and output format constraints. The suggestion list includes multiple modification suggestions, each corresponding to a document keyword in the document to be annotated and the logical description position of the document keyword. The document keyword is the document to be annotated. The document is given any phrase; a position mapping table is constructed between each character in the document to be annotated and its physical text position; based on the matching result between the document keywords corresponding to each modification suggestion in the suggestion list and the document to be annotated, multiple annotation keywords are determined, wherein the annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords; the logical description position of each annotation keyword is converted into a physical text position based on the position mapping table; and modification suggestions corresponding to each annotation keyword are inserted into the document to be annotated in the form of annotations according to the physical text position of each annotation keyword, so as to obtain and output the annotated document.

[0015] Based on the above method, a pre-set large language model is used to automatically generate modification suggestions corresponding to different document keywords in the document to be annotated according to the review objectives. Multiple document keywords are filtered to obtain multiple annotation keywords. Then, based on the position mapping table between each character and the physical position of the text, the logical description position of each annotation keyword is converted into the physical position of the text. Modification suggestions are inserted in the form of annotations according to the physical position of each annotation keyword, thereby realizing the automation of document annotation. Compared with manual review, it improves the objectivity of the review results, improves the review quality and efficiency, and solves the problems of strong subjectivity, unstable quality and low efficiency of existing manual document review. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0019] Figure 1 An application environment diagram of a document annotation method provided in this application embodiment; Figure 2 A flowchart illustrating a document annotation method provided in an embodiment of this application; Figure 3 A structural block diagram of a document annotation device provided in an embodiment of this application; Figure 4 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0022] Figure 1 This is a diagram illustrating the application environment of a document annotation method in one embodiment. (Refer to...) Figure 1 This document annotation method is applied to a document annotation system. The document annotation system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be a desktop terminal or a mobile terminal; a mobile terminal can be at least one of a mobile phone, tablet, or laptop. The server 120 can be a standalone server or a server cluster consisting of multiple servers.

[0023] In one embodiment, Figure 2 This is a flowchart illustrating a document annotation method in one embodiment, with reference to... Figure 2This document provides a document annotation method. This embodiment primarily applies this method to the aforementioned... Figure 1 Taking server 120 as an example, the annotation method for this document specifically includes the following steps: Step S210: Upon obtaining the document to be annotated, a prompt word template is generated using a preset large language model based on the user-input review objectives and the document to be annotated. The document to be annotated is then analyzed in conjunction with the prompt word template to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, review objective descriptions, and output format constraints. The suggestion list includes multiple modification suggestions, each corresponding to a document keyword in the document to be annotated and the logical description position of the document keyword. The document keyword is any phrase in the document to be annotated.

[0024] Specifically, the prompt word template includes multiple prompt words, each containing text fragment identifiers, contextual information, a review objective description, and output format constraints. Text fragment identifiers indicate text paragraphs; contextual information indicates the semantic relationships between contexts in the document to be annotated; the review objective description indicates the user's review requirements for the document; and the output format constraints indicate the output format of the suggestion list. For example, the prompt word template might be: "Please analyze the following paragraph: 'XX mobile phone is equipped with a brand-new imaging system, supports 100x zoom, and its photo-taking effect far surpasses similar products.' Based on the review objective of 'evaluating the appeal of the marketing copy's selling points, please extract keywords that reflect the product's selling points and comment on the strength of their appeal and optimization suggestions for each keyword. The output format is 'Keywords: [Keyword 1], Comments: [Appeal Analysis + Suggestions]; …'. Based on the prompt word template, review objectives can be structured, and a standard suggestion list can be output according to the template's structure in different scenarios."

[0025] Users upload documents to be annotated and preset review targets to server 120 via terminal 110. Server 120 then reviews and annotates the documents according to the preset review targets. The documents to be annotated can be in any format, including docx, doc, txt, pdf, md, etc. The preset large language model can be any pre-trained large language model (LLM), such as the OpenAI GPT model, Google Gemini model, DeepSeek model, Baidu Wenxin large model, etc.

[0026] The review objectives include the user's review standards and expected requirements for the document to be annotated. These objectives and the document to be annotated are input prompts into a pre-defined large language model. The model generates prompts based on the review objectives and then combines them with a pre-defined template to generate a suggestion list. The pre-defined large language model processes the document to be annotated according to the pre-defined review objectives, automatically generating modification suggestions for documents that do not meet the review objectives, the corresponding document keywords for these suggestions, and the logical description positions of these keywords within the document. Document keywords refer to the phrases associated with the modification suggestions, i.e., phrases present in the document. A suggestion list is generated based on multiple modification suggestions, the corresponding document keywords for each suggestion, and the logical description positions of these keywords within the document.

[0027] The pre-defined large language model outputs suggestions and location information, resulting in a structured output. Suggestions include the reason for modification and the suggested content. The reason indicates the type of problem in the document to be annotated, such as grammatical errors, unclear expression, or punctuation mistakes. Suggested content includes alternative expressions, optimization suggestions, or revision opinions. Location information includes the logical description of the paragraph or code block number or line number of the document keywords related to the suggestion.

[0028] Step S220: Construct a position mapping table between each character in the document to be annotated and its physical location.

[0029] Specifically, a position mapping table between each character and the physical location of the text is established by parsing the document structure of the document to be annotated. The physical location of the text refers to the precise positioning data inherent in the underlying format of the document. For example, in DOCX format documents, the content is located through the hierarchical path of the XML node, such as / document / body / p[2] / r[3]. The hierarchical path under DOCX format is the physical location of the text. In PDF format documents, the text range is locked by combining the page number with the coordinate area, such as "Page 2, coordinates (100,200)-(300,400)"". The page number under PDF format combined with the coordinate area is the physical location of the text. The logical description position output by the preset large language model is a logical positioning identifier given by the user's reading habits, such as "the third paragraph content", which is different from the physical location of the text.

[0030] Step S230: Based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list, determine multiple annotation keywords, wherein the annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords.

[0031] Specifically, based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list, multiple document keywords are filtered to avoid duplicate and abundant document keywords, thereby obtaining a smaller number of annotation keywords. Annotation keywords refer to the document phrases that will be annotated.

[0032] Step S240: Based on the location mapping table, convert the logical description location of each of the annotation keywords into the text physical location.

[0033] Specifically, in order to achieve automatic annotation, the logical description positions output by the preset large language model need to be converted into text physical positions that the server 120 can recognize and locate. Then, based on the position mapping table, the logical description positions of each annotation keyword are converted into text physical positions in a document-specific format. For example, paragraph numbers are accurately converted into XML node paths corresponding to DOCX format or page numbers combined with coordinate areas corresponding to PDF format.

[0034] This positional transformation process can also be used to align text or paragraph marks in the language model output with specific locations in the original document to be annotated.

[0035] Step S250: Insert modification suggestions corresponding to each of the annotation keywords in the document to be annotated according to the text physical location of each annotation keyword, and obtain and output the annotated document.

[0036] Specifically, based on the physical text location of each annotation keyword, corresponding modification suggestions are inserted into the document to be annotated in the form of annotations for each annotation keyword, resulting in an annotated document. The annotated document, compared to the document to be annotated, contains multiple annotations. This annotation process inserts native, interactive annotations into the document to be annotated without compromising its original formatting or document style, achieving non-destructive embedding of modification suggestions. The annotated document is then converted into binary data and returned to terminal 110, allowing the user to automatically download the annotated document without manual intervention.

[0037] Based on the above method, using a pre-set large language model to automatically generate modification suggestions corresponding to different document keywords in the to-be-annotated document according to the review objective, filtering multiple document keywords to obtain multiple annotation keywords, and then based on the position mapping table between each character and the physical position of the text, converting the logical description positions of each annotation keyword into physical positions of the text, and inserting the modification suggestions in the form of annotations according to the physical positions of each annotation keyword in the text, so as to achieve the automation of document annotation, which improves the objectivity of the review results compared with manual review, improves the review quality and review efficiency, and thus solves the problems of strong subjectivity, unstable quality and low review efficiency existing in the existing manual review of documents.

[0038] In one embodiment, constructing the position mapping table between each character and the physical position of the text in the to-be-annotated document includes: Dividing each text paragraph in the to-be-annotated document into multiple text blocks, and recording the first mapping relationship between each text block and the text paragraph to which it belongs; Determining the character offset of each character in each text block, and establishing the second mapping relationship between each character and the text block to which it belongs; Establishing the third mapping relationship between the character offset of each character and the text unit; Based on the first mapping relationship, the second mapping relationship, the third mapping relationship, and the physical position of the text corresponding to each text unit, determining the position mapping table between each character and the physical position of the text in the to-be-annotated document.

[0039] Specifically, first divide each text paragraph in the to-be-annotated document into multiple text blocks with consistent formats, and record the belonging relationship between each text block and the text paragraph, so as to establish the first mapping relationship.

[0040] Record the character offset of each character in each text block. The character offset refers to the position serial number of the character in the text block, which is used to accurately mark the specific position of a single character. For example, if the paragraph text of the text block is "Artificial intelligence is very important", the character offset of the first character "人" is 0, the character offset of the character "智" is 2, and the character offset of the character "要" is 6. Establish the belonging relationship between each character and the text block, so as to determine the second mapping relationship.

[0041] Determine the third mapping relationship based on the corresponding relationship between the character offset of each character and the text unit. The text unit is the Run element. The text unit is the smallest and uniformly formatted unit in the document bottom layer, and is the basic carrier for carrying text content and format information. And each text unit corresponds to the specific identifier of the document bottom layer structure, that is, each text unit corresponds to a physical position of the text.

[0042] A position mapping table is determined based on the first, second, and third mapping relationships, as well as the physical location of each text unit. The position mapping table obtained through the above steps enables precise location of any character in the document.

[0043] The establishment of a location mapping table also improves document compatibility across different platforms and software. Because the location mapping table is built upon the document's underlying text units and physical locations, it is unaffected by document format or software version. Therefore, when a document is transferred and edited across different platforms and software, the location mapping table ensures that the location information within the document remains accurate and valid, avoiding positional errors caused by platform and software differences.

[0044] In one embodiment, determining multiple annotation keywords based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list includes: In the document to be annotated, search for the document keywords corresponding to each modification suggestion in the suggestion list, and record the number of times each document keyword appears and the length of the phrase; Determine the nesting relationships between the keywords in each document; Based on the frequency of occurrence of each document keyword, the phrase length, and the nesting relationship between the document keywords, conflict filtering is performed on multiple document keywords to obtain multiple annotation keywords.

[0045] Specifically, the process iterates through the documents to be annotated, searching for the document keywords corresponding to each modification suggestion, and recording the frequency and phrase length of each document keyword. Then, it determines whether there is any overlap or nesting between the document keywords. For example, if the first document keyword is "artificial intelligence" and the second document keyword is "artificial intelligence is important," the second document keyword contains all the characters of the first document keyword; therefore, there is a nesting relationship between the first and second document keywords.

[0046] By combining the frequency of occurrence of keywords in each document, phrase length, and nesting relationships between keywords in different documents, conflict filtering is performed on multiple document keywords to reduce duplicate and redundant document keywords, resulting in a smaller number of annotation keywords.

[0047] In one specific embodiment, for nested keyword groups, a coverage priority rule is used to filter document keywords: if the frequency of the parent word "artificial intelligence is important" is greater than or equal to the frequency of the child word "artificial intelligence", and the modification suggestions corresponding to the parent word can cover all the modification suggestions corresponding to the child word, then the parent word is retained and the child word is removed to reduce the duplicate positioning of document keywords; if the child word is the core target of the modification suggestions, such as only targeting the terminology correction of "artificial intelligence", then the child word is retained and the parent word is removed to avoid the positioning scope being too large.

[0048] You can also set a threshold for the number of times a document appears, based on the total length of the document or the number of modification suggestions, to remove document keywords that appear less than the threshold, such as low-frequency words that appear only once and have no nested associations, to avoid the subsequent positioning being scattered due to occasional keywords; at the same time, high-frequency core words are retained to ensure that they cover most modification scenarios.

[0049] Alternatively, for document keywords without nested relationships, prioritize retaining phrases of moderate length, i.e., document keywords whose phrase length falls within a preset length range, such as 4-8 characters. This is because overly short phrases are prone to ambiguous positioning, such as the 2-character "AI," while overly long phrases lack flexibility, such as long sentences whose phrase length exceeds the preset length range. Using length-assisted filtering further improves the matching accuracy between annotation keywords and modification suggestions.

[0050] The number of filtered annotation keywords can usually be greatly reduced, avoiding positioning conflicts caused by too many keywords in the original document due to repetition, nesting, and low frequency words. This makes the subsequent positioning and annotation process more efficient, without having to deal with a large number of invalid keyword matches.

[0051] Furthermore, the retained annotation keywords are both comprehensive and targeted, covering the document range corresponding to all modification suggestions without causing positioning deviations due to excessively long nested parent words or excessively narrow low-frequency sub-words, thus providing a high signal-to-noise ratio positioning basis for subsequent position conversion.

[0052] The streamlined annotation keywords can be directly linked to the physical location conversion logic of different document formats. For DOCX format documents, it can quickly match the corresponding Run element XML path; for PDF format documents, it can accurately lock the page number and coordinate area, avoiding conversion failures caused by keyword redundancy or ambiguity, and improving the technical stability of the entire annotation process.

[0053] In one embodiment, the step of performing conflict filtering on multiple document keywords based on the frequency of occurrence of each document keyword, phrase length, and nesting relationship between the document keywords to obtain multiple annotation keywords includes: When the first document keyword appears more than once, the first document keyword that appears first is determined as the first candidate keyword based on the order in which the first document keywords appear, wherein the first document keyword can be any one of the document keywords; Based on the nesting relationship between the document keywords, a second document keyword that has a nesting relationship with the first candidate keyword is determined; When the number of keywords in the second document is not zero, the first candidate keywords and the second document keywords are sorted in descending order according to the phrase length, and the keyword at the beginning is used as the annotation keyword.

[0054] Specifically, first determine if the first document keyword appears once. If it does not, it means that there are multiple first document keywords in the document to be annotated. If each first document keyword is annotated, it will not only increase the workload of subsequent position conversion, but also increase the workload of annotation. Therefore, if the modification suggestions corresponding to each first document keyword are the same, it is necessary to filter the duplicate first document keywords. According to the order of appearance of each first document keyword in the document to be annotated, only the first first document keyword that appears is retained, and the first first document keyword that appears is determined as the first candidate keyword.

[0055] Based on the nesting relationships between the keywords in each document, it is determined whether there is a second document keyword that is nested with the first candidate keyword. If there is a second document keyword that is nested with the first candidate keyword, it is determined whether the phrase length of the first candidate keyword is greater than the phrase length of the second document keyword. If the phrase length of the first candidate keyword is greater than the phrase length of the second document keyword, it means that the first candidate keyword is the parent word of the second document keyword, and the first candidate keyword is used as a comment keyword, and the second document keyword is removed. If the phrase length of the first candidate keyword is less than the phrase length of the second document keyword, it means that the second document keyword is the parent word of the first candidate keyword, and the second document keyword is used as a comment keyword, and the first candidate keyword is removed.

[0056] After processing the first candidate keyword, select the next unprocessed keyword from the remaining document keywords as the new first document keyword, and repeat the above process: first, determine its occurrence frequency, filter duplicates and keep the first one; then check for nesting relationships and filter according to the phrase length rule; until all document keywords have been processed, a set of annotation keywords without duplication or nesting conflicts is finally formed.

[0057] After filtering duplicate keywords, the workload of converting logical description positions to text physical positions can be greatly reduced, avoiding multiple position calculations for the same modification suggestion; at the same time, the workload of annotation is positively correlated with the number of keywords, and the amount of annotation operations is reduced accordingly after filtering, directly reducing the system's computing power consumption and manual intervention costs.

[0058] By using phrase length comparison rules, we ensure that there are no instances of parent and child words coexisting in the annotation keyword set. This prevents the scope of positioning from becoming too narrow and missing related content due to retaining child words, while also preventing the scope of positioning from becoming too broad and causing ambiguity due to retaining parent words. Ultimately, each annotation keyword can uniquely correspond to a precise positioning unit, clearing up conflicts for subsequent position conversions.

[0059] For repeated keywords with the same modification suggestions, only the first one is retained, ensuring that the same modification requirement generates only one comment in the document, avoiding document clutter caused by repeated comments in multiple locations; at the same time, nested filtering rules ensure that the comment content matches the scope of the modification suggestions, neither omitting core information nor including irrelevant content, improving the readability and professionalism of the final comment document.

[0060] In one embodiment, after determining a second document keyword that has a nested relationship with the first candidate keyword based on the nesting relationship between the document keywords, the method further includes: When the number of keywords in the second document is zero, the first candidate keyword is used as the annotation keyword.

[0061] Specifically, if no second document keyword with a nested relationship to the first candidate keyword is found, the first candidate keyword is directly added to the annotation keyword set. Simultaneously, metadata such as "occurrence count = 1 (duplicates filtered), phrase length, and paragraph index" is recorded to provide complete positioning data for subsequent physical location conversion, avoiding the loss of modification suggestions due to the omission of valid keywords.

[0062] Alternatively, according to the above embodiments, it can be determined whether to retain the first candidate keyword as an annotation keyword based on whether the number of occurrences of the first candidate keyword is greater than a threshold; or it can be determined whether to retain the first candidate keyword as an annotation keyword based on whether the phrase length of the first candidate keyword is within a preset length range.

[0063] In one embodiment, inserting modification suggestions corresponding to each of the annotation keywords in the document to be annotated, according to the textual physical location of each annotation keyword, in the form of annotations, to obtain and output the annotated document, includes: Based on the textual physical location of each of the aforementioned annotation keywords, determine the target text paragraph to which each of the aforementioned annotation keywords belongs; Call the document service interface to clear the target text paragraph containing the annotation keywords in the document to be annotated; The ordinary text characters that make up the target text paragraph are rewritten in the original text style of the target text paragraph in sequence, wherein the ordinary text characters are characters other than the annotation keywords; The annotation keywords belonging to the target text paragraph are rewritten as independent fragments according to the original text style, and modification suggestions corresponding to the annotation keywords are inserted according to the annotation method corresponding to the document format of the document to be annotated. When the annotation status of each of the aforementioned annotation keywords is "annotation successful", the annotated document is obtained and output.

[0064] Specifically, based on the physical location of each annotation keyword in the text, the target text paragraph to which it belongs is determined. Since subsequent document operation processing is involved, it is necessary to call the document service interface to process the annotated document. There is no need to modify the existing backend interface, nor is there a need to maintain a state machine or asynchronous queue, which has strong system compatibility and scalability.

[0065] First, clear the target text paragraphs corresponding to the annotation keywords in the document to be annotated. Then, rewrite the ordinary text characters in the target text paragraphs according to their original text style. Next, rewrite the annotation keywords as independent fragments according to their original text style, keeping the paragraph format consistent with the original text. Then, according to the annotation method corresponding to the document format of the document to be annotated, insert annotation content with corresponding modification suggestions for the annotation keywords, and fully set attributes such as author, initials, and suggestion to ensure that the annotation content is natively recognized and interacted with by the document software.

[0066] For example, for DOCX format documents, OOXML is manipulated to insert native code. <w:comment>For PDF documents, the annotation element adds a standard annotation object to ensure that the annotation is integrated naturally, format compatible, and user-friendly, thereby achieving lossless native annotation across multiple formats.

[0067] After completing the annotation processing of a keyword, the above process is repeated to achieve independent processing of each paragraph and a fine-grained error capture and tracking mechanism for the suggestion list, ensuring high reliability and diagnosability of the annotation writing process.

[0068] The annotation status of each modification suggestion in the suggestion list will be dynamically updated along with the annotation status of each annotation keyword. If the annotation status of the annotation keyword is "annotation failed", the annotation status of the modification suggestion corresponding to the annotation keyword will also be updated to "annotation failed". The annotation status of each modification suggestion is saved in the log so that the back-end staff can view and analyze the reasons for the annotation failure of the annotation keyword, and use it to optimize the document annotation process.

[0069] In one embodiment, upon receiving a document to be annotated, a preset large language model is used to generate a prompt word template based on the user-input review objectives and the document to be annotated. The document to be annotated is then analyzed using the prompt word template to generate a suggestion list, including: When a document to be annotated is obtained, a prompt word template is generated based on the user's input review objectives and the document to be annotated using a preset large language model. The document to be annotated is then analyzed in conjunction with the prompt word template to generate an annotation list. The annotation list is validated using a format validator to obtain the validation result; If the verification result is successful, the annotation list will be used as the suggestion list.

[0070] Specifically, to ensure the reliability of the model output, server 120 also introduces a format validator to verify the model output results. For invalid model output results, the document annotation process will be terminated and an error message will be returned to terminal 110. For valid model output results, server 120 will use the annotation list as a suggestion list to facilitate subsequent annotation processing of the document to be annotated.

[0071] Figure 2 This is a flowchart illustrating a document annotation method in one embodiment. It should be understood that, although... Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0072] In one embodiment, such as Figure 3 As shown, a document annotation device is provided, comprising: The structured suggestion module 310 is used to generate a prompt word template based on the user-input review objectives and the document to be annotated when a document to be annotated is obtained, using a preset large language model. The prompt word template is then used to analyze the document to be annotated to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, review objective descriptions, and output format constraints. The suggestion list includes multiple modification suggestions, each of which corresponds to a document keyword in the document to be annotated and the logical description position of the document keyword. The document keyword is any phrase in the document to be annotated. Position mapping engine module 320 is used to construct a position mapping table between each character and the physical position of the text in the document to be annotated; The keyword positioning module 330 is used to determine multiple annotation keywords based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list, wherein the annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords; The location mapping engine module 320 is also used to convert the logical description location of each of the annotation keywords into a text physical location based on the location mapping table; The annotation writing module 340 is used to insert modification suggestions corresponding to each of the annotation keywords in the document to be annotated according to the text physical position of each of the annotation keywords, in the form of annotations, and to obtain and output the annotated document.

[0073] In one embodiment, the location mapping engine module 320 is further configured to: Each text paragraph in the document to be annotated is divided into multiple text blocks, and the first mapping relationship between each text block and its corresponding text paragraph is recorded; Determine the character offset of each character in each text block, and establish a second mapping relationship between each character and its corresponding text block; Establish a third mapping relationship between the character offset of each character and the text unit; Based on the first mapping relationship, the second mapping relationship, the third mapping relationship, and the physical location of the text corresponding to each text unit, a position mapping table between each character and the physical location of the text in the document to be annotated is determined.

[0074] In one embodiment, the keyword positioning module 330 is further configured to: In the document to be annotated, search for the document keywords corresponding to each modification suggestion in the suggestion list, and record the number of times each document keyword appears and the length of the phrase; Determine the nesting relationships between the keywords in each document; Based on the frequency of occurrence of each document keyword, the phrase length, and the nesting relationship between the document keywords, conflict filtering is performed on multiple document keywords to obtain multiple annotation keywords.

[0075] In one embodiment, the keyword positioning module 330 is further configured to: When the first document keyword appears more than once, the first document keyword that appears first is determined as the first candidate keyword based on the order in which the first document keywords appear, wherein the first document keyword can be any one of the document keywords; Based on the nesting relationship between the document keywords, a second document keyword that has a nesting relationship with the first candidate keyword is determined; When the number of keywords in the second document is not zero, the first candidate keywords and the second document keywords are sorted in descending order according to the phrase length, and the keyword at the beginning is used as the annotation keyword.

[0076] In one embodiment, the keyword positioning module 330 is further configured to: When the number of keywords in the second document is zero, the first candidate keyword is used as the annotation keyword.

[0077] In one embodiment, the annotation writing module 340 is further configured to: Based on the textual physical location of each of the aforementioned annotation keywords, determine the target text paragraph to which each of the aforementioned annotation keywords belongs; Call the document service interface to clear the target text paragraph containing the annotation keywords in the document to be annotated; The ordinary text characters that make up the target text paragraph are rewritten in the original text style of the target text paragraph in sequence, wherein the ordinary text characters are characters other than the annotation keywords; The annotation keywords belonging to the target text paragraph are rewritten as independent fragments according to the original text style, and modification suggestions corresponding to the annotation keywords are inserted according to the annotation method corresponding to the document format of the document to be annotated. When the annotation status of each of the aforementioned annotation keywords is "annotation successful", the annotated document is obtained and output.

[0078] In one embodiment, the structured suggestion module 310 is further configured to: When a document to be annotated is obtained, a prompt word template is generated based on the user's input review objectives and the document to be annotated using a preset large language model. The document to be annotated is then analyzed in conjunction with the prompt word template to generate an annotation list. The annotation list is validated using a format validator to obtain the validation result; If the verification result is successful, the annotation list will be used as the suggestion list.

[0079] like Figure 4 As shown, this application provides a computer device including a processor 711, a communication interface 712, a memory 713, and a communication bus 714, wherein the processor 711, the communication interface 712, and the memory 713 communicate with each other through the communication bus 714. Memory 713 is used to store computer programs; When the processor 711 executes the program stored in the memory 713, it implements the document annotation method provided in any of the foregoing method embodiments.

[0080] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0081] In one embodiment, the document annotation device provided in this application can be implemented as a computer program, and the computer program can be implemented as follows: Figure 4 It runs on the computer device shown. The computer device's memory can store the various program modules that make up the document annotation device, for example, Figure 3 The structured suggestion module 310, location mapping engine module 320, keyword positioning module 330, and annotation writing module 340 are shown. The computer program comprised of these modules causes the processor to execute the document annotation methods of the various embodiments of this application described in this specification.

[0082] Figure 4 The computer equipment shown can be used as follows Figure 3 The structured suggestion module 310 in the document annotation device, upon acquiring the document to be annotated, uses a preset large language model to generate a prompt word template based on the user-input review objectives and the document to be annotated. It then analyzes the document to be annotated using the prompt word template to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, a review objective description, and output format constraints. The suggestion list includes multiple modification suggestions, each corresponding to a document keyword in the document to be annotated and its logical description position. The document keyword can be any phrase in the document to be annotated. The computer device can construct a position mapping table between each character in the document to be annotated and its physical text position using the position mapping engine module 320. The computer device can determine multiple annotation keywords based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list using the keyword positioning module 330. The annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords. The computer device can use the location mapping engine module 320 to convert the logical description positions of each annotation keyword into text physical positions based on the location mapping table. The computer device can use the annotation writing module 340 to insert modification suggestions corresponding to each annotation keyword in the document to be annotated according to the text physical positions of each annotation keyword, and then obtain and output the annotated document.

[0083] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the document annotation method provided in any of the foregoing method embodiments.

[0084] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0085] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general-purpose hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server 120, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0086] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "a," "an," and "described" as used herein may also mean including the plural forms. The terms "comprising," "including," "containing," and "having" are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that alternatives or substitutions may be used.

[0087] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.< / w:comment>

Claims

1. A method of document annotation, characterized by, The method includes: Upon receiving a document to be annotated, a pre-defined large language model is used to generate a prompt word template based on the user-input review objectives and the document to be annotated. The document to be annotated is then analyzed in conjunction with the prompt word template to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, a description of the review objectives, and output format constraints. The suggestion list includes multiple modification suggestions, each corresponding to a document keyword in the document to be annotated and the logical description position of the document keyword. The document keyword can be any phrase in the document to be annotated. Construct a position mapping table between each character and the physical location of the text in the document to be annotated; Based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list, multiple annotation keywords are determined, wherein the annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords; Based on the location mapping table, the logical description location of each of the annotation keywords is converted into the text physical location; In the document to be annotated, modification suggestions corresponding to each of the annotation keywords are inserted in the form of annotations according to the text physical location of each annotation keyword, and the annotated document is obtained and output.

2. The method according to claim 1, characterized in that, The construction of the position mapping table between each character in the document to be annotated and its physical text location includes: Each text paragraph in the document to be annotated is divided into multiple text blocks, and the first mapping relationship between each text block and its corresponding text paragraph is recorded; Determine the character offset of each character in each text block, and establish a second mapping relationship between each character and its corresponding text block; Establish a third mapping relationship between the character offset of each character and the text unit; Based on the first mapping relationship, the second mapping relationship, the third mapping relationship, and the physical location of the text corresponding to each text unit, a position mapping table between each character and the physical location of the text in the document to be annotated is determined.

3. The method according to claim 1, characterized in that, The step involves determining multiple annotation keywords based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list, including: In the document to be annotated, search for the document keywords corresponding to each modification suggestion in the suggestion list, and record the number of times each document keyword appears and the length of the phrase; Determine the nesting relationships between the keywords in each document; Based on the frequency of occurrence of each document keyword, the phrase length, and the nesting relationship between the document keywords, conflict filtering is performed on multiple document keywords to obtain multiple annotation keywords.

4. The method according to claim 3, characterized in that, The method involves performing conflict filtering on multiple document keywords based on the frequency of occurrence of each document keyword, phrase length, and nesting relationships between the document keywords, to obtain multiple annotation keywords, including: When the first document keyword appears more than once, the first document keyword that appears first is determined as the first candidate keyword based on the order in which the first document keywords appear, wherein the first document keyword can be any one of the document keywords; Based on the nesting relationship between the document keywords, a second document keyword that has a nesting relationship with the first candidate keyword is determined; When the number of keywords in the second document is not zero, the first candidate keywords and the second document keywords are sorted in descending order according to the phrase length, and the keyword at the beginning is used as the annotation keyword.

5. The method according to claim 4, characterized in that, After determining the second document keyword that has a nested relationship with the first candidate keyword based on the nesting relationship between the various document keywords, the method further includes: When the number of keywords in the second document is zero, the first candidate keyword is used as the annotation keyword.

6. The method according to claim 1, characterized in that, The process of inserting modification suggestions corresponding to each of the annotation keywords into the document to be annotated, according to the textual physical location of each annotation keyword, in the form of annotations, to obtain and output the annotated document includes: Based on the textual physical location of each of the aforementioned annotation keywords, determine the target text paragraph to which each of the aforementioned annotation keywords belongs; Call the document service interface to clear the target text paragraph containing the annotation keywords in the document to be annotated; The ordinary text characters that make up the target text paragraph are rewritten in the original text style of the target text paragraph in sequence, wherein the ordinary text characters are characters other than the annotation keywords; The annotation keywords belonging to the target text paragraph are rewritten as independent fragments according to the original text style, and modification suggestions corresponding to the annotation keywords are inserted according to the annotation method corresponding to the document format of the document to be annotated. When the annotation status of each of the aforementioned annotation keywords is "annotation successful", the annotated document is obtained and output.

7. The method according to claim 1, characterized in that, Upon receiving a document to be annotated, a pre-defined large language model is used to generate a prompt word template based on the user-input review objectives and the document to be annotated. The document to be annotated is then analyzed using the prompt word template to generate a suggestion list, including: When a document to be annotated is obtained, a prompt word template is generated based on the user's input review objectives and the document to be annotated using a preset large language model. The document to be annotated is then analyzed in conjunction with the prompt word template to generate an annotation list. The annotation list is validated using a format validator to obtain the validation result; If the verification result is successful, the annotation list will be used as the suggestion list.

8. A document annotation device, characterized in that, The device includes: The structured suggestion module is used to generate a prompt word template based on the user-input review objectives and the document to be annotated when a document to be annotated is obtained, using a preset large language model. The prompt word template is then used to analyze the document to be annotated to generate a suggestion list. The prompt word template includes text fragment identifiers, contextual information, review objective descriptions, and output format constraints. The suggestion list includes multiple modification suggestions, each corresponding to a document keyword in the document to be annotated and the logical description position of the document keyword. The document keyword can be any phrase in the document to be annotated. The position mapping engine module is used to construct a position mapping table between each character and the physical location of the text in the document to be annotated. The keyword positioning module is used to determine multiple annotation keywords based on the matching results between the document to be annotated and the document keywords corresponding to each modification suggestion in the suggestion list. The annotation keywords are the document keywords to be annotated, and the number of annotation keywords is less than the number of document keywords. The location mapping engine module is also used to convert the logical description location of each of the annotation keywords into a text physical location based on the location mapping table; The annotation writing module is used to insert modification suggestions corresponding to each annotation keyword in the document to be annotated according to the text physical location of each annotation keyword, in the form of annotations, and to obtain and output the annotated document.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Annotation adding method, electronic equipment, and related devices

    CN114077825A

  • System for enhanced ink gesture support

    US20250258996A1