mirror of
https://github.com/microsoft/graphrag.git
synced 2026-01-14 00:57:23 +08:00
Use stable ids for community reports
This commit is contained in:
parent
710fdad6f0
commit
a4d1278c2a
@ -3,11 +3,10 @@
|
||||
|
||||
"""All the steps to transform final entities."""
|
||||
|
||||
from uuid import uuid4
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from graphrag.data_model.schemas import COMMUNITY_REPORTS_FINAL_COLUMNS
|
||||
from graphrag.index.utils.hashing import gen_sha512_hash
|
||||
|
||||
|
||||
def finalize_community_reports(
|
||||
@ -25,7 +24,9 @@ def finalize_community_reports(
|
||||
|
||||
community_reports["community"] = community_reports["community"].astype(int)
|
||||
community_reports["human_readable_id"] = community_reports["community"]
|
||||
community_reports["id"] = [uuid4().hex for _ in range(len(community_reports))]
|
||||
community_reports["id"] = community_reports.apply(
|
||||
lambda row: gen_sha512_hash(row, ["full_content"]), axis=1
|
||||
)
|
||||
|
||||
return community_reports.loc[
|
||||
:,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user