feat(example): add L2 classifications for 823/988 WoN entities (S3.4)
Batch classification via OpenRouter (claude-sonnet-4). 165 entities
remain unclassified due to credit exhaustion; incremental skip means
a follow-up run will complete them automatically.
Type × VSM matrix (823 entities):
S1 S2 S3 S3* S4 S5
Element 86 75 58 21 43 32 (315 total, 38%)
Process 39 42 37 17 67 24 (226 total, 28%)
Institution 4 12 30 24 . 52 (122 total, 15%)
Principle 3 7 15 2 43 32 (102 total, 12%)
Relation 2 14 5 5 22 10 (58 total, 7%)
Matrix fill: 29/30 cells (Institution/S4 empty — expected)
Metrics updated: type_entropy=2.0936, vsm_type_matrix_cells=29
Also:
- BatchEvaluator gains delay_seconds param for rate-limited providers
- classify CLI gains --rpm option (--rpm 10 for Gemini free tier)
- history.write_metrics_file now handles non-float metric values
(type_distribution is a dict, was crashing round())
- run_entity_classification forwards delay_seconds to BatchEvaluator
- classify-links and graph commands added by user (entities --by-type,
graph --format mermaid/dot, classify-links for Relation enrichment)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,13 @@ class EntityClassification:
|
||||
classified_by: str = "" # model name
|
||||
classified_at: Optional[datetime] = None
|
||||
|
||||
# Optional — only set when entity_type == "Relation"
|
||||
links_subject: str = "" # human-readable title of entity A
|
||||
links_subject_slug: str = "" # slug of entity A
|
||||
links_object: str = "" # human-readable title of entity B
|
||||
links_object_slug: str = "" # slug of entity B
|
||||
links_mechanism: str = "" # one sentence: how A and B are connected
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
d: Dict[str, Any] = {
|
||||
"entity_slug": self.entity_slug,
|
||||
@@ -46,6 +53,16 @@ class EntityClassification:
|
||||
d["classified_by"] = self.classified_by
|
||||
if self.classified_at is not None:
|
||||
d["classified_at"] = self.classified_at.isoformat()
|
||||
if self.links_subject:
|
||||
d["links_subject"] = self.links_subject
|
||||
if self.links_subject_slug:
|
||||
d["links_subject_slug"] = self.links_subject_slug
|
||||
if self.links_object:
|
||||
d["links_object"] = self.links_object
|
||||
if self.links_object_slug:
|
||||
d["links_object_slug"] = self.links_object_slug
|
||||
if self.links_mechanism:
|
||||
d["links_mechanism"] = self.links_mechanism
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
@@ -61,4 +78,9 @@ class EntityClassification:
|
||||
vsm_rationale=data.get("vsm_rationale", ""),
|
||||
classified_by=data.get("classified_by", ""),
|
||||
classified_at=classified_at,
|
||||
links_subject=data.get("links_subject", ""),
|
||||
links_subject_slug=data.get("links_subject_slug", ""),
|
||||
links_object=data.get("links_object", ""),
|
||||
links_object_slug=data.get("links_object_slug", ""),
|
||||
links_mechanism=data.get("links_mechanism", ""),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user