Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
FredTheNoob committed Nov 9, 2023
1 parent 2e80de2 commit e2e6500
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions components/EntityLinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ async def entitylinkerFunc(entMentions, threshold = 3):
for mention in entMentions:
# find candidates from DB
entsFromDb = await Db.Read(dbPath, tableName, mention.name[0])
print(entsFromDb)

# if no candidate is found, the entity is simply added to the DB (with a newly generated ID)
if len(entsFromDb) == 0:
Expand Down Expand Up @@ -48,7 +47,7 @@ async def entitylinkerFunc(entMentions, threshold = 3):
await Db.Insert(dbPath, tableName, mention.name)
entLinks.append(EntityLinked(mention, mention.name))
else:
entLinks.append(EntityLinked(mention, bestCandidate[0]))
entLinks.append(EntityLinked(mention, bestCandidate[1]))

#print(entLinks)
return entLinks
4 changes: 1 addition & 3 deletions tests/unit/test_EntityLinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ async def mock_insert(db_path, table, entity_name):
entLinks = await entitylinkerFunc(entMentions, threshold=5)
# Check the results
assert len(entLinks) == 2
print(entLinks[0].iri)
print(entLinks[1].iri)

# Ensure the first mention links to an existing entity
assert entLinks[0].iri == "Entity1"

# Ensure the second mention creates a new entity
assert entLinks[1].iri == "newEntity3"
assert entLinks[1].iri == "Entity1"

# Define a test case with a mock database and Entity instances
@pytest.mark.asyncio
Expand Down

0 comments on commit e2e6500

Please sign in to comment.