Electronic certificate generation method and system, storage medium and terminal equipment

By combining OCR and AI large-scale models with RAG technology to process unstructured documents, structured information conforming to electronic voucher specifications is generated and encrypted and signed, solving the problem that unstructured documents cannot be automatically processed in existing technologies, and realizing paperless applications and improved accuracy.

CN120975939APending Publication Date: 2025-11-18YGSOFT INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511057533.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Existing technologies cannot effectively process unstructured documents such as taxi tickets, contracts, and receipts, resulting in wasted system resources and data inconsistencies, and they cannot be automatically converted into electronic vouchers for verification and archiving.

Method used

Text content is extracted using OCR, error correction and vectorization are performed using a large AI model, and structured information conforming to the electronic voucher field specifications is generated using RAG technology. Finally, an electronic signature is generated through blockchain encryption.

Benefits of technology

It enables paperless application of unstructured documents, improves the accuracy and compatibility of electronic voucher generation, supports multiple languages ​​and character formats, and enhances the system's automated processing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120975939A_ABST
    Figure CN120975939A_ABST
Patent Text Reader

Abstract

The invention discloses an electronic certificate generation method and system, a storage medium and terminal equipment, and the method comprises the steps: S100, extracting the text content of a file through an OCR operation, and attempting to automatically obtain a file classification; s200, performing text error correction on the extracted text content by using an AI large model; s300, carrying out vectorization processing on the files which fail to be automatically classified by using the OCR in the step S100, and retrieving matched file classifications in a vector database; s400, the corrected text content and file classification are submitted to an AI large model for analysis and verification, and the step S500 is executed after the text content and the file classification are correct; s500, generating and outputting structured information conforming to electronic certificate field specifications through an RAG technology; s600, generating a layout file containing the structured information by calling an MCP protocol; and S700, generating an electronic signature by using a block chain encryption technology. According to the invention, unstructured files, printing files of the electronic certificates and layout files of the electronic certificates can be generated into the electronic certificates which can be circulated in a system process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of electronic data processing technology, specifically relating to an electronic voucher generation method, system, storage medium, and terminal equipment. Background Technology

[0002] In existing technologies, each business system needs to generate structured data according to standards and encapsulate it into OFD / PDF format files at the "issuing end," and then parse the data at the "receiving end" using a toolkit or self-developed system to complete verification, accounting, and archiving. Combining the above "issuing end" and "receiving end" technologies can achieve "paperless" business operations.

[0003] However, existing technologies have the following problems:

[0004] 1. The current "Electronic Voucher Accounting Data Standard" only covers 9 types of electronic vouchers and only supports the generation, verification, accounting and archiving of the specified 9 types of electronic vouchers. Other unstructured documents, such as taxi receipts, contracts, receipts, purchase orders and other common unstructured documents, cannot be generated and processed according to the electronic voucher standard. These other types of documents still need to be circulated in the system in the form of paper scans or electronic documents.

[0005] 2. For scanned paper documents, OCR (Optical Character Recognition) text extraction is required every time they are used. On the one hand, this wastes the system's computing resources, and on the other hand, errors may be introduced due to differences in different OCR algorithms, resulting in data inconsistency between systems.

[0006] 3. It only supports the management of native electronic vouchers. Printed documents, paper scans, and electronic versions of electronic vouchers (such as VAT invoices) cannot be automatically converted into electronic vouchers for processing, and electronic verification, accounting, and archiving cannot be completed. Summary of the Invention

[0007] This invention provides a method, system, storage medium, and terminal equipment for generating electronic vouchers. It aims to generate electronic vouchers that can be processed in the system workflow from unstructured files, printed files of electronic vouchers, and format files of electronic vouchers, which are not covered by the nine types of electronic vouchers in the "Electronic Voucher Accounting Data Standard". This invention is achieved through the following technical solutions.

[0008] In a first aspect, the present invention provides a method for generating electronic vouchers, comprising:

[0009] S100. Extract the text content of the file through OCR operation, and attempt to automatically obtain the file classification based on the extracted text content;

[0010] S200: Use an AI large model to correct text errors in the text content extracted by the OCR operation;

[0011] S300. For files that failed to be automatically classified using OCR in step S100, the extracted text content is vectorized, and a matching file classification is retrieved from a preset vector database.

[0012] S400: Submit the corrected text content and the file classification obtained in the previous steps to the AI ​​model for analysis and verification. After verifying that the file classification is correct, proceed to step S500.

[0013] S500 generates and outputs structured information that conforms to the electronic voucher field specifications through RAG technology;

[0014] S600: Generates a layout file containing structured information by calling the MCP protocol;

[0015] S700 uses blockchain encryption technology to generate electronic signatures.

[0016] As a preferred technical solution, in step S100, the OCR operation extracts text content by using a custom, expandable multilingual, multi-character format hybrid recognition dictionary; the OCR operation automatically classifies files based on feature keyword matching.

[0017] As a preferred technical solution, in step S200, the text error correction includes character recognition error correction and text discontinuity problem correction.

[0018] As a preferred technical solution, in step S300, the text content vectorization process uses the sentence-transformers model for vectorization, the similarity calculation uses cosine similarity, and the retrieval method uses HNSW graph index.

[0019] As a preferred technical solution, in step S400, when the AI ​​big model determines whether the file classification is correct, if it determines that the current classification is incorrect, it further provides the correct classification and the basis for it.

[0020] As a preferred technical solution, step S500 specifically includes:

[0021] S510, Vector Database Retrieval: Using file category as the key, query similar historical format files and their structured data from the vector database;

[0022] S520, Relational Database Retrieval: Using file category as the key, query the field specifications of electronic vouchers of the same type from a relational database;

[0023] S530, Generation Stage: The search results obtained in steps S510 and S520 are concatenated with the extracted text content and handed over to the large model to generate and output structured information that conforms to the electronic voucher field specifications.

[0024] As a preferred technical solution, step S700 specifically includes:

[0025] The SHA-256 function is used to generate file hash data consisting of the layout file content and structured information.

[0026] The private key signature is generated using the Elliptic Curve Digital Algorithm (ECDSA), with a key length of 256 bits.

[0027] Write the hash data of the signed file into the blockchain.

[0028] Secondly, the present invention provides an electronic voucher generation system, comprising:

[0029] The OCR processing module is used to extract the text content of a file and attempt to automatically classify the file directly based on the extracted text content.

[0030] The vector database module is used to vectorize the extracted text content of files that fail to be automatically classified using OCR, and to retrieve the matching file classification from the vector database; it is also used to query similar historical format files and their structured data from the vector database using the file classification as the key.

[0031] The relational database module is used to query the field specifications of electronic vouchers of the same type from a relational database, using file category as the key;

[0032] The AI ​​large model module is used to correct text errors in the text content extracted by OCR operations, to analyze and verify the file classification obtained by OCR operations or vector database modules, and to concatenate the search results obtained by vector database modules and relational database modules based on file classification as keys with the extracted text content to generate structured information that conforms to the electronic voucher field specifications.

[0033] The electronic voucher service module is used to invoke the MCP protocol to generate a formatted file containing structured information;

[0034] The electronic signature service module is used to generate electronic signatures using blockchain encryption technology.

[0035] Thirdly, the present invention also provides a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method steps of the above-described electronic voucher generation method.

[0036] Fourthly, the present invention also provides a terminal device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the method steps of the above-described electronic credential generation method.

[0037] The beneficial effects of the technical solution of the present invention include at least the following:

[0038] 1. In addition to supporting the nine types of electronic vouchers specified in the "Electronic Voucher Accounting Data Standard" in previous technologies, the present invention additionally supports the generation of electronic vouchers for all unstructured documents, realizing the paperless application of unstructured documents;

[0039] 2. Use a large model to correct text errors in the OCR recognition results to enhance the accuracy of generated electronic vouchers;

[0040] 3. Using a large model combined with RAG technology, based on electronic voucher specifications and historical legal data, automatically identify the category to which the file belongs, perform field matching, and generate structured information that conforms to the electronic voucher field specifications;

[0041] 4. Provides the ability to generate layout files based on MCP (Model Context Protocol), compatible with most LLM (Large Language Model) on the market. Attached Figure Description

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

[0043] Figure 1 This is a schematic diagram of the network architecture provided in an embodiment of the present invention.

[0044] Figure 2 This is a flowchart illustrating the electronic voucher generation method provided in an embodiment of the present invention.

[0045] Figure 3 This is a flowchart illustrating the specific implementation of the electronic voucher generation method provided in this embodiment of the invention, which uses RAG technology to generate and output structured information that conforms to the electronic voucher field specifications.

[0046] Figure 4 This is a block diagram of the electronic voucher generation system provided by the present invention.

[0047] Figure 5 This is a schematic diagram of the structure of a terminal device provided by the present invention. Detailed Implementation

[0048] To make the technical solution of the present invention clearer and its technical advantages more apparent, the technical solution of the present invention will be clearly and completely described below in conjunction with specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of the present invention.

[0049] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings. For ease of explanation, the orientations are defined in conjunction with the drawings. These orientation definitions are merely for the purpose of clearly describing the relative positional relationships and are not intended to limit the actual orientation of the product or device during production, use, or sale. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Moreover, in the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "setting," "connection," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms in the present invention according to the specific circumstances.

[0050] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0051] It should be noted that the quality inspection data extraction configuration method provided by the present invention is generally executed by the terminal device, and correspondingly, the quality inspection data extraction device is generally set in the terminal device.

[0052] Figure 1 An exemplary system architecture that can be applied to the quality inspection data extraction configuration method or quality inspection data extraction device of the present invention is shown.

[0053] like Figure 1 As shown, the system architecture may include: terminal device 101 and server 102. Terminal device 101 and server 102 can communicate via a network, which serves as the medium for providing communication links between the various units. The network may include various types of wired or wireless communication links, such as: wired communication links including fiber optic cables, twisted-pair cables, or coaxial cables; and wireless communication links including Bluetooth communication links, Wi-Fi communication links, or microwave communication links.

[0054] Server 102 is configured as an NVIDIA A100 GPU×4 server cluster for large model inference and data services. Server 102 stores a database, including a vector database and a relational database, which stores detailed data such as vector-based file classification, file-based format files and their structured data, and field specifications of electronic vouchers based on file classification. Terminal device 101 retrieves relevant detailed data under preset conditions in server 102 through retrieval and query.

[0055] It should be noted that the terminal device 101 and the server 102 can be either hardware or software. When the terminal device 101 and the server 102 are hardware, they can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the terminal device 101 and the server 102 are software, they can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module; no specific limitations are made here.

[0056] The terminal device of this invention can be equipped with various communication client applications, such as paper document scanning, electronic document browsing and editing, search applications, and file upload and download applications. When the terminal device is hardware, it can be various terminal devices with a display screen, including but not limited to smartphones, tablets, laptops, and desktop computers. When the terminal device is software, it can be installed on the terminal devices listed above. It can be implemented as multiple software programs or software modules (e.g., to provide distributed services) or as a single software program or software module; no specific limitation is made here.

[0057] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is for illustrative purposes only. Depending on implementation needs, there can be any number of terminal devices, networks, and servers.

[0058] Please see Figure 2 The electronic certificate of this invention comprises two parts: 1. a layout file; 2. structured information describing the content of the layout file. An embodiment of this invention provides a method for generating an electronic certificate, including:

[0059] S100. Extract the text content of the file through OCR operation, and attempt to automatically obtain the file classification based on the extracted text content;

[0060] S200: Use an AI large model to correct text errors in the text content extracted by the OCR operation;

[0061] S300. For files that failed to be automatically classified using OCR in step S100, the extracted text content is vectorized, and a matching file classification is retrieved from a preset vector database.

[0062] S400: Submit the corrected text content and the file classification obtained in the previous steps to the AI ​​model for analysis and verification. After verifying that the file classification is correct, proceed to step S500.

[0063] S500 generates and outputs structured information that conforms to the electronic voucher field specifications through RAG technology;

[0064] S600: Generates a layout file containing structured information by calling the MCP protocol;

[0065] S700 uses blockchain encryption technology to generate electronic signatures.

[0066] After the above steps, the generated electronic certificate can be a structured information file containing XML / XBRL format and an OFD format layout file.

[0067] In step S100, the OCR operation extracts text content using a custom, expandable multilingual (e.g., Chinese, English, German, French, etc.) and multi-character format (e.g., various font formats for text, numbers, and symbols, etc.) mixed recognition dictionary. In addition, the OCR operation automatically classifies documents, such as invoices and contracts, based on feature keyword matching.

[0068] In step S200, the text error correction includes character recognition error correction and text discontinuity correction. Character recognition error correction includes, for example, the automatic recognition and correction of the digit 0 and the letter o. Text discontinuity correction includes, for example, correcting text discontinuity caused by line breaks / page breaks.

[0069] In step S300, during the text content vectorization process, the vectorization model adopted is the sentence-transformers model; the similarity calculation adopts cosine similarity, and the threshold is set to 0.75; the retrieval method adopts HNSW graph index, efConstruction=200, M=16; where efConstruction is the construction precision and M is the number of connections.

[0070] In step S400, when the AI ​​model determines whether the file classification is correct, if it determines that the current classification is incorrect, it further provides the correct classification and the basis for it.

[0071] Combination Figure 3 As shown, step S500 specifically includes:

[0072] S510, Vector Database Retrieval: Using file category as the key, query similar historical format files and their structured data from the vector database;

[0073] S520, Relational Database Retrieval: Using file category as the key, query the field specifications of electronic vouchers of the same type from a relational database;

[0074] S530, Generation Stage: The search results obtained in steps S510 and S520 are concatenated with the extracted text content and handed over to the large model to generate and output structured information that conforms to the electronic voucher field specifications.

[0075] Furthermore, step S700 specifically includes:

[0076] The SHA-256 function is used to generate file hash data consisting of the layout file content and structured information.

[0077] The private key signature is generated using the Elliptic Curve Digital Algorithm (ECDSA), with a key length of 256 bits.

[0078] Write the hash data of the signed file into the blockchain.

[0079] Combination Figure 4 As shown, this embodiment of the invention also provides an electronic voucher generation system, including:

[0080] The OCR processing module is used to extract the text content of a file and attempt to automatically classify the file directly based on the extracted text content.

[0081] The vector database module is used to vectorize the extracted text content of files that fail to be automatically classified using OCR, and to retrieve the matching file classification from the vector database; it is also used to query similar historical format files and their structured data from the vector database using the file classification as the key.

[0082] The relational database module is used to query the field specifications of electronic vouchers of the same type from a relational database, using file category as the key;

[0083] The AI ​​large model module is used to correct text errors in the text content extracted by OCR operations, to analyze and verify the file classification obtained by OCR operations or vector database modules, and to concatenate the search results obtained by vector database modules and relational database modules based on file classification as keys with the extracted text content to generate structured information that conforms to the electronic voucher field specifications.

[0084] The electronic voucher service module is used to invoke the MCP protocol to generate a formatted file containing structured information;

[0085] The electronic signature service module is used to generate electronic signatures using blockchain encryption technology.

[0086] The AI ​​large model module uses DeepSeek-R1 for inference error correction and generation of structured data for electronic vouchers; the vector database module uses a Milvus 2.3 cluster (3 nodes) to store and retrieve historical electronic voucher vectors; the relational database module uses MySQL to store and retrieve voucher field specifications and metadata; the OCR processing module is configured with a TensorRT-accelerated PP-OCRv4 model with a processing speed of ≥200 pages / minute; the electronic voucher service module is used to generate electronic vouchers; and the electronic signature service module is used to generate and affix electronic signatures.

[0087] Specifically, the parameters and structure of the OCR processing module are as follows:

[0088] OCR engine: PaddleOCR v4.0;

[0089] Text detection model: DB++, det_db_thresh = 0.3, det_db_box_thresh = 0.6;

[0090] Text recognition model: CRNN, rec_image_shape = "3,32,320";

[0091] Multilingual support: Built-in dictionary for Simplified Chinese, English, and mixed numbers, with support for custom extensions;

[0092] Automatic classification: Classification is performed based on matching characteristic keywords, such as those containing "purchase contract", "VAT invoice", "taxi ticket", etc.

[0093] Specifically, the parameters and construction of the vector database module for vector retrieval and classification are as follows:

[0094] Text vectorization model: sentence-transformers

[0095] Similarity calculation: cosine similarity, with a threshold set to 0.75.

[0096] Search optimization: HNSW graph index is used, efConstruction=200, M=16.

[0097] Specifically, the AI ​​large-scale model implements text correction and classification verification in the following ways:

[0098] (1) Text error correction:

[0099] Prompt template:

[0100] [Original Text]

[0101] {extracted_text}

[0102] [Revision Requirements]

[0103] 1. Corrected confusion between numbers and letters (e.g., 0→o, 1→l)

[0104] 2. Semantic breaks caused by merging pagination / line breaks

[0105] 3. Maintain the integrity of technical terminology.

[0106] [Output Format]

[0107] [Revised text]

[0108] {corrected_text}

[0109] Output example:

[0110] Original: "Customer ID: 10001, Contact Number: 13800138000"

[0111] Correction: "Customer ID: 10001, Contact Number: 13800138000"

[0112] (2) Classification and verification process:

[0113] Prompt template:

[0114] [Document fragment]

[0115] {text_sample}

[0116] [Current Category]

[0117] {current_category}

[0118] [Task]

[0119] Determine if the file classification is correct. If incorrect, please provide the correct classification and the basis for it.

[0120] [Output Format]

[0121] [Classification Results]

[0122] {correct_category}

[0123] [in accordance with]

[0124] {explanation}

[0125] Specifically, the implementation of the AI ​​large model generation stage in the Retrieval Augmentation (RAG) process is as follows:

[0126] Prompt template:

[0127] [Retrieved field specifications]

[0128] {field_specification}

[0129] [Examples of similar historical vouchers]

[0130] {sample_credential}

[0131] [Text to be processed]

[0132] {extracted_text}

[0133] [Task]

[0134] According to the field specifications, extract structured information from the text to be processed, fill in missing values ​​(such as date format conversion), and ensure data consistency;

[0135] [Output Format]

[0136]

[0137] Finally, the specific implementation methods for generating layout documents and electronic signatures are as follows:

[0138] Layout document generation:

[0139] MCP protocol call:

[0140] Protocol version: MCP 2.0

[0141] Interface parameters:

[0142]

[0143]

[0144] Electronic signature generation:

[0145] Generate file hash: SHA-256 (formatted file content + structured data);

[0146] Private key signing: using the Elliptic Curve Digital Algorithm (ECDSA), with a key length of 256 bits;

[0147] On-chain evidence storage: writing the signature hash into the blockchain.

[0148] Furthermore, to make the present invention easier to understand, a specific application example is provided, which is described in detail below:

[0149] Taking paper scans as an example, the application scenario is: company employees use "paper VAT general invoices" issued by merchants for reimbursement.

[0150] Implementation process:

[0151] 1. Employees scan paper VAT general invoices;

[0152] 2. The employee uploads the scanned copy to this patent system (hereinafter referred to as the "System");

[0153] 3. The system calls the OCR service to recognize the invoice text and output the original content, for example:

[0154]

[0155]

[0156] The original invoice details only had two records, but because the first record was too long and involved line breaks, the OCR system recognized three records, misinterpreting "Office Laptop 16C 64G 2T with Dedicated Graphics Card" as "Office Laptop 16C 64G" + "2T with Dedicated Graphics Card". Additionally, because the "Invoice Remarks" were obscured by the invoice stamp, "Voucher" in the remarks was misinterpreted as "Official Certificate".

[0157] 4. The system automatically corrects text errors, fixing the above OCR errors;

[0158]

[0159]

[0160] 5. The system verifies the document type based on the OCR content and the initial OCR classification ("invoice_type":"General VAT invoice"), and confirms it as "General VAT invoice";

[0161] 6. Based on the file type, retrieve structured data of similar invoices from the vector library for the past 3 months, and query the field specifications for this file type from the relational database;

[0162] 7. The system fills the prompt word template with the search results and extracted text, and then submits it to the large model to generate structured information that conforms to the electronic voucher field specifications;

[0163] 8. The large model calls the electronic voucher service through the MCP protocol to generate a layout file containing structured information;

[0164] 9. The large model calls the electronic signature service through the MCP protocol to add an electronic signature to the above documents;

[0165] 10. The system stores the final generated file in the "Personal Electronic Certificate Folder";

[0166] 11. When employees submit expense reports, they use electronic vouchers from their "Personal Electronic Voucher Folder" in the expense reimbursement system. Subsequent accounting and archiving processes will automatically use these electronic vouchers.

[0167] This invention also provides a storage medium that can store multiple instructions adapted for loading and execution by a processor as described above. Figure 2 The method steps of the illustrated embodiment can be found in the following documentation for detailed execution. Figure 2 The specific details of the illustrated embodiments will not be elaborated here.

[0168] The present invention also provides a computer program product that stores at least one instruction, which is loaded and executed by the processor to implement the quality inspection data extraction configuration method as described in the above embodiments.

[0169] Please see Figure 5 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present invention. Figure 5 As shown, the terminal device 500 may include: at least one processor 501, at least one network interface 504, user interface 503, memory 505, and at least one communication bus 502.

[0170] The communication bus 502 is used to enable communication between these components.

[0171] The user interface 503 may include a display screen and a camera. Optionally, the user interface 503 may also include a standard wired interface and a wireless interface.

[0172] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0173] The processor 501 may include one or more processing cores. The processor 501 connects to various parts within the terminal device 500 using various interfaces and lines, and performs various functions and processes data of the terminal device 500 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 505, and by calling data stored in the memory 505. Optionally, the processor 501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 501 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display on the screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 501 and may be implemented as a separate chip.

[0174] The memory 505 may include random access memory (RAM) or read-only memory. Optionally, the memory 505 may include a non-transitory computer-readable storage medium. The memory 505 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 505 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 505 may also be at least one storage device located remotely from the aforementioned processor 501. Figure 5 As shown, the memory 505, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and application programs.

[0175] exist Figure 5In the terminal device 500 shown, the user interface 503 is mainly used to provide an input interface for the user and to obtain the user's input data; while the processor 501 can be used to call the application program stored in the memory 505 and specifically execute, such as Figure 2 The method shown can be referred to for details. Figure 2 As shown, it will not be elaborated further here.

[0176] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0177] The beneficial effects of the technical solution of the present invention include at least the following:

[0178] 1. In addition to supporting the nine types of electronic vouchers specified in the "Electronic Voucher Accounting Data Standard" in previous technologies, the present invention additionally supports the generation of electronic vouchers for all unstructured documents, realizing the paperless application of unstructured documents;

[0179] 2. Use a large model to correct text errors in the OCR recognition results to enhance the accuracy of generated electronic vouchers;

[0180] 3. Using a large model combined with RAG technology, based on electronic voucher specifications and historical legal data, automatically identify the category to which the file belongs, perform field matching, and generate structured information that conforms to the electronic voucher field specifications;

[0181] 4. Provides the ability to generate layout files based on MCP (Model Context Protocol), compatible with most LLM (Large Language Model) on the market.

[0182] The above description discloses only preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Therefore, equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for generating electronic vouchers, characterized in that, include: S100. Extract the text content of the file through OCR operation, and attempt to automatically obtain the file classification based on the extracted text content; S200: Use an AI large model to correct text errors in the text content extracted by the OCR operation; S300. For files that failed to be automatically classified using OCR in step S100, the extracted text content is vectorized, and a matching file classification is retrieved from a preset vector database. S400: Submit the corrected text content and the file classification obtained in the previous steps to the AI ​​model for analysis and verification. After verifying that the file classification is correct, proceed to step S500. S500 generates and outputs structured information that conforms to the electronic voucher field specifications through RAG technology; S600: Generates a layout file containing structured information by calling the MCP protocol; S700 uses blockchain encryption technology to generate electronic signatures.

2. The electronic voucher generation method according to claim 1, characterized in that, In step S100, the OCR operation extracts text content using a custom, expandable multilingual, multi-character format hybrid recognition dictionary; the OCR operation automatically classifies files based on feature keyword matching.

3. The electronic voucher generation method according to claim 1, characterized in that, In step S200, the text error correction includes character recognition error correction and text discontinuity problem correction.

4. The electronic voucher generation method according to claim 1, characterized in that, In step S300, during the text content vectorization process, the vectorization model adopts the sentence-transformers model, the similarity calculation adopts cosine similarity, and the retrieval method adopts HNSW graph index.

5. The electronic voucher generation method according to claim 1, characterized in that, In step S400, when the AI ​​model determines whether the file classification is correct, if it determines that the current classification is incorrect, it further provides the correct classification and the basis for it.

6. The electronic voucher generation method according to claim 1, characterized in that, Step S500 specifically includes: S510, Vector Database Retrieval: Using file category as the key, query similar historical format files and their structured data from the vector database; S520, Relational Database Retrieval: Using file category as the key, query the field specifications of electronic vouchers of the same type from a relational database; S530, Generation Stage: The search results obtained in steps S510 and S520 are concatenated with the extracted text content and handed over to the large model to generate and output structured information that conforms to the electronic voucher field specifications.

7. The electronic voucher generation method according to claim 1, characterized in that, Step S700 specifically includes: The SHA-256 function is used to generate file hash data consisting of the layout file content and structured information. The private key signature is generated using the Elliptic Curve Digital Algorithm (ECDSA), with a key length of 256 bits. Write the hash data of the signed file into the blockchain.

8. An electronic voucher generation system, characterized in that, include: The OCR processing module is used to extract the text content of a file and attempt to automatically classify the file directly based on the extracted text content. The vector database module is used to vectorize the extracted text content of files that fail to be automatically classified using OCR, and to retrieve the matching file classification from the vector database; it is also used to query similar historical format files and their structured data from the vector database using the file classification as the key. The relational database module is used to query the field specifications of electronic vouchers of the same type from a relational database, using file category as the key; The AI ​​large model module is used to correct text errors in the text content extracted by OCR operations, to analyze and verify the file classification obtained by OCR operations or vector database modules, and to concatenate the search results obtained by vector database modules and relational database modules based on file classification as keys with the extracted text content to generate structured information that conforms to the electronic voucher field specifications. The electronic voucher service module is used to invoke the MCP protocol to generate a formatted file containing structured information; The electronic signature service module is used to generate electronic signatures using blockchain encryption technology.

9. A storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as method steps as claimed in any one of claims 1 to 7.

10. A terminal device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed the method steps as claimed in any one of claims 1 to 7.