Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,25 @@ builder.l3.configure(model="knowledgator/gliner-linker-large-v1.0")
executor = DAGExecutor(builder.get_config())

# 3. Load entities
executor.load_entities("data/entities.jsonl", target_layers=["dict"])
executor.load_entities("data/pubmesh_ontology.jsonl", target_layers=["dict"])

# 4. Process text
result = executor.execute({
"texts": ["Farnese Palace is one of the most important palaces in the city of Rome."]
"texts": ["BRCA1 mutations are associated with breast cancer risk."]
})

# 5. Get results
l0_result = result.get("l0_result")
for entity in l0_result.entities:
if entity.linked_entity:
print(f"{entity.mention_text} → {entity.linked_entity.label}")
print(f" Confidence: {entity.linked_entity.score:.3f}")
for text_entities in l0_result.entities:
for entity in text_entities:
if entity.linked_entity:
print(f"{entity.mention_text} → {entity.linked_entity.label}")
print(f" Confidence: {entity.linked_entity.confidence:.3f}")
```

**Output:**
```
BRCA1 → BRCA1: Breast cancer type 1 susceptibility protein
Confidence: 0.923
breast cancer → Breast Cancer: Malignant neoplasm of the breast
Confidence: 0.887
# Labels and confidence values depend on the model and loaded entity database.
```

---
Expand Down Expand Up @@ -284,7 +282,7 @@ For full control over every layer, define the pipeline in YAML and load it:
```python
from glinker import ProcessorFactory

executor = ProcessorFactory.create_pipeline("configs/pipelines/dict/simple.yaml")
executor = ProcessorFactory.create_pipeline("configs/pipelines/dict/default.yaml")
executor.load_entities("data/entities.jsonl")
result = executor.execute({"texts": ["TP53 mutations cause cancer"]})
```
Expand Down
20 changes: 8 additions & 12 deletions configs/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,11 @@ python scripts/database/jsonl2postgresql.py
- Use case: High-performance BiEncoder inference

```python
from src.core.dag import DAGExecutor, DAGPipeline
import yaml
from glinker import ProcessorFactory

with open("configs/pipelines/postgres/with_embeddings.yaml") as f:
pipeline = DAGPipeline(**yaml.safe_load(f))

executor = DAGExecutor(pipeline)
executor = ProcessorFactory.create_pipeline(
"configs/pipelines/postgres/with_embeddings.yaml"
)

# Step 1: Load entities
executor.load_entities("entities.jsonl", target_layers=["postgres"])
Expand Down Expand Up @@ -233,13 +231,11 @@ python demo.py -c configs/pipelines/postgres_redis/default.yaml
```bash
# Setup embeddings
python -c "
from src.core.dag import DAGExecutor, DAGPipeline
import yaml
from glinker import ProcessorFactory

with open('configs/pipelines/postgres/with_embeddings.yaml') as f:
pipeline = DAGPipeline(**yaml.safe_load(f))

executor = DAGExecutor(pipeline)
executor = ProcessorFactory.create_pipeline(
'configs/pipelines/postgres/with_embeddings.yaml'
)
executor.load_entities('entities.jsonl', target_layers=['postgres'])
executor.precompute_embeddings(target_layers=['postgres'])
"
Expand Down
4 changes: 2 additions & 2 deletions docs/DATABASE_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ from glinker.core.factory import ProcessorFactory
import yaml

# Load pipeline config with multiple database layers
with open("configs/pipelines/postgres_redis_basic.yaml") as f:
with open("configs/pipelines/postgres_redis/default.yaml") as f:
config = yaml.safe_load(f)

executor = ProcessorFactory.create_from_dict(config, verbose=True)
Expand Down Expand Up @@ -379,7 +379,7 @@ from glinker.core.factory import ProcessorFactory
import yaml

# Use embedding-enabled config
with open("configs/pipelines/postgres_redis_embeddings.yaml") as f:
with open("configs/pipelines/postgres_redis/with_embeddings.yaml") as f:
config = yaml.safe_load(f)

executor = ProcessorFactory.create_from_dict(config, verbose=True)
Expand Down
Loading
Loading