@flexabrain/mcp-server
Version:
Advanced electrical schematic analysis MCP server with rail engineering expertise
95 lines • 3.12 kB
TypeScript
/**
* FlexaBrain MCP Server - Electrical Component Classification Engine
*
* Advanced component classification system leveraging rail electrical engineering expertise.
* Identifies and classifies electrical components from OCR results using pattern matching,
* context analysis, and domain knowledge.
*/
import { ComponentType, ComponentCategory, ElectricalComponent, SafetyLevel, BoundingBox } from '../types/electrical.js';
import { OCRResult, OCRWord } from '../types/schematic.js';
export interface ClassificationContext {
schematic_type?: string;
rail_system_type?: string;
voltage_level?: number;
surrounding_text?: string[];
image_region?: string;
}
export interface ComponentMatch {
component_id: string;
type: ComponentType;
pattern_match: RegExp;
confidence: number;
context_score: number;
location: BoundingBox;
ocr_word: OCRWord;
}
export declare class ElectricalComponentClassifier {
private readonly MINIMUM_CONFIDENCE;
private readonly CONTEXT_BOOST_FACTOR;
private readonly PATTERN_CONFIDENCE_WEIGHT;
private readonly OCR_CONFIDENCE_WEIGHT;
/**
* Classify electrical components from OCR results
*/
classifyComponents(ocrResult: OCRResult, context?: ClassificationContext): Promise<ElectricalComponent[]>;
/**
* Find potential component matches for a single OCR word
*/
private findComponentMatches;
/**
* Calculate confidence score for pattern matching
*/
private calculatePatternConfidence;
/**
* Calculate context-based confidence boost
*/
private calculateContextScore;
/**
* Combine different confidence scores
*/
private combineConfidences;
/**
* Apply context analysis to filter and improve matches
*/
private applyContextAnalysis;
/**
* Validate that a component match makes sense in context
*/
private validateComponentMatch;
/**
* Check if component ID format is valid for the component type
*/
private isValidComponentId;
/**
* Check if component type is appropriate for schematic type
*/
private isComponentAppropriateForSchematic;
/**
* Create ElectricalComponent object from match
*/
private createElectricalComponent;
/**
* Determine component category based on type
*/
private determineComponentCategory;
/**
* Determine safety level based on component type and specifications
*/
private determineSafetyLevel;
/**
* Remove duplicate components (same ID, overlapping locations)
*/
private deduplicateComponents;
/**
* Get classification statistics
*/
getClassificationStats(components: ElectricalComponent[]): {
total: number;
by_type: Record<ComponentType, number>;
by_category: Record<ComponentCategory, number>;
by_safety_level: Record<SafetyLevel, number>;
average_confidence: number;
};
}
export declare const electricalComponentClassifier: ElectricalComponentClassifier;
//# sourceMappingURL=component-classifier.d.ts.map