Page processing and model training method and device, equipment and storage medium

CN116108305BActive Publication Date: 2026-10-30BAIDU INT TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211665780.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2026-10-30
Estimated Expiration
2042-12-23

AI Technical Summary

Benefits of technology

[0013]应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116108305B_ABST
    Figure CN116108305B_ABST
Patent Text Reader

Abstract

The present disclosure provides a page processing and model training method, device and equipment, and a storage medium, relates to the technical field of computers, in particular to the technical field of page understanding, deep learning and the like. The page processing method comprises: dividing a page to be processed into at least one page block; for any page block in the at least one page block, updating an initial node feature of the any page block based on an attention weight between the any page block and an adjacent page block to obtain an updated node feature of the any page block; for the any page block, determining a category of the any page block based on the updated node feature; and constructing structured information of the page to be processed based on the category of the any page block and page content in the any page block. The present disclosure can obtain the structured information of the page.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to the fields of page understanding, deep learning, and more particularly to a page processing and model training method, apparatus, device, and storage medium. Background Technology

[0002] Pages are the basic elements that make up a website and serve as a platform for various website applications.

[0003] Generally speaking, information such as text and images on a page can be extracted based on simple rules. Summary of the Invention

[0004] This disclosure provides a method, apparatus, device, and storage medium for page processing and model training.

[0005] According to one aspect of this disclosure, a page processing method is provided, comprising: dividing a page to be processed into at least one page block; for any page block in the at least one page block, updating the initial node features of the page block based on the attention weight between the page block and adjacent page blocks to obtain updated node features of the page block; for the page block, determining the category of the page block based on the updated node features; and constructing structured information of the page to be processed based on the category of the page block and the page content within the page block.

[0006] According to another aspect of this disclosure, a training method for a page processing model is provided, comprising: the model comprising: a graph attention network and a classification network; the method comprising: dividing a page sample into at least one page block; for any page block in the at least one page block, using the graph attention network, updating the initial node features of the page block based on the attention weights between the page block and its neighboring page blocks to obtain updated node features of the page block; for any page block, using the classification network, determining the predicted category of the page block based on the updated node features; constructing a loss function based on the predicted category and the true category of the page block; and adjusting the parameters of the graph attention model and the classification network based on the loss function until preset conditions are met to obtain the final graph attention model and the final classification network.

[0007] According to another aspect of this disclosure, a page processing apparatus is provided, comprising: a segmentation module for dividing a page to be processed into at least one page block; an update module for updating the initial node features of any page block based on the attention weight between the page block and its adjacent page blocks, thereby obtaining updated node features of the page block; a determination module for determining the category of any page block based on the updated node features; and a construction module for constructing structured information of the page to be processed based on the category of the page block and the page content within the page block.

[0008] According to another aspect of this disclosure, a training apparatus for a page processing model is provided. The model includes a graph attention network and a classification network. The apparatus includes: a segmentation module for dividing a page sample into at least one page block; an update module for updating the initial node features of any page block using the graph attention network based on the attention weights between the page block and its neighboring page blocks, to obtain updated node features of the page block; a determination module for determining the predicted category of any page block using the classification network based on the updated node features; a construction module for constructing a loss function based on the predicted category and the true category of the page block; and an adjustment module for adjusting the parameters of the graph attention model and the classification network based on the loss function until preset conditions are met, to obtain a final graph attention model and a final classification network.

[0009] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to said at least one processor; wherein the memory stores instructions executable by said at least one processor, said instructions being executed by said at least one processor to enable said at least one processor to perform the method as described in any of the foregoing aspects.

[0010] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method according to any of the preceding aspects.

[0011] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method according to any of the preceding aspects.

[0012] According to the technical solution disclosed herein, the structured information of the page can be obtained.

[0013] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0014] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0015] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;

[0016] Figure 2 This is a schematic diagram illustrating an application scenario applicable to the embodiments of this disclosure;

[0017] Figure 3 This is a schematic diagram of the overall framework provided according to embodiments of this disclosure;

[0018] Figure 4 This is a schematic diagram according to the second embodiment of the present disclosure;

[0019] Figure 5 This is a schematic diagram illustrating the determination of attention weights according to embodiments of this disclosure;

[0020] Figure 6 This is a schematic diagram illustrating the acquisition of updated node features based on initial node features according to an embodiment of this disclosure;

[0021] Figure 7 This is a schematic diagram according to the third embodiment of the present disclosure;

[0022] Figure 8 This is a schematic diagram according to the fourth embodiment of the present disclosure;

[0023] Figure 9 This is a schematic diagram according to the fifth embodiment of the present disclosure;

[0024] Figure 10 This is a schematic diagram of an electronic device used to implement the page processing method or page processing model training method of the embodiments of this disclosure. Detailed Implementation

[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0026] In related technologies, page information can be extracted based on simple rules. However, the page information extracted in this way cannot describe the page layout information, resulting in poor expressive effect and difficulty in application. To improve information expression capabilities, structured information of the page can be obtained, but relevant solutions are currently lacking.

[0027] Figure 1 Based on a schematic diagram of the first embodiment of this disclosure, this embodiment provides a page processing method, the method comprising:

[0028] 101. Divide the page to be processed into at least one page block.

[0029] 102. For any page block in the at least one page block, based on the attention weight between the any page block and its adjacent page blocks, update the initial node features of the any page block to obtain the updated node features of the any page block.

[0030] 103. For any given page block, determine the category of the given page block based on the characteristics of the updated node.

[0031] 104. Based on the category of any page block and the page content within any page block, construct the structured information of the page to be processed.

[0032] Based on the page layout information, the page can be divided into at least one page block, with different page blocks corresponding to different areas of the page.

[0033] For example, a page can be divided into N page blocks, where N is a positive integer.

[0034] Any page block can be represented by the i-th page block, where i = 1, 2, ..., N.

[0035] Each page block can be considered as a node, and its features can be called node features. Node features can be represented by a vector of dimension M (M is a positive integer).

[0036] To distinguish them, the initial node features of each page block can be called initial node features, and the node features after updating the initial node features can be called updated node features.

[0037] Initial node features can be obtained by vectorizing the node information of page blocks, and the node information of page blocks can be obtained from the source data of the page.

[0038] For any (i-th) page block, its initial node features can be represented by h. i express.

[0039] For any (i-th) page block, its adjacent page blocks can be represented by the j-th page block, j = 1, 2, ..., N, j can be equal to or not equal to i. That is, for the i-th page block, its adjacent page blocks can include its own page block, and can also include other page blocks besides its own page block.

[0040] At least one page block can form a graph (or tree). The graph includes nodes and edges. Each page block can be considered a node in the graph. If there is a connection between two nodes, an edge can be considered to exist between them; otherwise, no edge exists. The existence of a connection (edge) between the corresponding nodes of two page blocks can be determined based on their layout information.

[0041] For a given node, nodes that have a connection relationship (edge) with that node can be considered as adjacent nodes of that node, and the corresponding page blocks are adjacent page blocks.

[0042] For the i-th page block and the j-th page block, the attention weight between them can be represented by α. ij This means that the weight can be based on the initial node features of both (i.e., h). i and h j The values ​​are obtained from the weights of the pre-trained graph attention network (e.g., represented by W).

[0043] For the i-th page block, the above α can be used. ij Its initial node features h i Perform update processing to obtain the updated node features, which can be obtained using h. i 'express.

[0044] For the i-th page block, the node feature h can be updated based on it. i ', determine the category of the page block (the i-th page block).

[0045] There can be L (L is a positive integer) preset categories, such as title, navigation bar, content list, footer, and others. Based on the updated node category, it can be determined which of the L categories the corresponding page block belongs to.

[0046] For the i-th page block, text, images, and other page content can be extracted. For example, page content can be extracted using preset rules. Extracting page content from a page block can be achieved using existing technologies, which will not be elaborated here.

[0047] For the i-th page block, after determining its category and page content, structured information can be constructed based on the category and page content. Assuming its category is the first category and its page content is the first page content, then <first category, first page content> can be considered as a piece of structured information.

[0048] Similarly, for N page blocks, N pieces of structured information can be obtained, each piece of structured information including the category and content of the corresponding page block.

[0049] In this embodiment, the structured information of a page is constructed based on the category and content of any page block, which improves the expressive power of the extracted information and facilitates subsequent applications. Furthermore, the category of a page block is determined based on its update node features, thus constructing structured information without requiring the formulation of extraction rules, resulting in stronger generalization. Additionally, update node features are obtained based on attention weights and initial node features, and the category is determined based on these update node features. Since attention weights reflect the layout relationship between page blocks, the accuracy of the determined category is improved, thereby enhancing the accuracy of the structured information.

[0050] To better understand the embodiments of this disclosure, the application scenarios to which the embodiments of this disclosure are applicable are described below.

[0051] like Figure 2 As shown, users can upload pages to electronic devices 201, which then process the pages to obtain their structured information.

[0052] In this context, electronic device 201 can be a user terminal, such as a personal computer, laptop, or mobile device (e.g., a mobile phone). Alternatively, electronic device 201 can also be a server, which can be a cloud server or a local server. Alternatively, the user can send the page to be processed to the server through the user terminal, whereby the server processes the page to obtain its structured information and returns it to the user terminal, which then displays the structured information to the user.

[0053] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0054] like Figure 3 As shown, taking a Hyper Text Markup Language (HTML) page as an example, the HTML page can be parsed to obtain the Document Object Model (DOM) tree corresponding to the HTML page, and the page can be divided into at least one page block based on the DOM.

[0055] The Document Object Model (DOM) is a standard interface specification defined by the W3C. It's a standard Application Programming Interface (API) for processing HTML files. The DOM provides an access model for the entire document, treating it as a tree structure. Each node (or node) in the tree represents an HTML tag or a text item within a tag. The DOM tree structure precisely describes the relationships between tags in an HTML document. The process of converting an HTML document into a DOM tree is called parsing. After parsing, the HTML document is transformed into a DOM tree, so processing of the HTML document can be achieved through operations on the DOM tree. The DOM model not only describes the document's structure but also defines the behavior of node objects. Using the methods and properties of these objects, nodes and content in the DOM tree can be easily accessed, modified, added, and deleted.

[0056] like Figure 3 As shown, by parsing the HTML page, the DOM tree of the HTML page can be obtained. Figure 3 The DOM tree consists of 7 nodes (node-0 to node-6), and each node can correspond to a tag on an HTML page, such as tags including: html-0, body-1, div-2 to div-6.

[0057] After determining each node (page block), the node features of each node can be obtained, and the node features are input into the Graph Attention Network (GAT). The output of GAT is the category of the corresponding node.

[0058] Specifically, the node features input into the GAT can be called initial node features. The GAT can update these initial node features, and its output is the updated node features for each node. Afterwards, a classification network can be used (…). Figure 3 (Not shown in the image) The input updated node features are processed to output the category of the corresponding node.

[0059] Taking node-2 as an example, after the initial node features of node-2 are input into GAT, and processed by GAT and the classification network, the output of the classification network is the category of node-2, assuming the category is "content list".

[0060] Node features are typically in vector form and can be multi-dimensional. For example, for each node, its features include: basic features, style features, and structural features. Multi-dimensional node features can reflect information such as location layout, visual information, label attributes, and structural relationships.

[0061] In conjunction with the above application scenarios, this disclosure also provides a page processing method.

[0062] Figure 4 Based on a schematic diagram of the second embodiment of this disclosure, this embodiment provides a page processing method, the method comprising:

[0063] 401. Get the page to be processed.

[0064] 402. Based on the DOM tree corresponding to the page to be processed, divide the page to be processed into at least one page block.

[0065] After parsing the HTML page, the corresponding DOM tree can be obtained, and the page elements contained in each node of the DOM tree can be combined into a page block.

[0066] Since the DOM tree of a page can reflect the layout information of the page, dividing the page into blocks based on the DOM tree can obtain at least one page block that can reflect the layout information of the page. The structured information built based on this page block can reflect the layout information of the page, which is convenient for subsequent applications.

[0067] 403. For any page block in the at least one page block, obtain the initial node features of the page block.

[0068] By parsing the HTML page, the source data of the HTML page can be obtained. The source data may contain node information of each node (page block). After vectorizing the node information, the initial node features are obtained.

[0069] Node information can be multi-dimensional (and can be set according to actual needs). For any node (page block), its node information can specifically include:

[0070] Basic information: node labels, location information, text information, etc.;

[0071] Style information: font information, color information, alignment, etc.;

[0072] Structural information: node depth, subtree structural similarity, number of subtree nodes, etc.

[0073] By vectorizing the above node information, we can obtain the corresponding node features. For example, vectorizing basic information yields basic features, vectorizing style information yields style features, and vectorizing structural information yields structural information.

[0074] Vectorization can be achieved using word2vec or existing methods such as embedding.

[0075] 404. For any given page block, using a pre-trained GAT, based on the initial node features of the given page block, obtain the updated node features of the given page block.

[0076] Each page block can be represented as the i-th page block, where i = 1, 2, ..., N, and N is the total number of page blocks.

[0077] For the i-th page block, its initial node features are represented by h. i express.

[0078] For the i-th page block, its adjacent page blocks can be represented by the j-th page block, where j can be equal to or not equal to i, j = 1, 2, ..., N. The initial node features of the adjacent page blocks are represented by h. j express.

[0079] Adjacent page blocks can be first-order adjacent page blocks, that is, page blocks that have a direct connection relationship with the i-th page block.

[0080] Specifically, the adjacent page blocks of any page block can be determined based on the page's DOM tree.

[0081] For example, see Figure 3 For node-1, the nodes that have a direct connection relationship with node-1 include: node-0, node-3 and node-2, and may also include node-1 itself. Therefore, the adjacent page blocks of node-1 include: node-0, node-1, node-2 and node-3.

[0082] The update process may include:

[0083] Using a pre-trained GAT, the initial node features of any page block and the initial node features of the adjacent page blocks are transformed to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks.

[0084] The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks;

[0085] Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

[0086] Among them, the model parameters of the pre-trained GAT can be represented by W;

[0087] For any page block (the i-th page block), its transformation node characteristics can be represented as: Wh i That is, W is usually a matrix, and the parameter matrix W is used to evaluate the initial node features h. iAfter weighted multiplication, the transition node feature Wh is obtained. i (can also be represented as W*h) i * indicates multiplication.

[0088] Similarly, for an adjacent page block (the j-th page block), its transition node feature can be represented as Wh j .

[0089] Obtain the transformation node feature Wh of the i-th page block i The transformation node feature Wh of the j-th page block j Then, the attention weight between the i-th page block and the j-th page block can be calculated based on the above two transformation node features, and the update node features of the i-th page block can be obtained based on the above attention weight.

[0090] Regarding attention weights, such as Figure 5 As shown, we can first base our analysis on the features of the transformation node (Wh). i and Wh j The initial attention weights are obtained, and then normalized (e.g., using the softmax function). The normalized attention weights α are then... ij This will be used as the attention weights in the final selection.

[0091] The calculation formula may include:

[0092] e ij =a(Wh i ,Wh j )

[0093] Among them, e ij It is the initial attention weight between the i-th page block and the j-th page block;

[0094] h i It is the initial node feature of the i-th page block;

[0095] h j It is the initial node feature of the j-th page block;

[0096] W is the model parameter of GAT, i.e., the weight matrix;

[0097] 'a' is the activation function.

[0098] The formula for normalizing the initial attention weights can be:

[0099]

[0100] Where, α ijIt is the normalized attention weight, that is, the attention weight between the i-th page block and the j-th page block that is finally used;

[0101] LeakyReLU is an activation function;

[0102] e ij It is the initial attention weight between the i-th page block and the j-th page block;

[0103] e ik It represents the initial attention weight between the i-th page block and the k-th page block;

[0104] N i It is the set of adjacent page blocks of the i-th page block.

[0105] Therefore, using the above calculation formula, the final attention weight α can be obtained. ij .

[0106] For weighted summation, the formula can be:

[0107]

[0108] Among them, h i ' is the update node feature of the i-th page block;

[0109] Wh j It is the feature of the transformation node of the j-th page block;

[0110] α ij It is the attention weight between the i-th page block and the j-th page block;

[0111] N i It is the set of adjacent page blocks of the i-th page block;

[0112] σ is a non-linear activation function.

[0113] Therefore, using the above calculation formula, the update node feature h of the i-th page block (any page block) can be obtained. i '.

[0114] For example, see Figure 6 For the first page block, its adjacent page blocks include page blocks 2 to 6. Its initial node feature is h1, and the initial node features of its adjacent page blocks are h2 to h6, respectively. The corresponding attention weights are α. 12 ~α 16 After weighted summation and non-linear activation processing (such as concatenation or mean operation), the updated node feature h1' of the page block can be obtained. It can be understood that, based on the above formula, the weighted feature is specifically the transformed node feature obtained from the initial node feature.

[0115] Furthermore, in practical calculations, to obtain richer node information, multiple attention heads are typically used for parallel computation, thereby improving the model's representational ability. The calculation formula can be:

[0116]

[0117] Among them, h i ' is the update node feature of the i-th page block;

[0118] W k h j It is the transformation node feature of the j-th page block calculated using the k-th attention head;

[0119] It is the attention weight between the i-th page block and the j-th page block corresponding to the k-th attention head;

[0120] W k It is the weight matrix of the k-th attention head of GAT, and it consists of learnable parameters;

[0121] K is the number of attention heads;

[0122] N i It is the set of adjacent page blocks of the i-th page block;

[0123] σ is a non-linear activation function.

[0124] In this embodiment, GAT is used to calculate the attention weight between any page block and its adjacent page blocks. Based on the attention weight, the update node features of any page block are obtained, which can make the update node features reflect the layout information between any page block and its adjacent page blocks. Therefore, when determining the category based on the update node features, the category is determined based on the layout information, which can improve the accuracy of the category determination.

[0125] 405. Using a pre-trained classification network, determine the category of any page block based on the updated node features.

[0126] Among them, GAT can be connected to a classification network, and the output of GAT can be used as the input of the classification network. The output of the classification network is the category of the page block.

[0127] Classification networks are linear networks, such as fully connected layers, which output the category of each page block.

[0128] In this embodiment, the category of page blocks is determined based on a classification network. The model parameters of the classification model are learnable, so that model parameters with better performance can be obtained, and thus the category of page blocks with higher accuracy can be obtained.

[0129] 406. Based on the category of any page block and the page content within any page block, construct the structured information of the page to be processed.

[0130] For example, for the i-th page block, whose category is the first category and whose page content is the first page content, a structured piece of information can be constructed as <first category, first page content>.

[0131] For each page block, its page content can be extracted using existing technologies, such as extraction based on preset rules, which will not be elaborated here.

[0132] In this embodiment, GAT can be used to obtain the update node features of any page block, and a classification network can be used to determine the category of the page block based on the update node features of any page block. Then, the structured information of the page can be constructed based on the category and page content. Since it is based on GAT and classification network, the generalization can be improved, thereby improving the general solution for obtaining the structured information of the page.

[0133] The above embodiments involve graph attention networks and classification networks. The training process of the model will be described below.

[0134] Figure 7 Based on a schematic diagram of the third embodiment of this disclosure, this embodiment provides a training method for a page processing model, the model including a graph attention network and a classification network, the method comprising:

[0135] 701. Divide the page sample into at least one page block.

[0136] 702. For any page block in the at least one page block, the graph attention network is used to update the initial node features of the page block based on the attention weights between the page block and its neighboring page blocks, so as to obtain the updated node features of the page block.

[0137] 703. For any page block, the classification network is used to determine the predicted category of the page block based on the updated node features.

[0138] 704. Construct a loss function based on the predicted category of any page block and the true category of any page block.

[0139] 705. Based on the loss function, adjust the parameters of the graph attention model and the classification network until the preset conditions are met to obtain the final graph attention model and the final classification network.

[0140] During the training process, page samples can be pre-collected, and the true category of page blocks can be manually labeled. For example, 30 categories can be pre-set, and each page block can be manually labeled as belonging to one of the 30 categories.

[0141] In this embodiment, a page processing model can be trained, and then the structured information of the page can be constructed based on the model, thereby improving the expressive power of the extracted information and facilitating subsequent applications. In addition, constructing structured information based on the model eliminates the need to formulate extraction rules for structured information, resulting in stronger generalization. Furthermore, updated node features are obtained based on attention weights and initial node features, and the predicted category is determined based on the updated node features. Since attention weights can reflect the layout relationship between page blocks, the accuracy of the determined predicted category can be improved, thereby improving the accuracy of the model.

[0142] In some embodiments, dividing the page sample into at least one page block includes:

[0143] Based on the DOM tree corresponding to the page sample, the page sample is divided into at least one page block.

[0144] Since the DOM tree of a page can reflect the layout information of the page, dividing the page into blocks based on the DOM tree can obtain at least one page block that can reflect the layout information of the page. The structured information built based on this page block can reflect the layout information of the page, which is convenient for subsequent applications.

[0145] In some embodiments, employing the graph attention network to update the initial node features of any page block based on the attention weights between any page block and its neighboring page blocks to obtain updated node features of the page block includes:

[0146] Using the graph attention network, the initial node features of any page block and the initial node features of the adjacent page blocks are transformed to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks.

[0147] The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks;

[0148] Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

[0149] In this embodiment, GAT is used to calculate the attention weight between any page block and its adjacent page blocks. Based on the attention weight, the update node features of any page block are obtained, which can make the update node features reflect the layout information between any page block and its adjacent page blocks. Therefore, when determining the category based on the update node features, the category is determined based on the layout information, which can improve the accuracy of the category determination.

[0150] After obtaining the predicted category of a page patch using GAT and a classification network, a loss function can be constructed based on the predicted category and the true category of the page patch. The specific structure of the loss function can be set; for example, the loss function can be selected as a cross-entropy function.

[0151] After obtaining the loss function, the model parameters can be adjusted based on the loss function until preset conditions are met, resulting in the final graph attention model and classification network. For example, the back propagation (BP) algorithm can be used to adjust the model parameters. The adjusted model parameters include those for the graph attention network and the classification network.

[0152] The adjusted parameters can be calculated as: Adjusted parameters = Unadjusted parameters - Learning rate * Gradient value, where the gradient value is obtained by differentiating the loss function with respect to the model parameters, and the learning rate is a preset hyperparameter. The initial values ​​for each parameter can be set; for example, they can be randomized to obtain random initial values.

[0153] Preset conditions, such as reaching a preset number of iterations, can be used as the final page processing model, including the final graph attention model and the final classification network. The final page processing model can be used for extracting structured information from the page during the inference stage.

[0154] Figure 8 This is a schematic diagram based on the fourth embodiment of the present disclosure. This embodiment provides a page processing device 800, which includes: a segmentation module 801, an update module 802, a determination module 803, and a construction module 804.

[0155] The segmentation module 801 is used to divide the page to be processed into at least one page block; the update module 802 is used to update the initial node features of any page block based on the attention weight between the page block and its adjacent page blocks, for any page block in the at least one page block, to obtain the updated node features of the page block; the determination module 803 is used to determine the category of any page block based on the updated node features; and the construction module 804 is used to construct the structured information of the page to be processed based on the category of the page block and the page content within the page block.

[0156] In this embodiment, the structured information of a page is constructed based on the category and content of any page block, which improves the expressive power of the extracted information and facilitates subsequent applications. Furthermore, the category of a page block is determined based on its update node features, thus constructing structured information without requiring the formulation of extraction rules, resulting in stronger generalization. Additionally, update node features are obtained based on attention weights and initial node features, and the category is determined based on these update node features. Since attention weights reflect the layout relationship between page blocks, the accuracy of the determined category is improved, thereby enhancing the accuracy of the structured information.

[0157] In some embodiments, the segmentation module 801 is further configured to: divide the page to be processed into at least one page block based on the DOM tree corresponding to the page to be processed.

[0158] Since the DOM tree of a page can reflect the layout information of the page, dividing the page into blocks based on the DOM tree can obtain at least one page block that can reflect the layout information of the page. The structured information built based on this page block can reflect the layout information of the page, which is convenient for subsequent applications.

[0159] In some embodiments, the update module 802 is further configured to:

[0160] A pre-trained graph attention network is used to transform the initial node features of any page block and the initial node features of the adjacent page blocks to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks.

[0161] The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks;

[0162] Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

[0163] In this embodiment, GAT is used to calculate the attention weight between any page block and its adjacent page blocks. Based on the attention weight, the update node features of any page block are obtained, which can make the update node features reflect the layout information between any page block and its adjacent page blocks. Therefore, when determining the category based on the update node features, the category is determined based on the layout information, which can improve the accuracy of the category determination.

[0164] In some embodiments, the determining module 803 is further configured to:

[0165] A pre-trained classification network is used to determine the category of any page block based on the features of the updated nodes.

[0166] In this embodiment, the category of page blocks is determined based on a classification network. The model parameters of the classification model are learnable, so that model parameters with better performance can be obtained, and thus the category of page blocks with higher accuracy can be obtained.

[0167] Figure 9 This is a schematic diagram according to the fifth embodiment of the present disclosure. This embodiment provides a training device for a page processing model. The model includes a graph attention network and a classification network. The device 900 includes a block segmentation module 901, an update module 902, a determination module 903, a construction module 904, and an adjustment module 905.

[0168] The segmentation module 901 is used to divide the page sample into at least one page block; the update module 902 is used to update the initial node features of any page block for any page block using the graph attention network, based on the attention weights between the page block and its neighboring page blocks, to obtain the updated node features of the page block; the determination module 903 is used to determine the predicted category of any page block using the classification network, based on the updated node features; the construction module 904 is used to construct a loss function based on the predicted category and the true category of any page block; the adjustment module 905 is used to adjust the parameters of the graph attention model and the classification network based on the loss function until preset conditions are met, to obtain the final graph attention model and the final classification network.

[0169] In this embodiment, a page processing model can be trained, and then the structured information of the page can be constructed based on the model, thereby improving the expressive power of the extracted information and facilitating subsequent applications. In addition, constructing structured information based on the model eliminates the need to formulate extraction rules for structured information, resulting in stronger generalization. Furthermore, updated node features are obtained based on attention weights and initial node features, and the predicted category is determined based on the updated node features. Since attention weights can reflect the layout relationship between page blocks, the accuracy of the determined predicted category can be improved, thereby improving the accuracy of the model.

[0170] In some embodiments, the segmentation module 901 is further configured to:

[0171] Based on the DOM tree corresponding to the page sample, the page sample is divided into at least one page block.

[0172] Since the DOM tree of a page can reflect the layout information of the page, dividing the page into blocks based on the DOM tree can obtain at least one page block that can reflect the layout information of the page. The structured information built based on this page block can reflect the layout information of the page, which is convenient for subsequent applications.

[0173] In some embodiments, the update module 902 is further configured to:

[0174] Using the graph attention network, the initial node features of any page block and the initial node features of the adjacent page blocks are transformed to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks.

[0175] The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks;

[0176] Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

[0177] In this embodiment, GAT is used to calculate the attention weight between any page block and its adjacent page blocks. Based on the attention weight, the update node features of any page block are obtained, which can make the update node features reflect the layout information between any page block and its adjacent page blocks. Therefore, when determining the category based on the update node features, the category is determined based on the layout information, which can improve the accuracy of the category determination.

[0178] It is understood that the same or similar content in different embodiments of this disclosure can be referred to each other.

[0179] It is understood that the terms "first" and "second" in the embodiments of this disclosure are only used for distinction and do not indicate the degree of importance or the order of events.

[0180] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0181] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0182] Figure 10A schematic block diagram of an example electronic device 1000 that can be used to implement embodiments of the present disclosure is shown. The electronic device 1000 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 1000 may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0183] like Figure 10 As shown, the electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. The RAM 1003 may also store various programs and data required for the operation of the electronic device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0184] Multiple components in electronic device 1000 are connected to I / O interface 1005, including: input unit 1006, such as keyboard, mouse, etc.; output unit 1007, such as various types of displays, speakers, etc.; storage unit 1008, such as disk, optical disk, etc.; and communication unit 1009, such as network card, modem, wireless transceiver, etc. Communication unit 1009 allows electronic device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0185] The computing unit 1001 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as page processing methods or page processing model training methods. For example, in some embodiments, the page processing methods or page processing model training methods can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the page processing methods or page processing model training methods described above can be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured in any other suitable manner (e.g., by means of firmware) to execute a page processing method or a training method for a page processing model.

[0186] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0187] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable retrieval device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0188] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on 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 of the foregoing.

[0189] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0190] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0191] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.

[0192] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0193] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A page processing method, comprising: The page to be processed is divided into at least one page block; each page block is composed of page elements contained in each node of the DOM tree corresponding to the page to be processed; the at least one page block forms a graph, each page block corresponds to a node in the graph, and the existence of an edge between corresponding nodes is determined based on the layout information of two page blocks; For any page block in the at least one page block, a pre-trained graph attention network is used to update the initial node features of the page block based on the attention weights between the page block and its neighboring page blocks, so as to obtain the updated node features of the page block. The initial node features are obtained by vectorizing node information, which includes basic information, style information, and structural information; the attention weights include the weights of multiple attention heads, and the multiple attention heads are computed in parallel. For any given page block, a pre-trained classification network is used to determine the category of the given page block based on the features of the updated nodes; Based on the category of any page block and the page content within any page block, construct the structured information of the page to be processed; The graph attention network and the classification network are trained based on a loss function, which is constructed based on the predicted category and the true category of any page block. The predicted category is obtained based on the updated node features of the any page block.

2. The method according to claim 1, wherein, The pre-trained graph attention network updates the initial node features of any page block based on the attention weights between any page block and its neighboring page blocks to obtain updated node features for that page block, including: A pre-trained graph attention network is used to transform the initial node features of any page block and the initial node features of the adjacent page blocks to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks. The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks; Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

3. A method for training a page processing model, the model comprising: The method includes graph attention networks and classification networks, and the method comprises: The page sample is divided into at least one page block; each page block is composed of page elements contained in each node of the DOM tree corresponding to the page sample; the at least one page block forms a graph, each page block corresponds to a node in the graph, and the existence of an edge between corresponding nodes is determined based on the layout information of two page blocks; For any page block in the at least one page block, the graph attention network is used to update the initial node features of the page block based on the attention weights between the page block and its neighboring page blocks, so as to obtain the updated node features of the page block. The initial node features are obtained by vectorizing the node information, which includes basic information, style information, and structural information. The attention weights include the weights of multiple attention heads, and the multiple attention heads are computed in parallel. For any given page block, the classification network is used to determine the predicted category of the given page block based on the updated node features; A loss function is constructed based on the predicted category and the true category of any page block; Based on the loss function, the parameters of the graph attention network and the classification network are adjusted until preset conditions are met to obtain the final graph attention network and the final classification network.

4. The method according to claim 3, wherein, The step of employing the graph attention network, based on the attention weights between any page block and its adjacent page blocks, updates the initial node features of any page block to obtain updated node features of the page block, including: Using the graph attention network, the initial node features of any page block and the initial node features of the adjacent page blocks are transformed to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks. The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks; Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

5. A page processing apparatus, comprising: The segmentation module is used to divide the page to be processed into at least one page block; each page block is composed of page elements contained in each node of the DOM tree corresponding to the page to be processed; the at least one page block forms a graph, each page block corresponds to a node in the graph, and the existence of an edge between corresponding nodes is determined based on the layout information of two page blocks; The update module is used to update the initial node features of any page block in the at least one page block by using a pre-trained graph attention network based on the attention weights between the page block and its neighboring page blocks, so as to obtain the updated node features of the page block. The initial node features are obtained by vectorizing node information, which includes basic information, style information, and structural information; the attention weights include the weights of multiple attention heads, and the multiple attention heads are computed in parallel. The determination module is used to determine the category of any page block based on the updated node features using a pre-trained classification network. A construction module is used to construct the structured information of the page to be processed based on the category of any page block and the page content within any page block; The graph attention network and the classification network are trained based on a loss function, which is constructed based on the predicted category and the true category of any page block. The predicted category is obtained based on the updated node features of the any page block.

6. The apparatus according to claim 5, wherein, The update module is further used for: A pre-trained graph attention network is used to transform the initial node features of any page block and the initial node features of the adjacent page blocks to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks. The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks; Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

7. A training apparatus for a page processing model, the model comprising: The device includes a graph attention network and a classification network, comprising: The segmentation module is used to divide a page sample into at least one page block; each page block is composed of page elements contained in each node of the DOM tree corresponding to the page sample; the at least one page block forms a graph, each page block corresponds to a node in the graph, and the existence of an edge between corresponding nodes is determined based on the layout information of two page blocks; The update module is used to update the initial node features of any page block in the at least one page block by employing the graph attention network and based on the attention weights between the page block and its neighboring page blocks, thereby obtaining updated node features of the page block. The initial node features are obtained by vectorizing node information, which includes basic information, style information, and structural information. The attention weights include the weights of multiple attention heads, and the multiple attention heads are computed in parallel. The determination module is used to determine the predicted category of any page block based on the updated node features using the classification network. A construction module is used to construct a loss function based on the predicted category and the true category of any page block; An adjustment module is used to adjust the parameters of the graph attention network and the classification network based on the loss function until preset conditions are met, so as to obtain the final graph attention network and the final classification network.

8. The apparatus according to claim 7, wherein, The update module is further used for: Using the graph attention network, the initial node features of any page block and the initial node features of the adjacent page blocks are transformed to obtain the transformed node features of any page block and the transformed node features of the adjacent page blocks. The attention weight is determined based on the transition node features of any page block and the transition node features of the adjacent page blocks; Based on the attention weights, the transition node features of the adjacent page blocks are weighted to obtain the update node features.

9. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.

11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Page content division method and device, readable storage medium and electronic equipment

    CN109710864A

  • Data processing method and device, model training method and device, equipment, storage medium and product

    CN114332516A