Understanding GraphReader: How It Works

Sizan - Oct 27 - - Dev Community

1. Graph Construction

GraphReader begins by constructing a graph from the input text. It breaks down the text into nodes, where each node represents a sentence. Links are created between nodes based on shared keywords, creating a network that connects related information.

2. Graph Exploration

To answer a question, GraphReader explores the graph, starting from nodes that share keywords with the question. This allows it to traverse through relevant sentences that could potentially hold the answer.

3. Answer Reasoning

Currently, GraphReader uses a simple approach to answer reasoning: it returns sentences from the graph that match the question's keywords. This helps retrieve relevant information based on keyword alignment.

Example Walkthrough

Example 1

  • Text: "Natural language processing enables computers to understand human languages. It involves techniques from both computer science and linguistics."
  • Question: "What does natural language processing involve?"
  • Result: "Natural language processing enables computers to understand human languages."
    Example 2

  • Text: "Father of the Nation Bangabandhu Sheikh Mujibur Rahman (1920-1975) is the architect of independent Bangladesh. Born on 17 March 1920 in the village Tungipara under the Gopalganj Sub-division (currently district) in the district of Faridpur, Sheikh Mujibur Rahman’s father, Sheikh Lutfar Rahman, was a serestadar in the civil court of Gopalganj."

  • Question: "Who is Sheikh Mujib?"

  • *Result: *"Father of the Nation Bangabandhu Sheikh Mujibur Rahman (1920-1975) is the architect of independent Bangladesh."

  • "Born on 17 March 1920 in the village Tungipara under the Gopalganj Sub-division (currently district) in the district of Faridpur, Sheikh Mujibur Rahman’s father, Sheikh Lutfar Rahman, was a serestadar in the civil court of Gopalganj."
    Example 3

  • Text: "My name is Hasan. I from Mymensingh."

  • Question: "Who is hasan?"

  • Result: "My name is Sizan."
    GraphReader leverages these steps to identify and return relevant information based on graph traversal and keyword matching.

. . . .