semantic-ds-toolkit
Version:
Performance-first semantic layer for modern data stacks - Stable Column Anchors & intelligent inference
64 lines • 2.42 kB
TypeScript
import { AnchorReconciliationResult } from '../types/anchor.types';
export interface SemanticContext {
anchor_id: string;
semantic_type: string;
confidence: number;
metadata: Record<string, any>;
inferred_relations: string[];
domain_specific_tags: string[];
}
export interface ShadowSemanticOptions {
confidence_threshold: number;
auto_inference: boolean;
preserve_original: boolean;
enable_caching: boolean;
semantic_domains: string[];
}
export interface DataFrameLike {
columns: string[];
dtypes: Record<string, string>;
shape: [number, number];
sample: (n?: number) => Record<string, any[]>;
getColumn: (name: string) => any[];
}
export interface SemanticAttachment {
column_name: string;
semantic_context: SemanticContext;
attachment_timestamp: string;
confidence_score: number;
auto_inferred: boolean;
}
export declare class ShadowSemanticsLayer {
private anchorSystem;
private semanticAttachments;
private dataframeCache;
private options;
constructor(options?: Partial<ShadowSemanticOptions>);
attachSemanticsShadow(dataframe: DataFrameLike, options?: Partial<{
dataset_name: string;
force_recompute: boolean;
custom_semantics: Record<string, Partial<SemanticContext>>;
}>): {
semantic_attachments: SemanticAttachment[];
reconciliation_result: AnchorReconciliationResult;
dataframe_id: string;
};
getSemanticContext(dataframeId: string, columnName: string): SemanticContext | null;
listSemanticAttachments(dataframeId?: string): SemanticAttachment[];
removeSemanticAttachment(dataframeId: string, columnName: string): boolean;
updateSemanticContext(dataframeId: string, columnName: string, updates: Partial<SemanticContext>): boolean;
private generateDataframeId;
private convertToColumnData;
private mapDataType;
private getExistingAnchors;
private inferSemanticContext;
private inferSemanticType;
private enhanceSemanticTypeFromAnchor;
private inferRelations;
private inferDomainTags;
private buildSemanticContext;
private createBasicSemanticContext;
exportSemanticMappings(dataframeId?: string): Record<string, SemanticAttachment>;
importSemanticMappings(mappings: Record<string, SemanticAttachment>, dataframeId: string): void;
}
//# sourceMappingURL=shadow-semantics.d.ts.map