Knowledge Capture
Capture and structure knowledge from unstructured data
Overview
Knowledge Capture component helps you capture and structure knowledge from unstructured data sources. It provides intelligent organization and structuring capabilities for raw information.
What is Knowledge Capture?
Knowledge Capture is the process of extracting meaningful information from unstructured sources and organizing it into a structured format that can be easily queried and analyzed.
Key Features
- Intelligent Structuring: Automatically organizes unstructured data
- Entity Recognition: Identifies and extracts key entities
- Relationship Mapping: Maps relationships between entities
- Context Preservation: Maintains context during capture
- Multiple Input Formats: Supports various data sources
Basic Usage
import { KnowledgeCapture } from 'gaik-toolkit';
// Create a knowledge capture instance
const capture = new KnowledgeCapture();
// Capture knowledge from text
const knowledge = await capture.captureFromText(text);
console.log(knowledge.entities);
console.log(knowledge.relationships);API Reference
KnowledgeCapture
Main class for capturing and structuring knowledge.
Constructor
const capture = new KnowledgeCapture(options);Options:
language(string): Language for processing (default: 'en')entityTypes(array): Types of entities to extractincludeRelationships(boolean): Include relationship mapping (default: true)
Methods
captureFromText(text: string): Promise<Knowledge>
Captures knowledge from text content.
Parameters:
text: Text content to process
Returns: Promise resolving to Knowledge object
Example:
const knowledge = await capture.captureFromText('Sample text...');captureFromDocument(document: ParseResult): Promise<Knowledge>
Captures knowledge from a parsed document.
Parameters:
document: ParseResult from Parser component
Returns: Promise resolving to Knowledge object
Knowledge
Result object containing captured knowledge.
Properties:
entities(array): Extracted entities with metadatarelationships(array): Relationships between entitiesconcepts(array): Key concepts identifiedsummary(string): Generated summarymetadata(object): Additional metadata
Usage Examples
Capturing from Parsed Documents
import { Parser, KnowledgeCapture } from 'gaik-toolkit';
const parser = new Parser();
const capture = new KnowledgeCapture();
// Parse document
const document = await parser.parse('document.pdf');
// Capture knowledge
const knowledge = await capture.captureFromDocument(document);
console.log('Entities:', knowledge.entities);
console.log('Concepts:', knowledge.concepts);Custom Entity Types
const capture = new KnowledgeCapture({
entityTypes: ['person', 'organization', 'location', 'date'],
includeRelationships: true
});
const knowledge = await capture.captureFromText(text);Working with Relationships
const knowledge = await capture.captureFromText(text);
// Access relationships
knowledge.relationships.forEach(rel => {
console.log(`${rel.source} -> ${rel.type} -> ${rel.target}`);
});Advanced Features
Entity Filtering
const knowledge = await capture.captureFromText(text);
// Filter entities by type
const people = knowledge.entities.filter(e => e.type === 'person');
const organizations = knowledge.entities.filter(e => e.type === 'organization');Knowledge Graph
// Build a knowledge graph
const graph = capture.buildGraph(knowledge);
// Query the graph
const connections = graph.findConnections(entity1, entity2);Integration with Other Components
Knowledge Capture works seamlessly with other GAIK toolkit components:
import { Parser, KnowledgeCapture, KnowledgeExtraction } from 'gaik-toolkit';
// Parse -> Capture -> Extract workflow
const document = await parser.parse('document.pdf');
const knowledge = await capture.captureFromDocument(document);
const insights = await extractor.extract(knowledge, query);Next Steps
- Explore Knowledge Extraction
- Check out Semantic Video Search Example
- Learn about the Parser component