BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Graph RAG with LangChain and Neo4j

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

acts = act_splitter.split_text(romeo_and_juliet)

for i, act in enumerate(acts):
	lines = act.strip().split("\n")
	
	# Only include text relating to an act
	if lines[0].startswith(____):
		print(i, act.strip().split("\n")[0])
Kodu Düzenle ve Çalıştır