Document classification method based on combination of semantic analysis and graph neural network
Patent Information
- Application Number
- CN202610877346.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-17
- Publication Date
- 2026-10-30
AI Technical Summary
[0005]本申请实施例提供了一种基于语义分析和图神经网络相结合的文档分类方法,旨在解决相关技术中企业内部的文档分类方式难以捕捉文档深层特征导致分类结果不准确的技术问题
[0016]以上技术方案,针对相关技术中企业内部的文档分类方式难以捕捉文档深层特征导致分类结果不准确的技术问题,第一步先提取文档表层信息,第二步再挖掘文档的深层语义特征,第三步再基于深层语义特征构建实体关系图谱,并生成表征文档全局语义的向量,最终利用该向量和分类模型完成对文档的自动分类。由此,通过三步特征挖掘将待分类文档的最深层语义特征进行了深度挖掘,由这一最深层语义特征作为分类依据,实现了对待分类文档从表层内容到深层逻辑的逐层解析,从而能够更全面、更准确地捕捉待分类文档与业务类型的深度关联。由此,可提升多种格式的复杂文档的分类准确性,避免了相关技术中的分类过程因依赖文档表层特征进行分类而导致的分类不准确缺陷,可提升企业办公效率。
Smart Images

Figure CN123012166A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of document management technology, and in particular to a document classification method based on a combination of semantic analysis and graph neural networks. Background Technology
[0002] As enterprises become more information-based, the number and types of documents involved in their office work have increased dramatically, which has led to a corresponding increase in the need for document classification.
[0003] In related technologies, documents are generally classified into business types based on their basic attributes, keywords, and other surface-level content. However, this approach often only captures the textual information on the surface of the document and fails to effectively identify the deeper features related to the business classification within the document content, resulting in inaccurate document classification results.
[0004] Therefore, improving the accuracy of document classification has become an urgent technical problem to be solved. Summary of the Invention
[0005] This application provides a document classification method based on a combination of semantic analysis and graph neural networks, aiming to solve the technical problem in related technologies where internal document classification methods within enterprises struggle to capture deep document features, leading to inaccurate classification results.
[0006] In a first aspect, embodiments of this application provide a document classification method based on a combination of semantic analysis and graph neural networks, including: The basic information of the documents to be classified is extracted using a predetermined information extraction method. The basic information of the documents is used to reflect the display format and display content of the documents to be classified. Based on the document basic information, the document mining information of the document to be classified is determined, wherein the document mining information is the deep document features reflected by the display format and the display content; Based on the predetermined semantic analysis model and the document mining information, the entity set of the document to be classified is identified; A graph neural network is used to construct an entity relationship network for the entity set. Based on the entity relationship network, the document graph vector of the document to be classified is determined; Using the document graph vector as input information for a predetermined business classification model, the business type to which the document to be classified belongs is output through the business classification model, wherein the business classification model is used to reflect the relationship between the document graph vector of the document and the business type to which the document belongs.
[0007] Optionally, in one embodiment of this application, the step of extracting the basic document information of the document to be classified through a predetermined information extraction method includes: Use the PdfFileReader class of the PyPDF2 library to read PDF files and extract the document content, number of pages, and document title of the PDF file; Use the Document class from the python-docx library to read Word files and extract the text content, paragraph formatting, and style information from the Word files; This paper uses the pandas library and the openpyxl library to read an Excel file and extract the table data, worksheet names and cell formats.
[0008] In one embodiment of this application, optionally, the document mining information includes: word segmentation, sentence structure, document content type, and text hierarchical relationships. Then, determining the document mining information of the document to be classified based on the basic document information includes: Lexical and syntactic analysis processes are performed on the basic information of the document to obtain word segmentation, sentence structure, and document content type. Based on the format information within the basic document information, the text hierarchical relationship of the document to be classified is determined.
[0009] In one embodiment of this application, optionally, identifying the entity set of the document to be classified based on a predetermined semantic analysis model and the document mining information includes: The word segmentation, sentence structure, document content type, and text hierarchy relationship in the document mining information are provided as input information to the semantic analysis model, and the self-attention mechanism in the semantic analysis model is used to perform contextual semantic understanding on the input information. Based on the results of the contextual semantic understanding, the entities contained in the document to be classified are identified to form the entity set, wherein the entity set includes: people, objects, time, events, and task objectives.
[0010] Optionally, in one embodiment of this application, constructing an entity relationship network for the entity set using a graph neural network includes: Using each entity in the entity set as a node, and using at least one of the semantic association, temporal order and causal relationship between entities as an edge, an initial entity relationship graph is constructed. The initial entity relationship graph is input into the pre-trained graph neural network, and the nodes and edges in the initial entity relationship graph are iteratively updated by the graph neural network to a specified number of times to obtain the entity relationship network.
[0011] In one embodiment of this application, optionally, determining the document graph vector of the document to be classified based on the entity relationship network includes: The feature vectors of all nodes in the entity relationship network are input into the graph pooling layer of the graph neural network. The feature vectors of all nodes are downsampled by the graph pooling layer and then aggregated to generate the document graph vector.
[0012] In one embodiment of this application, optionally, determining the document graph vector of the document to be classified based on the entity relationship network includes: Based on the attention mechanism and the feature vectors of all nodes in the entity relationship network, the global contribution weight of each node to the document to be classified is calculated. Based on the global contribution weight, the feature vectors of all nodes are weighted and summed to generate the document graph vector.
[0013] In one embodiment of this application, optionally, determining the document graph vector of the document to be classified based on the entity relationship network includes: The feature vectors of all nodes in the entity relationship network are aggregated to generate an initial graph vector; The multidimensional metadata is concatenated with the initial graph vector according to the vector dimension to generate the document graph vector, wherein the multidimensional metadata includes the document metadata of the document to be classified and the system metadata of the system in which the document to be classified is located.
[0014] In a second aspect, embodiments of this application provide a computer device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in the first aspect above.
[0015] Thirdly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions for performing the method described in the first aspect above.
[0016] The above technical solution addresses the problem of inaccurate classification results caused by the difficulty in capturing deep document features in internal document classification methods used in related technologies. The solution first extracts surface-level information from the document; second, it mines the document's deep semantic features; and third, it constructs an entity relationship graph based on these deep semantic features and generates a vector representing the document's global semantics. Finally, it uses this vector and a classification model to automatically classify the document. Thus, through three steps of feature mining, the deepest semantic features of the document to be classified are deeply mined. Using these deepest semantic features as the classification basis, the solution achieves a layer-by-layer analysis of the document from its surface content to its deep logic, thereby capturing the deep association between the document and its business type more comprehensively and accurately. This improves the classification accuracy of complex documents in various formats, avoiding the inaccuracies caused by relying on surface-level features in related technologies, and ultimately improving enterprise office efficiency. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart of a document classification method based on a combination of semantic analysis and graph neural networks according to an embodiment of this application is shown; Figure 2 A flowchart of a document classification method based on a combination of semantic analysis and graph neural networks according to another embodiment of this application is shown; Figure 3 A block diagram of a computer device according to one embodiment of this application is shown; Figure 4 A block diagram of a computer device according to another embodiment of this application is shown. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Figure 1 A flowchart of a document classification method based on a combination of semantic analysis and graph neural networks according to an embodiment of this application is shown.
[0021] like Figure 1 As shown, one embodiment of this application presents a document classification method based on a combination of semantic analysis and graph neural networks, which includes: Step 102: Extract the basic document information of the document to be classified using a predetermined information extraction method. The basic document information is used to reflect the display format and content of the document to be classified.
[0022] The predetermined information extraction method is the specified information extraction method corresponding to the document format type of the document to be classified. The basic document information is the surface information of the document to be classified that reflects its display format and content, such as document content, number of pages, document title, paragraph format and style information, and other intuitive content displayed by the document. Extracting the basic document information of the document to be classified is to obtain the basis for classifying the document to be classified, which serves as the data foundation for subsequent semantic analysis and classification.
[0023] Optionally, if the document to be categorized is a PDF file, the PdfFileReader class from the PyPDF2 library is used to read the PDF file and extract its document content, number of pages, and document title. PyPDF2 is a feature-rich PDF file processing library in Python, and the PdfFileReader class is its core component, used to open and read PDF files. Thus, the document content, number of pages, and document title can be extracted from the PDF file, serving as the basis for categorizing the PDF file.
[0024] Optionally, if the document to be categorized is a Word file, the Document class of the python-docx library is used to read the Word file and extract its text content, paragraph formatting, and style information. python-docx is a commonly used Python library for reading and writing Word documents. The Document class is the core entry point of python-docx, used to open and manipulate Word documents to access their content and formatting. Therefore, the text content, paragraph formatting, and style information of a Word document can be extracted as a basis for categorizing the document.
[0025] Optionally, if the document to be classified is an Excel file, the pandas and openpyxl libraries can be used together to read the Excel file and extract the table data, worksheet names, and cell formats. Pandas is a Python data analysis and manipulation library, while openpyxl is a library for reading and writing Excel files. When working together, openpyxl handles the underlying file reading, writing, and format acquisition, while pandas converts the content read by openpyxl into a DataFrame structure suitable for analysis. Thus, the table data, worksheet names, and cell formats of the Excel file can be read as DataFrame structure information, which can then be used as the basis for classifying the Excel file.
[0026] Step 104: Based on the document basic information, determine the document mining information of the document to be classified.
[0027] The document mining information refers to the deep document features reflected in the display format and content. It can be understood that basic document information is surface-level information reflecting the document's display format and content. Classifying files solely based on basic document information is often inaccurate because the classification criteria are superficial and lack the deep features of the documents to be classified. Therefore, document mining information reflecting the deep features of the documents can be further mined from the basic document information, serving as a more accurate classification criterion for reflecting document characteristics. In other words, by determining the document mining information of the documents to be classified, a more reliable classification basis can be obtained, thereby improving the accuracy of document classification.
[0028] Step 106: Based on the predetermined semantic analysis model and the document mining information, identify the entity set of the document to be classified.
[0029] Semantic analysis models are used to perform deep semantic analysis on mined document information, thereby accurately identifying key entities such as people, organizations, and time within the document's information. The semantic analysis model can be any pre-trained language model that meets the specific classification requirements, such as the Transformer model, BERT model, RoBERTa model, or GPT series models. The entities identified by the semantic analysis model in the document to be classified are objects that express specific concepts in the document, including but not limited to people, objects, time, events, and task goals—any specific concepts that may appear in the document. These entities serve as the foundational nodes for subsequently building an entity relationship network and embody the core semantic information of the document to be classified.
[0030] Step 108: Construct an entity relationship network for the entity set using a graph neural network.
[0031] Graph neural networks are used to learn complex relationships between different entities in an entity set. They can be any model capable of recognizing relationships between entities, such as graph convolutional networks, graph attention networks, or graph isomorphic networks. The entity relationship network constructed by the graph neural network for the entity set is a knowledge graph consisting of entities as nodes and semantic relationships between entities as edges. It quantifies the semantic relationships represented by deep features in the document to be classified into an intuitive structured graph, providing a reliable basis for calculating deep logical connections between entities.
[0032] Step 110: Based on the entity relationship network, determine the document graph vector of the document to be classified.
[0033] Document graph vectors derived from entity relationship networks are vectorized representations of these networks, reflecting their overall semantic features and serving as the final basis for classifying documents. Compared to surface-level basic document information and intermediate-level document mining information, they provide a more comprehensive and in-depth characterization of the overall semantics of the documents to be classified. Using these vectors as the final basis for classifying documents can effectively improve the accuracy of document classification.
[0034] Step 112: Using the document graph vector as input information for a predetermined business classification model, the business type to which the document to be classified belongs is output through the business classification model.
[0035] The business classification model reflects the relationship between the document graph vector of a document and the business type to which the document belongs. In other words, the business classification model learns and maps the complex relationship between document features and business types, thereby determining the business type of a document based on this complex relationship and the document graph vector representing the document features. Specifically, the business classification model can be any machine learning classifier with classification capabilities, such as a fully connected neural network, support vector machine, or random forest.
[0036] Furthermore, business types can be defined according to specific application scenarios. For example, in the financial field, business types may include loan contracts, wealth management agreements, risk assessment reports, audit reports, compliance documents, etc.; in the corporate office field, business types may include personnel files, purchase orders, project plans, meeting minutes, financial statements, etc.; in the legal field, business types may include litigation documents, agency contracts, legal provisions, judgments, etc.
[0037] Finally, the document graph vector is input into the predetermined business classification model to obtain the business type to which the document to be classified belongs. While realizing the automation of document classification, the accuracy of automatic document classification can be enhanced by three document feature mining operations with gradually increasing depth, providing more convenience for enterprise office work.
[0038] The above technical solution first extracts surface-level information from the document, then mines its deep semantic features, and finally constructs an entity relationship graph based on these features, generating a vector representing the document's global semantics. This vector, along with a classification model, is then used to automatically classify the document. Thus, this three-step feature mining process deeply explores the deepest semantic features of the document to be classified. Using these deepest semantic features as the classification basis, it achieves a layer-by-layer analysis of the document from its surface content to its deep logic, enabling a more comprehensive and accurate capture of the deep association between the document and its business type. This improves the classification accuracy of complex documents in various formats, avoiding the inaccuracies caused by relying on surface-level features in other technologies, thereby enhancing enterprise office efficiency.
[0039] Figure 2 A flowchart of a document classification method based on a combination of semantic analysis and graph neural networks according to another embodiment of this application is shown.
[0040] like Figure 2 As shown, a document classification method based on a combination of semantic analysis and graph neural networks according to another embodiment of this application includes: Step 202: Extract the basic document information of the document to be classified using a predetermined information extraction method. The basic document information is used to reflect the display format and content of the document to be classified.
[0041] The predetermined information extraction method is the specified information extraction method corresponding to the document format type of the document to be classified. The basic document information is the surface information of the document to be classified that reflects its display format and content, such as document content, number of pages, document title, paragraph format and style information, and other intuitive content displayed by the document. Extracting the basic document information of the document to be classified is to obtain the basis for classifying the document to be classified, which serves as the data foundation for subsequent semantic analysis and classification.
[0042] Optionally, if the document to be categorized is a PDF file, the PdfFileReader class from the PyPDF2 library is used to read the PDF file and extract its document content, number of pages, and document title. PyPDF2 is a feature-rich PDF file processing library in Python, and the PdfFileReader class is its core component, used to open and read PDF files. Thus, the document content, number of pages, and document title can be extracted from the PDF file, serving as the basis for categorizing the PDF file.
[0043] Optionally, if the document to be categorized is a Word file, the Document class of the python-docx library is used to read the Word file and extract its text content, paragraph formatting, and style information. python-docx is a commonly used Python library for reading and writing Word documents. The Document class is the core entry point of python-docx, used to open and manipulate Word documents to access their content and formatting. Therefore, the text content, paragraph formatting, and style information of a Word document can be extracted as a basis for categorizing the document.
[0044] Optionally, if the document to be classified is an Excel file, the pandas and openpyxl libraries can be used together to read the Excel file and extract the table data, worksheet names, and cell formats. Pandas is a Python data analysis and manipulation library, while openpyxl is a library for reading and writing Excel files. When working together, openpyxl handles the underlying file reading, writing, and format acquisition, while pandas converts the content read by openpyxl into a DataFrame structure suitable for analysis. Thus, the table data, worksheet names, and cell formats of the Excel file can be read as DataFrame structure information, which can then be used as the basis for classifying the Excel file.
[0045] Step 204: Perform lexical and syntactic analysis on the basic document information to obtain word segmentation, sentence structure, and document content type. Based on the format information in the basic document information, determine the text hierarchy of the document to be classified.
[0046] Lexical analysis can segment continuous text into independent words through word segmentation, obtaining the basic vocabulary sequence of the document to be classified. Syntactic analysis, on the other hand, analyzes the grammatical relationships between sentence components to obtain a syntactic tree reflecting the sentence's grammatical structure, which serves as the sentence structure.
[0047] Based on this, preliminary semantic analysis can be performed using the basic vocabulary sequence and sentence structure of the document to be classified, thus determining the document content type. Simultaneously, the basic vocabulary sequence and sentence structure of the document can be combined with formatting information such as heading levels and paragraph structure to determine the textual hierarchy. The textual hierarchy reflects the logical structure of the document's content, and this logical structure, to a certain extent, reflects the distribution of important information within the document. In short, the textual hierarchy provides a basis for the semantic analysis model to understand the document structure and offers reference evidence for understanding the distribution of important information in the document, thereby facilitating more accurate semantic analysis results.
[0048] Step 206: The word segmentation, sentence structure, document content type, and text hierarchy relationship in the document mining information are provided as input information to the semantic analysis model. The self-attention mechanism in the semantic analysis model is used to perform contextual semantic understanding on the input information.
[0049] The input information includes word segmentation, sentence structure, document content type, and textual hierarchical relationships from document mining information. In other words, the input information reflects the deep features of the document to be classified across multiple dimensions, including vocabulary, grammar, theme, and structure. Based on this, the semantic analysis model learns and strengthens the correlations between deep features of different dimensions within the input information through a self-attention mechanism. The result of its contextual semantic understanding of the input information is a feature representation that reflects the core semantics of the document to be classified at a deeper level, after strengthening the correlations between deep features of different dimensions. This achieves a deeper feature re-mining of document mining information, contributing to obtaining more accurate and reliable document classification criteria.
[0050] Step 208: Based on the result of the contextual semantic understanding, identify the entities contained in the document to be classified to form the entity set, wherein the entity set includes: people, objects, time, events, and task objectives.
[0051] The results of contextual semantic understanding imply the correlation between deep features of different dimensions expressed in the document to be classified. Based on the results of this contextual semantic understanding, the semantic analysis model can accurately locate specific semantic roles, or entities, in the document to be classified that are related to deep features of different dimensions.
[0052] Optionally, in the financial sector, entities may include personnel such as account managers, objects such as collateral, time such as loan disbursement dates, matters such as risk assessments, and tasks and objectives such as annualized rate of return targets.
[0053] Optionally, in the corporate office domain, entities may include personnel such as department heads, objects such as office equipment, time such as project deadlines, matters such as budget approvals, and tasks and objectives such as quarterly sales targets.
[0054] Step 210: Using each entity in the entity set as a node, and using at least one of the semantic association, temporal order, and causal relationship between entities as edges, construct an initial entity relationship graph.
[0055] Semantic association refers to the logical connection between entities in terms of concepts or professional domains, temporal order reflects the chronological order of entities, and causal relationship refers to the mutual influence and correlation between entities. Using at least one of the semantic association, temporal order, and causal relationship as edges, an initial entity relationship graph is constructed. This is equivalent to linking discrete entities in a document using these real-world relationship types, forming a structured graph representation. In short, the initial entity relationship graph is a relational representation of the deep features of the document to be classified.
[0056] Step 212: Input the initial entity relationship graph into the pre-trained graph neural network, and iterate and update the nodes and edges in the initial entity relationship graph through the graph neural network to a specified number of times to obtain the entity relationship network.
[0057] During the iterative update of the initial entity relationship graph, the feature representations of nodes and edges are continuously aggregated and refined through multi-layer message passing of the graph neural network. It can be said that compared with the initial entity relationship graph, the iterative learning of the entity relationship network integrates the deep semantic associations of the documents to be classified, thus more accurately representing the complex relationships between entities, and the deep semantics of the documents to be classified expressed are more accurate.
[0058] Step 214: Based on the entity relationship network, determine the document graph vector of the document to be classified.
[0059] Document graph vectors derived from entity relationship networks are vectorized representations of these networks, reflecting their overall semantic features and serving as the final basis for classifying documents. Compared to surface-level basic document information and intermediate-level document mining information, they provide a more comprehensive and in-depth characterization of the overall semantics of the documents to be classified. Using these vectors as the final basis for classifying documents can effectively improve the accuracy of document classification.
[0060] In one possible design, the feature vectors of all nodes in the entity relationship network can be input into the graph pooling layer of the graph neural network. The feature vectors of all nodes are downsampled by the graph pooling layer and then aggregated to generate the document graph vector.
[0061] The feature vector of a node reflects the deep semantics of the entity corresponding to that node after iterative updates by the graph neural network, as well as the distribution of inter-entity relationships within the entity relationship network. The graph pooling layer of the graph neural network compresses the feature vectors of all nodes in the entity relationship network into a fixed-dimensional global vector representation that characterizes the entire network. The resulting document graph vector effectively integrates and compresses the deep semantics and inter-entity relationship distribution of all nodes after iterative updates by the graph neural network, providing a more comprehensive and in-depth expression of the semantic features of the document to be classified, thus improving the reliability of the classification criteria.
[0062] In another possible design, the global contribution weight of each node to the document to be classified can be calculated based on the attention mechanism and the feature vectors of all nodes in the entity relationship network; based on the global contribution weight, the feature vectors of all nodes are weighted and summed to generate the document graph vector.
[0063] The global contribution weight of each node to the document to be classified reflects the importance of the entity represented by that node in the overall semantics of the document. By weighted summing of the feature vectors of each node based on the global contribution weight of each node, the deep semantics and the distribution of relationships between entities reflected after the iterative update of all nodes through the graph neural network can be fully integrated and compressed. This fully considers the different degrees of influence of different nodes on semantics, so that the final generated document graph vector can not only more comprehensively and deeply express the semantic features of the document to be classified, but also adjust the focus of semantic feature expression based on the importance of different nodes in the overall semantics when expressing this semantic feature, thus obtaining a more reliable classification basis.
[0064] In another possible design, the feature vectors of all nodes in the entity relationship network are aggregated to generate an initial graph vector; the multidimensional metadata is concatenated with the initial graph vector according to the vector dimensions to generate the document graph vector, wherein the multidimensional metadata includes the document metadata of the document to be classified and the system metadata of the system in which the document to be classified is located.
[0065] The initial graph vector reflects the overall semantic features of the entity relationship network. By concatenating the multidimensional metadata with the initial graph vector, the inherent attributes of the document to be classified and the system environment are taken as factors that affect its semantic expression and integrated into its final overall semantic feature expression. This allows the final classification criteria to combine the semantics of the document to be classified, its own metadata attributes, and the system environment to form a holistic expression, resulting in a more accurate classification criteria that fits the actual system environment.
[0066] Step 216: Using the document graph vector as input information for a predetermined business classification model, the business type to which the document to be classified belongs is output through the business classification model, wherein the business classification model is used to reflect the relationship between the document graph vector of the document and the business type to which the document belongs.
[0067] The business classification model reflects the relationship between the document graph vector of a document and the business type to which the document belongs. In other words, the business classification model learns and maps the complex relationship between document features and business types, thereby determining the business type of a document based on this complex relationship and the document graph vector representing the document features. Specifically, the business classification model can be any machine learning classifier with classification capabilities, such as a fully connected neural network, support vector machine, or random forest.
[0068] Furthermore, business types can be defined according to specific application scenarios. For example, in the financial field, business types may include loan contracts, wealth management agreements, risk assessment reports, audit reports, compliance documents, etc.; in the corporate office field, business types may include personnel files, purchase orders, project plans, meeting minutes, financial statements, etc.; in the legal field, business types may include litigation documents, agency contracts, legal provisions, judgments, etc.
[0069] Finally, the document graph vector is input into the predetermined business classification model to obtain the business type to which the document to be classified belongs. While realizing the automation of document classification, the accuracy of automatic document classification can be enhanced by three document feature mining operations with gradually increasing depth, providing more convenience for enterprise office work.
[0070] The above technical solution first extracts surface information from documents, then progressively performs lexical and syntactic analysis, semantic understanding, entity recognition, relational network construction, and feature vectorization. Finally, it achieves accurate classification through a classification model. This approach layer-by-layer mining and integration of the deep performance features of the documents to be classified across multiple dimensions, including format, content, semantics, structure, and even their own and system environments, avoids the inaccuracies caused by relying on surface features in related technologies. It can improve the classification accuracy of complex documents in various formats and enhance enterprise office efficiency.
[0071] In another embodiment, this application provides a computer device, which may be a server, and its internal structure diagram may be as follows. Figure 3As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it can implement the methods described in any of the above embodiments.
[0072] In one embodiment, this application also provides a computer device, which can be a client, and its internal structure diagram can be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it can implement the methods described in any of the above embodiments.
[0073] Any of the computer devices described in the embodiments of this application exist in various forms, including but not limited to: (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and primarily aim to provide voice and data communication. These terminals include smartphones, multimedia phones, feature phones, and low-end phones.
[0074] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, possessing computing and processing capabilities, and generally also have mobile internet access features. These terminals include PDAs, MIDs, and UMPCs, etc.
[0075] (3) Portable entertainment devices: These devices can display and play multimedia content. This category includes: audio and video players, handheld game consoles, e-books, as well as smart toys, wearable devices, and portable car navigation devices.
[0076] (4) Server: A device that provides computing services. The components of a server include a processor, hard disk, memory, system bus, etc. Servers are similar to general computer architectures, but because they need to provide highly reliable services, they have higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0077] (5) Other electronic devices with data interaction functions.
[0078] In addition, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which are used to perform the following steps: extracting basic document information of a document to be classified through a predetermined information extraction method, wherein the basic document information is used to reflect the display format and display content of the document to be classified; determining document mining information of the document to be classified based on the basic document information, wherein the document mining information is the deep document features reflected by the display format and the display content; identifying the entity set of the document to be classified based on a predetermined semantic analysis model and the document mining information; constructing an entity relationship network for the entity set through a graph neural network; determining the document graph vector of the document to be classified based on the entity relationship network; using the document graph vector as input information of a predetermined business classification model, and outputting the business type to which the document to be classified belongs through the business classification model, wherein the business classification model is used to reflect the association between the document graph vector of the document and the business type to which the document belongs.
[0079] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0080] The technical solution of this application has been described in detail above with reference to the accompanying drawings. This technical solution utilizes a three-step feature mining process to deeply mine the deepest semantic features of the document to be classified. Using these deepest semantic features as the classification basis, it achieves a layer-by-layer analysis of the document from its surface content to its deep logic, thereby enabling a more comprehensive and accurate capture of the deep correlation between the document and its business type. This improves the classification accuracy of complex documents in various formats, avoiding the inaccuracies caused by relying on surface-level document features in related technologies, and ultimately enhancing enterprise office efficiency.
[0081] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0082] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0083] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0084] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0085] 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. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0086] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A document classification method based on a combination of semantic analysis and graph neural networks, characterized in that, include: The basic information of the documents to be classified is extracted using a predetermined information extraction method. The basic information of the documents is used to reflect the display format and display content of the documents to be classified. Based on the document basic information, the document mining information of the document to be classified is determined, wherein the document mining information is the deep document features reflected by the display format and the display content; Based on the predetermined semantic analysis model and the document mining information, the entity set of the document to be classified is identified; A graph neural network is used to construct an entity relationship network for the entity set. Based on the entity relationship network, the document graph vector of the document to be classified is determined; Using the document graph vector as input information for a predetermined business classification model, the business type to which the document to be classified belongs is output through the business classification model, wherein the business classification model is used to reflect the relationship between the document graph vector of the document and the business type to which the document belongs.
2. The method according to claim 1, characterized in that, The step of extracting basic document information of the documents to be classified using a predetermined information extraction method includes: Use the PdfFileReader class of the PyPDF2 library to read PDF files and extract the document content, number of pages, and document title of the PDF file; Use the Document class from the python-docx library to read Word files and extract the text content, paragraph formatting, and style information from the Word files; This paper uses the pandas library and the openpyxl library to read an Excel file and extract the table data, worksheet names and cell formats.
3. The method according to claim 2, characterized in that, The document mining information includes: word segmentation, sentence structure, document content type, and text hierarchical relationships. Therefore, determining the document mining information of the document to be classified based on the basic document information includes: Lexical and syntactic analysis processes are performed on the basic information of the document to obtain word segmentation, sentence structure, and document content type. Based on the format information within the basic document information, the text hierarchical relationship of the document to be classified is determined.
4. The method according to claim 3, characterized in that, The process of identifying the entity set of the document to be classified based on the predetermined semantic analysis model and the document mining information includes: The word segmentation, sentence structure, document content type, and text hierarchy relationship in the document mining information are provided as input information to the semantic analysis model, and the self-attention mechanism in the semantic analysis model is used to perform contextual semantic understanding on the input information. Based on the results of the contextual semantic understanding, the entities contained in the document to be classified are identified to form the entity set, wherein the entity set includes: people, objects, time, events, and task objectives.
5. The method according to any one of claims 1 to 4, characterized in that, The step of constructing an entity relationship network for the entity set using a graph neural network includes: Using each entity in the entity set as a node, and using at least one of the semantic association, temporal order and causal relationship between entities as an edge, an initial entity relationship graph is constructed. The initial entity relationship graph is input into the pre-trained graph neural network, and the nodes and edges in the initial entity relationship graph are iteratively updated by the graph neural network to a specified number of times to obtain the entity relationship network.
6. The method according to claim 5, characterized in that, The step of determining the document graph vector of the document to be classified based on the entity relationship network includes: The feature vectors of all nodes in the entity relationship network are input into the graph pooling layer of the graph neural network. The feature vectors of all nodes are downsampled by the graph pooling layer and then aggregated to generate the document graph vector.
7. The method according to claim 5, characterized in that, The step of determining the document graph vector of the document to be classified based on the entity relationship network includes: Based on the attention mechanism and the feature vectors of all nodes in the entity relationship network, the global contribution weight of each node to the document to be classified is calculated. Based on the global contribution weight, the feature vectors of all nodes are weighted and summed to generate the document graph vector.
8. The method according to claim 5, characterized in that, The step of determining the document graph vector of the document to be classified based on the entity relationship network includes: The feature vectors of all nodes in the entity relationship network are aggregated to generate an initial graph vector; The multidimensional metadata is concatenated with the initial graph vector according to the vector dimension to generate the document graph vector, wherein the multidimensional metadata includes the document metadata of the document to be classified and the system metadata of the system in which the document to be classified is located.
9. A computer device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, the instructions being configured to cause the processor to perform the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions configured to perform the method as described in any one of claims 1 to 8.
