A page entity information extraction method and device
Patent Information
- Application Number
- CN202311302459.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-08
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-10-08
AI Technical Summary
通过离散的实体信息来确定用户感兴趣的内容,准确度较低
[0025] The page entity information extraction method and apparatus of this specification embodiment first extracts the text field ontology and obtains the path information and font information of the text field ontology to form text field data. Then, the text field data is constructed into a content tree. Next, the text field data is grouped by the content tree. Then, the importance value of each text field data in the group is obtained. Then, based on the grouping of text field data, entity information is extracted from the text field ontology of the text field data in the group and the importance value of the text field data is assigned to the extracted entity information. Finally, the entity information in each group is sorted according to the importance value. The grouped and sorted entity information can clearly determine the correlation between each entity information and determine which entity information is more important, thereby more accurately determining the content that the user is interested in.
Smart Images

Figure CN117421474B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification mainly relate to the field of data processing technology, specifically a method and apparatus for extracting page entity information. Background Technology
[0002] Users will browse the page. By extracting entity information from the page, we can understand what content users are interested in, and then push other related content to them.
[0003] like Figure 1 As shown, this is a schematic diagram of a webpage. Existing methods for extracting page entity information involve first collecting information from the page line by line; the collected information is as follows: Figure 2 As shown. Then the collected information is flattened, and the flattened information is as follows. Figure 3 As shown. Finally, entity information is extracted from the flattened information. The extracted entity information is as follows: Figure 4 As shown.
[0004] The entity information extracted by this method is discrete, and the correlation between entities is weak. Determining user-interested content based on discrete entity information results in low accuracy. Summary of the Invention
[0005] This specification addresses the problems existing in the prior art by proposing a method and apparatus for extracting page entity information. The technical solution is as follows:
[0006] Firstly, embodiments of this specification provide a method for extracting page entity information, including:
[0007] Extract the text field ontology, obtain the path information and font information of the text field ontology, and combine the path information and font information with the text field ontology to obtain the text field data;
[0008] Based on the path information, construct a content tree from the text field data;
[0009] Group text data according to the content tree;
[0010] Based on path information and font information, obtain the important values of the text field body in the grouped text field data;
[0011] Extract entity information from the text field ontology and assign the important values corresponding to the text field ontology to the extracted entity information;
[0012] Sort the entity information within the group according to its importance value.
[0013] Secondly, embodiments of this specification provide a page entity information extraction device, comprising:
[0014] The text field data acquisition module is used to extract the text field body, obtain the path information and font information of the text field body, and combine the path information and font information with the text field body to obtain the text field data.
[0015] The content tree building module is used to construct a content tree from text field data based on path information;
[0016] The text field data grouping module is used to group text field data according to the content tree;
[0017] The importance value acquisition module is used to obtain the importance value of the text field itself in the grouped text field data based on path information and font information.
[0018] The entity information extraction module is used to extract entity information from the text field ontology and assign the important values corresponding to the text field ontology to the extracted entity information.
[0019] The entity information sorting module is used to sort entity information within a group based on importance values.
[0020] Thirdly, embodiments of this specification provide an electronic device, including:
[0021] Memory, used to store programs;
[0022] A processor is used to run a program stored in memory to execute the page entity information extraction method of the first aspect.
[0023] Fourthly, embodiments of this specification provide a computer-readable storage medium storing computer program instructions thereon, which, when executed by a processor, implement the page entity information extraction method of the first aspect.
[0024] Beneficial effects
[0025] The page entity information extraction method and apparatus of this specification embodiment first extracts the text field ontology and obtains the path information and font information of the text field ontology to form text field data. Then, the text field data is constructed into a content tree. Next, the text field data is grouped by the content tree. Then, the importance value of each text field data in the group is obtained. Then, based on the grouping of text field data, entity information is extracted from the text field ontology of the text field data in the group and the importance value of the text field data is assigned to the extracted entity information. Finally, the entity information in each group is sorted according to the importance value. The grouped and sorted entity information can clearly determine the correlation between each entity information and determine which entity information is more important, thereby more accurately determining the content that the user is interested in.
[0026] Further or more detailed beneficial effects will be described in conjunction with specific embodiments in the detailed implementation. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a schematic diagram of a webpage;
[0029] Figure 2 This is a schematic diagram of the information collection process for existing page entity information extraction methods.
[0030] Figure 3 This is a schematic diagram showing the information after flattening the existing technology's method for extracting entity information from a webpage.
[0031] Figure 4 This is a schematic diagram of entity information extracted by existing page entity information extraction methods;
[0032] Figure 5 This is a flowchart illustrating the page entity information extraction method provided in Embodiment 1 of this specification;
[0033] Figure 6 This is a flowchart illustrating the process of obtaining path information of the text ontology in Embodiment 1 of this specification;
[0034] Figure 7 This is a flowchart illustrating the process of obtaining font information of the text field body in Embodiment 1 of this specification;
[0035] Figure 8 This is a flowchart illustrating how text field data is constructed into a content tree based on path information in Embodiment 1 of this specification.
[0036] Figure 9 This is a schematic diagram of the content tree finally constructed in Example 1 of this specification;
[0037] Figure 10 This is a schematic diagram illustrating the specific process of grouping text field data according to the content tree in Embodiment 1 of this specification;
[0038] Figure 11 This is a flowchart illustrating the process of determining group nodes in Embodiment 1 of this specification;
[0039] Figure 12 This is a schematic diagram of the process of creating a grouping area based on a grouping node in Embodiment 1 of this specification;
[0040] Figure 13 This is another flowchart illustrating the grouping of text field data according to the content tree in Embodiment 1 of this specification;
[0041] Figure 14 This is a schematic diagram of the content tree following the number in Embodiment 1 of this specification;
[0042] Figure 15 This is a schematic diagram of the grouping frame structure set for nodes 1 to 3 in Embodiment 1 of this specification;
[0043] Figure 16 This is a schematic diagram of the final text field data grouping structure in Embodiment 1 of this specification;
[0044] Figure 17 This is a schematic diagram of the structure after merging the grouped areas in Embodiment 1 of this specification;
[0045] Figure 18 This is a flowchart illustrating the entity information extraction process in Example 1 of this specification;
[0046] Figure 19 This is a schematic diagram of the structure after grouping entity information in Embodiment 1 of this specification;
[0047] Figure 20 This is a schematic diagram of the structure of the page entity information extraction device provided in Embodiment 1 of this specification;
[0048] Figure 21 This is a schematic diagram of the electronic device provided in Embodiment 3 of this specification. Detailed Implementation
[0049] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings.
[0050] The terms "first," "second," "third," etc., in the description, claims, and accompanying drawings are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0051] Example 1:
[0052] A method for extracting entity information from a page, such as Figure 5 As shown, it includes:
[0053] Step 502. Extract the text field ontology, obtain the path information and font information of the text field ontology, and combine the path information, font information and text field ontology to obtain text field data.
[0054] In this embodiment, when extracting text ontology from the page, text ontology is extracted one by one in a top-down, left-to-right order. A text ontology can be a word, a sentence, or a paragraph of text, and two text ontologs need to be separate and non-contiguous.
[0055] After extracting a text ontology, its path and font information need to be obtained first. Then, the text ontology, its path information, and its font information are combined into a text data set. Once the text data for one text ontology is obtained, the extraction of the next text ontology continues, and the text data for the next text ontology is obtained. This process is repeated until all text ontologies for the entire page have been extracted.
[0056] like Figure 6 As shown, obtaining the path information of the text ontology specifically includes:
[0057] Step 602. Use JavaScript and DOM manipulation to obtain the path information of the text object itself.
[0058] JavaScript is a programming language. DOM manipulation refers to using JavaScript to manipulate elements on a webpage, where the element can be the text object itself in this example. Through DOM manipulation, JavaScript can be used to obtain the attributes of elements on a webpage (e.g., path, font size, font color, font weight, etc.). When you need to obtain the path information of the text object, simply enter the following code: `var path = getElementPath(element);` After obtaining the path information of the text object, you can continue to obtain the font information of the text object.
[0059] like Figure 7 As shown, obtaining the font information of the text body specifically includes:
[0060] Step 702. Use JavaScript and DOM manipulation to obtain the font size information of the text field itself.
[0061] When you need to get the font size information of the text element, simply enter the following code: var fontSize = window.getComputedStyle(element).fontSize;
[0062] Step 704. Use JavaScript and DOM manipulation to obtain the font color information of the text field itself.
[0063] When you need to get the font color information of the text element itself, simply enter the following code: var color = window.getComputedStyle(element).color;
[0064] Step 706. Use JavaScript and DOM manipulation to obtain the font weight information of the text field itself.
[0065] To retrieve the font weight information of the text element, simply enter the following code: `var fontWeight = window.getComputedStyle(element).fontWeight;`. At this point, the font information of the text element will be retrieved.
[0066] Specifically, for example Figure 1 The page shown first extracts the first text field, "Common Services," and then obtains its path and font information. Assume the final path information for "Common Services" is A1 / B1, the font size is 18, the font color is RGB(0, 0, 0), and the font weight is W7. Then the final text field data for "Common Services" is: Common Services [A1 / B1; 18; RGB(0, 0, 0); W7].
[0067] Then, extract the second text field, namely "Recently Used," and obtain its path and font information. Assume the final path information for "Recently Used" is A1 / B2, the font size is 18, the font color is RGB(0, 0, 0), and the font weight is W5. Then the final text field data for "Recently Used" is: Recently Used [A1 / B2; 18; RGB(0, 0, 0); W5].
[0068] Then, by repeatedly performing step 502, we finally obtain... Figure 1 The complete text field data of the Chinese page is as follows:
[0069] Text field data 1: Common services [A1 / B1; 18; RGB(0, 0, 0); W7];
[0070] Text field data 2: Recently used [A1 / B2; 18; RGB(0, 0, 0); W5];
[0071] Text field data 3: Hangzhou Hot Topics [A1 / B3; 18; RGB(0, 0, 0); W5];
[0072] Text field data 4: In / Out [A1 / B4; 18; RGB(0, 0, 0); W5];
[0073] Text field data 5: Asian Games PASS Cultural and Tourism Benefit Card [A2 / C1 / D1; 16; RGB(0, 0, 0); W6];
[0074] Text field data 6: Purchase special offer package [A2 / C1 / D2; 14; RGB(0, 0, 0); W4];
[0075] Text field data 7: Public inspection [A2 / C2 / E1; 16; RGB(0, 0, 0); W6];
[0076] Text field data 8: Hospitals nationwide available for appointments [A2 / C2 / E2; 14; RGB(0, 0, 0); W4];
[0077] Text field data 9: Summer outbound travel [A2 / C3 / F1; 16; RGB(0, 0, 0); W6];
[0078] Text field data 10: Passport, Visa, and Health Application Form [A2 / C3 / F2; 14; RGB(0, 0, 0); W4];
[0079] Text field data 11: Social security contributions for flexible employment personnel [A2 / C4 / G1; 16; RGB(0, 0, 0); W6];
[0080] Text field data 12: Social insurance participation record for flexible employment personnel [A2 / C4 / G2; 14; RGB(0, 0, 0); W4];
[0081] Text field data 13: Social Security Certificate Printing [A2 / C5 / H1; 16; RGB(0, 0, 0); W6];
[0082] Text field data 14: One-click download, no need to run errands [A2 / C5 / H2; 14; RGB(0, 0, 0); W4];
[0083] Text field data 15: Housing provident fund account [A2 / C6 / I1; 16; RGB(0, 0, 0); W6];
[0084] Text field data 16: Account information query [A2 / C6 / I2; 14; RGB(0, 0, 0); W4].
[0085] like Figure 5 As shown, the page entity information extraction method in this embodiment further includes:
[0086] Step 504. Construct a content tree from the text field data based on the path information.
[0087] In this embodiment, the first text field data is used to build a partial content tree. Then, the second text field data is used to build a partial content tree based on the content tree built by the first text field data. Then, the third text field data is used to build a partial content tree based on the content tree built by the second text field data. This process is repeated until the content tree is built by the last text field data. Then, the final content tree is completed.
[0088] like Figure 8 As shown, constructing a content tree from text data based on path information specifically includes:
[0089] Step 802. Obtain the field data of a document.
[0090] In this embodiment, only one text field data is retrieved at a time. For example, when the text field data is retrieved for the first time, it is text field data 1: Common Services [A1 / B1; 18; RGB(0, 0, 0); W7]; when the text field data is retrieved for the sixth time, it is text field data 6: Purchase Special Offer Tickets [A2 / C1 / D2; 14; RGB(0, 0, 0); W4]; when the text field data is retrieved for the twelfth time, it is text field data 12: Flexible Employment Personnel Insurance Record [A2 / C4 / G2; 14; RGB(0, 0, 0); W4].
[0091] Furthermore, the content tree is primarily constructed based on the path information of the text field data. Therefore, after obtaining a text field data, its path information needs to be determined first. For example, when text field data 1: Common Services [A1 / B1; 18; RGB(0, 0, 0); W7] is obtained, the path information can be determined as A1 / B1. When text field data 8: Nationwide Hospital Appointment Available [A2 / C2 / E2; 14; RGB(0, 0, 0); W4] is obtained, the path information can be determined as A2 / C2 / E2. When text field data 16: Account Information Query [A2 / C6 / I2; 14; RGB(0, 0, 0); W4] is obtained, the path information can be determined as A2 / C6 / I2.
[0092] Step 804. Determine whether the root node of the content tree has been created. If yes, proceed to the next step; otherwise, create the root node of the content tree.
[0093] When the retrieved data is text field 1, the root node has not yet been created because the content tree has not yet been built. Therefore, the root node needs to be created at this point. If the retrieved data is any other type of text field, this step can be skipped since the root node was already created with text field 1, and we can proceed directly to the next step.
[0094] Step 806. Obtain the current layer path of the text field data.
[0095] If the path is from step 804, then the current layer path is the first layer path of the path information. If the path is from step 810, then the layer path that step 810 points to is the current layer path.
[0096] For example, if the path information is A1 / B3, then if it comes down from step 804, the current layer path is A1; if it is the first time returning from step 810, then the current layer path is B3.
[0097] For example, if the path information is A2 / C2 / E2, then if it comes down from step 804, the current layer path is A2; if it is the first time returning from step 810, then the current layer path is C2; if it is the second time returning from step 810, then the current layer path is E2.
[0098] Step 808. Determine whether the child node of the current layer path has been created. If yes, proceed to the next step; otherwise, create the child node corresponding to the current layer path on the content tree.
[0099] When the retrieved data is text field 1, since only the root node has been created previously, child nodes need to be created for the current layer path. When the retrieved data is other types of text field data, if the current layer path of the currently retrieved text field data is the same as a layer path of the previously retrieved text field data, it means that child nodes have already been created for the current layer path, so there is no need to create child nodes again, and proceed directly to the next step; if the current layer path of the currently retrieved text field data is different from all the path layers of the previously retrieved text field data, it means that child nodes have not yet been created for the current layer path, and child nodes need to be created for the current layer path.
[0100] For example, if the path information of text data 1 is A1 / B1, and the current layer path is A1, since no child nodes have been created for path layer A1 before, it is necessary to create child nodes for the current layer path A1 at this time.
[0101] For example, if the path information of text data 2 is A1 / B2, and the current layer path is A1, since child nodes have already been created for path layer A1, there is no need to create child nodes for the current layer path A1 at this time, and we can directly proceed to the next step.
[0102] Step 810. Determine if there is a next-level path in the path information of the text field data. If so, use the next-level path as the current level path of the text field data; otherwise, add the text field data to the current child node and end.
[0103] For example, if the path information of text field data 1 is A1 / B1, and the current layer path is A1, then since there is a next layer path B1 after A1, the next layer path B1 is taken as the current layer path, and the process returns to step 806.
[0104] For example, if the path information for text field data 12 is A2 / C4 / G2, and assuming the current layer path is G2, since there is no next layer path after G2, the flexible employment personnel insurance record [A2 / C4 / G2; 14; RGB(0, 0, 0); W4] (i.e., text field data 12) is directly added to the current child node. Then, return to step 802 to obtain the next text field data.
[0105] Specifically, with Figure 1 Taking a page as an example, the specific process of building a content tree is as follows:
[0106] 1. First, obtain text data 1 through step 802. Then, create the root node of the content tree through step 804. Next, obtain the current layer path A1 through step 806. Then, create a child node for the current layer path A1 through step 808. Next, take the next layer path B1 as the current layer path through step 810 and return to step 806. Then, obtain the current layer path B1 through step 806. Next, create a child node for the current layer path B1 through step 808. Finally, add text data 1 to the current child node through step 810 and return to step 802.
[0107] 2. First, obtain text data 2 through step 802. Then, determine through step 804 that a root node has been created and proceed directly to step 806. Next, obtain the current layer path A1 through step 806. Then, determine through step 808 that a child node has been created for the current layer path A1 and proceed directly to step 810. Next, use the next layer path B2 as the current layer path through step 810 and return to step 806. Then, obtain the current layer path B2 through step 806. Next, create a child node for the current layer path B2 through step 808. Finally, add text data 2 to the current child node through step 810 and return to step 802.
[0108] 3. First, obtain text field data 3 through step 802, then... The final content tree constructed is as follows... Figure 9 As shown.
[0109] like Figure 5 As shown, the page entity information extraction method in this embodiment further includes:
[0110] Step 506. Group the text field data according to the content tree.
[0111] This embodiment uses grouping nodes for grouping. First, the first node in the content tree is obtained as the grouping node and grouped. Then, the second node in the content tree is obtained as the grouping node and grouped. Next, the third node in the content tree is obtained as the grouping node and grouped, and so on, until finally the last node in the content tree is obtained as the grouping node and grouped. At this point, all nodes in the content tree have been grouped, thus completing the grouping of all text data.
[0112] like Figure 10 As shown, grouping text data according to the content tree specifically includes:
[0113] Step 1002. Determine the grouping node. Only one node in the content tree is used as the grouping node for each time period, and every node in the content tree needs to be used as a grouping node, with each node serving as a grouping node only once. Furthermore, the grouping nodes are not randomly determined; the nodes of the content tree need to be used as grouping nodes in a specific order.
[0114] like Figure 11 As shown, determining the grouping node specifically includes:
[0115] Step 1102. Number the nodes of the content tree in sequence.
[0116] In this embodiment, before determining the grouping nodes, the nodes of the content tree need to be numbered. Specifically, the nodes of the content tree can be numbered in a top-down, left-to-right order. The numbered content tree is as follows: Figure 14 As shown.
[0117] Step 1104. When the group node is obtained for the Nth time, the Nth node of the content tree is taken as the current group node.
[0118] The minimum value of N is 1, and the maximum value of N is the maximum number of the content tree node. In this embodiment, the maximum number of the content tree node is 25, so the maximum value of N is 25. When a group node is needed for the first time, node 1 of the content tree is directly used as the current group node; when a group node is needed for the second time, node 2 of the content tree is directly used as the current group node; ...; when a group node is needed for the 25th time, node 25 of the content tree is directly used as the current group node.
[0119] Step 1004. Create a grouping area based on the grouping node.
[0120] In this embodiment, creating a grouping area for a grouping node can specifically mean setting a "grouping frame" for that grouping node.
[0121] like Figure 12 As shown, creating a grouping area based on a grouping node specifically includes:
[0122] Step 1202. Determine whether the group node has a parent node connected to it in the content tree.
[0123] Step 1204. When there is no parent node, create the group area directly; when there is a parent node, create a group area for the group node within the group area corresponding to the parent node.
[0124] For example, such as Figure 14 As shown, when node 1 of the content tree is used as a grouping node, since node 1 has no connected parent node in the content tree, a "grouping box" is directly set for node 1. When node 2 of the content tree is used as a grouping node, since node 2 has a parent node of node 1 in the content tree, it is necessary to first find the "grouping box" of node 1 and then set a "grouping box" for node 2 within the "grouping box" of node 1. When node 3 of the content tree is used as a grouping node, since node 3 has a parent node of node 1 in the content tree, it is necessary to first find the "grouping box" of node 1 and then set a "grouping box" for node 3 within the "grouping box" of node 1. The specific structure of the grouping box at this time is as follows: Figure 15 As shown.
[0125] Step 1006. Determine whether the content of the group node is text data or empty.
[0126] After creating a grouping area (i.e., setting a "group box") for a grouping node, it's necessary to determine whether the grouping node's content is empty or contains text data. For example, when node 8 of the content tree is used as a grouping node, after setting a "group box" for it, the content of the grouping node needs to be determined; in this case, the content is empty. As another example, when node 15 of the content tree is used as a grouping node, after setting a "group box" for it, the content of the grouping node needs to be determined; in this case, the content is the text data "6". And as yet another example, when node 25 of the content tree is used as a grouping node, after setting a "group box" for it, the content of the grouping node needs to be determined; in this case, the content is the text data "16".
[0127] Step 1008. When the content of the group node is text data, add the text data to the group area and end; when the content of the group node is empty, end.
[0128] When the content of a group node is empty, there is no need to add anything to the "group box" of that group node, and the operation on that group node will end directly. When the content of a group node is text data, the corresponding text data needs to be added to the "group box" of that group node, and then the operation on that group node will end.
[0129] Specifically, with Figure 14 Taking the content tree in the image as an example, the process of grouping text data according to the content tree is as follows:
[0130] 1. First, determine the first node of the content tree as a group node through step 1002. Then, set a "group box" for the group node through step 1004. Next, determine that the content of the group node is empty through step 1006. Finally, end directly through step 1008.
[0131] 2. First, determine that node 2 of the content tree is a grouping node through step 1002. Then, set a "grouping box" for the grouping node in the grouping box of node 1 through step 1004. Next, determine that the content of the grouping node is empty through step 1006. Finally, end directly through step 1008.
[0132] 3. First, determine that node 3 of the content tree is a grouping node through step 1002. Then, set a "grouping box" for the grouping node in the grouping box of node 1 through step 1004. Next, determine that the content of the grouping node is empty through step 1006. Finally, end directly through step 1008.
[0133] 4. First, determine that node 4 of the content tree is a grouping node through step 1002. Then, set a "grouping box" for this grouping node in the grouping box of node 2 through step 1004. Next, determine that the content of this grouping node is text field data 1 through step 1006. Finally, add text field data 1 to the "grouping box" through step 1008 to end.
[0134] 5. First, determine that node 5 of the content tree is a grouping node through step 1002. Then, set a "grouping box" for this grouping node in the grouping box of node 2 through step 1004. Next, determine that the content of this grouping node is text field data 2 through step 1006. Finally, add text field data 2 to the "grouping box" through step 1008 to end.
[0135] 6. First, determine node 6 of the content tree as the grouping node through step 1002, then... Finally, complete the grouping of the text data. The final text data grouping structure is as follows... Figure 16 As shown.
[0136] like Figure 13 As shown, grouping text data according to the content tree also includes:
[0137] Step 1302. Merge groups containing only one text field within the same grouping area.
[0138] Specifically, with Figure 16 Taking the text field data grouping structure in the example: Node 2's "grouping box" contains 4 "grouping boxes". Since each of these 4 "grouping boxes" contains only one text field data, these 4 "grouping boxes" are merged into 1 "grouping box". This setting makes the grouping results of the text field data clearer and easier to determine the relationship between subsequent entity information. Furthermore, if Node 2's "grouping box" itself does not contain a single text field data, then Node 2's "grouping box" can be directly used as the merged "grouping box". If Node 2's "grouping box" contains a single text field data, then a new merged "grouping box" needs to be set within Node 2's "grouping box".
[0139] Similarly, there are two group boxes in the "group box" of node 8. Since each of these two "group boxes" contains only one text field, these two "group boxes" are merged into one "group box". Since the "group box" of node 8 itself does not contain any separate text field, the "group box" of node 8 is directly used as the merged "group box".
[0140] The same operation applies to the two group boxes within the group box of node 9, the two group boxes within the group box of node 10, the two group boxes within the group box of node 11, the two group boxes within the group box of node 12, and the two group boxes within the group box of node 13. The final merged group structure is as follows. Figure 17 As shown.
[0141] like Figure 5 As shown, the page entity information extraction method in this embodiment further includes:
[0142] Step 508. Obtain the importance value of the text field body in the grouped text field data based on the path information and font information. This embodiment requires obtaining the importance value of the text field body in each text field data.
[0143] The importance values of the text ontology can be obtained in the following way: First, an intelligent model is acquired. Then, path information, font size information, font color information, and font weight information are used as inputs to the intelligent model, and the importance values are used as outputs to continuously train the intelligent model until the empirical parameter values of the intelligent model are determined. The training process of the intelligent model is a current technology.
[0144] The trained intelligent model can be directly used to obtain the importance value of text ontology. For example, inputting "A1 / B1; 18; RGB(0, 0, 0); W7" into the intelligent module yields an importance value of 0.60 for "Frequently Used Services". Inputting "A1 / B2; 18; RGB(0, 0, 0); W5" into the intelligent model yields an importance value of 0.55 for "Recently Used". Inputting "A1 / B3; 18; RGB(0, 0, 0); W5" into the intelligent model yields an importance value of 0.55 for "Hot Topics in Hangzhou". Inputting "A1 / B4; 18; RGB(0, 0, 0); W5" into the intelligent model yields an importance value of 0.55 for "Entering and Exiting Scenes". Inputting "A2 / C1 / D1; 16; RGB(0, 0, 0); W6" into the intelligent model yields an importance value of 0.51 for "Asian Games PASS Cultural Tourism Benefit Card". Inputting “A2 / C1 / D2; 14; RGB(0, 0, 0); W4” into the smart model yields an importance value of 0.46 for “Purchase Special Offer Packages”. Inputting “A2 / C2 / E1; 16; RGB(0, 0, 0); W6” into the smart model yields an importance value of 0.51 for “Public Health Checkup”. Inputting “A2 / C2 / E2; 14; RGB(0, 0, 0); W4” into the smart model yields an importance value of 0.46 for “Nationwide Hospital Appointment Available”. Inputting “A2 / C3 / F1; 16; RGB(0, 0, 0); W6” into the smart model yields an importance value of 0.51 for “Summer Outbound Travel”. Inputting “A2 / C3 / F2; 14; RGB(0, 0, 0); W4” into the smart model yields an importance value of 0.46 for “Passport, Visa, and Health Application Form”. Inputting “A2 / C4 / G1; 16; RGB(0, 0, 0); W6” into the smart model yields an importance value of 0.51 for “Social Security Contributions for Flexible Employment Personnel”. Inputting “A2 / C4 / G2; 14; RGB(0, 0, 0); W4” into the smart model yields an importance value of 0.46 for “Social Security Certificate Printing”. Inputting “A2 / C5 / H1; 16; RGB(0, 0, 0); W6” into the smart model yields an importance value of 0.51 for “One-Click Download for No Need to Run Around”. Inputting “A2 / C6 / I1; 16; RGB(0, 0, 0); W6” into the smart model yields an importance value of 0.51 for “Housing Provident Fund Account”. Inputting “A2 / C6 / I2;14;RGB(0,0,0);W4” into the smart model will give you the importance value of “Account Information Query” as 0.46.
[0145] The importance value of a text field needs to take into account path information, font size information, font color information, and font weight information. Generally speaking, the fewer the path layers, the larger the font, the brighter the font color, and the thicker the font, the greater the final importance value.
[0146] like Figure 5 As shown, the page entity information extraction method in this embodiment further includes:
[0147] Step 510. Extract entity information from the text field ontology and assign the important values corresponding to the text field ontology to the extracted entity information.
[0148] For example, if the entity information extracted from "Frequently Used Services" is "Frequently Used Services", then the importance value of "Frequently Used Services" is 0.60. No entity information can be extracted from "Recently Used". The entity information extracted from "Hangzhou Hot Topics" is "Hangzhou". Assigning the importance value of "Hangzhou Hot Topics" to "Hangzhou" results in a final importance value of 0.55 for "Entering and Exiting the Camera". No entity information can be extracted from "Entering and Exiting the Camera".
[0149] The entity information extracted from "Asian Games PASS Cultural Tourism Benefit Card" is "Asian Games" and "Benefit Card". Assigning the importance value of "Asian Games PASS Cultural Tourism Benefit Card" to "Asian Games" and "Benefit Card" results in an importance value of 0.51 for both "Asian Games" and "Benefit Card". The entity information extracted from "Purchase Special Offer Package Ticket" is "Package Ticket". Assigning the importance value of "Purchase Special Offer Package Ticket" to "Package Ticket" results in an importance value of 0.46 for both "Package Ticket".
[0150] The entity information that cannot be extracted from "Public Health Checkup" is "Hospital". The entity information extracted from "Nationwide Hospital Appointment Available" is "Hospital". Assigning the importance value of "Nationwide Hospital Appointment Available" to "Hospital" will result in an overall importance value of 0.46 for "Hospital".
[0151] The entity information that cannot be retrieved from "Summer Outbound Travel" is as follows. The entity information retrieved from "Passport, Visa and Health Application Form" is "Passport", "Visa" and "Application Form". Assigning the importance value of "Passport", "Visa" and "Application Form" to "Passport", "Visa" and "Application Form" will result in an importance value of 0.46 for each of them.
[0152] The entity information extracted from "Social Security Contributions for Flexible Employment Personnel" is "Social Security". Assigning the importance value of "Social Security Contributions for Flexible Employment Personnel" to "Social Security" results in a final importance value of 0.51. The entity information extracted from "Social Security Participation Records for Flexible Employment Personnel" is "Participation Records". Assigning the importance value of "Social Security Participation Records for Flexible Employment Personnel" to "Participation Records" results in a final importance value of 0.46 for both.
[0153] The entity information extracted from "Social Security Certificate Printing" is "Social Security Certificate". Assigning the importance value of "Social Security Certificate Printing" to "Social Security Certificate" results in an importance value of 0.51 for "Social Security Certificate". "One-click download, no need to go to the office" does not extract any entity information.
[0154] The entity information retrieved from "Housing Provident Fund Account" is "Provident Fund Account". Assigning a significance value to "Provident Fund Account" results in all "Provident Fund Accounts" having a significance value of 0.51. "Account Information Inquiry" cannot retrieve entity information.
[0155] In addition, such as Figure 18 As shown, step 510 also includes:
[0156] Step 1802. When the entity information in a text field ontology is extracted, replace the text field data corresponding to the text field ontology with the extracted entity information.
[0157] like Figure 17 As shown, assuming Figure 17 The entity information has been extracted from text field data 1. Therefore, delete text field data 1 and add the extracted entity information to the corresponding "grouping box". When... Figure 17 After the entity information extraction operation is completed for all text field data, then Figure 17 The text field data grouping structure diagram will become Figure 19 The entity information grouping structure diagram.
[0158] like Figure 5 As shown, the page entity information extraction method in this embodiment further includes:
[0159] Step 512. Sort the entity information within the group according to importance value. For example... Figure 19 As shown, the entity information within each group in this embodiment is already sorted by importance value after extraction, so there is no need to sort it again. If the entity information within a group is not sorted by importance value, then the entity information within the group needs to be sorted by importance value from largest to smallest.
[0160] The page entity information extraction method in this embodiment first extracts the text field ontology and obtains the path information and font information of the text field ontology to form text field data. Then, the text field data is constructed into a content tree. Next, the text field data is grouped by the content tree. Then, the importance value of each text field data in the group is obtained. Then, based on the grouping of text field data, entity information is extracted from the text field ontology of the text field data in the group, and the importance value of the text field data is assigned to the extracted entity information. Finally, the entity information in each group is sorted according to the importance value. The grouped and sorted entity information can clearly determine the correlation between each entity information and determine which entity information is more important, thereby more accurately determining the content that the user is interested in.
[0161] Example 2:
[0162] A device for extracting page entity information, such as Figure 20 As shown, it includes: text field data acquisition module, content tree construction module, text field data grouping module, important value acquisition module, entity information extraction module, and entity information sorting module.
[0163] The document field data acquisition module extracts the document field ontology, obtains its path and font information, and combines this information with the document field ontology to obtain the document field data. The content tree construction module constructs a content tree from the document field data based on the path information. The document field data grouping module groups the document field data according to the content tree. The importance value acquisition module obtains the importance value of the document field ontology within the grouped document field data based on the path and font information. The entity information extraction module extracts entity information from the document field ontology and assigns the corresponding importance value to the extracted entity information. The entity information sorting module sorts the entity information within each group according to its importance value.
[0164] The text data acquisition module includes: a path information acquisition unit, a font size information acquisition unit, a font color information acquisition unit, and a font weight information acquisition unit. The path information acquisition unit uses JavaScript and DOM manipulation to obtain the path information of the text object. The font size information acquisition unit uses JavaScript and DOM manipulation to obtain the font size information of the text object. The font color information acquisition unit uses JavaScript and DOM manipulation to obtain the font color information of the text object. The font weight information acquisition unit uses JavaScript and DOM manipulation to obtain the font weight information of the text object.
[0165] The content tree construction module includes: a text field data acquisition unit, a root node creation unit, a current-level path acquisition unit, a child node creation unit, and a next-level path determination unit. The text field data acquisition unit acquires a text field. The root node creation unit determines whether the root node of the content tree has already been created; if so, it proceeds to the next step; otherwise, it creates the root node. The current-level path acquisition unit acquires the current-level path of the text field data. The child node creation unit determines whether the child nodes of the current-level path have already been created; if so, it proceeds to the next step; otherwise, it creates the child nodes corresponding to the current-level path in the content tree. The next-level path determination unit determines whether a next-level path exists in the path information of the text field data; if so, it uses the next-level path as the current-level path of the text field data; otherwise, it adds the text field data to the current byte and ends the process.
[0166] The text data grouping module includes: a group node determination unit, a group area creation unit, a group node judgment unit, and a group area content setting unit. The group node determination unit determines the group nodes. The group area creation unit creates group areas based on the group nodes. The group node judgment unit determines whether the content of the group node is text data or empty. The group area content setting unit adds the text data to the group area when the content of the group node is text data, and then terminates the module; it terminates the module when the content of the group node is empty.
[0167] The group node determination unit includes a node numbering subunit and a group node determination subunit. The node numbering subunit is used to number the nodes of the content tree sequentially. The group node determination subunit is used to select the Nth node of the content tree as the current group node when the group node is retrieved for the Nth time.
[0168] The group area creation unit includes a parent node determination subunit and a group area creation subunit. The parent node determination subunit is used to determine whether a group node has a parent node connected to it in the content tree. The group area creation subunit is used to directly create a group area when there is no parent node; when there is a parent node, it creates a group area for the group node within the group area corresponding to the parent node.
[0169] The text field data grouping module also includes a grouping area merging unit. The grouping area merging unit is used to merge grouping areas containing only one text field data within the same grouping area.
[0170] The entity information extraction module also includes a text field data replacement unit. This unit replaces the corresponding text field data with the extracted entity information when the entity information extraction from a text field's body is complete.
[0171] The page entity information extraction device in this embodiment first extracts the text field ontology and obtains the path information and font information of the text field ontology to form text field data. Then, it constructs a content tree from the text field data. Next, it groups the text field data through the content tree. Then, it obtains the importance value of each text field data in the group. Then, based on the grouping of text field data, it extracts entity information from the text field ontology of the text field data in the group and assigns the importance value of the text field data to the extracted entity information. Finally, it sorts the entity information in each group according to the importance value. The grouped and sorted entity information can clearly determine the correlation between each entity information and determine which entity information is more important, thereby more accurately determining the content that the user is interested in.
[0172] Example 3:
[0173] An electronic device, such as Figure 21 As shown, it includes a memory and a processor. The memory is used to store programs. The processor is used to run the programs stored in the memory to perform the page entity information extraction method in Embodiment 1.
[0174] Specifically, the electronic device in this embodiment may include: at least one processor, at least one network interface, user interface, memory, and at least one communication bus.
[0175] The communication bus can be used to connect and communicate with the above-mentioned components.
[0176] The user interface may include buttons, and optional user interfaces may also include standard wired interfaces and wireless interfaces.
[0177] Network interfaces may include, but are not limited to, Bluetooth modules, NFC modules, Wi-Fi modules, etc.
[0178] A processor may include one or more processing cores. The processor connects various parts within the electronic device using various interfaces and lines, executing instructions, programs, code sets, or instruction sets stored in memory, and retrieving data stored in memory to perform various functions of the routing device and process data. Optionally, the processor can be implemented using at least one hardware form of DSP, FPGA, or PLA. The processor can integrate one or more of the following: CPU, GPU, and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor.
[0179] The memory may include RAM or ROM. Optionally, the memory may include a non-transitory computer-readable medium. The memory may be used to store instructions, programs, code, code sets, or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0180] Example 4:
[0181] A computer-readable storage medium stores computer program instructions thereon, which, when executed by a processor, implement the page entity information extraction method of Embodiment 1. If the components of the electronic device in Embodiment 3 are implemented as software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium of this embodiment.
[0182] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this specification is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0183] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.
[0184] The above embodiments are merely preferred embodiments described in this specification and are not intended to limit the scope of this specification. Any modifications and improvements made by those skilled in the art to the technical solutions of this specification without departing from the spirit of this specification should fall within the protection scope defined by the claims of this specification.
Claims
1. A method for extracting entity information from a page, comprising: Extract the text field ontology, obtain the path information and font information of the text field ontology, and combine the path information and font information with the text field ontology to obtain text field data; Based on the path information, construct a content tree from the text field data; The text field data is grouped according to the content tree; Based on the path information and font information, obtain the importance value of the text field body in the grouped text field data; Extract entity information from the text field ontology and assign the importance value corresponding to the text field ontology to the extracted entity information; The entity information within the group is sorted according to the importance value.
2. The method for extracting page entity information according to claim 1, wherein obtaining the path information of the text ontology includes: Use JavaScript and DOM manipulation to obtain the path information of the text field ontology.
3. The method for extracting page entity information according to claim 1, wherein obtaining the font information of the text entity ontology includes: Use JavaScript and DOM manipulation to obtain the font size information of the text field itself; Use JavaScript and DOM manipulation to obtain the font color information of the text field itself; Use JavaScript and DOM manipulation to obtain the font weight information of the text field itself.
4. The page entity information extraction method according to claim 1, wherein constructing a content tree from the text field data based on the path information includes: Retrieve the data from one of the text fields; Determine whether the root node of the content tree has been created. If yes, proceed to the next step; otherwise, create the root node of the content tree. Obtain the current layer path of the text data; Determine whether the child node of the current layer path has been created. If yes, proceed to the next step; otherwise, create the child node corresponding to the current layer path on the content tree. Determine whether there is a next-level path in the path information of the text field data. If so, use the next-level path as the current level path of the text field data; otherwise, add the text field data to the current byte and end.
5. The method for extracting page entity information according to claim 1, wherein grouping the text data according to the content tree includes: Determine the grouping nodes; Create a grouping area based on the grouping node; The content of the group node is determined to be text data or empty; When the content of the group node is text data, the text data is added to the group area, and the process ends; when the content of the group node is empty, the process ends.
6. The method for extracting page entity information according to claim 5, wherein determining the grouping nodes includes: Number the nodes of the content tree in sequence; When the group node is retrieved for the Nth time, the Nth node of the content tree is taken as the current group node.
7. The method for extracting page entity information according to claim 5, wherein creating a grouping area based on the grouping node includes: Determine whether the group node has a parent node connected to it in the content tree; When there is no parent node, create a group area directly; when there is a parent node, create a group area for the group node within the group area corresponding to the parent node.
8. The method for extracting page entity information according to claim 5, further comprising grouping the text data according to the content tree: Merge groups containing only one text field within the same group.
9. The page entity information extraction method according to claim 8, further comprising extracting entity information from the text field ontology and assigning an importance value corresponding to the text field ontology to the extracted entity information: When entity information in a text field ontology is extracted, the extracted entity information replaces the text field data corresponding to the text field ontology.
10. A device for extracting page entity information, comprising: The text field data acquisition module is used to extract the text field body, obtain the path information and font information of the text field body, and combine the path information and font information with the text field body to obtain text field data; A content tree construction module is used to construct a content tree from the text field data based on the path information; The text field data grouping module is used to group the text field data according to the content tree; The importance value acquisition module is used to acquire the importance value of the text field body in the grouped text field data based on the path information and font information. An entity information extraction module is used to extract entity information from the text field ontology and assign the importance value corresponding to the text field ontology to the extracted entity information. The entity information sorting module is used to sort the entity information within the group according to the importance value.
11. The page entity information extraction device according to claim 10, wherein the text field data acquisition module comprises: The path information acquisition unit is used to obtain the path information of the text field ontology using JavaScript and DOM manipulation.
12. The page entity information extraction device according to claim 10, wherein the text field data acquisition module comprises: The font size information acquisition unit is used to obtain the font size information of the text field body using JavaScript and DOM manipulation; The font color information acquisition unit is used to obtain the font color information of the text field body using JavaScript and DOM manipulation; The font weight information acquisition unit is used to obtain the font weight information of the text field body using JavaScript and DOM manipulation.
13. The page entity information extraction device according to claim 10, wherein the content tree construction module comprises: A text field data acquisition unit is used to acquire one of the text field data; The root node creation unit is used to determine whether the root node of the content tree has been created. If so, proceed to the next step; otherwise, create the root node of the content tree. The current layer path acquisition unit is used to acquire the current layer path of the text field data; The child node creation unit is used to determine whether the child node of the current layer path has been created. If so, proceed to the next step; otherwise, create the child node corresponding to the current layer path on the content tree. The next-level path determination unit is used to determine whether there is a next-level path in the path information of the text field data. If so, the next-level path is used as the current level path of the text field data; otherwise, the text field data is added to the current byte and the process ends.
14. The page entity information extraction device according to claim 10, wherein the text data grouping module comprises: Grouping node determination unit, used to determine grouping nodes; A grouping area creation unit is used to create a grouping area based on the grouping node; A group node determination unit is used to determine whether the content of the group node is text data or empty; The group area content setting unit is used to add the text field data to the group area when the content of the group node is text field data, and then end; and to end when the content of the group node is empty.
15. The page entity information extraction device according to claim 14, wherein the group node determination unit comprises: The node numbering subunit is used to number the nodes of the content tree sequentially. The group node determines the sub-unit, which is used to take the Nth node of the content tree as the current group node when the group node is obtained for the Nth time.
16. The page entity information extraction device according to claim 14, wherein the grouping area creation unit comprises: The upper-level node determination subunit is used to determine whether the grouping node has an upper-level node connected to it in the content tree; The grouping area creation sub-unit is used to directly create a grouping area when there is no parent node; when there is a parent node, a grouping area is created for the grouping node within the grouping area corresponding to the parent node.
17. The page entity information extraction device according to claim 14, wherein the text data grouping module further comprises: The grouping merge unit is used to merge grouping areas that contain only one text field of data within the same grouping area.
18. The page entity information extraction device according to claim 17, wherein the entity information extraction module further comprises: The text field data replacement unit is used to replace the text field data corresponding to the text field body with the extracted entity information when the entity information in a text field body is extracted.
19. An electronic device comprising: Memory, used to store programs; A processor is configured to run the program stored in the memory to perform the page entity information extraction method according to any one of claims 1-9.
20. A computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, implement the page entity information extraction method according to any one of claims 1-9.
Citation Information
Patent Citations
General webpage theme content extraction method and system
CN108920434A