UNPKG

@typecad/kicad-symbols

Version:

Intelligent fuzzy search for KiCad symbols with CLI interface

88 lines 3.21 kB
import { ParameterParser } from '../interfaces/ParameterParser.js'; import { ParsedParameters } from '../types/index.js'; /** * Data source types that affect parameter parsing behavior */ export declare enum DataSourceType { /** KiCad symbols without electrical values */ KICAD = "kicad" } /** * Implementation of the ParameterParser interface that extracts electrical parameters from search queries * Behavior varies based on data source type */ export declare class ElectricalParameterParser implements ParameterParser { private readonly dataSourceType; private readonly voltagePattern; private readonly capacitancePattern; private readonly resistancePattern; private readonly inductancePattern; /** * Creates a new ElectricalParameterParser * @param dataSourceType - Type of data source to adjust parsing behavior */ constructor(dataSourceType?: DataSourceType); /** * Parses a natural language query to extract electrical parameters * @param query - The search query to parse * @returns Structured parameters extracted from the query */ parseQuery(query: string): ParsedParameters; /** * Extracts non-electrical parameters for KiCad symbols * @param query - The search query to parse * @param result - The result object to populate * @private */ private extractNonElectricalParameters; /** * Extracts an electrical value from the query using the provided regex pattern * @param query - The search query * @param pattern - Regex pattern to match * @returns Electrical value or undefined if not found */ private extractElectricalValue; /** * Extracts implicit resistance values (e.g., "10k resistor") * @param query - The search query * @returns Electrical value or undefined if not found */ private extractImplicitResistance; /** * Extracts implicit capacitance values (e.g., "100n capacitor") * @param query - The search query * @returns Electrical value or undefined if not found */ private extractImplicitCapacitance; /** * Extracts implicit inductance values (e.g., "10u inductor") * @param query - The search query * @returns Electrical value or undefined if not found */ private extractImplicitInductance; /** * Normalizes voltage values to a standard unit (V) * @param value - The extracted voltage value * @returns Normalized voltage value */ private normalizeVoltage; /** * Normalizes capacitance values to a standard unit (F) * @param value - The extracted capacitance value * @returns Normalized capacitance value */ private normalizeCapacitance; /** * Normalizes resistance values to a standard unit (Ω) * @param value - The extracted resistance value * @returns Normalized resistance value */ private normalizeResistance; /** * Normalizes inductance values to a standard unit (H) * @param value - The extracted inductance value * @returns Normalized inductance value */ private normalizeInductance; } //# sourceMappingURL=ParameterParser.d.ts.map