IAAR-Shanghai / PGRAG

PGRAG
Other
28 stars 1 forks source link

How to extend a graph #1

Closed jonhilgart22 closed 1 month ago

jonhilgart22 commented 1 month ago

If I've generated a graph, what's the best way to extend the graph as new documents come in?

siminniu commented 1 month ago

Thank you for your interest in our work!

Regarding your question, you only need to place the new set of documents into a new directory, for example:

raw_news_files_dir = 'data/raw_news/new_batch'

Then, execute the following code:

from pgrag.mindmap_generator import MindmapGeneration

mindmap_generation = MindmapGeneration(
    model_name, 
    num_threads, 
    raw_news_files_dir, 
    title_files_dir, 
    fcis_files_dir, 
    mindmaps_str_files_dir, 
    mindmaps_json_files_dir
)
mindmap_generation.execute()

For each document in the new batch, we independently extract FCIs and transform them into a separate mind map. This hierarchical indexing process is independent and can be incrementally added to the existing PG database.

Thank you for your question. We will further enhance the user experience in the new version, including optimizing the operation of batch updates to the database.

Thanks again for your support!