OntoLearner 1.4.9__tar.gz → 1.4.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ontolearner-1.4.9 → ontolearner-1.4.10}/PKG-INFO +1 -1
- ontolearner-1.4.10/ontolearner/VERSION +1 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/base/ontology.py +2 -2
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/tools/analyzer.py +51 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/pyproject.toml +1 -1
- ontolearner-1.4.9/ontolearner/VERSION +0 -1
- {ontolearner-1.4.9 → ontolearner-1.4.10}/LICENSE +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/README.md +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/images/logo.png +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/_learner.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/_ontology.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/base/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/base/learner.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/base/text2onto.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/data_structure/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/data_structure/data.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/data_structure/metric.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/evaluation/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/evaluation/evaluate.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/evaluation/metrics.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/label_mapper.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/llm.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/prompt.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/rag.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/retriever/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/retriever/crossencoder.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/retriever/embedding.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/retriever/learner.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/retriever/llm_retriever.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/retriever/ngram.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/taxonomy_discovery/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/taxonomy_discovery/alexbek.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/taxonomy_discovery/rwthdbis.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/taxonomy_discovery/sbunlp.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/taxonomy_discovery/skhnlp.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/term_typing/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/term_typing/alexbek.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/term_typing/rwthdbis.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/term_typing/sbunlp.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/text2onto/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/text2onto/alexbek.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/learner/text2onto/sbunlp.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/agriculture.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/arts_humanities.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/biology.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/chemistry.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/ecology_environment.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/education.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/events.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/finance.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/food_beverage.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/general.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/geography.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/industry.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/law.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/library_cultural_heritage.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/material_science_engineering.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/medicine.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/news_media.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/scholarly_knowledge.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/social_sciences.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/units_measurements.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/upper_ontologies.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/web.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/processor.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/text2onto/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/text2onto/batchifier.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/text2onto/general.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/text2onto/splitter.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/text2onto/synthesizer.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/tools/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/tools/visualizer.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/utils/__init__.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/utils/io.py +0 -0
- {ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/utils/train_test_split.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.4.10
|
|
@@ -372,7 +372,7 @@ class BaseOntology(ABC):
|
|
|
372
372
|
# Save updated metrics
|
|
373
373
|
df.to_excel(metrics_file_path, index=False)
|
|
374
374
|
|
|
375
|
-
def is_valid_label(label: str) -> Any:
|
|
375
|
+
def is_valid_label(self, label: str) -> Any:
|
|
376
376
|
invalids = ['root', 'thing']
|
|
377
377
|
if label.lower() in invalids:
|
|
378
378
|
return None
|
|
@@ -522,7 +522,7 @@ class BaseOntology(ABC):
|
|
|
522
522
|
return True
|
|
523
523
|
return False
|
|
524
524
|
|
|
525
|
-
def _is_anonymous_id(label: str) -> bool:
|
|
525
|
+
def _is_anonymous_id(self, label: str) -> bool:
|
|
526
526
|
"""Check if a label represents an anonymous class identifier."""
|
|
527
527
|
if not label:
|
|
528
528
|
return True
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import logging
|
|
16
16
|
import time
|
|
17
|
+
import numpy as np
|
|
17
18
|
from abc import ABC
|
|
18
19
|
from rdflib import RDF, RDFS, OWL
|
|
19
20
|
from collections import defaultdict
|
|
@@ -186,6 +187,56 @@ class Analyzer(ABC):
|
|
|
186
187
|
|
|
187
188
|
return metrics
|
|
188
189
|
|
|
190
|
+
@staticmethod
|
|
191
|
+
def compute_complexity_score(
|
|
192
|
+
topology_metrics: TopologyMetrics,
|
|
193
|
+
dataset_metrics: DatasetMetrics,
|
|
194
|
+
a: float = 0.4,
|
|
195
|
+
b: float = 6.0,
|
|
196
|
+
eps: float = 1e-12
|
|
197
|
+
) -> float:
|
|
198
|
+
"""
|
|
199
|
+
Compute a single normalized complexity score for an ontology.
|
|
200
|
+
|
|
201
|
+
This function combines structural topology metrics and dataset quality metrics
|
|
202
|
+
into a weighted aggregate score, then applies a logistic transformation to
|
|
203
|
+
normalize it to the range [0, 1]. The score reflects overall ontology complexity,
|
|
204
|
+
considering graph structure, hierarchy, breadth, coverage, and dataset richness.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
topology_metrics (TopologyMetrics): Precomputed structural metrics of the ontology graph.
|
|
208
|
+
dataset_metrics (DatasetMetrics): Precomputed metrics of extracted learning datasets.
|
|
209
|
+
a (float, optional): Steepness parameter for the logistic normalization function. Default is 0.4.
|
|
210
|
+
b (float, optional): Centering parameter for the logistic function, should be tuned to match the scale of aggregated metrics. Default is 6.0.
|
|
211
|
+
eps (float, optional): Small epsilon to prevent numerical issues in logistic computation. Default is 1e-12.
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
float: Normalized complexity score in [0, 1], where higher values indicate more complex ontologies.
|
|
215
|
+
|
|
216
|
+
Notes:
|
|
217
|
+
- Weights are assigned to different metric categories: graph metrics, coverage metrics, hierarchy metrics,
|
|
218
|
+
breadth metrics, and dataset metrics (term-types, taxonomic, non-taxonomic relations).
|
|
219
|
+
- Metrics are log-normalized before weighting to reduce scale differences.
|
|
220
|
+
- The logistic transformation ensures the final score is bounded and interpretable.
|
|
221
|
+
"""
|
|
222
|
+
# Define metric categories with their weights
|
|
223
|
+
metric_categories = {
|
|
224
|
+
0.3: ["total_nodes", "total_edges", "num_root_nodes", "num_leaf_nodes"],
|
|
225
|
+
0.25: ["num_classes", "num_properties", "num_individuals"],
|
|
226
|
+
0.10: ["max_depth", "min_depth", "avg_depth", "depth_variance"],
|
|
227
|
+
0.20: ["max_breadth", "min_breadth", "avg_breadth", "breadth_variance"],
|
|
228
|
+
0.15: ["num_term_types", "num_taxonomic_relations", "num_non_taxonomic_relations", "avg_terms"]
|
|
229
|
+
}
|
|
230
|
+
weights = {metric: weight for weight, metrics in metric_categories.items() for metric in metrics}
|
|
231
|
+
metrics = [metric for _, metric_list in metric_categories.items() for metric in metric_list]
|
|
232
|
+
onto_metrics = {**topology_metrics.__dict__, **dataset_metrics.__dict__}
|
|
233
|
+
norm_weighted_values = [np.log1p(onto_metrics[m]) * weights[m] for m in metrics if m in onto_metrics]
|
|
234
|
+
total_weight = sum(weights[m] for m in metrics if m in onto_metrics)
|
|
235
|
+
weighted_sum = sum(norm_weighted_values) / total_weight if total_weight > 0 else 0.0
|
|
236
|
+
complexity_score = 1.0 / (1.0 + np.exp(-a * (weighted_sum - b) + eps))
|
|
237
|
+
return complexity_score
|
|
238
|
+
|
|
239
|
+
|
|
189
240
|
@staticmethod
|
|
190
241
|
def compute_dataset_metrics(ontology: BaseOntology) -> DatasetMetrics:
|
|
191
242
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "OntoLearner"
|
|
3
|
-
version = "1.4.
|
|
3
|
+
version = "1.4.10"
|
|
4
4
|
description = "OntoLearner: A Modular Python Library for Ontology Learning with LLMs."
|
|
5
5
|
authors = ["Hamed Babaei Giglou <hamedbabaeigiglou@gmail.com>", "Andrei C. Aioanei <andrei.c.aioanei@gmail.com>"]
|
|
6
6
|
license = "MIT License"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.4.9
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ontolearner-1.4.9 → ontolearner-1.4.10}/ontolearner/ontology/material_science_engineering.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|