System and method for document metadata analysis and generation
View Patent ↗Provided is a system and a computer implemented method for generating metadata for a document and documents therefrom. A document is received for analysis via a communication interface a document for analysis. Text is extracted from the document and using a structural analyser model a plurality of segment titles therein are identified and regular expressions derived therefrom. A segmented document is generated comprising extracted text in logical segments with corresponding segment titles by analysing the generated regular expressions. For at least some of the plurality of the logical segments of the segmented document structured metadata summaries of that segment are generated using a metadata creator model. Document metadata thereof is also generated using a metadata creator model. When a new document is requested, using a library of documents and corresponding metadata that document may be generated.
1 . A computer implemented method for generating a document having a given document type, the method comprising:
receiving, by one or more processors of a computing system and via a communication interface, a document request specifying the document type;
generating, by the one or more processors, text content for a plurality of segments based on the document type, wherein each segment is generated by the one or more processors through automated retrieval and processing of segment metadata retrieved from a document library of previously analyzed documents stored in a database;
extracting, by a large language model executed by the one or more processors, defined terms from the generated text content, the large language model being configured to identify terms and definitions of the terms across the plurality of segments;
modifying, by a consistency checker module executed by the one or more processors, the defined terms to create consistent versions through comparison of the definitions across the plurality of segments and generation of definitions performed by the consistency checker module based on stored digital data structures in memory of the computing system, wherein the consistency checker module compares different definitions of a same defined term extracted from different segments of the plurality of segments to identify inconsistencies therein and generates each consistent version by combining the different definitions of the same defined term into a single refined definition, wherein the modifying comprises generating a clean defined terms data structure comprising, for one or more of the defined terms, a corresponding consistent version and an associated refined definition;
replacing, by the one or more processors, the defined terms in the text content with the consistent versions within a digital document data structure stored in the memory of the computing system to generate the document, wherein the replacing comprises replacing the definitions associated with one or more the defined terms with the associated refined definition from the clean defined terms data structure when inconsistencies exist between an initial definition and the associated refined definition; and
outputting, by the one or more processors, the document to a user interface or client device via the communication interface.
2 . The method of claim 1 , wherein generating text content for the plurality of segments comprises:
retrieving, via a database query, the segment metadata from the document library based on similarity between the requested segment and previously analyzed segments; and
generating the text content based on the retrieved segment metadata.
3 . The method of claim 1 , further comprising:
generating, by a document outlining module executed by the one or more processors, a document outline data structure specifying the plurality of segments before generating the text content for the plurality of segments.
4 . The method of claim 1 , wherein the consistency checker module is configured to:
analyze the defined terms from the plurality of segments;
identify inconsistencies between definitions of the defined terms across the plurality of segments; and
generate the consistent versions by addressing the inconsistencies.
5 . The method of claim 1 , further comprising:
generating a dedicated defined terms segment comprising the consistent versions and associated definitions; and
inserting the dedicated defined terms segment into the document.
6 . The method of claim 1 , wherein the document library comprises a plurality of previously analyzed documents and, for one or more of the plurality of previously analyzed documents, structured metadata comprising the segment metadata and document metadata.
7 . The method of claim 1 , wherein extracting the defined terms comprises:
generating a dictionary data structure comprising entries, wherein each entry comprises a defined term, a corresponding definition, and a content identifier associating the defined term to a source segment; and
for the defined terms in multiple segments, updating an existing entry in the dictionary data structure by adding additional definition information from a subsequent segment when the additional definition information adds detail not present in the existing entry.
8 . The method of claim 1 , wherein modifying the defined terms comprises:
inserting the defined terms into a pre-defined prompting template to generate a defined terms prompt;
providing the defined terms prompt as a few-shot learning example to the consistency checker module; and
generating the consistent versions by the consistency checker module with the defined terms prompt as pre-prompt tuning.
9 . The method of claim 1 , wherein replacing the defined terms comprises:
generating a mapping data structure that maps each extracted defined term to a corresponding consistent version and an updated definition;
comparing one or more defined terms with a corresponding consistent version to identify changes made during consistency checking;
replacing definitions associated with the one or more defined terms when inconsistencies exist between an initial definition and the updated definition; and
iterating through each segment to replace one or more occurrences of the one or more defined terms with the corresponding consistent version in the mapping data structure.
10 . The method of claim 1 , wherein:
the segment metadata are generated by a metadata creator module that analyzes text of previously analyzed documents divided into logical segments, and
the segment metadata is stored in a first data library associated with a corresponding previously analyzed document stored in a separate document library.
11 . The method of claim 1 , further comprising:
iterating through the plurality of segments in sequence, wherein extracting defined terms comprises, for a first segment, creating an empty defined terms data structure, and for each subsequent segment, extracting defined terms from the subsequent segment and adding the extracted defined terms to the defined terms data structure, and wherein modifying the defined terms is performed after the defined terms have been extracted from the plurality of segments.
12 . A non-transitory machine-readable medium for generating a document having a given document type, the non-transitory machine-readable medium storing instructions which, when executed by one or more processors of a computing system, cause the one or more processors to perform operations comprising:
receiving, by the one or more processors and via a communication interface, a document request specifying the document type;
generating, by the one or more processors, text content for a plurality of segments based on the document type, wherein each segment is generated by the one or more processors through automated retrieval and processing of segment metadata retrieved from a document library of previously analyzed documents stored in a database;
extracting, by a large language model executed by the one or more processors, defined terms from the generated text content, the large language model being configured to identify terms and definitions of the terms across the plurality of segments;
modifying, by a consistency checker module executed by the one or more processors, the defined terms to create consistent versions through comparison of the definitions across the plurality of segments and generation of definitions performed by the consistency checker module based on stored digital data structures in memory of the computing system, wherein the consistency checker module compares different definitions of a same defined term extracted from different segments of the plurality of segments to identify inconsistencies therein and generates each consistent version by combining the different definitions of the same defined term into a single refined definition, wherein the modifying comprises generating a clean defined terms data structure comprising, for one or more of the defined terms, a corresponding consistent version and an associated refined definition;
replacing, by the one or more processors, the defined terms in the text content with the consistent versions within a digital document data structure stored in the memory of the computing system to generate the document, wherein the replacing comprises replacing the definitions associated with one or more the defined terms with the associated refined definition from the clean defined terms data structure when inconsistencies exist between an initial definition and the associated refined definition; and
outputting, by the one or more processors, the document to a user interface or client device via the communication interface.
13 . The non-transitory machine-readable medium of claim 12 , wherein extracting the defined terms comprises:
generating a dictionary data structure comprising entries, wherein each entry comprises a defined term, a corresponding definition, and a content identifier associating the defined term to a source segment; and
for the defined terms in multiple segments, updating an existing entry in the dictionary data structure by adding additional definition information from a subsequent segment when the additional definition information adds detail not present in the existing entry.
14 . The non-transitory machine-readable medium of claim 12 , wherein modifying the defined terms comprises:
inserting the defined terms into a pre-defined prompting template to generate a defined terms prompt;
providing the defined terms prompt as a few-shot learning example to the consistency checker module; and
generating the consistent versions by the consistency checker module with the defined terms prompt as pre-prompt tuning.
15 . The non-transitory machine-readable medium of claim 12 , wherein replacing the defined terms comprises:
generating a mapping data structure that maps each extracted defined term to a corresponding consistent version and an updated definition;
comparing one or more defined terms with a corresponding consistent version to identify changes made during consistency checking;
replacing definitions associated with the one or more defined terms when inconsistencies exist between an initial definition and the updated definition; and
iterating through each segment to replace one or more occurrences of the one or more defined terms with the corresponding consistent version in the mapping data structure.
16 . The non-transitory machine-readable medium of claim 12 , wherein:
the segment metadata are generated by a metadata creator module that analyzes text of previously analyzed documents divided into logical segments, and
the segment metadata is stored in a first data library associated with a corresponding previously analyzed document stored in a separate document library.
17 . The non-transitory machine-readable medium of claim 12 , the operations further comprising:
iterating through the plurality of segments in sequence, wherein extracting defined terms comprises, for a first segment, creating an empty defined terms data structure, and for each subsequent segment, extracting defined terms from the subsequent segment and adding the extracted defined terms to the defined terms data structure, and wherein modifying the defined terms is performed after the defined terms have been extracted from the plurality of segments.
18 . A system for generating a document having a given document type, the system comprising:
one or more processors; and
memory storing instructions which, when executed by one or more processors, cause the one or more processors to perform operations comprising:
receiving, by the one or more processors and via a communication interface, a document request specifying the document type;
generating, by the one or more processors, text content for a plurality of segments based on the document type, wherein each segment is generated by the one or more processors through automated retrieval and processing of segment metadata retrieved from a document library of previously analyzed documents stored in a database;
extracting, by a large language model executed by the one or more processors, defined terms from the generated text content, the large language model being configured to identify terms and definitions of the terms across the plurality of segments;
modifying, by a consistency checker module executed by the one or more processors, the defined terms to create consistent versions through comparison of the definitions across the plurality of segments and generation of definitions performed by the consistency checker module based on stored digital data structures in the memory, wherein the consistency checker module compares different definitions of a same defined term extracted from different segments of the plurality of segments to identify inconsistencies therein and generates each consistent version by combining the different definitions of the same defined term into a single refined definition, wherein the modifying comprises generating a clean defined terms data structure comprising, for one or more of the defined terms, a corresponding consistent version and an associated refined definition;
replacing, by the one or more processors, the defined terms in the text content with the consistent versions within a digital document data structure stored in the memory to generate the document, wherein the replacing comprises replacing the definitions associated with one or more the defined terms with the associated refined definition from the clean defined terms data structure when inconsistencies exist between an initial definition and the associated refined definition; and
outputting, by the one or more processors, the document to a user interface or client device via the communication interface.
19 . The system of claim 18 , wherein generating text content for the plurality of segments comprises:
retrieving, by a database query, the segment metadata from the document library based on similarity between the requested segment and previously analyzed segments; and
generating the text content based on the retrieved segment metadata.
20 . The system of claim 18 , the operations further comprising:
generating, by a document outlining module executed by the one or more processors, a document outline data structure specifying the plurality of segments before generating the text content for the plurality of segments.