Structured document processing device, structured document processing method and program
The structured document processing device facilitates the application of neural networks to structured documents by converting them into a readable format, maintaining structural information and reducing tag variations, thereby enhancing processing accuracy.
Patent Information
- Application Number
- JP2023137695
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-12-10
- Estimated Expiration
- 2039-08-01
AI Technical Summary
Structured documents, such as HTML documents, are difficult to process using neural networks due to the need for understanding structural information, which is not directly applicable in their original state.
A structured document processing device that analyzes the document to extract hierarchical relationships and converts it into a format readable by neural networks, maintaining structural information by generating converted documents from leaf nodes to the root, and optionally reducing metastrings to pseudowords or character strings.
Enables easy application of neural networks to structured documents, improving the accuracy of question answering and document processing tasks by retaining structural information and reducing tag variations.
Smart Images

Figure 0007783859000001 
Figure 0007783859000002 
Figure 0007783859000003
Abstract
Description
[Technical Field]
[0001] The present invention relates to a structured document processing device, a structured document processing method, and a program. [Background technology]
[0002] In recent years, natural language processing using neural networks has been developing rapidly. For example, progress has been made in machine reading comprehension technology (e.g., Non-Patent Document 1). Machine reading comprehension technology enables question answering based on natural language understanding using text as a knowledge source, and is a technology that automatically finds answers to questions from text. [Prior art documents] [Non-patent literature]
[0003] [Non-Patent Document 1] K. Nishida, I. Saito, A. Otsuka, H. Asano, and J. Tomita:"Retrieve-and-read: Multi-task learning of information retrieval and reading comprehension," Proc. of CIKM 2018, pp.647-656, Torino, Italy, Oct. 2018. Summary of the Invention [Problem to be solved by the invention]
[0004] The document sets used in natural language processing using neural networks, such as machine reading comprehension technology, are assumed to be unstructured text. However, processing structured documents using neural networks requires understanding of structural information, making it difficult to apply structured documents to neural networks in their original state.
[0005] The present invention has been made in view of the above points, and has as its object to facilitate the application of neural networks to structured documents. [Means for solving the problem]
[0006] To solve the above problem, a structured document processing device has an analysis unit that analyzes a structured document and obtains information indicating a tree structure in which character strings that make up the structured document correspond to nodes, and a generation unit that identifies, for each leaf node in the tree structure, a path from the leaf node to a root node and generates a converted document including text data in which character strings related to each node on each path from the root node to the leaf node are connected. [Effects of the Invention]
[0007] It is possible to easily apply neural networks to structured documents. [Brief explanation of the drawings]
[0008] [Figure 1] FIG. 2 is a diagram for explaining the structural meaning of tags in an HTML document. [Figure 2] 1 is a diagram illustrating an example of a hardware configuration of a structured document processing apparatus 10 according to a first embodiment. [Figure 3] FIG. 2 is a diagram illustrating an example of a functional configuration of a structured document processing apparatus 10 according to the first embodiment during learning. [Figure 4] 1 is a flowchart illustrating an example of a processing procedure executed by the structured document processing apparatus 10 according to the first embodiment when learning a machine reading comprehension model. [Figure 5] FIG. 10 is a diagram for explaining the analysis of a hierarchical structure. [Figure 6] FIG. 10 is a diagram illustrating an example of extraction of a substructure. [Figure 7] FIG. 2 is a diagram illustrating an example of a functional configuration when a task is executed in the structured document processing apparatus 10 according to the first embodiment. [Figure 8] FIG. 10 is a diagram showing an example of a displayed HTML document including an answer to a question. [Figure 9] FIG. 10 is a diagram illustrating an example of a functional configuration of a structured document processing apparatus 10 according to a second embodiment during learning. [Figure 10] 10 is a flowchart illustrating an example of a processing procedure executed by the structured document processing apparatus 10 according to the second embodiment when learning a machine reading comprehension model. [Figure 11] 10 is a diagram showing an example of an extraction result by an extraction unit 113. FIG. [Figure 12] FIG. 10 is a diagram illustrating an example of combining a meta string and a content string. [Figure 13] FIG. 10 is a diagram illustrating an example of degeneration of a meta character string. [Figure 14] FIG. 11 is a diagram illustrating an example of a functional configuration of a structured document processing apparatus 10 according to a third embodiment during learning. [Figure 15] 10 is a flowchart illustrating an example of a processing procedure executed by a structured document processing apparatus 10 according to a third embodiment when learning a machine reading comprehension model. [Figure 16] FIG. 10 is a diagram illustrating an example of table conversion. [Figure 17] FIG. 10 is a diagram showing experimental results. DETAILED DESCRIPTION OF THE INVENTION
[0009] Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the present embodiment, a document written in HTML (HyperText Markup Language) (an HTML document) will be described as an example of a structured document. Furthermore, a neural network related to machine reading comprehension technology (hereinafter referred to as a "machine reading comprehension model") will be described as an example of a neural network that performs natural language processing. However, the present embodiment may also be applied to structured documents written in other formats, such as XML (eXtensible Markup Language). Furthermore, the present embodiment may also be applied to various types of natural language processing other than machine reading comprehension, such as automatic summarization and document classification processing.
[0010] In this embodiment, a method for converting an HTML document into text in a format that is readable by a machine reading comprehension model and that retains structural information is disclosed.
[0011] When a structured document such as an HTML document is interpreted by a machine reading comprehension model, it is possible to have the model interpret each unit (element) separated by character strings (hereinafter referred to as "metastrings") that represent the structure, such as the tree structure of the structured document. In an HTML document, HTML tags correspond to metastrings.
[0012] However, this method is considered to be unrealistic for the following reasons. · There are various ways to express the same content in HTML. The same meta string (HTML tag) may be used differently (with different meanings) in different documents. -It is difficult to treat metastrings (HTML tags) like normal words and have them read and understood.
[0013] Therefore, when we consider what "structure" means in a structured document, what is important in the structure of a structured document is not the type of metastring (type of tag), but the hierarchical relationship (inclusion relationship) and parallel relationship between the elements surrounded by the metastring, which are expressed by the metastring.
[0014] 1 is a diagram for explaining the structural meaning of tags in an HTML document. In the structural information of the HTML document shown in FIG. 1, the structural meaning of tag t1 is, for example, the following three meanings. -Subsection "Terms of Use" Top of "xxxTV's..." Parallel to "Available contracts" Therefore, in the first embodiment, the structure of the HTML document is divided so that the structural meaning of the tags is uniquely determined, eliminating tag fluctuations, and the HTML document is converted into a format that is readable by a machine reading comprehension model and retains the structural information of the HTML document.
[0015] Fig. 2 is a diagram showing an example of the hardware configuration of a structured document processing device 10 in the first embodiment. The structured document processing device 10 in Fig. 2 has a drive device 100, an auxiliary storage device 102, a memory device 103, a CPU 104, an interface device 105, etc., which are interconnected by a bus B.
[0016] A program for realizing processing in the structured document processing device 10 is provided by a recording medium 101 such as a CD-ROM. When the recording medium 101 storing the program is set in the drive device 100, the program is installed from the recording medium 101 to the auxiliary storage device 102 via the drive device 100. However, the program does not necessarily have to be installed from the recording medium 101, but may be downloaded from another computer via a network. The auxiliary storage device 102 stores the installed program as well as necessary files, data, etc.
[0017] When an instruction to start a program is received, the memory device 103 reads the program from the auxiliary storage device 102 and stores it. The CPU 104 executes functions related to the structured document processing device 10 in accordance with the program stored in the memory device 103. The interface device 105 is used as an interface for connecting to a network.
[0018] FIG. 3 is a diagram showing an example of the functional configuration of the structured document processing device 10 during learning in the first embodiment. In FIG. 3, the structured document processing device 10 has a structure conversion unit 11, a learning unit 12, etc. The structure conversion unit 11 also includes a structure analysis unit 111 and a structure division unit 112. These units are realized by processing in which one or more programs installed in the structured document processing device 10 are executed by the CPU 104. The structured document processing device 10 also uses a converted document storage unit 121 and a learning parameter storage unit 122. These storage units can be realized using, for example, the auxiliary storage device 102 or a storage device connectable to the structured document processing device 10 via a network. The structure conversion unit 11 and the learning unit 12 may be realized using different computers.
[0019] The following describes the processing procedures executed by the structured document processing device 10 of the first embodiment when learning a machine reading comprehension model. FIG. 4 is a flowchart for explaining an example of the processing procedures executed by the structured document processing device 10 of the first embodiment when learning a machine reading comprehension model. In FIG. 4, a loop process L1 including step S110 and loop process L2 is executed for each structured document (each HTML document) included in the structured document set that constitutes the learning data. Hereinafter, the structured document that is the processing target in loop process L1 will be referred to as the "target document."
[0020] In step S110, the structural analysis unit 111 analyzes (extracts or identifies) the hierarchical structure (tree structure) of the target document, and outputs information indicating the hierarchical structure (information indicating the hierarchical relationships (parent-child relationships) and parallel relationships (sibling relationships) between tags; hereinafter referred to as "structural information") as the analysis result (extraction result or identification result).
[0021] Fig. 5 is a diagram for explaining the analysis of a hierarchical structure. Fig. 5 shows an example of structural information s1 obtained as an analysis result when HTML document d1 is the target document. As shown in Fig. 5, structural information s1 is information indicating a tree structure in which meta strings (tags) and the values of elements enclosed by the meta strings (hereinafter referred to as "content strings") are nodes. Note that the structural information may be in any format as long as it can indicate a hierarchical structure.
[0022] For structural analysis, existing tools such as Beutiful Soup (https: / / www.crummy.com / software / BeautifulSoup / bs4 / doc / ) may be used.
[0023] Next, the structure dividing unit 112 executes a loop process L2 including step S120 for each leaf node (each terminal node) of the structure information s1. Hereinafter, the leaf node to be processed in the loop process L2 will be referred to as a "target node".
[0024] In step S120, the structure division unit 112 identifies a path from the target node to the root node by recursively tracing parent nodes one by one from the target node in the structure information s1, and extracts the identified path as a substructure for the target node. Note that the nodes on each path correspond to the meta string and content string corresponding to the node.
[0025] FIG. 6 shows an example of extracted substructures. FIG. 6 shows an example in which substructures are extracted for all leaf nodes of structural information s1. That is, FIG. 6 shows an example in which the hierarchical structure indicated by structural information s1 is divided into three substructures, substructures s1-1 to s1-3. Each extracted substructure becomes a single tree structure without branches. By forming each substructure into a single tree structure, the structural meaning of HTML tags can be summarized into only the topical superordinate-subordinate relationships. This enables robust machine reading comprehension of HTML documents in a variety of styles.
[0026] After step S120 is performed for all leaf nodes, the structure division unit 112 generates a converted document for the target document (hereinafter referred to as the "converted document") by converting the extracted substructures for each leaf node into a single text document, and stores the converted document in the converted document storage unit 121 (S130). Converting a substructure into text means restoring the substructure to an HTML document. However, in the text conversion, each tag may be deleted rather than restored as is. In this case, the converted document becomes text data that does not include metacharacters. Alternatively, each tag may be converted into a pseudoword that represents structural information, such as "@@@@." In this case, the converted document becomes text data in which each tag is converted into a common pseudoword. Furthermore, each tag may be reduced to a predetermined character string indicating the existence of a tag boundary. Such reduction will be described in detail in the second embodiment. Hereinafter, pseudowords and reduced character strings are also included in the concept of metacharacters. The above text conversion may be performed after tags that do not contribute to the hierarchical structure (such as line break tags, font tags, and span tags) have been removed.
[0027] After loop processing L1 is executed for all structured documents (HTML documents) included in the set of structured documents in the training data, the training unit 12 executes a training process for the machine reading comprehension model using the set of question and answer pairs in the training data and the set of converted documents as inputs to the machine reading comprehension model, and stores the values of the learning parameters of the reading comprehension model obtained as a result of the training in the training parameter storage unit 122 (S140). The machine reading comprehension model may be trained using a known method. For example, multi-task training may be performed, as disclosed in Non-Patent Document 1, which minimizes the combined results of the loss in the information retrieval task and the loss in the machine reading comprehension task. However, if a metacharacter string is included in the converted document, the metacharacter string may be treated as a single word in the training process.
[0028] However, if the converted document contains a metacharacter string, information (annotation) indicating correct answer information (for machine reading comprehension, the location of the answer to the question (the range of the answer) for each question included in the learning data) is added to each converted document stored in the converted document storage unit 121. As a result, the converted document with the annotation added is input to the learning unit 12. That is, the learning unit 12 performs a learning process using the converted document with the annotation added as input. This can promote learning by the machine reading comprehension model how to read metacharacter strings (HTML tags) that indicate a hierarchical structure in a structured document. Note that the range of correct answer information indicated by the annotation may be, for example, a range delimited by the metacharacter string (between a start tag and an end tag), a certain content character string, or a part of a certain content character string. Furthermore, the correct answer information does not have to be added in the form of an annotation. For example, correct answer information corresponding to the content of the converted document may be input to the learning unit 12 separately from the converted document. Here, "correct answer information corresponding to the content of the converted document" refers to a string indicating the answer in the case of question answering, to a correct summary created from the converted document in the case of document summarization, and to the classification results of each converted document in the case of document classification (if the input document is divided into multiple converted documents based on a tree structure, the summary and classification destination may differ for each converted document).
[0029] Next, the execution of a task (machine reading comprehension) will be described. Fig. 7 is a diagram showing an example of the functional configuration of the structured document processing device 10 in the first embodiment when executing a task. In Fig. 7, the same parts as in Fig. 3 are given the same reference numerals, and their description will be omitted.
[0030] 7, the structured document processing device 10 has a reading unit 13 instead of the learning unit 12. The reading unit 13 is realized by processing that one or more programs installed in the structured document processing device 10 cause the CPU 104 to execute.
[0031] The reading unit 13 generates a trained machine reading comprehension model by setting the learning parameters stored in the learning parameter storage unit 122 into the machine reading comprehension model, and inputs a question and a group of candidate documents containing an answer to the question to the trained machine reading comprehension model. The group of candidate documents containing an answer to the question refers to a set of converted documents generated by the structure conversion unit 11 for the set of structured documents provided as input. The machine reading comprehension model extracts an answer to the question from the set of converted documents and outputs the extracted answer. By using the converted documents as input to the machine reading comprehension model, the accuracy of answers to questions about what is written in the structured documents can be improved compared to when the structured documents are input directly to the machine reading comprehension model.
[0032] For example, when an HTML document as shown in Figure 8 is input, in response to the question "If I add capacity daily, until what time can I use it?", the reading comprehension unit 13 outputs the answer "Unlimited use until 23:59 on the same day" based on the descriptions p1, p2, and p3, etc.
[0033] As described above, according to the first embodiment, the hierarchical relationship between the meta strings and content strings that make up a structured document is maintained, and the structured document is divided into multiple converted documents so as not to include content strings that were in a parallel relationship. Therefore, converted documents are generated in a state where the structure of the structured document is reflected. This makes it easy to apply neural networks to structured documents.
[0034] Furthermore, while machine reading comprehension technology learns "how a text should be read" from the connections between sentences and the use of conjunctions, the metacharacter strings included in the converted document act as pseudo-words that represent the connections between sentences and words. Therefore, this embodiment is particularly effective for neural networks in machine reading comprehension technology.
[0035] In this embodiment, an example has been described in which a converted document is generated for each structured document included in a structured document collection (i.e., there is a one-to-one correspondence between a structured document and a converted document), but a converted document may also be generated for each substructure. In this case, one structured document will be divided into multiple converted documents.
[0036] On the other hand, in general machine reading comprehension technology (machine reading comprehension technology that does not perform multitask learning, as described in Non-Patent Document 1), processing is performed by serially connecting models for information retrieval (selecting answer extraction candidates from a set of documents) and machine reading comprehension (finding an answer from a document). Therefore, when one structured document is divided into multiple converted documents (i.e., when there is a one-to-many correspondence between the structured document and the converted document), there is a higher possibility that a document containing the correct answer will be omitted from the answer extraction candidates at the time of information retrieval compared to when there is a one-to-one correspondence between the structured document and the converted document, or when an unstructured document is used as input.
[0037] However, when applied to a machine reading comprehension model that simultaneously learns information retrieval and machine reading comprehension (multi-task learning), multi-task learning of information retrieval and machine reading comprehension can reduce the possibility that a converted document containing the correct answer will be omitted from the answer extraction candidates, even if there is a one-to-many correspondence between a structured document and a converted document.
[0038] Next, a second embodiment will be described. In the second embodiment, differences from the first embodiment will be described. Points not specifically mentioned in the second embodiment may be the same as those in the first embodiment. In the first embodiment, the structure of a structured document mainly refers to a hierarchical structure, but in the second embodiment, the structure of a structured document refers to additional information (e.g., tree structure, table structure, emphasis structure, link structure, etc.) to content strings indicated by meta strings or the like. That is, for convenience, a hierarchical structure will be described below as an example, but the second embodiment may also be applied to structures other than the hierarchical structure.
[0039] Fig. 9 is a diagram showing an example of the functional configuration of the structured document processing device 10 in the second embodiment during learning. In Fig. 9, parts that are the same as or correspond to those in Fig. 3 are given the same reference numerals, and their description will be omitted as appropriate. As shown in Fig. 9, the structure conversion unit 11 in the second embodiment does not include a structure division unit 112, but does include an extraction unit 113, a combination unit 114, and a reduction unit 115. However, in the second embodiment, the structured document processing device 10 does not necessarily have to include the reduction unit 115.
[0040] 10 is a flowchart illustrating an example of a processing procedure executed by the structured document processing apparatus 10 according to the second embodiment when learning a machine reading comprehension model. In FIG. 10, the same steps as those in FIG. 4 are assigned the same step numbers, and their explanations will be omitted.
[0041] Following step S110, the extraction unit 113 refers to the structural information (structural information s1 in FIG. 5 ) analyzed by the structural analysis unit 111 for the target document, and extracts from the target document information related to the predetermined structure to be extracted, such as metastrings and content strings that contribute to the hierarchical structure of the target document (S135). In other words, the extraction unit 113 removes (deletes) structural information that does not have the predetermined structure to be extracted, such as metastrings that do not contribute to the hierarchical structure of the target document, from the target document. Metastrings that do not contribute to the hierarchical structure of the target document are metastrings that are not treated as nodes in the structural information s1. However, if the analysis result by the structural analysis unit 111 simply indicates the hierarchical and parallel relationships of metastrings (i.e., if metastrings that do not substantially contribute to the hierarchical structure are also treated as nodes), the extraction unit 113 removes (deletes) specific metastrings that do not contribute to the hierarchical structure (e.g., line break tags, font tags, span tags, etc.) from the target document.
[0042] Fig. 11 is a diagram showing an example of the extraction result by extraction unit 113. In Fig. 11, (1) is an example in which the extracted start tag, content character string, and end tag are output as the extraction result in their original format. (2) is an example in which a set of the start tag and content character string is output as the extraction result.
[0043] Next, the combining unit 114 combines the meta character string and the content character string extracted by the extracting unit 113 (S136).
[0044] Fig. 12 is a diagram showing an example of combining meta strings and content strings. The element group (a set of meta strings and their content strings) shown as [Input example] in Fig. 12 is an example of a portion of the target document output from the extraction unit 113. [Output example] is an example of the combining result for [Input example]. Six examples (a) to (f) are shown in Fig. 12.
[0045] (a) is an example in which all meta strings output from the extraction unit 113 are combined directly with content strings (in other words, an example in which no special processing is performed by the combining unit 114). (b) is an example in which only start tags are combined with content strings (an example in which end tags are omitted (removed)). (c) is an example in which only end tags are combined with content strings (an example in which start tags are omitted (removed)). (d) is an example in which end tags and start tags between consecutive content strings are combined with the content strings. (e) is an example in which only start tags between consecutive content strings are combined with the content strings. (f) is an example in which only end tags between consecutive content strings are combined with the content strings.
[0046] Any of the processes (a) to (f) may be adopted. Furthermore, when combining, the combining unit 114 may convert line feed codes and consecutive spaces contained in the target documents into a single space.
[0047] Next, the reduction unit 115 reduces all meta character strings of the target document output from the extraction unit 113 to a predetermined character string (for example, <tag>By converting each meta character string into a meta character string (boundary of the hierarchical structure) between content character strings, each meta character string is reduced to information that merely indicates that a meta character string (boundary of the hierarchical structure) exists between content character strings (S137).
[0048] FIG. 13 is a diagram showing an example of degeneration of meta character strings. In FIG. 13, (a') to (f') are shown as examples of the degeneration results for (a) to (f) shown in FIG. 12. In FIG. 13, each meta character string is <tag>An example is shown, which is converted to <tag>Any character string other than the above may be used as the degenerated character string.
[0049] In the second embodiment, the result of the meta character string being reduced by the reduction unit 115 is used as the converted document for the target document. However, step S137 is executed when the structured document processing device 10 has the reduction unit 115. When the structured document processing device 10 does not have the reduction unit 115, the document output from the combination unit 114 is used as the converted document for the target document.
[0050] When loop processing L1 is executed for all structured documents (HTML documents) included in the set of structured documents of the training data, learning unit 12 executes a learning process for the machine reading comprehension model using the set of question and answer pairs of the training data and the set of converted documents as inputs to the machine reading comprehension model, and stores the values of the learning parameters of the reading comprehension model obtained as the learning result in learning parameter memory unit 122 (S140).
[0051] In the second embodiment, if the structured document processing device 10 has the reduction unit 115, each metacharacter string is reduced to a common character string that indicates the existence of each metacharacter string. This can be expected to improve the efficiency of learning the machine reading comprehension model.
[0052] That is, HTML tags offer a high degree of freedom in tag usage and notation. This allows for a variety of HTML tag usages to express the same structure. Training a machine reading comprehension model to recognize generic HTML tag readings requires preparing a large number of HTML files written in various styles and notations, which is costly. Therefore, the second embodiment focuses on HTML tag boundaries. The second embodiment focuses only on a specific structure (such as a hierarchical structure) that is important for subsequent processing (machine reading in this embodiment), and converts the focused structural information accordingly. Information other than the focused structure may also be deleted. This is because understanding a hierarchical structure is not dependent on the meaning of HTML tags; rather, it is important to understand that there is a semantic connection between consecutive pieces of text enclosed by different tags. Therefore, in the second embodiment, instead of converting the HTML tags themselves into text, machine reading comprehension is applied to text in which the information contained in the HTML tags has been somewhat reduced, such as "information indicating whether or not an HTML tag boundary was present." This makes it possible to train a machine reading comprehension model that absorbs variations in HTML tag usage. This allows for robust machine-readability of HTML files with various styles. <h1> and< / h1> It's not a difference between start and end tags, but <h2> and< / h2> <h3>It means a difference in the type of tag.
[0053] In general, in natural language processing using neural networks, each word included in an input document is converted into an embedding vector. Here, embedding vectors for ordinary words (words used in natural language) often use a codebook created in advance using a large-scale corpus. However, such codebooks do not support embedding vectors corresponding to metastrings (including degenerated strings) that represent a hierarchical structure, as used in this embodiment.
[0054] Therefore, before training the machine reading comprehension model, appropriate initial values are set as embedding vectors corresponding to each meta character string, and these are updated when training the machine reading comprehension model. Alternatively, embedding vectors corresponding to meta character strings may be obtained using a set of converted structured documents in a manner similar to that used to create embedding vectors for general words. This also applies to the first embodiment.
[0055] Furthermore, information (annotations) indicating correct answer information (for machine reading comprehension, the location of the answer (range of answers) for each question included in the learning data) is added to each structured document included in the learning data. As a result, the converted document with the annotations added is input to the learning unit 12. That is, the learning unit 12 executes a learning process using the converted document with the annotations added as input. This makes it possible to learn "embedded vectors that represent the relationships between content strings" for meta strings that represent the tree structure of the structured document, thereby facilitating learning by the machine reading comprehension model of how to read meta strings in the structured document (converted document). The range of correct answer information indicated by the annotations may be the same as in the first embodiment.
[0056] The execution of tasks by the structured document processing device 10 may be the same as in the first embodiment. However, the processing procedure executed by the structure conversion unit 11 is as explained in Fig. 10. In the second embodiment, if the structured document processing device 10 has the reduction unit 115, a document in which each metacharacter string has been reduced is input to the machine reading comprehension model, so that even if the structured document contains unknown metacharacter strings, it can be expected that the degradation of task accuracy will be suppressed.
[0057] As described above, the second embodiment also makes it easy to apply a neural network to a structured document.
[0058] In the above, a hierarchical structure has been used as an example of the specified structure to be extracted, but the specified structure to be extracted may also include an emphasis structure indicated by font size or color specification, or a link structure indicated by anchor text.
[0059] Furthermore, in the second embodiment, an example has been given in which the extraction unit 113 removes metastrings that do not contribute to the hierarchical structure. However, metastrings and anchor texts related to emphasis of content strings, which are indicated by the font size, color specification, etc., may not be removed even if they do not contribute to the hierarchical structure. In this case, the degeneration unit 115 may distinguish the degeneration method depending on the type of structure, that is, metastrings that contribute to the hierarchical structure, metastrings that contribute to emphasis, and anchor text, rather than converting all metastrings into a common string. Specifically, the degeneration unit 115 may use different degenerated strings for metastrings that contribute to the hierarchical structure, metastrings that contribute to emphasis, and anchor text. In this case, a conversion table indicating the string after degeneration (conversion) for each metastring may be created in advance, and the degeneration unit 115 may refer to the conversion table to perform degeneration (conversion) of the metastring. Note that anchor text is, for example, "For ... Here This refers to the "here" part of "Please see here."
[0060] Also, in the above example, the tag string is a string that does not have meaning in natural language (for example, <tag>), the example has been described in which the tag string is reduced (converted) to "", "regarding", etc. However, the reduction unit 115 may also convert the tag string into a string that has meaning in natural language and expresses a hierarchical relationship (object or relation) (for example, "about", "regarding", etc.). By doing so, it is possible to eliminate the need for preparation of special training data and model training for the purpose of processing structured documents. Therefore, it is possible to execute tasks using a model that has been trained using unstructured documents as training data.
[0061] Furthermore, such conversion (conversion of tag strings to strings representing hierarchical relationships (objects or associations) (for example, "about", "regarding", etc.)) may be performed by the structure dividing unit 112 in the first embodiment.
[0062] Next, a third embodiment will be described. In the third embodiment, differences from the first or second embodiment will be described. Points not specifically mentioned in the third embodiment may be the same as those in the first or second embodiment.
[0063] Fig. 14 is a diagram showing an example of the functional configuration of the structured document processing device 10 during learning in the third embodiment. In Fig. 14, the same parts as or corresponding parts to Fig. 3 or Fig. 9 are given the same reference numerals, and their explanation will be omitted as appropriate. As shown in Fig. 14, the structure conversion unit 11 in the third embodiment has a configuration that combines the first and second embodiments.
[0064] 15 is a flowchart illustrating an example of a processing procedure executed by the structured document processing device 10 according to the third embodiment when learning a machine reading comprehension model. In FIG. 15, the same steps as those in FIG. 4 or FIG. 10 are assigned the same step numbers, and their explanations will be omitted as appropriate.
[0065] 15, steps S135 to S137 are executed following loop processing L2 and step S130. That is, the document output from structure division unit 112 (the converted document in the first embodiment) is input to extraction unit 113, step S135 and subsequent steps are executed, and the document output in step S137 is input to learning unit 12 as the converted document.
[0066] Therefore, according to the third embodiment, it is possible to obtain the same effects as those obtained in the first and second embodiments.
[0067] In the above embodiments, elements indicating tables (including matrices) included in a structured document (for example,
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079] If elements enclosed in tags (e.g., "[element]" and "tags") are processed in the same way as other elements, the correspondence between the rows and columns in the table and the values may be lost. Therefore, for tables, the structure dividing unit 112 or the reduction unit 115 may recognize that the table is a table and perform special conversion processing when converting the table to text. Figure 16 shows an example of table conversion. In Figure 16, (1) shows an example of a table contained in a structured document. (2) and (3) show examples of table conversion. (2) is an example in which each metacharacter string is reduced. (3) is an example in which the hierarchical relationship and other relationships (e.g., "and," "or," "above," "below," "parallel," etc.) of each metacharacter string are distinguished and converted. In both (2) and (3), each row expresses the price for each combination of column (plan) and row (service). As a result, it is expected that the machine reading comprehension model will learn answers to questions about the price for each combination of plan and service. The execution of tasks by the structured document processing device 10 may be the same as in the first embodiment. However, the processing procedure executed by the structure conversion unit 11 is as explained in FIG. 15. As mentioned above, according to the third embodiment, a structured document is divided into substructures and then metastring conversion is performed. As a result, when converting metastrings, metastrings in the same hierarchical structure do not exist in the tree representing the structure, and the meaning of the metastring becomes clear, so this configuration is considered to be the most effective among the three embodiments. Next, the results of an experiment conducted by the inventors of the present application on the first and third embodiments will be explained. The structured document used in this experiment was an operator's manual for a certain service, and the training data was as follows: number of htmls: 38 htmls / number of QA pairs: 22,129. Furthermore, the following two types of evaluation sets (question sets used when executing a task) were prepared. Evaluation set A: A group of questions created by people who understand machine reading comprehension technology (questions that are friendly to machine reading comprehension technology)Evaluation set B: A group of questions created by people who have never used machine reading comprehension technology (questions that are more natural to people)If the correct answer was included in the top five answers obtained by machine reading comprehension, it was considered correct, and even if it was not a perfect match, it was considered correct if there was a partial match.The results of this experiment are shown in Figure 17.FIG. 17 shows experimental results (accuracy rates) for evaluation sets A and B under three conditions, which are combinations of the "division unit" and the presence or absence of "metastring degeneration." Specifically, the first condition (hereinafter referred to as "condition 1") is a condition in which the "division unit" is a paragraph unit (e.g., a heading unit in an HTML document) and "metastring degeneration" is not present. The second condition (hereinafter referred to as "condition 2") is a condition in which the "division unit" is a leaf node unit and "metastring degeneration" is not present. The third condition (hereinafter referred to as "condition 3") is a condition in which the "division unit" is a leaf node unit and "metastring degeneration" is present. Here, the "division unit" being a leaf node unit means that the processing by the structure division unit 112 described in the first embodiment is applied. Furthermore, the "metastring degeneration" means whether the processing by the degeneration unit 115 described in the second embodiment is applied. Therefore, Condition 1 corresponds to a condition where none of the above embodiments are applied, Condition 2 corresponds to a condition where the first embodiment is applied, and Condition 3 corresponds to a condition where the third embodiment is applied. FIG. 17 shows that for all evaluation sets, Condition 2 has a higher accuracy rate than Condition 1, and Condition 3 does not have a higher accuracy rate than Condition 2. In other words, the effectiveness of this embodiment has been confirmed experimentally. The structured document processing device 10 of each of the above embodiments may be realized using different computers for learning and for executing tasks. In each of the above embodiments, the structure analysis unit 111 is an example of an analysis unit. The structure division unit 112 is an example of a generation unit. The interpretation unit 13 is an example of a processing unit. The reduction unit 115 is an example of a conversion unit. While the embodiments of the present invention have been described above in detail, the present invention is not limited to such specific embodiments, and various modifications and variations are possible within the scope of the gist of the present invention as defined in the claims. [Explanation of symbols] 10 Structured document processing device 11 Structure conversion unit 12 Learning unit 13 Reading unit 100 Drive device 101 Recording medium 102 Auxiliary storage device 103 Memory device 104 CPU 105 Interface device 111 Structure analysis unit 112 Structure division unit 113 Extraction unit 114 Combination unit 115 Degeneration unit 121 Converted document memory unit 122 Learning parameter memory unit B Bus. < / tag> < / h3> < / tag> < / tag> < / tag>
Claims
1. an analysis unit that analyzes a structured document and acquires information indicating a tree structure in which character strings that constitute the structured document correspond to nodes; a generation unit that identifies a path from each leaf node in the tree structure to a root node, and generates a converted document including text data in which the character strings related to each node from the root node to the leaf node of each path are concatenated; A structured document processing device comprising:
2. the generation unit generates the converted document as data that can be read by a neural network.
2. The structured document processing apparatus according to claim 1, wherein:
3. a conversion unit that converts a metacharacter string representing the tree structure, among character strings included in the converted document generated by the generation unit, into a common character string that indicates the existence of the metacharacter string; 3. The structured document processing device according to claim 1, wherein:
4. an analysis unit that analyzes a structured document and acquires information indicating a tree structure in which character strings that constitute the structured document correspond to nodes; a generation unit that identifies a path from each leaf node in the tree structure to a root node, and generates a converted document including text data in which the character strings related to each node from the root node to the leaf node of each path are concatenated; and the character strings constituting the structured document include meta character strings and content character strings; A structured document processing device characterized by:
5. an analysis procedure for analyzing a structured document and acquiring information indicating a tree structure in which character strings constituting the structured document correspond to nodes; a generation procedure for identifying a path from each leaf node in the tree structure to a root node, and generating a converted document including text data in which character strings related to each node from the root node to the leaf node of each path are concatenated; A structured document processing method characterized in that the above is executed by a computer.
6. 5. A program for causing a computer to function as the structured document processing device according to claim 1.
Citation Information
Patent Citations
Text extraction method, text extraction device and text extraction program
JP2012027852A