From e442dc496002b788d30f996cdfc87d36f5bcaa35 Mon Sep 17 00:00:00 2001 From: FredTheNoob Date: Fri, 8 Dec 2023 11:38:25 +0100 Subject: [PATCH] add dbPath to env --- components/EntityLinker.py | 4 +--- main.py | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/EntityLinker.py b/components/EntityLinker.py index 6158c4d..17c9195 100644 --- a/components/EntityLinker.py +++ b/components/EntityLinker.py @@ -5,11 +5,9 @@ from lib.Entity import Entity from fuzzywuzzy import fuzz - -async def entitylinkerFunc(entities: List[Entity], threshold:int=80): +async def entitylinkerFunc(entities: List[Entity], db_path: str, threshold:int=80): iri_dict = {} linked_entities = [] - db_path = "./Database/DB.db" for entity in entities: if entity.type == "Literal": linked_entities.append(EntityLinked(entity, "")) diff --git a/main.py b/main.py index e80917e..9f098e3 100644 --- a/main.py +++ b/main.py @@ -22,6 +22,7 @@ PIPELINE_C_URL = str(os.getenv("PIPELINE_C_URL")) PIPELINE_C_AUTHORIZATION = str(os.getenv("PIPELINE_C_AUTHORIZATION")) ACCESS_API_AUTHORIZATION = str(os.getenv("ACCESS_API_AUTHORIZATION")) +DB_PATH = str(os.getenv("DB_PATH")) async def newFileCreated(file_path: str): try: @@ -120,12 +121,13 @@ async def processInput(file_path: str = "Artikel.txt"): ents = GetSpacyData.GetEntities(doc) # construct entities from text await Db.InitializeIndexDB( - "./Database/DB.db" + DB_PATH ) # makes the DB containing the entities of KG # Returns JSON object containing an array of entity links entLinks = await entitylinkerFunc( - ents + ents, + DB_PATH ) # Returns JSON object containing an array of entity links entsJSON = GetSpacyData.BuildJSONFromEntities(entLinks, doc, file_path)