Mail information extraction method and device, and electronic equipment
By parsing email pages and processing email text using a pre-defined feature recognition model, the problem of low accuracy in email information extraction has been solved, achieving more efficient information extraction and understanding.
Patent Information
- Application Number
- CN202310907244.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2043-07-21
AI Technical Summary
In existing technologies, the accuracy of email information extraction is low, and the email content cannot be effectively understood, resulting in inaccurate information extraction.
By parsing the target email page, the attribute information of multiple primary elements is determined. The target email text is then processed using a preset element recognition model, and the content of the primary and secondary elements is combined to extract the email information.
It improves the accuracy and efficiency of email information extraction, enabling better understanding of email content and reducing the possibility of users missing important information.
Smart Images

Figure CN116821552B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computers, relates to data processing technology, and in particular relates to a mail information extraction method and device and electronic equipment. BACKGROUND
[0002] With the continuous development of Internet communication, more and more information is transmitted in the form of electronic mail in people's daily work, study and life, and mail communication has become an indispensable communication and exchange method for most people. In the face of massive electronic mail, how to quickly and effectively analyze mail information has become a focus of massive electronic mail analysis in the big data era.
[0003] However, in the related art, the receiver of the mail often needs to filter illegal mail and spam mail with a security protocol, but cannot further understand the content of the mail, resulting in low accuracy of mail information extraction. SUMMARY
[0004] The embodiments of the present application provide a mail information extraction method, device and electronic equipment to solve the problem of low accuracy of mail information extraction.
[0005] The first aspect of the embodiments of the present application provides a mail information extraction method, which comprises: determining a target mail page of mail information to be extracted; parsing the target mail page to obtain attribute information corresponding to a plurality of first elements; determining first element content corresponding to the first elements according to the attribute information; determining a target mail text corresponding to the target mail page, and inputting the target mail text into a preset element recognition model to obtain second elements and second element content corresponding to the second elements; combining the first elements and the first element content, and combining the second elements and the second element content to obtain extracted mail information.
[0006] Further, in the above method provided by the embodiments of the present application, the determination of the target mail page of the mail information to be extracted comprises: obtaining an initial mail set; selecting a target mail set associated with a preset element keyword from the initial mail set; performing page rendering on each target mail in the target mail set according to a rendering instruction to obtain a target mail page.
[0007] Further, in the above method provided by the embodiments of the present application, the parsing of the target mail page to obtain attribute information corresponding to a plurality of first elements comprises: obtaining a first element associated with the preset element keyword according to the preset element keyword; determining an element position of the first element in the target mail page; determining an element size corresponding to the first element according to the element position; and combining the element position and the element size to obtain attribute information of the first element.
[0008] Further, in the method provided by the embodiments of the present application, the determining the first element content corresponding to the first element according to the attribute information comprises: determining the element position corresponding to the first element according to the attribute information; acquiring a plurality of data blocks in a neighborhood corresponding to the element position; selecting a target data block from the plurality of data blocks, and taking content corresponding to the target data block as the first element content corresponding to the first element.
[0009] Further, in the method provided by the embodiments of the present application, the selecting the target data block from the plurality of data blocks comprises: analyzing each data block in the neighborhood to obtain a data block length and a data type corresponding to each data block; and selecting the target data block from the plurality of data blocks in the neighborhood according to the data block length and the data type.
[0010] Further, in the method provided by the embodiments of the present application, the determining the target mail text corresponding to the target mail page comprises: acquiring an initial mail text corresponding to the target mail page; and deleting the first element and the first element content from the initial mail text to obtain the target mail text.
[0011] Further, in the method provided by the embodiments of the present application, the inputting the target mail text into the preset element recognition model to obtain the second element and the second element content corresponding to the second element comprises: inputting the target mail text into an embedding layer of the preset element recognition model to obtain a text feature vector sequence; inputting the text feature vector sequence into a feature encoding layer of the preset element recognition model to obtain a character-level feature vector sequence; inputting the character-level feature vector sequence into a label prediction network layer of the preset element recognition model to obtain a label corresponding to each character-level feature vector; and determining the second element and the second element content corresponding to the second element according to the label.
[0012] Further, in the method provided by the embodiments of the present application, after the combining the first element and the first element content, and the combining the second element and the second element content, the method further comprises: determining a first preset additional content corresponding to the first element and a second preset additional content corresponding to the second element; updating the first element content according to the first preset additional content to obtain target first element content; updating the second element content according to the second preset additional content to obtain target second element content; and sending the first element and the target first element content, and the second element and the target second element content to a terminal device.
[0013] The second aspect of the embodiment of the present application further provides a mail information extraction device, the device comprising: a page determination module configured to determine a target mail page of mail information to be extracted; a page analysis module configured to analyze the target mail page to obtain attribute information corresponding to a plurality of first elements; a content determination module configured to determine first element content corresponding to the first elements according to the attribute information; a model processing module configured to determine target mail text corresponding to the target mail page, and input the target mail text into a preset element recognition model to obtain second elements and second element content corresponding to the second elements; and a content combination module configured to combine the first elements and the first element content, and combine the second elements and the second element content to obtain extracted mail information.
[0014] The third aspect of the embodiment of the present application further provides an electronic device, the electronic device comprising a controller and a memory, the controller being configured to implement the mail information extraction method according to any one of the above aspects when executing a computer program stored in the memory.
[0015] The fourth aspect of the embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium storing a computer program, the computer program being executed by a controller to implement the mail information extraction method.
[0016] The above mail information extraction method provided by the embodiment of the present application comprises the following steps: analyzing a target mail page to obtain attribute information corresponding to a plurality of first elements; determining first element content corresponding to the first elements according to the attribute information; determining target mail text corresponding to the target mail page, and inputting the target mail text into a preset element recognition model to obtain second elements and second element content corresponding to the second elements; and combining the first elements and the first element content, and combining the second elements and the second element content to obtain extracted mail information. According to the embodiment of the present application, the first element content corresponding to the first elements in the mail is determined according to the attribute information, the second elements in the mail and the second element content are determined by inputting the target mail text into the preset element recognition model, and the mail information is extracted by combining attribute analysis and model processing, thereby improving the accuracy of mail information extraction. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 FIG. 1 is an application scenario diagram of a mail information extraction method provided by the embodiment of the present application.
[0018] Figure 2 FIG. 2 is a flowchart of a mail information extraction method provided by the embodiment of the present application.
[0019] Figure 3 FIG. 3 is a determination flowchart of a target mail page provided by the embodiment of the present application.
[0020] Figure 4 is a property information determination flowchart provided by an embodiment of the present application.
[0021] Figure 5 is a first element content determination flowchart provided by an embodiment of the present application.
[0022] Figure 6 is a target data block selection flowchart provided by an embodiment of the present application.
[0023] Figure 7 is a target mail text determination flowchart provided by an embodiment of the present application.
[0024] Figure 8 is a preset element recognition model processing flowchart provided by an embodiment of the present application.
[0025] Figure 9 is a display flowchart applied to a terminal device provided by an embodiment of the present application.
[0026] Figure 10 is a structural schematic diagram of a mail information extraction device provided by an embodiment of the present application.
[0027] Figure 11 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0028] It should be noted that the terms "first", "second" in the specification and claims of the present application and the drawings are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0029] In addition, it should be noted that the method disclosed in the embodiments of the present application or the method shown in the flowchart includes one or more steps for implementing the method, and the execution order of the steps can be interchanged with each other without departing from the scope of the claims, and some steps can also be deleted.
[0030] Some embodiments will be described below with reference to the accompanying drawings. The following embodiments and features in the embodiments can be combined with each other without conflict.
[0031] With the continuous development of Internet communication, e-mail plays an increasingly important role in various fields, such as the field of case investigation involving network security, the field of e-commerce, the field of education, etc. Embodiments of the present application take e-mail applied to the field of e-commerce as an example. Merchants push some product information, preferential activities, order information, logistics information, etc. to customers in the form of e-mail. If the customer ignores the e-mail or treats it as spam when processing the e-mail, it is an order loss for the merchant; and for some order information and logistics information e-mails, they are easily overwhelmed by other e-mails or forgotten, and when the customer wants to view the e-mail information next time, it is found that it is difficult to find. Therefore, it is necessary to analyze the content of the received e-mail.
[0032] However, in the related art, the receiver of the e-mail is often helped by the relevant security protocol to filter illegal e-mails and spam, but it is impossible to further understand the content of the e-mail, resulting in low accuracy of e-mail information extraction.
[0033] Based on the above problems, the embodiments of the present application provide a mail information extraction method, which can improve the accuracy of mail information extraction.
[0034] In combination with Figure 1 The application scenario of the mail information extraction method provided by the embodiments of the present application is illustrated. As shown in Figure 1 The electronic device is in communication connection with a terminal device, and the terminal device is in communication connection with a mail service provider. The terminal device can realize human-computer interaction or network communication, for example, the terminal device can be a personal computer, a tablet computer, a smart phone, a digital camera, etc. The terminal device can receive and store multiple e-mails of different types, such as e-mails about product discounts sent by merchants, order information e-mails, logistics information e-mails, news push e-mails, etc. The electronic device is used to realize the mail information extraction method, for example, the electronic device can be a computer, a notebook computer, a server, etc. The mail service provider can be a mail server, which is used to provide mail service, for example, the mail service provider can store multiple e-mails of different types corresponding to different users.
[0035] In an embodiment of the present application, the terminal device is the authorized party and the electronic device is the authorized party. For example, the terminal device can authorize the electronic device to establish a communication connection with the terminal device and extract all the emails sent to the terminal device. Then, the electronic device can call the emails in the terminal device through an input device (e.g., a keyboard, a mouse, a remote controller, a touchpad, a voice control device, etc.). After that, the electronic device extracts the email information of the called emails to obtain the email information. Finally, the email information is output to the terminal device to display the email information on the terminal device. In another embodiment of the present application, the terminal device can authorize the electronic device to establish a communication connection with the terminal device. After that, the electronic device obtains multiple emails of different types of the user of the terminal device from the email service provider.
[0036] Figure 2 FIG. 1 is a flowchart of a method for extracting email information according to an embodiment of the present application. The method for extracting email information is applied to an electronic device. As shown in FIG. 1, the order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted. Figure 2
[0037] S11, determining a target email page of email information to be extracted.
[0038] In some embodiments, in order to extract the email information, a keyword for identifying a corresponding element of an email is set in advance, wherein the element can include an order element, a logistics element, a discount element, etc., and the corresponding preset element keyword can include keywords such as "order", "logistics", "discount", etc. By setting the preset element keyword and performing preliminary screening on a large number of emails according to the preset element keyword, the target email of the email information to be extracted can be obtained. The target email page refers to the page of the target email associated with the preset element keyword after rendering. The electronic device extracts an initial email set from the terminal device and performs a preset element keyword search on each initial email in the initial email set. If any initial email includes the preset element keyword, the email is determined as the target email. After that, the electronic device renders the target email to obtain the target email page. The initial email set refers to a collection of all emails obtained from the terminal device, and the initial email set can include the target email containing the preset element keyword and irrelevant emails not containing the preset element keyword.
[0039] S12, parsing the target email page to obtain attribute information corresponding to multiple first elements.
[0040] In some embodiments, the first element refers to an element pre-set to have a positional relationship with the element content. Taking the elements including an order element, a logistics element, a discount element, a merchant element and a commodity element as examples, the element content corresponding to the order element is an order number, and the order element has a positional relationship with the order number, for example, the order number is set in the same column or the same row of the order element. The element content corresponding to the logistics element is a logistics number, and the logistics element has a positional relationship with the logistics number, for example, the logistics number is set in the same column or the same row of the logistics element. The element content corresponding to the discount element is commodity discount information, and the commodity discount information is not fixedly set in a certain position of the discount element, that is, the discount element does not have a positional relationship with the commodity discount information. Similarly, the merchant element and the commodity element are also the same, and are not fixedly set in a certain position. Thus, the order element and the logistics element having the positional relationship are taken as the first element. By analyzing the target mail page, attribute information corresponding to the first element is obtained. The attribute information can include element name, element type, element position and element size and the like pre-set to identify the data block corresponding to the first element, wherein the element type can include a text type and a picture type, the element position can refer to the coordinates of the data block in the target mail page, and the element size can refer to the width and height of the data block. Taking the order element as the first element as an example, a text box of the order element in the target mail page is determined, and the text box is taken as the data block. The element name corresponding to the data block is “order”, the element type corresponding to the data block is “text”, the element position corresponding to the data block is “x”: 100, “y”: 200, and the element size corresponding to the data block is “width”: 300, “height”: 100.
[0041] S13, determining first element content corresponding to the first element according to the attribute information.
[0042] In some embodiments, the first element has a positional relationship with the first element content, and the first element content corresponding to the first element can be determined according to the element position in the attribute information. First, the neighborhood corresponding to the element position of the first element and the data blocks in the neighborhood are determined, and a plurality of data blocks are obtained; then, the data type and the data length of each data block in the neighborhood are determined; then, the target data block satisfying the preset data requirement in terms of data type and data block length is selected from the plurality of data blocks in the neighborhood; finally, the content corresponding to the target data block is determined as the first element content corresponding to the first element. The neighborhood corresponding to the element position of the first element can include but is not limited to the left position and the right position of the same row, the upper position and the lower position of the same column; the data blocks in the neighborhood can include at least one data block in the left position, at least one data block corresponding to the right position, at least one data block corresponding to the upper position, and at least one data block corresponding to the lower position. The data type of the data block can include but is not limited to the number type, the letter type, the number and letter combination type, the character type, and the picture type. The data block length can refer to the width of the data block. In an embodiment, the width of the data block can refer to the number of bytes of each element in the data block. For example, if the data block contains 10 integers, each integer occupies 4 bytes, and the width of the data block is 40 bytes; in another embodiment, the width of the data block can refer to the width of the content area.
[0043] In an embodiment, the preset data requirement refers to the requirement that the data type and the data block length of the data block corresponding to the first element content should meet. Taking the first element as an order element for example, the first element content corresponding to the order element is an order number, and thus the preset data requirement corresponding to the order element can be that the data type can include the number type, the letter type, and the number and letter combination type, and the data block length is 8 to 32 characters. By detecting the plurality of data blocks in the neighborhood corresponding to the order element according to the preset data requirement, it is determined that the data block corresponding to the right position of the same row meets the preset data requirement, the data block is taken as the target data block, and the content corresponding to the data block is taken as the order number corresponding to the order element.
[0044] S14, determining the target mail text corresponding to the target mail page, and inputting the target mail text into a preset element recognition model to obtain a second element and a second element content corresponding to the second element.
[0045] In some embodiments, the second element refers to an element that has no positional relationship with the element content. Taking an order element, a logistics element, a discount element, a merchant element, and a commodity element as examples, the discount element, the merchant element, and the commodity element are all second elements. The element content corresponding to the discount element can be commodity discount information, the element content corresponding to the merchant element can be commodity name information, and the element content corresponding to the commodity element can be commodity name, commodity model, commodity price, and the like. The target mail text can include the remaining mail content after the first element and the first element content are removed from the target mail page.
[0046] In some embodiments, the preset element recognition model is a model that is pre-set to perform sequence labeling processing on the target mail text to obtain elements and element content. The preset element recognition model can be a hidden Markov model, a maximum entropy model, a conditional random field, or a deep learning model, without limitation. The input data of the preset element recognition model is a mail text, and the output data is an element and element content. In an embodiment, a mail text with an element label and an element content label is collected as input data in training data, and the element corresponding to the determined element label and the element content corresponding to the element content label are output data in the training data. An element recognition model is trained according to the above input data and output data until the model converges to a preset range, and a preset element recognition model is obtained.
[0047] S15, combining the first element and the first element content, and combining the second element and the second element content, to obtain extracted mail information.
[0048] In some embodiments, the electronic device combines the first element and the first element content, and combines the second element and the second element content as extracted mail information. Then, the electronic device transmits the extracted mail information to a terminal device and displays the extracted mail information on the terminal device. For example, a mail label is constructed for a target mail that has extracted mail information in the terminal device, and the content of the mail label includes the first element and the first element content, and the second element and the second element content. Then, when there are a large number of mails in the terminal device, a user can quickly understand the mails by searching the mail label on the mails, so as to avoid missing important mail information.
[0049] The mail information extraction method provided in the embodiments of the present application comprises the following steps: analyzing a target mail page to obtain attribute information corresponding to a plurality of first elements; determining first element content corresponding to the first elements according to the attribute information; determining a target mail text corresponding to the target mail page, and inputting the target mail text into a preset element recognition model to obtain second elements and second element content corresponding to the second elements; and combining the first elements and the first element content, and combining the second elements and the second element content to obtain extracted mail information. According to the embodiments of the present application, the first element content corresponding to the first elements in the mail is determined according to the attribute information, and the second elements and the second element content in the mail are determined by inputting the target mail text into the preset element recognition model. The mail information is extracted by combining attribute analysis and model processing, and the accuracy of mail information extraction can be improved.
[0050] Figure 3 FIG. 1 is a flowchart of a determination process of a target mail page according to an embodiment of the present application. The determination process of the target mail page is applied to an electronic device. As shown in FIG. 1, the determination process of the target mail page comprises the following steps: Figure 3
[0051] S21, obtaining an initial mail set.
[0052] In some embodiments, the initial mail set refers to a collection of all mails of different types stored in the terminal device. For example, the initial mail set can comprise mails about commodity discounts issued by a merchant, order information mails, logistics information mails, news push mails, etc. In another embodiment, the initial mail set can also be a collection of all mails of customers collected from a mail server according to authorization of the terminal device. In an embodiment, the initial mail set can be obtained from the terminal device or the mail server according to a preset collection period, for example, the preset collection period can be one week, which is not limited herein.
[0053] S22, selecting a target mail set associated with a preset element keyword from the initial mail set.
[0054] In some embodiments, the preset element keyword refers to a keyword used to identify an element which is set in advance. For example, the preset element keyword can comprise keywords such as "order", "logistics", "discount", "rebate", etc. The preset element keyword is searched in each initial mail in the initial mail set. If the initial mail comprises the preset element keyword, the mail is determined as a target mail. If the initial mail does not comprise the preset element keyword, the mail is determined as not a target mail.
[0055] S23, performing page rendering on each target mail in the target mail set according to a rendering instruction to obtain a target mail page.
[0056] In some embodiments, the rendering instruction refers to a preset instruction for rendering the initial mail format into the target mail format, where the initial mail format can be in html or xml format, and the target mail format can be in plain text format, which is not limited herein. Since the initial mail format corresponds to a mail with a difficultly positioned element and element content, rendering the initial mail format into the target mail format reduces the difficulty of determining the position of the element and the position of the element content, thereby improving the rate of mail information extraction.
[0057] The embodiments of the present application can filter a large number of irrelevant mails, reduce the number of mails to be information-extracted, reduce the running pressure of the electronic device, and thereby improve the rate of mail information extraction by selecting the target mail set associated with the preset element keyword from the initial mail set. In addition, the embodiments of the present application can obtain a target mail page by rendering the target mail page, so that the target mail page can reduce the difficulty of determining the position of the element and the position of the element content, thereby further improving the rate of mail information extraction.
[0058] Figure 4 is a flowchart of the determination of attribute information provided by the embodiments of the present application. The determination of attribute information is applied to an electronic device. As shown in Figure 4 , the following steps are included:
[0059] S31, obtaining a first element associated with the preset element keyword according to the preset element keyword.
[0060] In some embodiments, the preset element keyword and the element have a corresponding relationship, i.e., a first mapping relationship. For example, the preset element keyword is "order", and the corresponding element is the order element; the preset element keyword is "logistics", and the corresponding element is the logistics element. By querying the above first mapping relationship, the first element corresponding to the preset element keyword can be obtained. In some other embodiments, the first element associated with the preset element keyword can also be obtained directly by associating the preset element keyword with the element.
[0061] S32, determining the element position of the first element in the target mail page.
[0062] In some embodiments, the element position can be the coordinates of a data block in the target mail page. For example, the element position corresponding to the data block where the first element is located is "x": 100, "y": 200.
[0063] S33, determining the element size corresponding to the first element according to the element position.
[0064] In some embodiments, the data block at the element position is obtained, and the width and height of the data block are taken as the element size corresponding to the first element, for example, the element size corresponding to the first element is "width": 300, "height": 100".
[0065] S34, the element position and the element size are combined to obtain the attribute information of the first element.
[0066] In some embodiments, the element position and the element size are combined according to a preset data format to obtain the attribute information of the first element, the preset data format is a pre-set data format, for example, the preset data format can be {element position, element size}. In other embodiments, the attribute information can also include the name and type of the first element, wherein the type can include a text type and a picture type.
[0067] Embodiments of the present application obtain the attribute information by analyzing the element position and the element size of the first element in the target mail page, facilitate subsequent determination of the first element content according to the attribute information, and can improve the accuracy and rate of determination of the first element content, and further improve the accuracy and rate of mail information extraction.
[0068] Figure 5 is a first element content determination flowchart provided by an embodiment of the present application. The first element content determination flowchart is applied to an electronic device. As shown in Figure 5 includes the following steps:
[0069] S41, the element position corresponding to the first element is determined according to the attribute information.
[0070] In some embodiments, the attribute information can include the element name, element type, element position and element size of the first element, and for each attribute information, there is a unique attribute identifier. For example, the attribute identifier corresponding to the element name can be "content", the attribute identifier corresponding to the element type can be "type", the attribute identifiers corresponding to the element position can be "X" and "Y", and the attribute identifiers corresponding to the element size can be "width" and "height". The element position corresponding to the first element can be obtained by querying the above attribute identifiers "X" and "Y".
[0071] S42, a plurality of data blocks in the neighborhood corresponding to the element position are obtained.
[0072] In some embodiments, the neighborhood corresponding to the element position can include left and right positions in the same row, and upper and lower positions in the same column; the data blocks in the neighborhood can include at least one data block of the left position, at least one data block corresponding to the right position, at least one data block corresponding to the upper position, and at least one data block corresponding to the lower position. The number of data blocks corresponding to each neighborhood position can be one or more, which is not limited herein. The closer the neighborhood position to the element position, the greater the probability that the data block corresponding to the neighborhood position can be used as the element content. Embodiments of the present application take the number of data blocks corresponding to each neighborhood position as one for example.
[0073] S43, selecting a target data block from the plurality of data blocks, and taking the content corresponding to the target data block as the first element content corresponding to the first element.
[0074] In some embodiments, the target data block refers to the selected database as the first element content, and the data type and data block length corresponding to the target data block need to meet the preset data requirement corresponding to the first element. The preset data requirement refers to the requirement that the data type and data block length of the data block corresponding to the first element content need to meet. In an embodiment, there is a corresponding relationship between the first element and the preset data requirement, and by querying the corresponding relationship, the preset data requirement corresponding to the first element can be obtained. Before the plurality of data blocks in the neighborhood are detected for the preset data requirement, the data block meeting the preset data requirement is taken as the target data block, and the content corresponding to the target data block is taken as the first element content corresponding to the first element.
[0075] According to the attribute information, the embodiments of the present application determine the element position of the first element in the mail, and then select the data block meeting the preset data requirement corresponding to the first element from the plurality of data blocks in the neighborhood corresponding to the element position as the target data block, and take the content corresponding to the target data block as the first element content corresponding to the first element. By determining the first element content corresponding to the first element in the mail through the attribute information, the first element and the first element content with a positional relationship can be quickly extracted, and the efficiency of mail information extraction is improved.
[0076] Figure 6 is a flowchart of a target data block selection process provided by an embodiment of the present application. The target data block selection process is applied to an electronic device. As shown in Figure 6 , the process includes the following steps:
[0077] S51, analyzing each data block in the neighborhood to obtain the data block length and data type corresponding to each data block.
[0078] In some embodiments, the data block length can be obtained by parsing the data block size corresponding to the data block, and the data block width within the data block size is taken as the data block length. The data type can include, but is not limited to, a number type, a letter type, a combination of number and letter type, a character type, and a picture type.
[0079] S52, selecting a target data block from the plurality of data blocks in the neighborhood according to the data block length and the data type.
[0080] In some embodiments, the above-mentioned embodiments are determined, the first element corresponding to the preset data requirement, the data type and the data block length of the data block corresponding to the first element content in the preset data requirement are obtained, and the data block length and the data type corresponding to each data block are matched with the data block length and the data type in the preset data requirement. The data block length and the data type of the data block satisfying the preset data requirement are selected as the target data block.
[0081] Embodiments of the present application determine the target data block according to the data block length and the data type corresponding to the data block, which can improve the accuracy of determining the target data block, and further improve the accuracy of extracting the mail information.
[0082] Figure 7 is a flowchart of a target mail text determination process provided by an embodiment of the present application. The target mail text determination process is applied to an electronic device. As shown in Figure 7 includes the following steps:
[0083] S61, obtaining an initial mail text corresponding to the target mail page.
[0084] In some embodiments, all contents in the target mail page (for example, mail recipients, mail senders, mail subjects, mail bodies, mail attachments, and mail signatures) constitute the initial mail text. In an embodiment, if there is a mail attachment, the attachment text can be obtained by parsing the mail attachment. If the mail attachment is a compressed text, the attachment text can also be obtained by decompressing the compressed text. The content of the target mail page can only include text content, only include picture content, or include a combination of text content and picture content, which is not limited herein. If the content of the target mail page includes picture content, the picture content can be processed by a preset picture coding model to obtain text data, and the text data can also be obtained from the picture by using an optical character recognition (OCR) technology. The input data of the preset picture coding model is a picture, and the output data is text data corresponding to the picture. The preset picture coding model can be a convolutional neural network model, a recurrent neural network model, or an adversarial network model, which is not limited herein.
[0085] S62, delete the first element and the first element content from the initial mail text to obtain a target mail text.
[0086] In some embodiments, since the first element and the first element content can be extracted as mail information, to reduce the processing amount of subsequent models, the first element and the first element content are deleted from the initial mail text to obtain a target mail text.
[0087] Embodiments of the present application can reduce the processing amount of subsequent models, improve model processing efficiency, and further improve the efficiency of mail extraction by deleting the determined extracted first element and first element content from the initial mail text to obtain a target mail text.
[0088] Figure 8 is a processing flowchart of a preset element recognition model provided by an embodiment of the present application. The processing flow of the preset element recognition model is applied to an electronic device. As shown in Figure 8 includes the following steps:
[0089] S71, input the target mail text to an embedding layer of the preset element recognition model to obtain a text feature vector sequence.
[0090] In some embodiments, the embedding layer of the preset element recognition model converts each word of the target mail text into a text feature vector to map high-dimensional input data into a low-dimensional vector space. For example, text data is converted into vector data, such as a text feature vector, so that features can be extracted therefrom. After converting the text into vector data, the text can be classified, clustered, and the like.
[0091] S72, input the text feature vector sequence to a feature encoding layer of the preset element recognition model to obtain a character-level feature vector sequence.
[0092] In some embodiments, the feature encoding layer of the preset element recognition model can be a bidirectional LSTM network, a Text-CNN network, or a transformer network, a bert network, or a stack of multiple encoding networks, which is not limited here. The text feature vector sequence is input to the feature encoding layer of the preset element recognition model to obtain a character-level feature vector sequence combined with context information.
[0093] S73, input the character-level feature vector sequence to a label prediction network layer of the preset element recognition model to obtain a label corresponding to each character-level feature vector.
[0094] In some embodiments, the label can refer to a pre-set label used to identify the element name and the element content position. For example, the label corresponding to each character-level feature vector can be "Business Name Begin", "Business Name Middle", and "Business Name End", wherein "Business Name Begin" is used to identify that the character-level feature vector corresponding to the label is the beginning part of the business name, "Business Name Middle" is used to identify that the character-level feature vector corresponding to the label is the middle part of the business name, and "Business Name End" is used to identify that the character-level feature vector corresponding to the label is the end part of the business name.
[0095] S74, determining a second element and a second element content corresponding to the second element according to the label.
[0096] In some embodiments, based on the above embodiments, by analyzing the "Business Name Begin" label, it is determined that the second element is the business element. By locating the "Business Name Begin" label and the "Business Name End" label, the complete information of the business name can be obtained, and the text between the "Business Name Begin" label and the "Business Name End" label is taken as the name of the business, i.e., the element content corresponding to the business element.
[0097] According to the embodiments of the present application, the target mail text is input into the pre-set element recognition model for sequence labeling processing, so that the label identifying the element name and the element content position can be obtained. By identifying and converting the label, the second element and the second element content can be obtained. The model processing can improve the accuracy and efficiency of determining the second element and the second element content, and further improve the accuracy and efficiency of mail extraction.
[0098] Figure 9 is a display flowchart provided by an embodiment of the present application and applied to a terminal device. The display flowchart of the terminal device is applied to an electronic device. As shown in Figure 9 the display flowchart includes the following steps:
[0099] S81, determining a first pre-set additional content corresponding to the first element and a second pre-set additional content corresponding to the second element.
[0100] In some embodiments, the preset additional content can be additional content corresponding to the first element or additional content corresponding to the second element. The preset additional content is not stored in the target mail page and needs to be called from the associated application (for example, an e-commerce platform) to retrieve. In the above embodiment, the additional content corresponding to the order element can be an order link, and the order link can include order time, order goods, order address and the like; the additional content corresponding to the logistics element can be a current logistics address; the additional content corresponding to the merchant element can be a merchant address, and the additional content corresponding to the goods element can be a sales quantity of the goods.
[0101] S82, updating the first element content according to the first preset additional content to obtain target first element content.
[0102] In some embodiments, the first preset additional content is added to a specified position of the first element content to obtain the target first element content. For example, the element content corresponding to the order element is an order number, the first preset additional content is an order link, and the order link can be added behind the order number to obtain the target first element content.
[0103] S83, updating the second element content according to the second preset additional content to obtain target second element content.
[0104] In some embodiments, the second preset additional content is added to a specified position of the second element content to obtain the target second element content. For example, the element content corresponding to the merchant element is a merchant name, the second preset additional content is a merchant address, and the merchant address can be added behind the merchant name to obtain the target second element content.
[0105] S84, sending the first element and the target first element content, and the second element and the target second element content to a terminal device.
[0106] In the embodiments of the present application, the first element content is updated according to the first preset additional content to obtain target first element content, and the second element content is updated according to the second preset additional content to obtain target second element content. By displaying the first element and the target first element content, and the second element and the target second element content on the terminal device, the completeness of mail information extraction can be improved, and the user can quickly understand the mail by the displayed mail information when checking a large number of mails.
[0107] Please refer to Figure 10 , Figure 10is a structural schematic diagram of a mail information extraction device provided in an embodiment of the present application. In some embodiments, the mail information extraction device 20 can include a plurality of function modules composed of computer program segments. The computer programs of each program segment in the mail information extraction device 20 can be stored in the memory of the computer device 30 and executed by at least one controller to perform the functions of extracting mail information (see detailed description) Figure 2 .
[0108] In the present embodiment, the mail information extraction device 20 can be divided into a plurality of function modules according to the functions it performs. When the mail information extraction device 20 is applied to a host device, the function modules can include a page determination module 201, a page analysis module 202, a content determination module 203, a model processing module 204, and a content combination module 205. The module referred to in the present application refers to a series of computer program segments that can be executed by at least one controller and can complete a fixed function, which are stored in the memory. In the present embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0109] The page determination module 201 is configured to determine a target mail page of mail information to be extracted.
[0110] The page analysis module 202 is configured to analyze the target mail page to obtain attribute information corresponding to a plurality of first elements.
[0111] The content determination module 203 is configured to determine first element content corresponding to the first elements according to the attribute information.
[0112] The model processing module 204 is configured to determine a target mail text corresponding to the target mail page, and input the target mail text into a preset element recognition model to obtain a combined second element and second element content corresponding to the second element.
[0113] The content combination module 205 is configured to combine the first elements and the first element content, and the second elements and the second element content, to obtain extracted mail information.
[0114] In some embodiments, the page determination module 201 further includes a mail acquisition sub-module configured to acquire an initial mail set, a keyword query sub-module configured to select a target mail set associated with a preset element keyword from the initial mail set, and a mail page rendering sub-module configured to perform page rendering on each target mail in the target mail set according to a rendering instruction to obtain a target mail page.
[0115] In some embodiments, the page parsing module 202 further comprises: a first element obtaining submodule for obtaining a first element associated with the preset element keyword according to the preset element keyword; an element position determining submodule for determining an element position of the first element in the target mail page; an element size determining submodule for determining an element size corresponding to the first element according to the element position; and an attribute information determining submodule for combining the element position and the element size to obtain attribute information of the first element.
[0116] In some embodiments, the content determining module 203 further comprises: an attribute information parsing submodule for determining the element position corresponding to the first element according to the attribute information; a neighborhood data block obtaining submodule for obtaining a plurality of data blocks in a neighborhood corresponding to the element position; and a target data block selecting submodule for selecting a target data block from the plurality of data blocks and taking content corresponding to the target data block as first element content corresponding to the first element.
[0117] In some embodiments, the content determining module 203 further comprises: a data block parsing submodule for parsing each data block in the neighborhood to obtain a data block length and a data type corresponding to each data block; and a target data block selecting submodule for selecting a target data block from the plurality of data blocks in the neighborhood according to the data block length and the data type.
[0118] In some embodiments, the model processing module 204 further comprises: an initial mail text obtaining submodule for obtaining an initial mail text corresponding to the target mail page; and a target mail text obtaining submodule for deleting the first element and the first element content from the initial mail text to obtain a target mail text.
[0119] In some embodiments, the model processing module 204 further comprises: an embedding layer processing submodule for inputting the target mail text into an embedding layer of the preset element recognition model to obtain a text feature vector sequence; an encoding layer processing submodule for inputting the text feature vector sequence into a feature encoding layer of the preset element recognition model to obtain a character-level feature vector sequence; a label prediction layer processing submodule for inputting the character-level feature vector sequence into a label prediction network layer of the preset element recognition model to obtain a label corresponding to each character-level feature vector; and a label identifying submodule for determining a second element and second element content corresponding to the second element according to the label.
[0120] In some embodiments, the content combination module 205 further comprises: a second mapping relationship traversing submodule, configured to traverse a second mapping relationship between preset elements and preset additional contents, to obtain first preset additional contents corresponding to the first element and second preset additional contents corresponding to the second element; a first element content updating submodule, configured to update the first element content according to the first preset additional contents, to obtain target first element content; a second element content updating submodule, configured to update the second element content according to the second preset additional contents, to obtain target second element content; and a client display submodule, configured to send the first element and the target first element content, and the second element and the target second element content to a terminal device.
[0121] It can be understood that the mail information extraction device 20 and the mail information extraction method of the above embodiments belong to the same inventive concept. The specific implementation of each module of the mail information extraction device 20 corresponds to each step of the mail information extraction method in the above embodiments, and the present application will not be described here.
[0122] The above-described module division is a logical functional division, and there can be another division manner in actual implementation. In addition, each functional module in each embodiment of the present application can be integrated in the same processing unit, or each module can be physically present alone, or two or more modules can be integrated in the same unit. The integrated module can be realized in the form of hardware or in the form of hardware plus software functional module.
[0123] Figure 11 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. As shown in Figure 11 The electronic device 30 includes a memory 31, at least one controller 32, and at least one communication bus 33. The controller 32 is configured to implement the mail information extraction method when executing a computer program stored in the memory 31. The at least one communication bus 33 is configured to realize the connection and communication between the memory 31 and the at least one controller 32.
[0124] Figure 11 The structure of the electronic device shown does not constitute a limitation on the embodiments of the present application. The electronic device 30 can also include more or fewer other hardware or software, or different component arrangements.
[0125] In some embodiments of the present application, the electronic device 30 can also be connected to a client device, which includes but is not limited to any electronic product that can interact with a user through a keyboard, a mouse, a remote controller, a touchpad, or a voice control device, such as a personal computer, a tablet computer, a smart phone, a digital camera, etc.
[0126] It should be noted that the electronic device 30 is only an example, and other existing or future electronic products, such as those adaptable to the present application, should also be included in the protection scope of the present application and are hereby incorporated by reference.
[0127] In some embodiments, the electronic device 30 can further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which are not described here.
[0128] The memory 31 stores a computer program, which, when executed by the at least one controller 32, implements all or part of the steps of the email information extraction method. The memory 31 includes a Read-Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an Electrically-Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disk memory, a magnetic disk memory, a magnetic tape memory, or any other computer-readable medium capable of carrying or storing data.
[0129] Further, the computer-readable storage medium can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required by at least one function, etc.; and the data storage area can store data created according to the use of the electronic device 30, etc.
[0130] In some embodiments, the at least one controller 32 is a control unit of the electronic device 30, which connects various components of the electronic device 30 through various interfaces and lines, and performs various functions of the electronic device 30 and processes data by running or executing programs or modules stored in the memory 31 and calling data stored in the memory 31. For example, the at least one controller 32 implements all or part of the steps of the mail information extraction method in the embodiments of the present application when executing a computer program stored in the memory, or implements all or part of the functions of the mail information extraction apparatus. The at least one controller 32 can be composed of integrated circuits, for example, can be composed of a single packaged integrated circuit, or can be composed of a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microcontrollers, digital processing chips, graphics controllers, and combinations of various control chips.
[0131] The integrated units implemented in the form of software function modules can be stored in a computer readable storage medium. The software function modules are stored in a storage medium, and include a plurality of instructions for causing an electronic device (which can be a personal computer, an electronic device, or a network device, etc.) or a processor to perform part of the method of each embodiment of the present application.
[0132] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. For example, the apparatus embodiments described above are merely schematic, and the division of the modules is merely a logical function division, and actual implementation can have another division manner.
[0133] The modules illustrated as separate components can or can not be physically separated, and the components illustrated as modules can or can not be physical units, and can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments.
[0134] In addition, each functional module in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software function modules.
[0135] It is apparent for a person skilled in the art that the application is not restricted to the details of the exemplary embodiments described above and that the application can be implemented in other concrete forms without departing from the spirit or general character thereof. The embodiments are therefore to be considered as illustrative and not restrictive and the scope of the application is defined by the appended claims rather than by the description above, which is therefore intended to be regarded as a general elucidation only and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims should not be construed as limiting the scope of the claims. Furthermore, the word "comprising" does not exclude other elements or steps and the singular does not exclude the plural and vice versa. Multiple elements or devices can be provided by means of one single element or device, and vice versa, if appropriate. The terms first, second and the like do not denote any ordinal sequence, but do not exclude that different, identical or similar elements are provided.
[0136] Finally, it should be noted that the above-mentioned embodiments are merely intended to illustrate the technical solutions of the present application, but not to limit the present application. Although the present application is described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or equivalently replaced without departing from the spirit and scope of the present application.
Claims
1. A mail information extracting method characterized by comprising: The method comprises: determining a target email page to be extracted email information; parsing the target email page to obtain attribute information corresponding to a plurality of first elements, including: obtaining a first element associated with a preset element keyword; determining the element position of the first element in the target email page; determining the element size corresponding to the first element according to the element position; combining the element position and the element size to obtain the attribute information of the first element; determining the first element content corresponding to the first element according to the attribute information; determining the target email text corresponding to the target email page, and inputting the target email text into a preset element recognition model to obtain a second element and second element content corresponding to the second element; combining the first element and the first element content, and combining the second element and the second element content to obtain the extracted email information.
2. The method of claim 1, wherein, The method comprises: obtaining an initial email set; selecting a target email set associated with the preset element keyword from the initial email set; rendering each target email in the target email set according to the rendering instruction to obtain a target email page.
3. The method of claim 1, wherein, The method comprises: determining the element position corresponding to the first element according to the attribute information; obtaining a plurality of data blocks in the neighborhood corresponding to the element position; selecting a target data block from the plurality of data blocks, and taking the content corresponding to the target data block as the first element content corresponding to the first element.
4. The method of claim 3, wherein, The method comprises: parsing each data block in the neighborhood to obtain the data block length and data type corresponding to each data block; selecting a target data block from the plurality of data blocks in the neighborhood according to the data block length and the data type.
5. The method of claim 1, wherein, The method comprises: obtaining an initial email text corresponding to the target email page; deleting the first element and the first element content from the initial email text to obtain a target email text.
6. The method of claim 1, wherein, The method comprises: inputting the target email text into the embedding layer of the preset element recognition model to obtain a text feature vector sequence; inputting the text feature vector sequence into the feature encoding layer of the preset element recognition model to obtain a character-level feature vector sequence; inputting the character-level feature vector sequence into the label prediction network layer of the preset element recognition model to obtain a label corresponding to each character-level feature vector; determining a second element and second element content corresponding to the second element according to the label.
7. The method of claim 1, wherein, After the method comprises: determining a first preset additional content corresponding to the first element and a second preset additional content corresponding to the second element; updating the first element content according to the first preset additional content, to obtain target first element content; updating the second element content according to the second preset additional content, to obtain target second element content; sending the first element and the target first element content, and the second element and the target second element content to a terminal device.
8. A mail information extracting apparatus characterized by comprising: The device comprises: a page determining module configured to determine a target mail page of mail information to be extracted; a page analyzing module configured to analyze the target mail page to obtain attribute information corresponding to a plurality of first elements, including: acquiring a first element associated with a preset element keyword; determining an element position of the first element in the target mail page; determining an element size corresponding to the first element according to the element position; and combining the element position and the element size to obtain attribute information of the first element; a content determining module configured to determine first element content corresponding to the first element according to the attribute information; a model processing module configured to determine a target mail text corresponding to the target mail page, and input the target mail text into a preset element recognition model to obtain a second element and second element content corresponding to the second element; a content combining module configured to combine the first element and the first element content, and combine the second element and the second element content, to obtain extracted mail information.
9. An electronic device, comprising: The electronic device comprises a controller and a memory, and the controller is configured to implement the mail information extraction method of any one of claims 1 to 7 when executing a computer program stored in the memory.
Citation Information
Patent Citations
Mail handling service system and method
CN107517152A