Skip to content

Commit 754dfb7

Browse files
committed
Cleanup adapter
1 parent 747ec58 commit 754dfb7

File tree

4 files changed

+6
-28
lines changed

4 files changed

+6
-28
lines changed

coverage-badge.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/Code Examples/Advanced/Knowledge Extraction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ The modular architecture enables teams to iteratively refine their extraction pi
447447

448448
By separating concerns across different stages, Synalinks allows for specialized optimization at each level of the extraction hierarchy. Entity extraction can leverage lightweight, fast models, while complex reasoning tasks can utilize more powerful, specialized models. This granular control over computational resources leads to more efficient systems that deliver better results at lower costs.
449449

450-
Whether you're building a simple entity extraction system or a comprehensive knowledge discovery platform, Synalinks provides the flexibility, control, and scalability needed to transform unstructured data into actionable insights.
450+
Whether you're building a simple entity extraction system or a comprehensive knowledge discovery platform, Synalinks provides the flexibility, control, and scalability needed to transform unstructured data into actionable insights.
451451

452452
In an era where structured data is the new oil, Synalinks provides the refinery that transforms raw information into structured knowledge, enabling organizations to unlock the full potential of their data assets through intelligent, adaptive extraction pipelines.
453453

synalinks/src/knowledge_bases/database_adapters/neo4j_adapter.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,6 @@ def __init__(
102102
self.query("CALL db.awaitIndexes(300)"),
103103
)
104104

105-
def sanitize_label(self, label):
106-
"""Sanitize labels for Neo4j compatibility"""
107-
if not label:
108-
return "Entity"
109-
# Remove special characters and replace spaces with underscores
110-
sanitized = re.sub(r"[^a-zA-Z0-9_]", "_", str(label))
111-
# Ensure it starts with a letter or underscore
112-
if sanitized and not sanitized[0].isalpha() and sanitized[0] != "_":
113-
sanitized = "_" + sanitized
114-
return sanitized
115-
116-
def sanitize_properties(self, properties):
117-
"""Sanitize property names and values for Neo4j compatibility"""
118-
if not isinstance(properties, dict):
119-
return {}
120-
121-
sanitized = {}
122-
for key, value in properties.items():
123-
# Sanitize key names
124-
sanitized[self.sanitize(key)] = value
125-
return sanitized
126-
127105
async def query(self, query: str, params: Dict[str, Any] = None):
128106
driver = neo4j.GraphDatabase.driver(
129107
self.index_name, auth=(self.username, self.password)

synalinks/src/knowledge_bases/knowledge_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async def similarity_search(
117117
self,
118118
similarity_search,
119119
k=10,
120-
threshold=0.7,
120+
threshold=0.8,
121121
):
122122
"""Perform similarity search to find entities similar to the given text.
123123
@@ -130,7 +130,7 @@ async def similarity_search(
130130
Defaults to 10.
131131
threshold (float): Minimum similarity score for results.
132132
Entities with similarity below this threshold are excluded.
133-
Should be between 0.0 and 1.0. Defaults to 0.7.
133+
Should be between 0.0 and 1.0 (Defaults to 0.8).
134134
"""
135135
return await self.adapter.similarity_search(
136136
similarity_search,
@@ -142,7 +142,7 @@ async def triplet_search(
142142
self,
143143
triplet_search,
144144
k=10,
145-
threshold=0.7,
145+
threshold=0.8,
146146
):
147147
"""Search for triplets in the knowledge graph.
148148
@@ -155,7 +155,7 @@ async def triplet_search(
155155
(Defaults to 10).
156156
threshold (float, optional): Minimum similarity score for triplet matches.
157157
Triplets with similarity below this threshold are excluded.
158-
Should be between 0.0 and 1.0. Defaults to 0.7.
158+
Should be between 0.0 and 1.0. (Defaults to 0.8).
159159
"""
160160
return await self.adapter.triplet_search(
161161
triplet_search,

0 commit comments

Comments
 (0)