Do - Listen, Process, Act & Learn
This section is about the brain of the operation.
The Natural Language Processor.
Key Features
Pattern Matching Engine
Dual-layer system with pre-compiled regex for exact matches and Levenshtein-based fuzzy matching as fallback.
Automatic parameter extraction and 15% tolerance threshold for natural input errors.
Supports command chaining by splitting patterns with pre-defined word in the module option.
Declarative Pattern Definition
All command patterns and variants defined in Nix.
Build-time pattern expansion eliminates runtime regex compilation.
Prioritization by weight, complexity, and lexicographic order.
Signature-Based Fuzzy Index
Pre-computed, word-orderโindependent signatures for accelerated fuzzy lookup.
Optimized for large-scale command sets and voice variations.
Parameter & Entity System
Supports required, alternative, and optional parameters.
Entity resolution maps natural phrases to canonical flags or arguments.
Three Parameter Types:
{param} - Required parameters with entity resolution
(option1|option2) - Required alternative
[optional|words] - Optional components
Extensive Sentence Testing Framework
Generates test cases by expanding sentence patterns with optional words and alternatives.
Validates both exact and fuzzy matching against defined voice commands.
Verifies command recognition accuracy, handles parameter extraction, and provides detailed statistics about voice command coverage and performance.
Conflict-Free Validation
Build-time assertion checks prevent overlapping or ambiguous sentence definitions.
Detects prefix and duplicate conflicts before deployment.
Statistical Learning
Tracks match success rates, fuzzy distance effectiveness, and failure patterns.
Feeds data back into model tuning and pattern optimization.
Real-Time Voice Mode
Rust-based WebSocket client handles live transcription and NLP intent recognition.
Enables hands-free interaction and compound command handling.
The Brain of the Voice Assistant
The natural language processor is the brain of my dotfiles.
It translates human text into Shell commands.
It began in Bash as a world-class challenge, worked flawlessly - until my /bin grew.
Now it's in Rust and faster than ever.
User defines sentences in Nix, and at build time it dynamically generates regex patterns.
At runtime it automatically resolves entities to properly generate the parameters before execution.
What Does All THis Mean?
It means that I can say for example:
"Update the flake and rebuild the system and deploy dad's media server and wait 5 minutes and check for errors at dad's media server"
Another usage example:
"play the movie the mighty ducks"
โฎ View 'play the movie the mighty ducks' Usage
๐ฆ๐ HOME via ๎ via ๐ v3.12.10 via ๐ฆ v1.86.0 :41:04 โฏ yo do "spela upp filmen the mighty ducks" [๐ฆ๐] [19:41:11] โ INFOโ โฎ [๐ฆ๐ง ] 'spela upp filmen the mighty ducks" [๐ฆ๐] โ INFOโ โฎ MEMORY ADJUSTMENT: tv: base=3 โ adjusted=0 (uses=5, confirms=1, context=YES) [๐ฆ๐] โ INFOโ โฎ MEMORY ADJUSTMENT: tv-guide: base=3 โ adjusted=3 (uses=0, confirms=0, context=NO) [๐ฆ๐] โ INFOโ โฎ MEMORY ADJUSTMENT: call-remote: base=3 โ adjusted=3 (uses=0, confirms=0, context=NO) ๐ฆMEMORY:ARGS:--typ movie --search the mighty ducks ๐ฆMEMORY:SENTENCE:spela upp {typ} {search} ๐ฆMEMORY:TYPE:exact โโ(yo-tv) โ๐ฆ qwack!? spela upp {typ} {search} โโโฎ --typ movie โโโฎ --search the mighty ducks โโโฐ do took 23.914604ms Playlist generated: /Pool/playlist.m3u (shuffle: true) ๐ฆ Recorded: tv - spela upp {typ} {search}
โฎ but does it understand ducks?? quack quack quack quack quack quack quack