feat: expose neural entity extraction APIs (v5.7.6 - Workshop request)
Addresses Workshop team's request for direct access to neural extraction classes.
**Changes:**
1. **New Exports** (src/index.ts):
- `NeuralEntityExtractor` - Full extraction orchestrator
- `SmartExtractor` - Entity type classifier (4-signal ensemble)
- `SmartRelationshipExtractor` - Relationship type classifier
- Types: `ExtractedEntity`, `ExtractionResult`, `RelationshipExtractionResult`, etc.
2. **Package.json Subpath Exports**:
```typescript
// Enable direct imports:
import { NeuralEntityExtractor } from '@soulcraft/brainy/neural/entityExtractor'
import { SmartExtractor } from '@soulcraft/brainy/neural/SmartExtractor'
import { SmartRelationshipExtractor } from '@soulcraft/brainy/neural/SmartRelationshipExtractor'
```
3. **New brain.extractEntities() Method** (brainy.ts:3254):
- Alias for `brain.extract()` with clearer naming
- Documented with examples and architecture details
- 4-signal ensemble: ExactMatch (40%) + Embedding (35%) + Pattern (20%) + Context (5%)
4. **Comprehensive Documentation** (docs/neural-extraction.md):
- Complete neural extraction guide (200+ lines)
- API reference for all extraction classes
- Performance optimization tips
- Import preview mode documentation
- Confidence scoring explanation
- 42 NounType detection methods
- Troubleshooting guide
- Real-world examples
5. **README Updates**:
- Added "Entity Extraction" section with examples
- Links to neural extraction guide
- Import preview mode link
**Features:**
- ⚡ Fast extraction: ~15-20ms per entity
- 🎯 4-signal ensemble architecture
- 📊 Format intelligence (Excel, CSV, PDF, YAML, DOCX, JSON, Markdown)
- 🌍 42 universal noun types + 127 verb types
- 💾 LRU caching built-in
- 🧪 Production-tested in import pipeline
**Usage:**
```typescript
// Simple API (recommended)
const entities = await brain.extractEntities('John Smith founded Acme Corp', {
types: [NounType.Person, NounType.Organization],
confidence: 0.7
})
// Advanced API (custom configuration)
import { SmartExtractor } from '@soulcraft/brainy'
const extractor = new SmartExtractor(brain, { minConfidence: 0.8 })
const result = await extractor.extract('CEO', {
formatContext: { format: 'excel', columnHeader: 'Title' }
})
```
**Backward Compatible:** All existing APIs unchanged. New exports are pure additions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
201fbed78c
commit
8cca096d7e
5 changed files with 794 additions and 0 deletions
12
package.json
12
package.json
|
|
@ -39,6 +39,18 @@
|
|||
"./universal": {
|
||||
"import": "./dist/universal/index.js",
|
||||
"types": "./dist/universal/index.d.ts"
|
||||
},
|
||||
"./neural/entityExtractor": {
|
||||
"import": "./dist/neural/entityExtractor.js",
|
||||
"types": "./dist/neural/entityExtractor.d.ts"
|
||||
},
|
||||
"./neural/SmartExtractor": {
|
||||
"import": "./dist/neural/SmartExtractor.js",
|
||||
"types": "./dist/neural/SmartExtractor.d.ts"
|
||||
},
|
||||
"./neural/SmartRelationshipExtractor": {
|
||||
"import": "./dist/neural/SmartRelationshipExtractor.js",
|
||||
"types": "./dist/neural/SmartRelationshipExtractor.d.ts"
|
||||
}
|
||||
},
|
||||
"browser": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue