Text abstract generation method and device based on large model and electronic equipment

By using a large-model-based text summarization method to parse legal text using paragraph templates and regular expressions, and combining adaptive switching between segmented and full-text summarization routes, the problem of insufficient adaptability of legal text summarization results is solved, achieving higher accuracy and consistency.

CN121901412APending Publication Date: 2026-04-21BEIJING MEGA INTELLIGENT TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING MEGA INTELLIGENT TECHNOLOGY CO LTD
Filing Date
2025-12-30
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing methods for generating legal text summaries are insufficient in terms of adaptability and accuracy. They struggle to handle legal documents of different types and lengths and lack detailed modeling of the structure of legal documents, resulting in inaccurate summaries and logical inconsistencies.

Method used

A large-model-based text summarization method is adopted. Legal text is parsed using paragraph templates and regular expression sets. Segmentation detection is performed by combining keywords and regular expressions. The final summary result is generated by adaptively switching between segmented summarization route and full-text summarization route, ensuring structural integrity and content accuracy.

Benefits of technology

It achieves adaptive processing of legal documents of different lengths and structures, enhances the adaptability, stability and controllability of the abstract generation results, improves the accuracy and consistency of the abstracts, and reduces the risk of illusion generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901412A_ABST
    Figure CN121901412A_ABST
Patent Text Reader

Abstract

The invention provides a text abstract generation method and device based on a large model and electronic equipment, and relates to the field of natural language process.The method comprises the steps that a legal text is analyzed, legal information is extracted through a paragraph template and a regular expression set based on an analysis result, and an extraction result is obtained; carrying out segmentation detection on structural integrity and content accuracy on an extraction result by utilizing a keyword and regular expression mode, and if a segmentation detection result is unqualified, switching to a large model and cue word mode to carry out intelligent segmentation on the legal text; comprehensively judging the document type, the segmentation quality and the length based on the segmentation result, and determining to generate an initial abstract result by utilizing a segmentation abstract route or a full-text abstract route according to a judgment result; and performing speculative expression consistency detection on the initial abstract result, if the consistency is detected to be inconsistent, performing route switching between the segmented abstract route and the full-text abstract route, and generating a final abstract result through the switched route.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a method, apparatus, and electronic device for text summarization generation based on a large model. Background Technology

[0002] Currently, with the advancement of judicial informatization and digitalization, a large number of legal documents, such as judgments, rulings, and mediation agreements, are being continuously published through judicial open platforms, and their scale is rapidly growing. Legal documents are highly specialized, written in a rigorous style, and contain various structural information, including party information, factual findings, legal basis, and judgment results. Legal document summarization, as a core task of intelligent systems, aims to extract key information from lengthy legal documents, including but not limited to facts, disputes, court findings, and judgment results, making it easier for judicial professionals and the general public to understand and read the documents more efficiently. Simultaneously, extracting essential elements from legal documents also helps improve the retrieval and recall of relevant legal documents.

[0003] Unlike general document summaries, legal documents have higher accuracy requirements. Any inappropriate simplification or omission can distort the facts and content, leading to misjudgments. Therefore, summarizing legal documents requires not only strong text compression capabilities from the model, but also higher standards for legal language, logical reasoning, and other aspects. However, current methods for generating legal text summaries are limited and lack flexibility, resulting in low adaptability of the generated results. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, and electronic device for generating text summarization based on a large model, in order to solve the technical problem of low adaptability of current legal text summarization results.

[0005] In a first aspect, this application provides a text summarization generation method based on a large model, the method comprising: The process involves acquiring the legal text to be processed, parsing the legal text, and obtaining the parsing result; the legal text corresponds to a preset paragraph template and a set of regular expressions. Based on the parsing results, legal information is extracted using the paragraph template and regular expression set to obtain the extraction results. The extracted results are then segmented for structural integrity and content accuracy using keywords and regular expressions. If the segmentation detection results are unqualified, the method of using a large model and prompt words is switched to intelligent segmentation of the legal text to obtain the segmentation results. Based on the segmentation results, a comprehensive judgment is made on the document type, segmentation quality, and length. Based on the judgment results, it is determined whether to use a segmented summary route or a full-text summary route to generate initial summary results. The segmented summary route involves constructing a summary based on the segmentation results, including a case overview, reasoning, and judgment. The full-text summary route involves inputting the full text of the legal text into the large model and generating the case overview, reasoning, and judgment based on a preset multi-segment summary template. The initial summary results are subjected to a consistency check of speculative representations. If a consistency discrepancy is detected, the route is switched between the segmented summary route and the full-text summary route. The final summary results are generated through the switched route.

[0006] In one possible implementation, parsing the legal text to obtain the parsing result includes: The legal text is subjected to basic analysis, and basic information is extracted from it; wherein, the basic information includes at least one of the following: case number, document type, case type, and trial stage; Based on the basic information, the legal text is routed to the corresponding segmentation strategy and summary template.

[0007] In one possible implementation, the paragraph template and regular expression set corresponding to the legal text are determined based on the document type, case type, and trial stage of the legal text; after performing segmentation checks on the extraction results using keywords and regular expressions to verify structural integrity and content accuracy, the method further includes: If the segmented test result is qualified, then the segmentation is performed directly to obtain the segmented result; The intelligent segmentation process using the large model and prompt words includes: using prompt words to indicate the document type and target structure, so that the large model can automatically label the type of each paragraph according to semantics and context, and re-detect and correct the segmentation results to ensure that the final segmentation results meet the input requirements of the summary template.

[0008] In one possible implementation, after switching routes between the segmented summary route and the full-text summary route, the method further includes: On the server side of the large model, an access matrix and queue monitoring are deployed based on the Virtual Large Language Model (vLLM) inference service engine. The input length, prompt word type and runtime status of different summary generation requests are monitored in real time. Dynamic traffic distribution and queue management are performed in combination with the characteristics of summary generation tasks to avoid task blocking caused by task allocation based on the number of tasks.

[0009] In one possible implementation, determining whether to generate the initial summary result using a segmented summarization route or a full-text summarization route based on the judgment result includes: The initial summary result is generated by prioritizing the segmented summary route. If the segmented detection result corresponding to the segmented result is unqualified, the initial summary result is generated by using the full-text summary route. If the document type corresponding to the segmented result is a criminal judgment, the initial summary result is generated by using the full-text summary route and extracting the summary results of each part.

[0010] In one possible implementation, the case summary is generated by the large model according to a preset format based on segmented content and the full text. If the segmented results lack relevant content of the case summary, targeted adjustments are made according to different summary format templates to avoid the large model generating non-existent content. The reasoning for the judgment includes segmenting the facts and reasons found by the court at the current trial stage to generate structured reasoning for the judgment. The segmentation method distinguishes the reasoning for the judgment at different trial stages to avoid confusion between different levels of trial. The judgment result is an extraction and standardized expression of a portion of the judgment. The summary is constructed based on the segmented results, including a case overview, reasoning, and judgment, and includes: Based on the segmented results, a summary is constructed according to the case overview, the reasoning of the judgment, and the judgment result. According to the completeness of the segmented content and the segmented type, the corresponding prompt word template is automatically selected. For the segmented content of each segmented type, the large model is called to generate summary content through the prompt word template. Based on the summary content, an overall summary is generated by extraction and integration.

[0011] In one possible implementation, the step of inputting the full text of the legal text into the large model and generating case details, reasoning, and judgment based on a preset multi-segment summary template includes: If the segmentation result is unqualified or the segmented summary fails the output detection after multiple retries, the system will automatically switch to the full-text summary route, input the full text of the legal text into the large model, and generate the case details, judgment reasoning and judgment result according to the preset three-segment summary template to obtain the full-text summary result. The full-text summary results are subjected to structured extraction and detection. If the full-text summary results do not meet the format requirements corresponding to the preset generation rules, or if factual details and / or missummarized judgment reasons that are not present in the original text that generated the legal text are detected, then the summary is regenerated using the full-text content of the legal text.

[0012] In one possible implementation, the consistency check of the speculative representation of the initial summary result, and the route switching between the segmented summary route and the full-text summary route if a consistency discrepancy is detected, and the final summary result is generated through the switched route, includes: The initial summary result is subjected to structured extraction and format rule detection to obtain an intermediate summary result after format and structure detection; Based on the preset legal document specifications and the prompt word template, the consistency of some key elements in the speculative statements appearing in the intermediate summary results with the original text of the legal text is compared and detected by combining regular expressions and keyword rules. If the speculative statements are found to have inconsistent results, the template library rules are triggered, and the route is switched between the segmented summary route and the full-text summary route. The final summary result is generated through the switched route.

[0013] Secondly, this application provides a text summarization generation apparatus based on a large model, comprising: The parsing module is used to acquire the legal text to be processed, parse the legal text, and obtain the parsing result; the legal text corresponds to a preset paragraph template and a set of regular expressions. The detection module is used to extract legal information based on the parsing results using the paragraph template and regular expression set, obtain the extraction results, and perform segmentation detection on the extracted results for structural integrity and content accuracy using keywords and regular expressions. If the segmentation detection results are unqualified, the module switches to the large model and prompt word method to perform intelligent segmentation on the legal text, and obtain segmentation results. The determination module is used to comprehensively judge the document type, segment quality, and length based on the segmentation results, and determine whether to generate an initial summary result using a segmented summary route or a full-text summary route based on the judgment results. The segmented summary route is to construct a summary based on the segmentation results according to the case summary, the reasoning of the judgment, and the judgment result. The full-text summary route is to input the full text of the legal text into the large model and generate the case summary, the reasoning of the judgment, and the judgment result according to the preset multi-segment summary template. The switching module is used to perform consistency checks on the speculative representation of the initial summary results. If a consistency discrepancy is detected, the module switches between the segmented summary route and the full-text summary route, and generates the final summary result through the switched route.

[0014] Thirdly, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the method described in the first aspect above.

[0015] Fourthly, this application also provides a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the method described in the first aspect above.

[0016] This application brings the following beneficial effects: This application provides a text summarization method, apparatus, and electronic device based on a large model. It can acquire legal text to be processed, parse the legal text, and obtain parsing results. The legal text corresponds to a preset paragraph template and regular expression set. Based on the parsing results, legal information is extracted using the paragraph templates and regular expression set to obtain extraction results. The extracted results are then segmented using keywords and regular expressions to check structural integrity and content accuracy. If the segmentation detection result is unqualified, the method switches to a large model and prompt word approach for intelligent segmentation of the legal text, obtaining segmentation results. Based on the segmentation results, the document type, segmentation quality, and length are comprehensively judged, and an initial summary result is generated using either a segmented summarization route or a full-text summarization route based on the judgment results. The segmented summarization route is based on the segmentation results and follows the order of case overview, reasoning, and judgment. The abstract construction process involves inputting the full text of the legal text into the large model and generating case details, reasoning, and judgment based on a preset multi-segment abstract template. The initial abstract result undergoes a consistency check of speculative representations. If a consistency discrepancy is detected, the process switches between the segmented abstract route and the full-text abstract route, generating the final abstract result through the switched route. This solution utilizes a dual-route approach—using both segmented and full-text abstract routes to generate the initial abstract result—combined with pre-input and post-output detection. This bidirectional detection before and after input drives the adaptive switching of the segmented and full-text abstract routes, enabling adaptive processing of documents of different lengths and structures. This enhances the adaptability, stability, and controllability of the abstract generation results for extremely long legal documents, solving the current technical problem of low adaptability in legal text abstract generation results.

[0017] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 A flowchart illustrating the text summarization method based on a large model provided in this application embodiment; Figure 2 Another flowchart illustrating the text summarization method based on a large model provided in this application embodiment; Figure 3 A schematic diagram of a text summarization device based on a large model provided in this application embodiment; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions 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 terms "comprising" and "having," and any variations thereof, used in the embodiments of this application, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.

[0022] Currently, for the judicial field, the automatic summarization of legal documents such as judgments and rulings mainly follows these technical approaches: (1) Traditional structured extraction techniques based on rules and keywords: These methods typically rely on pre-designed rule templates, feature word lists, paragraph heading patterns, etc., to deconstruct different structures in documents and extract key information such as case details, reasoning, and judgment results. These methods are simple to implement and highly interpretable, but they have the following problems: Insufficient rule generalization ability: There are huge differences in document formats among different courts, different trial levels, different eras, and different case types, and even within the same court, there are differences in writing habits. Manually written rules are often effective for specific styles and are difficult to stably migrate and generalize in large-scale, multi-source document scenarios, resulting in high rule maintenance costs. Furthermore, they lack true structure perception ability: These methods rely heavily on surface features (such as keywords, fixed headings, and fixed positions) and lack the ability to model complex chapter structures and legal argumentation structures, making it difficult to accurately identify facts, points of contention, and legal reasons when there are complex writing styles such as cross-paragraph citations and supplementary explanations.

[0023] (2) Machine learning and traditional NLP extraction methods: These methods typically treat legal documents as a sequence of sentences. Combining extraction-based summarization techniques such as TF-IDF and TextRank, the document content is segmented into sentences. Then, the sentences are scored using content structure features, statistical models, or shallow neural networks. Several "important sentences" are selected and spliced ​​together to form a summary. Since the original sentences are directly retained, the risk of direct content alteration is relatively low, and it also has a certain degree of interpretability. However, the following problems exist: the summary is a simple splicing, resulting in poor readability and coherence. There is a lack of connection and rewriting between different sentences. The summary generated solely through scoring and splicing is prone to problems such as awkward language and logical jumps. Moreover, the lack of global semantic modeling of long texts makes it easy to "take things out of context." The model's judgment of sentence importance is mostly based on local statistics or local features, making it difficult to accurately grasp the semantic dependencies across paragraphs and parts. It is easy to extract descriptive sentences that are not closely related to the key points of contention, and even "take things out of context." Furthermore, there is a lack of differentiation in document type and structure. Different types of documents (such as civil, criminal, and administrative documents) differ significantly in structure and focus. Existing extraction methods often fail to model document types in detail, still employing a uniform strategy, which can easily lead to inaccurate extraction of key points for certain document types or even produce erroneous summaries. In addition, there is a lack of deep semantic understanding and legal expertise. Due to a lack of understanding of professional elements such as "legal relationships" and "key facts and evidence," the model struggles to distinguish the content that truly affects the judgment outcome when scoring, easily overlooking crucial information.

[0024] (3) Direct summarization method based on pre-trained models: This type of method is usually based on pre-trained language models such as BERT, T5, and BART, and is fine-tuned on legal corpora to achieve end-to-end generative summarization: input a legal document and directly generate the corresponding summary text. Compared with traditional extraction methods, the summaries generated by this type of method are usually better in terms of readability and language coherence. However, there are the following problems: the input length is limited, making it difficult to cover the complete document. That is, pre-trained models generally have a maximum input length limit, while legal documents are often long and vary greatly in length. In practical applications, it is usually necessary to forcibly truncate or segment the document for summarization, which can easily cause the context to be broken, destroy the integrity of the case facts and legal reasoning chain, and result in incoherent summary logic. Moreover, the training data coverage is insufficient, making it difficult to take into account various case scenarios. The fields covered by legal documents are extremely wide, such as civil disputes involving marriage and family, labor disputes, intellectual property, financial lending and other life and business scenarios. It is difficult to construct a high-quality labeled training set that is large enough and diverse to cover all scenarios, resulting in unstable generation performance of the model on unseen or rare types of cases. Furthermore, generative models, which lack sufficient legal knowledge and logical reasoning ability, can summarize and rewrite at the natural language level, but their understanding of core legal concepts such as "legal relationship" and "constitutive elements" mainly relies on training data and lacks explicit reasoning and constraint mechanisms, which can easily lead to inaccurate summaries.

[0025] (4) Large-scale model-driven summarization methods: These methods are based on general-purpose large language models and utilize techniques such as prompt design, few-shot examples, chained thinking (CoT), and retrieval-enhanced generation (RAG) to enable the model to directly generate legal document summaries based on the input document content. Compared with general methods based on pre-trained models, large language models have advantages in language generation capabilities and zero-shot / few-shot generalization capabilities, and usually do not require a large amount of additional training data to achieve good summarization results. However, in judicial scenarios, the following problems exist: the risk of "illusion" is serious, and there is a lack of consistency between facts and legal provisions. Large language models may generate factual details that do not exist in the document and mis-summarize the reasons for the judgment. Such "illusions" are unacceptable in judicial scenarios and will seriously interfere with the user's understanding of the case. Existing methods generally lack mechanisms for verifying and constraining the results. Furthermore, the unique structure of legal documents is not fully utilized. Although some methods introduce external knowledge for retrieval enhancement, most still treat judgments as ordinary long texts, failing to make full use of the inherent chapter structure and tag information (such as fact-finding, court opinion, and judgment result) within the document. This results in the summary failing to consistently highlight the content of the points of contention. Moreover, the processing of extremely long documents is crude, easily resulting in the loss of key information. To meet the model's context length constraints, existing solutions often simply truncate or coarsely segment the document, which may lead to the omission of key information or the disruption of reasoning chains across paragraphs, affecting the accuracy and completeness of the summary.

[0026] (5) Common problems and difficulties in engineering practice. From an engineering perspective, legal document summarization currently faces the following problems and difficulties: It is difficult to ensure the consistency of the summary structure and style. In the scenario of large-scale batch generation of summaries, existing methods often cannot guarantee the uniformity of the summary structure, information presentation order and expression style of documents of the same type and from the same source, resulting in poor user reading experience and hindering subsequent case retrieval, statistical analysis and quantitative research. Moreover, the sources of documents are diverse and the formats vary greatly, making unified processing difficult. Legal documents of different types, categories and years differ significantly in format, field annotation and content organization. Existing methods mostly rely on a unified preprocessing and summarization process, which is difficult to adapt to the specific document structure in a fine-grained manner, resulting in high costs and many error points in model cleaning, segmentation and structuring. Furthermore, there is a deviation between the evaluation indicators and the actual judicial demands. The automatic evaluation indicators commonly used in the technical field (such as ROUGE, Perplexity, etc.) mainly measure text similarity or language fluency, which is difficult to directly reflect the dimensions that the judicial field is more concerned with, such as "whether key facts are omitted" and "whether the legal logic is complete and correct". Existing systems often target general metrics when optimizing models, resulting in a mismatch between the optimization direction and the actual judicial application scenarios.

[0027] Therefore, the following problems exist in the generation of legal text summaries in existing technologies. Insufficient utilization of legal document structure leads to inaccurate summaries: Most existing methods treat judgments and rulings as ordinary long texts, lacking detailed modeling of document type (judgment / ruling), case type (civil / criminal / administrative), trial stage (first instance / second instance / retrial), and the structure of "claims—facts ascertained—reasoning—judgment result." This results in: first instance content and original instance content being mixed in second instance and retrial documents; blurred and overlapping boundaries between the three types of information: case facts, reasoning, and judgment result; and easy omission of key factual elements or points of contention. Furthermore, the large language model suffers from insufficient stability and controllability in ultra-long legal documents: When processing legal documents with tens of thousands of words and complex structures, simply inputting the entire text or roughly segmenting it leads to: logical breaks and chronological errors due to contextual truncation; model "illusion" generating facts or legal basis that do not exist in the document; unstable output format, making it difficult to meet the requirements of judicial scenarios for structured and standardized summaries; and a lack of adaptive routing and quality control in the summary generation process. Furthermore, existing solutions mostly use fixed pipelines: either segmented summarization throughout or full-text summarization throughout. This leads to: pre-input document type and structural quality checks and sorting; and post-output structural integrity, content consistency, and "illusion" risk detection based on automatic reruns, summary route switching, and rollback mechanisms. This makes it difficult to consistently control summary quality and requires extensive manual checks and corrections in engineering practice. Moreover, there is the problem of summary services being prone to blocking in large-scale concurrent scenarios. Due to significant differences in document length, number of segments, and complexity of prompts, simply distributing tasks based on quantity leads to: some long text tasks accumulating, blocking the overall service; and uneven resource utilization, affecting overall throughput and response time.

[0028] Based on this, embodiments of this application provide a method, apparatus, and electronic device for generating text summaries based on a large model. This method can solve the technical problem of low adaptability of current legal text summary generation results.

[0029] The embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0030] Figure 1 This is a flowchart illustrating a text summarization method based on a large model, provided as an embodiment of this application. Figure 1 As shown, the method includes: Step S110: Obtain the legal text to be processed, parse the legal text, and obtain the parsing result.

[0031] The legal texts are pre-set with paragraph templates and regular expression sets.

[0032] As one possible implementation, the above-mentioned parsing of legal text to obtain the parsing results may specifically include the following steps: performing basic parsing of the legal text and extracting basic information from the legal text; wherein, the basic information includes at least one of the following: case number, document type, case type, trial stage, and court name; and routing the legal text to the corresponding segmentation strategy and summary template based on the basic information.

[0033] like Figure 2 As shown, for basic information parsing and document routing, the input legal documents are first parsed to extract unified information including but not limited to: case number, document type (judgment / ruling, etc.), case type (civil / criminal / administrative, etc.), trial stage (first instance / second instance / retrial, etc.), and court name. Then, based on the above information, the documents are routed to the corresponding segmentation strategy and summary template, such as: civil first instance judgment, civil second instance judgment, criminal first instance judgment, administrative retrial judgment, and various rulings, etc.

[0034] By using unified segmentation and summary templates for documents of the same type and at the same level of review, and with the help of structured format verification, the summaries of different cases can present a consistent structure and style, ensuring consistency and maintainability in batch summary scenarios.

[0035] Step S120: Based on the parsing results, legal information is extracted using paragraph templates and regular expression sets to obtain the extraction results. The extracted results are then segmented using keywords and regular expressions to check the structural integrity and content accuracy. If the segmentation detection results are unqualified, the method of using a large model and prompt words is switched to intelligently segment the legal text to obtain the segmentation results.

[0036] In one possible implementation, the paragraph templates and regular expression sets corresponding to the legal text are determined based on the document type, case type, and trial stage of the legal text; after segmenting the extracted results for structural integrity and content accuracy using keywords and regular expressions, the method may further include the following steps: If the segmentation detection result is qualified, the segmentation is performed directly to obtain the segmentation result. The intelligent segmentation process of the large model and prompt words includes: using prompt words to indicate the document type and target structure, so that the large model can automatically label the type of each paragraph according to semantics and context and re-detect and correct the segmentation result to ensure that the final segmentation result meets the input requirements of the abstract template.

[0037] For example, such as Figure 2As shown, pre-designed paragraph templates and regular expression sets are used for different types and levels of documents to extract, including but not limited to: party information, claims and factual grounds, responses, third-party opinions, prosecutorial opinions, protest content, facts ascertained by the first / second / retrial courts, reasons for the first / second / retrial judgments, judgment results, appendices, etc. Then, the extracted results are checked for structural integrity and content accuracy using keywords and regular expressions, including but not limited to: in the case origin section, at least one of the following keywords should be satisfied: dispute, plaintiff, defendant, appellant, court hearing, termination, etc.; in the response section, at least one of the following rules should be satisfied: response, defense, no response, no appearance in court, etc. If the paragraph quality is qualified, it enters the paragraph summary process.

[0038] For piecewise compensation based on a large model, such as Figure 2 As shown, if the segmentation detection based on regular expressions fails, or if the document has a new writing paradigm (such as a table format or a non-standard template), the system switches to a large model and prompt word method to intelligently segment the original text: the prompt words are used to explicitly inform the document type and target structure, allowing the large model to automatically label the type of each paragraph based on semantics and context, and to re-detect and correct the segmentation results to ensure that the final segmentation meets the input requirements of the subsequent summary template.

[0039] By meticulously segmenting documents according to document type, case type, and trial stage, and independently modeling the case facts, reasoning, and judgment results, this invention effectively reduces overlap between these three parts and between different trial levels. It avoids issues such as incorrect citations of first or second instance judgments in retrial reasoning paragraphs, reducing problems like incomplete content, mixed writing, and incorrect citations, significantly improving the accuracy and precision of the generated summary content. Furthermore, by using unified segmentation and summary templates for documents of the same type and trial level, coupled with structured format validation, it ensures consistency in structure and style across summaries from different cases, guaranteeing consistency and maintainability in batch summary scenarios.

[0040] Step S130: Based on the segmentation results, a comprehensive judgment is made on the document type, segmentation quality and length, and the initial summary result is generated by using either the segmented summary route or the full-text summary route according to the judgment results.

[0041] The segmented summary route involves constructing a summary based on the segmented results, including a case overview, reasoning, and judgment. The full-text summary route involves inputting the full legal text into the large model and generating the case details, reasoning, and judgment based on a preset multi-segment summary template.

[0042] As an optional implementation, the initial summary result is generated by determining whether to use a segmented summary route or a full-text summary route based on the judgment result. Specifically, it may include the following steps: preferentially use the segmented summary route to generate the initial summary result; if the corresponding segment detection result in the segmented result is unqualified, then determine to use the full-text summary route to generate the initial summary result; if the document type corresponding to the segmented result is a criminal judgment, then determine to use the full-text summary route and obtain the summary results of each part by extraction to generate the initial summary result.

[0043] like Figure 2 As shown, for pre-input detection and dynamic routing, a pre-input detection module is set up on the pipeline to comprehensively judge factors such as document type, segmentation quality, and document length to determine whether to use a segmented or full-text route. For example, if the segmented result does not pass the segmentation detection, the full-text approach is used directly for summarizing, because the document format may not be conventional under the current paradigm rules. If the type is a criminal judgment, currently, the full text is used to generate summaries for each part, and then the summary results for each part are obtained through extraction. This is because criminal cases may involve multiple people and multiple crimes, as well as complex factual findings, and segmentation can easily lead to inconsistencies in logic and omissions. Excessively long document lengths can compromise the accuracy of the output summary, potentially creating illusions, and there are limitations on document length in the deployment environment. Therefore, by default, if segmentation is possible, it is preferred.

[0044] It should be noted that segmented summaries are prioritized for documents with clear structure to ensure fine-grained control. For documents with abnormal structure or insufficient rule coverage, full-text summaries are automatically reverted to ensure system robustness.

[0045] For example, the case summary is generated by a large model based on the segmented content and the full text, according to a preset format. If the segmented results lack relevant content of the case summary, targeted adjustments are made according to different summary format templates to avoid the large model generating non-existent content. The reasoning for the judgment includes segmented facts and reasons found by the court at the current stage of the trial, generating structured reasoning for the judgment. The segmentation method distinguishes the reasoning for the judgment at different stages of the trial to avoid confusion between content at different levels of trial. The judgment result is a partial and standardized expression of the judgment. Based on the segmented results, a summary is constructed according to the case summary, the reasoning of the judgment, and the judgment result. Specifically, it may include the following steps: Based on the segmented results, a summary is constructed according to the case summary, the reasoning of the judgment, and the judgment result. According to the completeness of the segmented content and the segmented type, the corresponding prompt word template is automatically selected. For the segmented content of each segmented type, the large model is called to generate summary content through the prompt word template. Based on the summary content, the overall summary is generated by extraction and integration.

[0046] For segmented summary routes, such as Figure 2 As shown, based on the segmented results, a summary is first constructed according to three parts: "Case Overview," "Judgment Reasons," and "Judgment Result." The case overview is generated by the large model according to a fixed format based on the segments and full text content, such as "Plaintiff…claims,…requests:…"; Defendant…argues,…; Third Party…statements,…; Court, after investigation, finds…. If relevant content is missing, it will be adjusted according to different format templates. Common adjustments include: the defendant did not respond, did not appear in court, or there is no third party. In these cases, the template will be adjusted accordingly to avoid the large model generating non-existent content. For the judgment reasons: a structured judgment reason is generated based on the "Court's Findings of Facts and Reasons" segment of the initial trial, distinguishing between the first-instance judgment reasons and the second-instance / retrial judgment reasons to avoid confusion between different levels of trial content. For the judgment result: the "Judgment Result" section is extracted and standardized. Then, based on the completeness and type of the segmented content, the corresponding prompt word template is automatically selected, and the large model is called to generate content for each type of segment. Finally, the overall summary is formed through extraction and integration.

[0047] In one optional implementation, the full text of the legal text is input into a large model, and the case details, reasoning, and judgment are generated based on a preset multi-segment summary template. Specifically, this may include the following steps: If the segmentation result is unqualified or the segmented summary fails the output check after multiple retries, the system will automatically switch to the full-text summary route, input the full text of the legal text into the large model, and generate the case details, reasoning, and judgment based on the preset three-segment summary template to obtain the full-text summary result. The full-text summary results are extracted and tested in a structured manner. If the full-text summary results do not meet the format requirements corresponding to the preset generation rules, or if factual details and / or missummarized judgment reasons that are not present in the original legal text are detected, the summary is regenerated using the full text of the legal text.

[0048] For the full-text summarization route and fallback mechanism, if the segmented results are unqualified, or if the segmented summary still fails the output check after multiple retries, it will automatically switch to the full-text summarization route. For example... Figure 2 As shown, the full text is input into the large model, and the case details, reasoning, and judgment are generated according to the established "three-part summary template." The full text summary results are then subjected to structured extraction and testing, and multiple reruns are performed if necessary. If the generated summary results do not meet the format requirements set by the generation rules, or violate the illusion detection rules explained above, the summary is regenerated using the full text content.

[0049] By extracting and validating the output data according to rules, the abstract text is restructured and its format and content are reviewed. This filters out a large amount of speculative content and content that does not conform to the original text, significantly reducing the risk of the "big model illusion" in judicial scenarios, effectively suppressing the "big model illusion," and improving the degree of structuring. Moreover, the standardized format and structure of the output abstract facilitates subsequent case retrieval, statistical analysis, and secondary structuring.

[0050] As an example, the process for a civil second instance trial is as follows: 1. Pre-input detection: Cases with normal segmentation and not of a formal type. Segmentation method is used: 2. Based on the **case number** and **trial procedure**, this is a civil second instance trial. It will proceed with priority to the segmented process.

[0051] 3. Obtain the dispute type information from the **Case Background** section: Sales Contract Dispute. The extraction is successful; proceed to the next step.

[0052] 4. By extracting **party information**, obtain information such as the appellant and the appellee.

[0053] 5. Summarize the **claims and factual grounds** section, dividing it into two parts: claims and factual grounds. The claims and factual grounds were obtained without issue, and the generated result did not trigger any anomaly detection. Proceed to the next step.

[0054] 6. Filter the **defense comments** section; this document contains defense comments. Refine the defense comments: Defense Comments. The generated result did not trigger any anomaly detection; proceed to the next step.

[0055] 7. Filter the **third-party allegations** section. No third-party allegations appeared in the document. Therefore, it was filtered. No problem occurred; proceed to the next step.

[0056] 8. Based on the **case number**, this is identified as civil second instance content. A summary of the **court's findings of fact** is provided, divided into two parts: the facts confirmed by the second instance court in the first instance, and the facts ascertained by the second instance court. The generated result did not trigger any abnormality detection; proceed to the next step.

[0057] 9. Based on the **case number**, this is identified as civil second instance content. A summary of the **facts of evidence found by the first instance court** is provided, divided into: the facts ascertained by the first instance court, the reasoning process of the first instance court, and the judgment of the first instance court. The generated result did not trigger any abnormality detection; proceed to the next step.

[0058] 10. Based on the **case number**, this is identified as civil second instance content. A summary of the **reasoning** is provided: the second instance court's findings. The generated result did not trigger any anomaly detection; proceed to the next step.

[0059] 11. Merge the extracted content of the currently generated results according to the existing template. Based on the case number, the content of the civil second instance template will be used for merging.

[0060] The elements for consolidating the facts of a case include: the origin of the case, the claims, the facts and reasons, the defendant's response, the reasoning of the court of first instance, the facts found by this court, and the judgment of this court. This case concerns a sales contract dispute between Zhao Moumei (appellant) and Zhao Moutie and Cui Mouyong (appellees). The appellant alleges that the IOU provided by Zhao Moutie is forged, and that the statute of limitations has expired, as Zhao Moutie failed to assert his rights within the statutory period. The appellant requests the court to: overturn the first-instance judgment, dismiss Zhao Moutie's claims, or remand the case for retrial, with the amount disputed being RMB 122,505. Appellee Zhao Moutie argues that the appeal should be dismissed and the original judgment upheld, arguing that the evidence proves the debt should be borne jointly by both parties, and that the debt collection was not time-barred. Appellee Cui Mouyong argues that the appeal should be dismissed and the original judgment upheld, arguing that the debt is genuine and should be repaid, and that the first-instance judgment was correct. The court of first instance found that Cui Mouyong and Zhao Moumei jointly operated a medicinal herb cultivation business during their marriage. During this period, they purchased production materials from Zhao Moutie and issued IOUs, confirming the existence of a sales relationship and the fact that payment was outstanding. The court of first instance held that legally established sales contracts are protected by law, and the IOUs provided by Zhao Moutie proved the sales relationship and the fact of the debt. Since Cui Mouyong and Zhao Moumei jointly operated the business during their marriage, they should jointly bear the repayment responsibility. The court of first instance ruled that Cui Mouyong and Zhao Moumei must jointly repay the debt owed by Zhao Moutie, with interest calculated at the market rate from the date of the lawsuit until the date of actual payment. This court, after review, found that the appellant Zhao Moumei submitted a mediation record from her divorce case with Cui Mouyong, intending to prove that she was unaware of the debt in question. However, this evidence was not accepted because it was not valid against the third party, Zhao Moutie, and could not prove Zhao Moumei's claim. The facts ascertained in the first instance are confirmed. In summary, Zhao Moumei's appeal is unfounded and should be dismissed. The reasoning for the judgment is as follows: This is the result of the selection of the court's reasoning. The court finds that the central issue in this case is whether the amount of outstanding payment determined in the first instance was accurate and whether Zhao Moumei should bear joint liability for repayment. Regarding the amount of outstanding payment, while Zhao Moumei denies the amount determined in the first instance, she admits that during her marriage with Cui Mouyong, Cui Mouyong contracted and operated the land, and that family income and expenditure were conducted through Zhao Moumei's bank account, indicating that Zhao Moumei participated in the family business. The IOU issued by Cui Mouyong confirms the debt incurred from the purchase of fertilizer, and Zhao Moumei failed to provide evidence that the source or quantity of fertilizer used was unreasonable. Given that Zhao Moumei participated in the joint business, and that the use of fertilizer on the contracted land was a normal business practice, the first instance court's determination that the amount of debt acknowledged by Zhao Moutie is legally valid for Zhao Moumei, and that the debt was used for the couple's joint living expenses, and therefore, the judgment ordering Zhao Moumei to bear joint liability for repayment, is not inappropriate. Regarding Zhao Moumei's statute of limitations defense, since she did not raise it in the first instance, the second instance court does not support it according to relevant legal provisions. In conclusion, Zhao Moumei's appeal lacks basis, the first instance judgment's factual findings are clear, and the application of law is correct; therefore, it should be upheld.

[0061] The extraction result of the judgment result of the above example obtained by the method provided in the embodiments of this application is: the appeal is dismissed and the original judgment is upheld.

[0062] As another example, the process for a criminal second instance trial is as follows: 1. Based on the **case number** and **trial procedure**, the content pertains to a second-instance criminal case. The full text is presented.

[0063] 2. Obtain the prompt template based on the **litigation type** and the second instance of criminal proceedings, and obtain a full text summary, including: defendant information, charge, court name, defense arguments presented by the defendant and defense counsel, findings of the court, the court's opinion, and a summary section.

[0064] 3. Detect the generated content above to check if any hallucination content appears.

[0065] 4. Perform a format check on the generated content to see if there are any problems with the generated structure.

[0066] 5. Extract the defendant's information, charges, court name, defense arguments presented by the defendant and their counsel, and the findings of the court during the trial. Summarize the above information.

[0067] The names of the individuals appearing in the above content were verified. Then, they were merged according to the template to generate a case summary. The procuratorate filed a public prosecution with the Yubei District People's Court of Chongqing Municipality against the defendants Li Moujiang and Wu Mouzhong, and the defendant company Mouya, for the crime of contract fraud. The defendants and their defense lawyers argued that Li Moujiang had mitigating circumstances such as confession, being a first-time offender, and making full restitution, and requested a suspended sentence; Wu Mouzhong argued that he only participated in part of the dispute resolution and should not bear full responsibility, and requested a reduced sentence and a suspended sentence. The court found that around November 2019, Li Moujiang and others established Mouya Company in Chongqing, operating a model agency business. The company lured clients to sign contracts and pay fees by falsely promising to provide "high-quality models" to work at clients' locations, but the models provided did not actually go to work. Li Moujiang, as the actual person in charge of the company, and Wu Mouzhong, as the general manager, jointly participated in the contract fraud activities, involving multiple victims, with a total fraud amount of 312,609 yuan. Wu Mouzhong joined in October 2020, and was involved in the fraud amount of 164,500 yuan.

[0068] 6. Extracting a portion of the court's opinion to generate a summary of the judgment's reasoning. The court held that the defendant company, Mouya Company, and defendants Li Moujiang and Wu Mouzhong, with the intent of illegal possession, defrauded the other party of property during the signing and performance of the contract, and their actions constituted the crime of contract fraud. Li Moujiang and Wu Mouzhong, as the directly responsible supervisors and other directly responsible personnel of the company, played a principal role in the joint crime and were therefore principal offenders. Li Moujiang truthfully confessed after being apprehended, voluntarily pleaded guilty and accepted punishment, and fully repaid the outstanding amount, thus warranting a lighter sentence. Wu Mouzhong had a prior criminal record, which warranted a heavier sentence at the court's discretion, but due to his voluntary plea and acceptance of punishment, he was also given a lighter sentence.

[0069] The judgment result portion of the extraction segmentation result in the above example is determined by the method provided in the embodiments of this application, and is taken as the content of the judgment result. I. The criminal judgment No. (2022) Yu 0112 Xing Chu 1217 of the Yubei District People's Court of Chongqing Municipality is upheld, namely, the defendant company Chongqing Mouya Culture Media Co., Ltd. is guilty of contract fraud and is sentenced to a fine of 20,000 yuan; the defendant Li Moujiang is guilty of contract fraud and is sentenced to three years imprisonment and a fine of 10,000 yuan; the defendant Wu Mouzhong is guilty of contract fraud and is sentenced to two years imprisonment and a fine of 5,000 yuan; the defendant company Chongqing Mouya Culture Media Co., Ltd. is ordered to compensate the victims for their economic losses. II. The appellant (defendant in the first instance) Li Moujiang is given a four-year suspended sentence.

[0070] Step S140: Perform a consistency check on the speculative representation of the initial summary results. If a consistency discrepancy is detected, switch between the segmented summary route and the full-text summary route. Generate the final summary results through the switched route.

[0071] As an example, a consistency check is performed on the speculative representation of the initial summary results. If a consistency discrepancy is detected, the process switches between the segmented summary route and the full-text summary route. The final summary result is then generated using the switched route. Specifically, this may include the following steps: The initial summary results are subjected to structured extraction and format rule detection to obtain intermediate summary results after format and structure checks. Based on preset legal document norms and prompt word templates, and combined with regular expressions and keyword rules, the consistency of some key elements in speculative expressions appearing in the intermediate summary results with the original text of the legal text is compared and checked. If a non-consistency is detected in the speculative expression, the template library rules are triggered, and the route is switched between the segmented summary route and the full-text summary route. The final summary result is generated through the switched route.

[0072] By extracting and validating the rules after output, the abstract text is restructured and its format and content are reviewed. This can filter out a large amount of speculative content that does not match the original text, significantly reducing the risk of big model illusion in judicial scenarios. Moreover, the format and structure of the abstract output are standardized, which is conducive to subsequent case retrieval, statistical analysis and secondary structuring. Therefore, it effectively suppresses big model illusion and improves the degree of structuring.

[0073] For post-output inspection and summary quality control, format and structure checks are performed first. This involves structured extraction and rule checks on the summary results generated by the large model, including: whether it conforms to the pre-designed format template (such as the expression patterns of plaintiff / defendant / third party / court findings); whether there is obvious content overlap or omission in each part; and whether the punctuation format meets the requirements. Then, illusion and consistency checks are performed: based on legal document norms and pre-designed prompt word templates, combined with regular expressions and keyword rules, speculative expressions such as "hypothesis," "presumption," and "simulation" appearing in the summary are detected. For example, for the first-instance litigation claims and factual grounds in civil cases, the "plaintiff's name," "request content," and "factual grounds" can definitely be obtained. If the model displays specific markers from the prompt words under the current prompt word, such as "output" or "lacking...case facts," then the template library rules are triggered, and it is considered that the model is exhibiting an illusion.

[0074] For example, the information provided in the original text is insufficient to constitute a complete case overview because it lacks key case details, such as the specific facts in dispute, the claims of both parties, the facts ascertained by the court, and the judgment. However, based on the given information framework, this application embodiment can attempt to construct a hypothetical case overview, assuming the case is as follows: This case concerns a dispute between A and B regarding the right to life, bodily integrity, and health. The plaintiff alleges that the defendant physically harmed him during an argument, resulting in injury, medical expenses, and emotional distress. The court, after hearing the case, finds that the defendant did indeed physically harm the plaintiff during the argument, causing injury, and that the harmful act was intentionally committed by the defendant. Therefore, the court supports the plaintiff's claims, ordering the defendant to bear the plaintiff's medical expenses, pay damages for emotional distress, and issue a public apology to the plaintiff. It should be noted that the above content is based on a hypothetical scenario, and the specific case details need to be determined according to the detailed content of the actual court judgment.

[0075] The example above triggered the following rules: Rule-based detection: Lack of...Case details: Lack of key case details; Keyword detection: Hypothesis: Construct a hypothetical case overview and hypothetical case details; Structure-based detection: Lack of claims. (It should include similar claims: Requesting a judgment ordering: 1. The defendant to bear all medical expenses of 1000 yuan. 2. To pay 1000 yuan in damages for mental distress. 3. The defendant to publicly apologize to the plaintiff).

[0076] Selective consistency checks are performed on certain key elements against the original text, such as the names of the parties and the date. If there is a conflict with the results of the segmented extraction, it is marked. For example, in case number (2024) Liaoning 03 Civil Final 3277, the party information extracted in segments is as follows: {'role': 'Appellant (Defendant in the first instance)', 'name': 'Zhao Moumei'}; {'role': 'Litigation agent entrusted by the appellant (defendant in the first instance) Zhao Moumei', 'name': 'Luo Jingyi'}; {'role': 'Appellee (Plaintiff in the first instance)', 'name': 'Zhao Moutie'}; {'role': 'Appellee (Defendant in the first instance)', 'name': 'Cui Mouyong'}. If the extracted name in the generated summary is Zhao Moumou, Luo Moumou, etc., which is inconsistent with the extracted name, this rule will be triggered.

[0077] If obvious hallucinations or content inconsistent with the original text is detected, the following is triggered: rerun on the same route and / or route switching (e.g., changing from segmented summarization to full-text summarization). In practical engineering, this invention focuses on rule and structure detection, which has reduced the risk of hallucinations to an acceptable level, and using large models for hallucination detection is feasible.

[0078] By employing a dual-path approach—using segmented summarization and full-text summarization—to generate initial summary results, and combining pre-input detection with post-output detection, the dual-path summary generation method of segmented summarization and full-text summarization is adaptively switched through bidirectional detection before and after input. This achieves adaptive processing of documents of different lengths and structures, enhancing the adaptability, stability, and controllability of ultra-long legal document summaries.

[0079] The method provided in this application is a structured analysis and summary generation method for legal judgment documents. This method uses technologies such as document type recognition, content segmentation, large language model generation, and result verification to automatically extract and generate summaries of key contents such as case facts, reasoning, and results in legal documents such as judgments and rulings.

[0080] In some embodiments, after switching between the segmented summarization route and the full-text summarization route, the method may further include the following steps: on the server side of the large model, based on vLLM deployment, the access matrix and queue monitoring are performed to monitor the input length, prompt word type and runtime status of different summary generation requests in real time, and dynamic diversion and queue management are performed in combination with the characteristics of the summary generation task to avoid task blocking caused by allocation based on the number of tasks.

[0081] For server-side concurrent scheduling and load balancing, in this embodiment, an access matrix / queue monitoring mechanism is deployed on the large model server based on vLLM: real-time monitoring of the input length, prompt word type and runtime status of different requests; dynamic traffic splitting and queue management based on task characteristics to avoid long task blocking caused by simple allocation based on the number of tasks; improving overall throughput and response time, and ensuring the availability and stability of the summary service in high-concurrency scenarios.

[0082] By introducing pre-input detection, summary route switching, and server-side dynamic scheduling, this invention can rationally allocate large model computing resources based on document length and complexity, avoiding blocking caused by concentrated long text tasks and improving the performance and resource utilization efficiency of engineered deployments. Furthermore, while ensuring summary quality, it also improves the system's throughput and response speed in high-concurrency scenarios and reduces review costs.

[0083] Figure 3 A schematic diagram of a text summarization generation device based on a large model is provided. For example... Figure 3 As shown, the large model-based text summarization generation device 300 includes: The parsing module 301 is used to acquire the legal text to be processed, parse the legal text, and obtain the parsing result; the legal text corresponds to a preset paragraph template and a set of regular expressions. The detection module 302 is used to extract legal information based on the parsing results through the paragraph template and regular expression set, obtain the extraction results, and use keywords and regular expressions to perform segmentation detection on the structural integrity and content accuracy of the extraction results. If the segmentation detection result is unqualified, it switches to the large model and prompt word method to perform intelligent segmentation on the legal text to obtain the segmentation result. The determination module 303 is used to comprehensively judge the document type, segmentation quality, and length based on the segmentation results, and determine whether to generate an initial summary result using a segmented summary route or a full-text summary route based on the judgment results. The segmented summary route is to construct a summary based on the segmentation results according to the case summary, the reasoning of the judgment, and the judgment result. The full-text summary route is to input the full text of the legal text into the large model and generate the case summary, the reasoning of the judgment, and the judgment result according to the preset multi-segment summary template. The switching module 304 is used to perform a consistency check on the speculative representation of the initial summary result. If a consistency discrepancy is detected, the module switches between the segmented summary route and the full-text summary route, and generates the final summary result through the switched route.

[0084] The large-model-based text summarization device provided in this application has the same technical features as the large-model-based text summarization method provided in the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.

[0085] An electronic device provided in this application embodiment, such as Figure 4 As shown, the electronic device 400 includes a processor 402 and a memory 401. The memory stores a computer program that can run on the processor. When the processor executes the computer program, it implements the steps of the method provided in the above embodiments.

[0086] See Figure 4 The electronic device also includes a bus 403 and a communication interface 404. The processor 402, the communication interface 404 and the memory 401 are connected via the bus 403. The processor 402 is used to execute executable modules, such as computer programs, stored in the memory 401.

[0087] The memory 401 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 404 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network.

[0088] Bus 403 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0089] The memory 401 is used to store programs. After receiving an execution instruction, the processor 402 executes the program. The method executed by the apparatus defined by the process disclosed in any of the preceding embodiments of this application can be applied to the processor 402 or implemented by the processor 402.

[0090] Processor 402 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 402 or by instructions in software form. The processor 402 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 401, and processor 402 reads the information from memory 401 and, in conjunction with its hardware, completes the steps of the above method.

[0091] Corresponding to the above-described text summarization method based on large models, this application also provides a computer-readable storage medium storing computer-executable instructions. When called and executed by a processor, the computer-executable instructions cause the processor to perform the steps of the above-described text summarization method based on large models.

[0092] The large-model-based text summarization generation device provided in this application embodiment can be specific hardware on a device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this application embodiment are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.

[0093] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0094] For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0095] 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0096] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0097] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the large-model-based text summarization method described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0098] 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. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0099] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A text summarization generation method based on a large model, characterized in that, The method includes: The process involves acquiring the legal text to be processed, parsing the legal text, and obtaining the parsing result; the legal text corresponds to a preset paragraph template and a set of regular expressions. Based on the parsing results, legal information is extracted using the paragraph template and regular expression set to obtain the extraction results. The extracted results are then segmented for structural integrity and content accuracy using keywords and regular expressions. If the segmentation detection results are unqualified, the system switches to a large model and prompt word method to intelligently segment the legal text to obtain the segmentation results. Based on the segmentation results, a comprehensive judgment is made on the document type, segmentation quality, and length. Based on the judgment results, it is determined whether to use a segmented summary route or a full-text summary route to generate initial summary results. The segmented summary route involves constructing a summary based on the segmentation results, including a case overview, reasoning, and judgment. The full-text summary route involves inputting the full text of the legal text into the large model and generating the case overview, reasoning, and judgment based on a preset multi-segment summary template. The initial summary results are subjected to a consistency check of speculative representations. If a consistency discrepancy is detected, the route is switched between the segmented summary route and the full-text summary route. The final summary results are generated through the switched route.

2. The method according to claim 1, characterized in that, The parsing of the legal text to obtain the parsing result includes: The legal text is subjected to basic analysis, and basic information is extracted from it; wherein, the basic information includes at least one of the following: case number, document type, case type, and trial stage; Based on the basic information, the legal text is routed to the corresponding segmentation strategy and summary template.

3. The method according to claim 2, characterized in that, The paragraph templates and regular expression sets corresponding to the legal text are determined based on the document type, case type, and trial stage of the legal text; after performing segmentation checks on the extracted results using keywords and regular expressions to verify structural integrity and content accuracy, the method further includes: If the segmented test result is qualified, then the segmentation is performed directly to obtain the segmented result; The intelligent segmentation process using the large model and prompt words includes: using prompt words to indicate the document type and target structure, so that the large model can automatically label the type of each paragraph according to semantics and context, and re-detect and correct the segmentation results to ensure that the final segmentation results meet the input requirements of the summary template.

4. The method according to claim 1, characterized in that, After switching between the segmented summary route and the full-text summary route, the method further includes: On the server side of the large model, access matrix and queue monitoring are deployed based on vLLM. The input length, prompt word type and runtime status of different summary generation requests are monitored in real time. Dynamic traffic distribution and queue management are performed in combination with the characteristics of summary generation tasks to avoid task blocking caused by task allocation based on the number of tasks.

5. The method according to claim 1, characterized in that, The step of determining whether to use a segmented summarization route or a full-text summarization route to generate the initial summary result based on the judgment result includes: The initial summary result is generated by prioritizing the segmented summary route. If the segmented detection result corresponding to the segmented result is unqualified, the initial summary result is generated by using the full-text summary route. If the document type corresponding to the segmented result is a criminal judgment, the initial summary result is generated by using the full-text summary route and extracting the summary results of each part.

6. The method according to claim 2, characterized in that, The case summary is generated by the large model according to a preset format based on the segmented content and the full text. If the segmented results lack relevant content of the case summary, targeted adjustments are made according to different summary format templates to avoid the large model generating non-existent content. The reasoning for the judgment includes segmenting the facts and reasons found by the court at the current trial stage to generate structured reasoning for the judgment. The segmentation method distinguishes the reasoning for the judgment at different trial stages to avoid confusion between different levels of trial. The judgment result is an extraction and standardized expression of a portion of the judgment. The summary is constructed based on the segmented results, including a case overview, reasoning, and judgment, and includes: Based on the segmented results, a summary is constructed according to the case overview, the reasoning of the judgment, and the judgment result. According to the completeness of the segmented content and the segmented type, the corresponding prompt word template is automatically selected. For the segmented content of each segmented type, the large model is called to generate summary content through the prompt word template. Based on the summary content, an overall summary is generated by extraction and integration.

7. The method according to claim 1, characterized in that, The process of inputting the full text of the legal text into the large model and generating case details, reasoning, and judgment based on a preset multi-segment summary template includes: If the segmentation result is unqualified or the segmented summary fails the output detection after multiple retries, the system will automatically switch to the full-text summary route, input the full text of the legal text into the large model, and generate the case details, reasoning, and judgment based on the preset three-segment summary template to obtain the full-text summary result. The full-text summary results are subjected to structured extraction and detection. If the full-text summary results do not meet the format requirements corresponding to the preset generation rules, or if factual details and / or missummarized judgment reasons that are not present in the original text that generated the legal text are detected, then the summary is regenerated using the full-text content of the legal text.

8. The method according to claim 6, characterized in that, The consistency check of the speculative representation of the initial summary result, if a consistency discrepancy is detected, involves switching between the segmented summary route and the full-text summary route, and generating the final summary result through the switched route, including: The initial summary result is subjected to structured extraction and format rule detection to obtain an intermediate summary result after format and structure detection; Based on the preset legal document specifications and the prompt word template, the consistency of some key elements in the speculative statements appearing in the intermediate summary results with the original text of the legal text is compared and detected by combining regular expressions and keyword rules. If the speculative statements are found to have inconsistent results, the template library rules are triggered, and the route is switched between the segmented summary route and the full-text summary route. The final summary result is generated through the switched route.

9. A text summarization generation device based on a large model, characterized in that, include: The parsing module is used to acquire the legal text to be processed, parse the legal text, and obtain the parsing result; The legal text corresponds to a pre-defined set of paragraph templates and regular expressions; The detection module is used to extract legal information based on the parsing results using the paragraph template and regular expression set, obtain the extraction results, and perform segmentation detection on the extracted results for structural integrity and content accuracy using keywords and regular expressions. If the segmentation detection results are unqualified, the module switches to the large model and prompt word method to perform intelligent segmentation on the legal text, and obtain segmentation results. The determination module is used to comprehensively judge the document type, segment quality, and length based on the segmentation results, and determine whether to generate an initial summary result using a segmented summary route or a full-text summary route based on the judgment results. The segmented summary route is to construct a summary based on the segmentation results according to the case summary, the reasoning of the judgment, and the judgment result. The full-text summary route is to input the full text of the legal text into the large model and generate the case summary, the reasoning of the judgment, and the judgment result according to the preset multi-segment summary template. The switching module is used to perform consistency checks on the speculative representation of the initial summary results. If a consistency discrepancy is detected, the module switches between the segmented summary route and the full-text summary route, and generates the final summary result through the switched route.

10. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Legal instrument segmentation method and system

    CN112668284A