| name | extract |
| description | Run the full VeritasReason semantic extraction pipeline on a file or selected text — NER, relations, events, coreference resolution, triplets, and validation. Clears result cache before each run. Returns Markdown tables with entity/relation/event/triplet results and inline validator warnings. |
/veritasreason:extract
Run the full extraction pipeline. Usage: /veritasreason:extract [file_path | "inline text"]
$ARGUMENTS = file path, inline text in quotes, or blank (uses active editor file).
Steps
1. Resolve the source.
- If
$ARGUMENTS is a readable file path → text = open(path).read()
- If it's quoted inline text → use directly
- If blank → use the active editor file
2. Clear the result cache to prevent cross-invocation pollution:
from veritasreason.semantic_extract.cache import _result_cache
_result_cache.clear()
3. Run the full pipeline:
from veritasreason.semantic_extract import (
NamedEntityRecognizer,
RelationExtractor,
EventDetector,
CoreferenceResolver,
TripletExtractor,
ExtractionValidator,
)
ner = NamedEntityRecognizer()
entities = ner.extract(text)
rel = RelationExtractor()
relations = rel.extract(text)
evt = EventDetector()
events = evt.extract(text)
coref = CoreferenceResolver()
resolved_text = coref.resolve(text)
triplet = TripletExtractor()
triplets = triplet.extract(resolved_text)
validator = ExtractionValidator()
issues = validator.validate(entities, relations)
4. Report validator warnings above results:
⚠ ExtractionValidator: <warning message>
5. Return results as Markdown tables:
Entities (N total)
Relations (M total)
| Source | Relation Type | Target | Confidence |
|---|
Events (K total)
| Label | Type | Participants | Confidence |
|---|
Triplets (J total)
| Subject | Predicate | Object | Confidence |
|---|
6. Summary line:
Extracted: N entities, M relations, K events, J triplets — from <source>
For large files (>50KB), process in chunks and show a progress indicator. Highlight any entities appearing in the context graph already (ContextGraph.has_node(label)) with [in graph] tag.