1. Learn
  2. /
  3. Courses
  4. /
  5. Graph RAG with LangChain and Neo4j

Connected

Exercise

Creating a hierarchical lexical graph

You may have noticed that the previous output contained more than just acts. Extracting a knowledge graph is often an iterative process. The output of a text splitter often needs additional examination and filtering before creating the nodes and relationships.

In this exercise, you'll filter out this additional information, then use it to create Act nodes that connect to a Play node.

The play_node variable, containing a Node object for the play, has been created for you along with a graph_document variable to hold the new nodes and relationships you'll create.

Instructions 1/3

undefined XP
    1
    2
    3
  • Filter the output of act_splitter to only process text starting with the pattern ACT.