graph LR
Data_Ingestion_Graph_Construction["Data Ingestion & Graph Construction"]
Graph_Data_Structure["Graph Data Structure"]
Graph_Representation_Learning["Graph Representation Learning"]
Core_Models["Core Models"]
Prediction_Decoding["Prediction & Decoding"]
Evaluation_Loss["Evaluation & Loss"]
Application_Orchestrator["Application Orchestrator"]
Application_Orchestrator -- "Configures & Initiates" --> Data_Ingestion_Graph_Construction
Application_Orchestrator -- "Configures & Invokes" --> Core_Models
Application_Orchestrator -- "Utilizes for Metrics & Loss" --> Evaluation_Loss
Data_Ingestion_Graph_Construction -- "Generates & Populates" --> Graph_Data_Structure
Graph_Data_Structure -- "Provides Input Graph" --> Graph_Representation_Learning
Graph_Representation_Learning -- "Updates with Embeddings" --> Graph_Data_Structure
Graph_Representation_Learning -- "Provides Encoded Features" --> Core_Models
Core_Models -- "Utilizes for Output Generation" --> Prediction_Decoding
Prediction_Decoding -- "Returns Predictions" --> Core_Models
Core_Models -- "Outputs Final Results" --> Application_Orchestrator
click Data_Ingestion_Graph_Construction href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/graph4nlp/Data_Ingestion_Graph_Construction.md" "Details"
click Graph_Data_Structure href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/graph4nlp/Graph_Data_Structure.md" "Details"
click Graph_Representation_Learning href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/graph4nlp/Graph_Representation_Learning.md" "Details"
click Core_Models href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/graph4nlp/Core_Models.md" "Details"
click Prediction_Decoding href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/graph4nlp/Prediction_Decoding.md" "Details"
click Application_Orchestrator href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/graph4nlp/Application_Orchestrator.md" "Details"
The graph4nlp library is structured around a clear data flow pipeline for NLP tasks leveraging graph neural networks. The Application Orchestrator serves as the entry point, configuring and initiating the entire process. It first directs Data Ingestion & Graph Construction to process raw text into a Graph Data Structure, which is the central data representation. This Graph Data Structure then feeds into Graph Representation Learning, where various GNN models learn rich embeddings, updating the graph data. These learned representations are then consumed by Core Models, which are high-level implementations for specific NLP tasks (e.g., Graph2Seq, Graph2Tree, Knowledge Graph Completion). The Core Models interact with the Prediction & Decoding component to generate final outputs. Throughout the training and evaluation phases, the Evaluation & Loss component provides metrics and loss functions to assess model performance, with results ultimately reported back to the Application Orchestrator. This modular design facilitates clear separation of concerns and enables flexible integration of different graph processing and NLP techniques.
Data Ingestion & Graph Construction [Expand]
Responsible for loading raw text data, tokenization, vocabulary building, and constructing various graph topologies (e.g., dependency, constituency) from the preprocessed text. It prepares the initial GraphData instances.
Related Classes/Methods:
graph4nlp.pytorch.data.dataset.Dataset:236-824graph4nlp.pytorch.modules.utils.vocab_utils.Vocab:345-546graph4nlp.pytorch.modules.graph_construction.dependency_graph_construction.static_topology:132-196graph4nlp.pytorch.modules.graph_construction.constituency_graph_construction.static_topology:71-203
Graph Data Structure [Expand]
The fundamental and central data structure (GraphData) for representing graphs within the library. It encapsulates nodes, edges, their features, and attributes, serving as the primary intermediate representation passed between components.
Related Classes/Methods:
Graph Representation Learning [Expand]
Initializes numerical embeddings for nodes and edges and applies various Graph Neural Network (GNN) architectures (e.g., GAT, GCN, GraphSAGE) to learn rich, context-aware graph embeddings. It updates the GraphData object with these learned representations.
Related Classes/Methods:
graph4nlp.pytorch.modules.graph_embedding_initialization.embedding_construction.EmbeddingConstruction:43-319graph4nlp.pytorch.modules.graph_embedding_learning.gat.GAT:13-186graph4nlp.pytorch.modules.graph_embedding_learning.gcn.GCN:9-193graph4nlp.pytorch.modules.graph_embedding_learning.graphsage.GraphSAGE:11-164
Core Models [Expand]
High-level model implementations that orchestrate the entire pipeline for specific NLP tasks (e.g., Graph2Seq, Graph2Tree, Knowledge Graph Completion). They integrate graph representation learning with prediction components to perform end-to-end operations.
Related Classes/Methods:
graph4nlp.pytorch.models.graph2seq.Graph2Seq:14-367graph4nlp.pytorch.models.graph2tree.Graph2Tree:13-413examples.pytorch.kg_completion.model.Complexexamples.pytorch.kg_completion.model.Distmult
Prediction & Decoding [Expand]
Generates final outputs (e.g., text sequences) based on the encoded graph representations. This component includes sequence decoders (e.g., RNN-based) and implements various search algorithms (e.g., beam search) for inference.
Related Classes/Methods:
graph4nlp.pytorch.modules.prediction.generation.StdRNNDecoder:18-299graph4nlp.pytorch.modules.prediction.generation.decoder_strategy.DecoderStrategy:90-538
Provides a collection of standard NLP and graph-specific evaluation metrics (e.g., BLEU, Accuracy) and various loss functions used for training and assessing model performance.
Related Classes/Methods:
graph4nlp.pytorch.modules.evaluation.bleu.BLEU:5-71graph4nlp.pytorch.modules.evaluation.accuracy.Accuracy:9-269graph4nlp.pytorch.modules.loss.kg_loss.KGLoss:75-198
Application Orchestrator [Expand]
Example scripts and main entry points that demonstrate the end-to-end usage of the graph4nlp library for specific NLP tasks. These scripts configure, initialize, and coordinate the data flow and interactions between all other components.
Related Classes/Methods: