# Extract

Run the full Semantica semantic extraction pipeline on a file or selected text, NER...

- Repository: https://github.com/semantica-agi/semantica (14373 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add semantica-agi/semantica --skill extract -g -a claude-code -y`
Codex: `npx skills add semantica-agi/semantica --skill extract -g -a codex -y`
Cursor: `npx skills add semantica-agi/semantica --skill extract -g -a cursor -y`
Gemini CLI: `npx skills add semantica-agi/semantica --skill extract -g -a gemini-cli -y`

## Description

Run the full Semantica 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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# /semantica:extract

Run the full extraction pipeline. Usage: `/semantica: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:

```python
from semantica.semantic_extract.cache import extraction_cache
extraction_cache.clear()
```

**3. Run the full pipeline:**

```python
from semantica.semantic_extract import (
    NamedEntityRecognizer,
    RelationExtractor,
    EventDetector,
    CoreferenceResolver,
    TripletExtractor,
    ExtractionValidator,
)

# Named Entity Recognition
ner = NamedEntityRecognizer()
entities = ner.extract(text)

# Relation Extraction
rel = RelationExtractor()
relations = rel.extract(text)

# Event Detection
evt = EventDetector()
events = evt.extract(text)

# Coreference Resolution, resolve pronouns/aliases before extraction
coref = CoreferenceResolver()
resolved_text = coref.resolve(text)

# Triplet Extraction (subject, predicate, object)
triplet = TripletExtractor()
triplets = triplet.extract(resolved_text)

# Validate quality
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)
| Label | Type | Confidence | Span |
|-------|------|------------|------|

**Relations** (M total)
| Source | Relation Type | Target | Confidence |
|--------|---------------|--------|------------|

**Events** (K total)
| Label | Type | Participants | Confidence |
|-------|------|--------------|------------|

**Triplets** (J total)
| Subject | Predicate | Object | Confidence |
|---------|-----------|--------|------------|

The rest: https://github.com/semantica-agi/semantica/blob/HEAD/plugins/skills/extract/SKILL.md
