Mail attachment analysis method, system and equipment and storage medium
By identifying the business type when receiving an email and applying strategies from the parsing rule base, the problem of existing technologies being unable to adapt to email attachments of different formats is solved, achieving efficient and accurate email attachment parsing.
Patent Information
- Application Number
- CN202511444826.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-10
- Publication Date
- 2025-12-12
AI Technical Summary
Existing email attachment parsing technologies lack flexibility and cannot adapt to different email attachment formats and diverse business scenarios, thus affecting processing efficiency.
Upon receiving an email, the system identifies the current business type, retrieves the email attachments, and parses them according to the parsing scope configuration information and pre-defined strategies in the parsing rule base, including specific parsing strategies for spreadsheets, PDFs, and image formats.
It improves the accuracy and efficiency of email attachment parsing, and can quickly match appropriate parsing strategies to meet the processing needs of different business scenarios.
Smart Images

Figure CN121125678A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of email processing technology, and in particular to an email attachment parsing method, system, device and storage medium. Background Technology
[0002] Email, as a crucial tool for information transmission, is widely used in various business scenarios. With the increasing complexity and diversity of business operations, the need for processing email attachments is also growing. Email attachments may contain various formats, such as Excel spreadsheets, PDFs, and images, and these attachments contain critical business data. To efficiently extract and utilize this data, email attachment parsing technology has emerged.
[0003] However, existing email attachment parsing technologies typically employ a single processing method, primarily targeting image files. This lack of flexibility makes them unsuitable for email attachments of different formats and diverse business scenarios, thus impacting the efficiency of email attachment processing. Summary of the Invention
[0004] The main purpose of this application is to provide a method, system, device and storage medium for parsing email attachments, in order to solve the technical problem that existing email attachment parsing methods are difficult to adapt to different formats.
[0005] To achieve the above objectives, this application proposes a method for parsing email attachments, the method comprising: Upon receiving the current email, the service type of the current email is identified to determine the current service type of the current email; Obtain the email attachment of the current email, and determine the attachment to be parsed in the email attachment according to the parsing range configuration information corresponding to the current business type; The attachment format of the attachment to be parsed is determined, and the parsing strategy corresponding to the attachment format is queried in the parsing rule base corresponding to the current business type. The parsing rule base includes several preset attachment formats and corresponding configured parsing strategies that are predetermined based on historical email data. The attachment to be parsed is parsed according to the parsing strategy to obtain the parsing result.
[0006] In one embodiment, the step of identifying the service type of the current email upon receiving it, and determining the current service type of the current email, includes: Upon receiving the current email, the current email is pre-parsed to obtain its basic attributes, which include at least: relevant personnel, email body, and email attachments. Determine whether the basic attributes of the current email meet the preset sorting rule conditions, which include the basic attribute requirements for different preset business types; If so, the corresponding preset business type will be determined as the current business type of the current email.
[0007] In one embodiment, the step of obtaining the email attachment of the current email and determining the attachment to be parsed in the email attachment according to the parsing range configuration information corresponding to the current business type includes: Query the parsing range configuration information corresponding to the current business type. The parsing range configuration information includes: filtering conditions based on attachment name. Obtain the email attachment of the current email and determine whether the attachment name meets the filtering conditions; If so, the email attachments that meet the filtering criteria will be treated as attachments to be parsed.
[0008] In one embodiment, before the step of determining the attachment format of the attachment to be parsed and querying the parsing strategy corresponding to the attachment format in the parsing rule base corresponding to the current business type, the method includes: Based on the historical email data, several preset attachment formats are determined, and the attachment parsing strategies corresponding to each preset attachment format under different preset business types are determined. The attachment parsing strategies include content configuration information and field configuration information. The preset attachment formats include: spreadsheet format, portable document format, and image format. Based on the preset attachment formats and the preset attachment parsing strategies, a parsing rule library corresponding to different preset business types is constructed.
[0009] In one embodiment, when the preset attachment format is the spreadsheet format, the content configuration information is a pre-specified table cell, and the field configuration information is a cell data extraction method based on the table cell; When the preset attachment format is the portable document format, the content configuration information is the full text of the attachment or a pre-specified conversion table unit, and the field configuration information is a field matching method based on preset keywords or a unit data extraction method based on the conversion table unit; When the preset attachment format is the image format, the content configuration information is the full text of the attachment, and the field configuration information is a data extraction method based on a large language model.
[0010] In one embodiment, before the step of constructing a parsing rule base corresponding to different preset business types based on each of the preset attachment formats and each of the preset attachment parsing strategies, the method further includes: Based on the historical email data, determine the corresponding text parsing strategy configured for the email body under different preset business types; Accordingly, the step of constructing a parsing rule base corresponding to different preset business types based on each preset attachment format and each preset attachment parsing strategy includes: Based on the text parsing strategies, the preset attachment formats, and the attachment parsing strategies, a parsing rule library corresponding to different preset business types is constructed.
[0011] In one embodiment, the step of parsing the attachment to be parsed according to the parsing strategy to obtain the parsing result includes: Retrieve the text parsing strategy from the parsing rule base corresponding to the current business type; The email body of the current email is parsed according to the aforementioned text parsing strategy to obtain the text parsing result; The attachment to be parsed is parsed according to the attachment parsing strategy to obtain the attachment parsing result; The parsing results of the main text and the parsing results of the attachments are formatted and converted according to a preset conversion format to obtain formatted data; The formatted data is mapped at the field level according to a preset field dictionary to obtain email parsing data, and the email parsing data is determined as the parsing result.
[0012] Furthermore, to achieve the above objectives, this application also proposes an email attachment parsing system, the system comprising: The email sorting module is used to identify the business type of the current email when it is received, and to determine the current business type of the current email. The parsing range determination module is used to obtain the email attachments of the current email and determine the attachments to be parsed in the email attachments according to the parsing range configuration information corresponding to the current business type; The parsing strategy determination module is used to determine the attachment format of the attachment to be parsed, and query the parsing strategy corresponding to the attachment format in the parsing rule base corresponding to the current business type. The parsing rule base includes several preset attachment formats and corresponding configured parsing strategies that are predetermined based on historical email data. The email parsing module is used to parse the attachment to be parsed according to the parsing strategy and obtain the parsing result.
[0013] In addition, to achieve the above objectives, this application also proposes an email attachment parsing device, the device comprising: a memory, a processor, and an email attachment parsing program stored in the memory and executable on the processor, the email attachment parsing program being configured to implement the steps of the email attachment parsing method described above.
[0014] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, storing an email attachment parsing program, which, when executed by a processor, implements the steps of the email attachment parsing method described above.
[0015] This application proposes an email attachment parsing method, comprising: upon receiving a current email, identifying the business type of the current email to determine its current business type; obtaining the email attachments of the current email and determining the attachments to be parsed in the email attachments according to the parsing range configuration information corresponding to the current business type; determining the attachment format of the attachments to be parsed and querying the parsing strategy corresponding to the attachment format in the parsing rule base corresponding to the current business type, wherein the parsing rule base includes several preset attachment formats predetermined based on historical email data and corresponding configured parsing strategies; and parsing the attachments to be parsed according to the parsing strategy to obtain the parsing result.
[0016] This application improves the accuracy and efficiency of email attachment parsing by flexibly selecting parsing strategies based on different business types and attachment formats. Furthermore, the pre-configured parsing rule base allows for rapid matching of appropriate parsing strategies, reducing processing time for email attachments of different formats and better meeting the email attachment processing needs of various business scenarios. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the first embodiment of the email attachment parsing method of this application; Figure 2 This is a schematic diagram of the mail sorting process based on business type; Figure 3 This is a schematic diagram illustrating the entire process of parsing email attachments in this application. Figure 4 This is a flowchart illustrating the second embodiment of the email attachment parsing method of this application; Figure 5 This is a flowchart illustrating the third embodiment of the email attachment parsing method of this application; Figure 6This is a diagram illustrating the email parsing process based on a parsing strategy. Figure 7 This is a schematic diagram of the module structure of the email attachment parsing system in this application; Figure 8 This is a schematic diagram of the structure of the email attachment parsing device in an embodiment of this application.
[0020] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0023] This application provides a method for parsing email attachments, referencing... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the email attachment parsing method of this application. In this embodiment, the method includes steps S10 to S40: Step S10: Upon receiving the current email, identify the business type of the current email to determine its current business type.
[0024] It should be noted that the executing entity in this embodiment can be a computing electronic device with data processing, network communication, and program execution capabilities, such as a mobile phone, tablet, or system server. It can also be other electronic devices capable of accessing an email processing system, and this embodiment does not impose any limitations on this. Here, a system server (hereinafter referred to as "the system") is used as an example to explain and illustrate the various embodiments of this application.
[0025] It should be understood that the current email is received by the proxy mailbox being monitored by the system. When the proxy mailbox receives the email, it can synchronize the email to the system memory and store it in the format of an .eml file for subsequent email parsing.
[0026] When the system receives the current email, it can first preprocess and perform preliminary parsing to extract the basic attributes of the email to determine the business type of the email. Therefore, step S10 also includes: steps S101~S103: Step S101: Upon receiving the current email, pre-parse the current email to obtain its basic attributes, which include at least: relevant personnel, email body, and email attachments.
[0027] It should be noted that after receiving an email, the system can parse the content of the .eml file as follows: First, it determines the sender, recipient, subject, body, and whether there are any attachments. If there are attachments and they are compressed files, it can decompress them by searching for passwords, and then store the decompressed attachments in the system memory.
[0028] In addition, the system can monitor the capacity of proxy mailboxes: if the capacity of the proxy mailbox reaches a preset capacity threshold, it can issue a mailbox capacity warning to the user; it can also perform spam blocking and duplicate email filtering operations; and it can identify the stakeholders of the current email based on the sender and recipient.
[0029] In its implementation, after receiving the current email, the system can perform preliminary content parsing and extract the basic attributes of the current email: sender, recipient, CC recipient, email subject, email body, and (decompressed) email attachments, etc.
[0030] Step S102: Determine whether the basic attributes of the current email meet the preset sorting rule conditions, which include the basic attribute requirements of different preset business types.
[0031] Step S103: If yes, then the corresponding preset service type is determined as the current service type of the current email.
[0032] It should be understood that the preset sorting rules can include several sorting rules, which can be divided into basic rules and advanced rules. Users can set basic rules or advanced rules corresponding to different preset business types according to their configuration needs, so as to classify different emails into different business types according to these sorting rules.
[0033] The preset business types can be different business types that users pre-set and name based on business needs, email purposes, and different business scenarios, such as "share reduction", "market analysis", "contract signing", "project report", etc. This embodiment does not limit this.
[0034] Understandably, basic rules can include fundamental attribute requirements such as sender, recipient, CC, and proxy email addresses. The fundamental attribute requirements for each basic rule can be configured as follows: Sender: Supports multiple senders; checks if the email sender includes the configured sender. Recipients: Supports multiple recipients; checks if the email recipients include the configured recipients. CC recipients: Supports multiple recipients; checks if the configured CC recipients are included in the email's CC recipient list. Proxy email: Supports multiple proxy emails; checks if the configured proxy email is included in the email proxy email list.
[0035] Advanced rules can include basic attribute requirements such as email subject, email body, and email attachments. The basic attribute requirements in each advanced rule can be configured as follows: Subject rules: Supports multiple rules, which determine whether the email subject contains / does not contain / begins with / ends with the configured keywords, and allow configurable AND / OR logical operations between multiple rules; Body rules: Multiple rules are supported. They determine whether the email body contains / does not contain / begins with / ends with the configured keywords. Multiple rules can be configured with AND / OR logical operations. Attachment name rules: Supports multiple rules, which determine whether the attachment name contains / does not contain / begins with / ends with the configured keyword, and allow configurable AND / OR logical operations between multiple rules.
[0036] This can be used as a reference. Figure 2 This section describes the current email sorting process by business type. Figure 2 This is a schematic diagram of the mail sorting process based on business type.
[0037] Depend on Figure 2 As can be seen, after receiving the current email, the system can extract the basic attributes of the email to obtain the email information (sender, recipient, CC recipient, email subject, email body, email attachment name, and the email's email address); then, it sorts the email by business type according to the pre-configured sorting rules: basic rules and advanced rules. The basic rules include basic attribute requirements such as sender, recipient, CC recipient, and email address, while the advanced rules include basic attribute requirements such as whether the email subject, email body, and email attachment name are included.
[0038] Once the sorting is completed based on the above sorting rules, the corresponding business type of the current email can be determined, thus providing an accurate business context for subsequent attachment parsing and ensuring that the parsing operation can be optimized and adjusted according to specific business needs.
[0039] In practice, if the basic attributes of the current email meet the basic attribute requirements of any basic rule or advanced rule, then the business type of the current email is the preset business type set by that rule.
[0040] Step S20: Obtain the email attachment of the current email, and determine the attachment to be parsed in the email attachment according to the parsing range configuration information corresponding to the current business type.
[0041] It should be noted that users can also pre-configure the corresponding resolution range information for different preset business types according to different business needs and store it in the system memory. This resolution range information can be based on the filtering conditions of the attachment name.
[0042] The filtering criteria can be set to support multiple attachment names, specifically: determining whether the attachment name contains / does not contain / begins with / ends with the configured keyword.
[0043] In the specific implementation, the system can first query the parsing range configuration information, i.e., the filtering conditions, corresponding to the current business type in memory; then it can determine whether the name of the email attachment of the current email meets the filtering conditions; if so, it can determine several email attachments that meet the filtering conditions as attachments to be parsed.
[0044] Step S30: Determine the attachment format of the attachment to be parsed, and query the parsing strategy corresponding to the attachment format in the parsing rule base corresponding to the current business type. The parsing rule base includes several preset attachment formats and corresponding configured parsing strategies that are predetermined based on historical email data.
[0045] It should be noted that email attachments can be in Excel (spreadsheet) format, PDF (portable document) format, and image format. Different preset business types can be pre-configured with corresponding parsing rule bases, which include parsing strategies for different attachment formats.
[0046] For example, for email attachments in image or PDF format, the parsing strategy can be to use Optical Character Recognition (OCR) to parse the email attachments, or to input the attachments into a Large Language Model (LLM) and have the model parse the email attachments.
[0047] Step S40: Parse the attachment to be parsed according to the parsing strategy to obtain the parsing result.
[0048] In its implementation, the system can parse attachments of different formats according to the queried parsing strategy, and then standardize and convert the parsed data according to a pre-set format to obtain the parsing results, which can then be pushed to the user.
[0049] This can be used as a reference. Figure 3 This document describes the entire process of parsing email attachments in this application. Figure 3 This is a schematic diagram illustrating the entire process of parsing email attachments in this application.
[0050] Depend on Figure 3 As can be seen, when the system receives the current email, it can parse the email to obtain its basic attributes; then it determines whether the basic attributes of the current email match at least one sorting rule. If so, it sorts the email based on the sorting rule to determine the business type to which the current email belongs; then it determines the corresponding parsing strategy based on the business type to achieve email parsing; finally, after obtaining the parsed data, it can transform the parsed data according to a pre-set preset format to obtain the final parsing result and push it to the user.
[0051] In this embodiment, the system can flexibly select parsing strategies based on different business types and attachment formats, thereby improving the accuracy and efficiency of email attachment parsing. Furthermore, the pre-configured parsing rule base allows for rapid matching of suitable parsing strategies, reducing processing time for email attachments of different formats and better meeting the email attachment processing needs of various business scenarios.
[0052] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 4 , Figure 4 This is a flowchart illustrating the second embodiment of the email attachment parsing method of this application.
[0053] In this embodiment, to specifically illustrate how to construct the parsing rule base, before step S30, the following steps are included: S01~S02: Step S01: Determine several preset attachment formats based on the historical email data, and determine the attachment parsing strategy configured for each preset attachment format under different preset business types. The attachment parsing strategy includes content configuration information and field configuration information.
[0054] It should be understood that historical email data can be different emails received by the system in historical scenarios, along with their corresponding email parsing data. Based on historical email data, common attachment formats (common attachment formats under different preset business types) can be identified, which can then be used to build a parsing rule base.
[0055] However, it should be understood that the default attachment format may include spreadsheet formats (such as Excel, CSV), portable document formats (such as PDF), and image formats (such as JPEG, PNG), etc.
[0056] Under different preset business types, for each preset attachment format, users can pre-configure corresponding attachment parsing strategies in the system. These attachment parsing strategies can include content configuration information (configuring the content to be parsed within the attachment of that format) and field configuration information (configuring the extraction rules for fields within the attachment of that format), used to extract fields from email attachments. A detailed explanation of different preset attachment formats and their corresponding attachment parsing strategies is as follows: For spreadsheet formats (such as Excel and CSV), the content configuration information can be pre-specified table cells. Users can pre-configure the following information: Sheet: Specify the sequence number and key name of the sheet to be selected; Start line: Specifies the nth positive line, the mth line from the end, or the line containing the keyword as the start line; End line: Specifies the nth line from the end, the line containing the keyword, as the end line; Parse line: No parse line is specified; the line containing the keyword is used as the parse line.
[0057] Field configuration information for spreadsheet formats (such as Excel and CSV) can be based on the cell data extraction method specified above for the table cells. This extraction method can be as follows: Current Sheet: Table_Cell Position: Field information can be extracted from the cell in the nth row and mth column of the current Sheet, and regular expression matching is supported.
[0058] Table_Row: Field information can be extracted from the current Sheet, starting from the positive 0th row, with each row extracting the nth column / each row extracting the column containing the keyword, supporting regular expression matching.
[0059] Table_Column: Field information can be extracted from the current Sheet, taking the nth row of each column, starting from the mth column, and supports regular expression matching.
[0060] (Fuzzy) Table_Cell Content: Field information can be extracted from the current Sheet by specifying the cell (name fuzzy matching), moving it down x cells and right y cells, and supports regular expression matching.
[0061] (Precise) Table_Cell Content: Field information can be extracted from the current Sheet by specifying the cell (name exactly matched), moving it down x cells and right y cells, and supports regular expression matching.
[0062] Specify the Sheet: Table_Cell Position: Field information can be extracted from the cell in row n and column m of the sheet with the specified name, and regular expression matching is supported.
[0063] (Fuzzy) Table_Cell Content: Field information can be extracted from a Sheet with a specified name, by moving the specified cell down x cells and right y cells (fuzzy matching of name), and supports regular expression matching.
[0064] (Precise) Table_Cell Content: Field information can be extracted from a Sheet with a specified name, by shifting the specified cell down x cells and right y cells (name exactly matching), and supports regular expression matching.
[0065] Portable document formats (such as PDF) can be further divided into PDF text format and PDF table format.
[0066] For PDF body text format, the content configuration information can be the full text of the attachment. The system can split the PDF into several pages, each page being independent text, and removing tabs, line breaks, and other special characters, which will then be the content to be parsed under this format.
[0067] The field configuration information in the PDF text format can be based on a preset keyword matching method, which can be shown below: PDF Keywords: Field information can be extracted from configured PDF keywords, and regular expression matching is supported.
[0068] For PDF table format, the content configuration information can be pre-specified conversion table cells. Users can pre-configure the following information: parse pages: Specify all pages, the first page, or all pages except the first page as the selected parse pages.
[0069] Sheet: Specify the sequence number, sheet name, and keyword as the selected sheet. Start line: Specifies the nth positive line, the mth line from the end, or the line containing the keyword as the start line. End line: Specifies the nth line from the end, the line containing the keyword, as the end line. Parsing line: The line containing the keyword (without specifying it) is used as the parsing line. The field configuration information in the PDF table format can be based on the cell data extraction method specified above for the converted table cells. This extraction method can be as follows: Table_Cell Position: Field information can be extracted from the cell in the nth row and mth column of the selected Sheet, and regular expression matching is supported.
[0070] Table_Row: Field information can be extracted from the selected Sheet, starting from the positive 0th row, with each row having its nth column extracted, and regular expression matching is supported.
[0071] (Fuzzy) Table_Cell Content: Field information can be extracted from the selected Sheet by specifying the cell (name fuzzy matching), moving it down x cells and right y cells, and supports regular expression matching.
[0072] (Precise) Table_Cell Content: Field information can be extracted from the selected Sheet by specifying the cell (name exactly matched), moving down x cells and right y cells, and supports regular expression matching.
[0073] Outside the table: Fields can be extracted from the text outside the table in the PDF, and regular expression matching is supported.
[0074] For image formats (such as JPEG and PNG), the content configuration information can be the full text of the attachment. The system can use OCR to recognize image attachments and convert them into text content, while removing watermarks and stamps to avoid affecting the accuracy of the parsing. Furthermore, for image table formats, the system can also recognize the corresponding tables.
[0075] When the image format is an image form or image table, the field configuration information can be extracted using a data extraction method based on a large language model. This data extraction method can be as follows: Form keywords / external text: Field information is extracted through a large model's queries. It supports inputting background knowledge and sample content to assist the large model's recognition, improving its accuracy. The large model returns JSON-formatted questions and answers for easy field information extraction. A field can be configured with multiple aliases; all aliases will be queried, and the first alias with a result is used as the extracted information.
[0076] Text within the table: Field information is extracted from the table results of OCR. Multiple aliases can be configured for each field, and multiple aliases will be asked. The first alias with a result is taken as the extracted information.
[0077] Specifically, the aforementioned preset attachment formats and their corresponding attachment parsing strategies are as follows: when the preset attachment format is the spreadsheet format, the content configuration information is a pre-specified table cell, and the field configuration information is a cell data extraction method based on the table cell; when the preset attachment format is the portable document format, the content configuration information is the full text of the attachment or a pre-specified converted table cell, and the field configuration information is a field matching method based on preset keywords or a cell data extraction method based on the converted table cell; when the preset attachment format is the image format, the content configuration information is the full text of the attachment, and the field configuration information is a data extraction method based on a large language model.
[0078] Furthermore, considering that the common content and structure of emails under different preset business types can also be determined based on historical email data, this can also be used to build a parsing rule base later.
[0079] Therefore, under different preset business types, the system can configure corresponding text parsing strategies. These strategies can include content configuration information and field configuration information similar to the attachment parsing strategies described above, used to extract fields from the email body. Therefore, the specific text parsing strategies corresponding to the email body are explained below: In the text parsing strategy, the content configuration information can be a Sheet, and the selected Sheet can be used as the parsing content by specifying the serial number and Sheet name keyword.
[0080] In the text parsing strategy, the field configuration information can be pre-configured with specified business types, multiple extractable fields under that business category, and extraction methods. Field information is extracted from the parsed content according to the following rules: Body: Field information can be extracted from the email body, and regular expression matching is supported.
[0081] Subject: Field information can be extracted from the email subject, and regular expression matching is supported.
[0082] Attachment Name: This field information can be extracted from the email attachment name and supports regular expression matching.
[0083] Table_Cell Position: Field information can be extracted from the cell in the nth row and mth column of the selected Sheet, and regular expression matching is supported.
[0084] Table_Row: Field information can be extracted from the selected Sheet, starting from the positive 0th row, with each row having its nth column extracted, and regular expression matching is supported.
[0085] Table_Column: Field information can be extracted from the selected Sheet table, taking the nth row of each column, starting from the mth column, and supports regular expression matching.
[0086] Step S02: Construct a parsing rule library corresponding to different preset business types based on the preset attachment formats and the preset attachment parsing strategies.
[0087] Accordingly, since the aforementioned configuration includes different preset business types with corresponding email body parsing strategies, step S02 specifically includes: constructing parsing rule bases corresponding to different preset business types based on each of the aforementioned email body parsing strategies, each of the aforementioned preset attachment formats, and each of the aforementioned attachment parsing strategies.
[0088] In its implementation, the system can construct a parsing rule base based on preset attachment formats, attachment parsing strategies, and email body parsing strategies. This rule base stores the parsing strategies for email bodies and attachments under each business type, helping the system to quickly find and apply the appropriate parsing strategies when receiving emails of different business types and attachment formats.
[0089] This embodiment predefines and configures body text parsing strategies based on historical email data, and constructs a comprehensive parsing rule base by combining attachment formats and their corresponding parsing strategies. This not only improves the accuracy and efficiency of email attachment parsing but also enhances the system's adaptability and scalability, enabling it to better handle email body and attachment content across various business types. Furthermore, users can pre-configure parsing strategies for different business types within the aforementioned parsing library, thus helping to meet the customized needs of different business scenarios.
[0090] Based on the first and second embodiments of this application, in the third embodiment of this application, the content that is the same as or similar to that in embodiments one and two above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 5 , Figure 5 This is a flowchart illustrating the third embodiment of the email attachment parsing method of this application.
[0091] In this embodiment, to specifically illustrate how to parse the attachments to be parsed, step S40 includes: steps S401~S405: Step S401: Obtain the text parsing strategy from the parsing rule base corresponding to the current business type.
[0092] Step S402: Parse the email body of the current email according to the text parsing strategy to obtain the text parsing result.
[0093] In its implementation, the system determines the scope of the text to be parsed based on the content configuration information in the text parsing strategy, and extracts field-level information such as the text content, subject, and attachment name according to the field configuration information therein, to obtain the text parsing results.
[0094] Step S403: Parse the attachment to be parsed according to the attachment parsing strategy to obtain the attachment parsing result.
[0095] In its implementation, the system parses attachments of different formats according to the attachment parsing strategy. After obtaining the parsed attachment data, it can also perform functions such as text conversion, formula conversion, data validity verification, and data formatting on the parsed attachment data corresponding to different formats.
[0096] Step S404: Format and convert the parsing results of the main text and the parsing results of the attachments according to the preset conversion format to obtain formatted data.
[0097] It should be noted that the preset conversion format can include date format, number format, and text format, which helps users to intuitively obtain the parsing results.
[0098] For example, if the parsing result of the main text is: Order Number: 20250916-001, Order Amount: 5000 yuan; and the parsing result of the attachment is: Product Name: Product A, Quantity: 100, Unit Price: 50 yuan, and the preset conversion format is: Date format is YYYY-MM-DD, and number format is integer or floating-point number.
[0099] The corresponding formatted data could be: Order Number: 20250916-001, Order Amount: 5000.00, Product Name: Product A, Quantity: 100, Unit Price: 50.00.
[0100] Step S405: Perform field-level mapping on the formatted data according to the preset field dictionary to obtain email parsing data, and determine the email parsing data as the parsing result.
[0101] It should be understood that this preset field dictionary can define the name of each field and the corresponding parsing result. Based on the preset field dictionary, field-level mapping is performed on the formatted data, which helps with subsequent system storage and downstream parsing data processing.
[0102] For example, if the formatted data is: Order number: 20250916-001, Order amount: 5000.00, Product name: Product A, Quantity: 100, Unit price: 50.00.
[0103] The mapping relationships defined in the default field dictionary are: Order ID, Order Amount, Product Name, Quantity, and Unit Price.
[0104] After field-level mapping, the obtained email parsing data is: OrderID: 20250916-001, OrderAmount: 5000.00, ProductName: Product A, Quantity: 100, UnitPrice: 50.00.
[0105] Furthermore, you can also refer to this section. Figure 6 This section explains the process of parsing emails using attachment parsing and body parsing strategies. Figure 6This is a diagram illustrating the email parsing process based on a parsing strategy.
[0106] Depend on Figure 6 It can be seen that different attachment parsing strategies can be applied to the attachments to be parsed based on their different formats.
[0107] When parsing spreadsheet formats (such as Excel and CSV), the parsing content can be determined based on the content configuration information, such as a specified table, a specified starting row and column, or a specified row data keyword; then, based on the field configuration information, the parsing content can be extracted, such as row data extraction, table position extraction, and table content offset extraction.
[0108] When parsing PDF form formats, the content to be parsed can be determined to be formatted PDF text based on the content configuration information, and then the parsed content can be located and extracted based on the field configuration information.
[0109] When parsing PDF table formats, the parsing content can be determined based on the content configuration information, such as a specified table, a specified starting row and column, or a specified row data keyword. Then, based on the field configuration information, the parsing content can be extracted, such as row data extraction, table position extraction, and table content offset extraction.
[0110] When parsing image form / image table formats, the parsing content can be determined based on the content configuration information as the text content obtained by splitting PDF pages and recognizing them through OCR. This text content is then input into the large model, which extracts the form / table data at the field level.
[0111] In addition, when parsing the email body, the parsing content can be determined as the table or text content specified by the user in the email body based on the content configuration information; then, based on the field configuration information, the parsing content can be used to perform operations such as row data extraction, table position extraction, table content offset extraction, and text keyword extraction.
[0112] After completing email parsing, the obtained body and attachment parsing results can be integrated and processed, such as data formatting, field mapping, text conversion, data reuse, data validity verification, calculation formula conversion, and numerical precision processing, to obtain email parsing data. This parsing data can then be displayed to users as parsing results or pushed to other systems.
[0113] This embodiment parses the email body according to a text parsing strategy to obtain the text parsing result; it then parses the attachments according to an attachment parsing strategy to obtain the attachment parsing result; finally, it formats both the text parsing result and the attachment parsing result according to a preset conversion format to obtain formatted data; and finally, it maps the formatted data to fields according to a preset field dictionary to obtain the email parsing data, which is then identified as the parsing result. Because this embodiment can comprehensively process information from both the email body and attachments, it ensures the comprehensiveness and accuracy of information extraction, thereby improving the overall quality and reliability of email parsing. Furthermore, through format conversion and field-level mapping, this embodiment can convert the extracted data into a unified format, facilitating subsequent data processing and storage, further enhancing the system's flexibility and scalability.
[0114] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the email attachment parsing method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0115] In addition, this application also provides an email attachment parsing system, such as... Figure 7 As shown, Figure 7 This is a schematic diagram of the module structure of the email attachment parsing system in this application.
[0116] Depend on Figure 7 It is known that the system includes: mail sorting module 701, parsing range determination module 702, parsing strategy determination module 703, and mail parsing module 704.
[0117] The email sorting module 701 is used to identify the business type of the current email when it is received, and to determine the current business type of the current email. The parsing range determination module 702 is used to obtain the email attachments of the current email and determine the attachments to be parsed in the email attachments according to the parsing range configuration information corresponding to the current business type; The parsing strategy determination module 703 is used to determine the attachment format of the attachment to be parsed, and query the parsing strategy corresponding to the attachment format in the parsing rule base corresponding to the current business type. The parsing rule base includes several preset attachment formats and corresponding configured parsing strategies that are predetermined based on historical email data. The email parsing module 704 is used to parse the attachment to be parsed according to the parsing strategy and obtain the parsing result.
[0118] This system can flexibly select parsing strategies based on different business types and attachment formats, thereby improving the accuracy and efficiency of email attachment parsing. Furthermore, the pre-configured parsing rule base allows for rapid matching of appropriate parsing strategies, reducing processing time for email attachments of different formats and better meeting the email attachment processing needs of various business scenarios.
[0119] This application also provides an email attachment parsing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the email attachment parsing method in Embodiment 1 above.
[0120] The following is for reference. Figure 8 , Figure 8 This is a schematic diagram of the email attachment parsing device of this application. The email attachment parsing device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The email attachment parsing device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0121] like Figure 8As shown, the email attachment parsing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the email attachment parsing device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the email attachment parsing device to communicate wirelessly or wiredly with other devices to exchange data. Although email attachment parsing devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0122] The email attachment parsing device provided in this application, employing the email attachment parsing method described in the above embodiments, can solve the technical problem of email attachment parsing. Compared with the prior art, the beneficial effects of the email attachment parsing device provided in this application are the same as those of the email attachment parsing method provided in the above embodiments, and other technical features of this email attachment parsing device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0123] This application also provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the email attachment parsing method in the above embodiments.
[0124] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0125] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described email attachment parsing method, thereby solving the technical problems of the email attachment parsing method. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the email attachment parsing method provided in the above embodiments, and will not be repeated here.
[0126] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other elements in the process, method, article, or system that includes that element.
[0127] The sequence numbers of the above embodiments of the present invention are merely for description and do not represent the superiority or inferiority of the embodiments. They are only some embodiments of this application and are not intended to limit the scope of this application. All equivalent structural transformations made under the technical concept of this application and based on the content of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included within the protection scope of this application.
Claims
1. A method for parsing email attachments, characterized in that, The method includes: Upon receiving the current email, the service type of the current email is identified to determine the current service type of the current email; Obtain the email attachment of the current email, and determine the attachment to be parsed in the email attachment according to the parsing range configuration information corresponding to the current business type; The attachment format of the attachment to be parsed is determined, and the parsing strategy corresponding to the attachment format is queried in the parsing rule base corresponding to the current business type. The parsing rule base includes several preset attachment formats and corresponding configured parsing strategies that are predetermined based on historical email data. The attachment to be parsed is parsed according to the parsing strategy to obtain the parsing result.
2. The method as described in claim 1, characterized in that, The step of identifying the current business type of the current email upon receipt and determining the current business type of the current email includes: Upon receiving the current email, the current email is pre-parsed to obtain its basic attributes, which include at least: relevant personnel, email body, and email attachments. Determine whether the basic attributes of the current email meet the preset sorting rule conditions, which include the basic attribute requirements for different preset business types; If so, the corresponding preset business type will be determined as the current business type of the current email.
3. The method as described in claim 2, characterized in that, The step of obtaining the email attachment of the current email and determining the attachment to be parsed in the email attachment according to the parsing range configuration information corresponding to the current business type includes: Query the parsing range configuration information corresponding to the current business type. The parsing range configuration information includes: filtering conditions based on attachment name. Obtain the email attachment of the current email and determine whether the attachment name meets the filtering conditions; If so, the email attachments that meet the filtering criteria will be treated as attachments to be parsed.
4. The method as described in claim 1, characterized in that, Before the step of determining the attachment format of the attachment to be parsed and querying the parsing strategy corresponding to the attachment format in the parsing rule base corresponding to the current business type, the following steps are included: Based on the historical email data, several preset attachment formats are determined, and the attachment parsing strategies corresponding to each preset attachment format under different preset business types are determined. The attachment parsing strategies include content configuration information and field configuration information. The preset attachment formats include: spreadsheet format, portable document format, and image format. Based on the preset attachment formats and the preset attachment parsing strategies, a parsing rule library corresponding to different preset business types is constructed.
5. The method as described in claim 4, characterized in that, When the preset attachment format is the spreadsheet format, the content configuration information is a pre-specified table cell, and the field configuration information is a cell data extraction method based on the table cell; When the preset attachment format is the portable document format, the content configuration information is the full text of the attachment or a pre-specified conversion table unit, and the field configuration information is a field matching method based on preset keywords or a unit data extraction method based on the conversion table unit; When the preset attachment format is the image format, the content configuration information is the full text of the attachment, and the field configuration information is a data extraction method based on a large language model.
6. The method as described in claim 4, characterized in that, Before the step of constructing a parsing rule base corresponding to different preset business types based on each preset attachment format and each preset attachment parsing strategy, the method further includes: Based on the historical email data, determine the corresponding text parsing strategy configured for the email body under different preset business types; Accordingly, the step of constructing a parsing rule base corresponding to different preset business types based on each preset attachment format and each preset attachment parsing strategy includes: Based on the text parsing strategies, the preset attachment formats, and the attachment parsing strategies, a parsing rule library corresponding to different preset business types is constructed.
7. The method as described in claim 1, characterized in that, The step of parsing the attachment to be parsed according to the parsing strategy to obtain the parsing result includes: Retrieve the text parsing strategy from the parsing rule base corresponding to the current business type; The email body of the current email is parsed according to the aforementioned text parsing strategy to obtain the text parsing result; The attachment to be parsed is parsed according to the attachment parsing strategy to obtain the attachment parsing result; The parsing results of the main text and the parsing results of the attachments are formatted and converted according to a preset conversion format to obtain formatted data; The formatted data is mapped at the field level according to a preset field dictionary to obtain email parsing data, and the email parsing data is determined as the parsing result.
8. An email attachment parsing system, characterized in that, The system includes: The email sorting module is used to identify the business type of the current email when it is received, and to determine the current business type of the current email. The parsing range determination module is used to obtain the email attachments of the current email and determine the attachments to be parsed in the email attachments according to the parsing range configuration information corresponding to the current business type; The parsing strategy determination module is used to determine the attachment format of the attachment to be parsed, and query the parsing strategy corresponding to the attachment format in the parsing rule base corresponding to the current business type. The parsing rule base includes several preset attachment formats and corresponding configured parsing strategies that are predetermined based on historical email data. The email parsing module is used to parse the attachment to be parsed according to the parsing strategy and obtain the parsing result.
9. An email attachment parsing device, characterized in that, The device includes: a memory, a processor, and an email attachment parsing program stored in the memory and executable on the processor, the email attachment parsing program being configured to implement the steps of the email attachment parsing method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, The storage medium stores an email attachment parsing program, which, when executed by a processor, implements the steps of the email attachment parsing method as described in any one of claims 1 to 7.