Skip to content

dineshram0212/LTTS-knowledge-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Knowledge Graph Generator

This project is a Dynamic Knowledge Graph Generator designed to convert text data into interactive knowledge graphs, using Python and Natural Language Processing (NLP) techniques. It allows users to extract and visualize relationships from unstructured text, making it easier to explore and understand complex data.

Check out the full article for an in-depth explanation: Creating a Dynamic Knowledge Graph Generator with Python and NLP.

Features

  • Text Parsing and Entity Extraction: Leverages NLP to identify entities (e.g., names, places, events) and their relationships in text data.
  • Graph Visualization: Creates a dynamic, interactive graph from extracted relationships, allowing users to explore connections visually.
  • Customizable and Scalable: Supports multiple customization options and works with various data sizes and formats.
  • Interactivity: Users can click on nodes to expand details and view additional related entities.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/dynamic-knowledge-graph-generator.git
    cd dynamic-knowledge-graph-generator
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the application:

    python app.py

Usage

  1. Prepare Input Data: The tool can accept various input types (e.g., text files or JSON documents). Ensure your data is formatted for easy processing.
  2. Configure Parameters: Customize entity types and relationships to be extracted by the NLP model.
  3. Generate the Graph: Use the tool to extract entities and relationships, then render them in a knowledge graph format.
  4. Explore the Graph: Interact with the graph nodes to reveal additional relationships and gain insights.

Example Code

Here’s a basic example of using the tool to parse text and visualize a knowledge graph:

from graph_generator import KnowledgeGraphGenerator

# Sample text
text = "Albert Einstein developed the theory of relativity. He was born in Germany."

# Initialize and configure the generator
graph_gen = KnowledgeGraphGenerator()
knowledge_graph = graph_gen.create_graph(text)

# Visualize the graph
graph_gen.visualize(knowledge_graph)

Requirements

  • spacy: For entity recognition and relationship extraction.
  • networkx: For creating graph structures.
  • pyvis: For visualizing graphs interactively in a browser.

Install dependencies with:

pip install spacy networkx pyvis

License

This project is licensed under the MIT License.

Additional Resources

Contributing

Contributions are welcome! Please submit issues or pull requests for any enhancements or bug fixes.