CommandConverter
Defined in: CommandConverter.ts:29
CommandConverter processes transcribed text in real-time, tokenizes it, and matches words against the CommandLibrary.
This class:
- Tokenizes incoming transcription text into individual words
- Normalizes and cleans tokens (lowercase, trim, remove punctuation)
- Checks each token against the CommandLibrary
- Uses SynonymResolver to check for synonym matches
- Sends matched commands to CommandHistory with timestamps
- Automatically executes matched commands
- Invokes callback when commands are matched
Methods
getConfidenceMatcher()
getConfidenceMatcher(): ConfidenceMatcher;
Defined in: CommandConverter.ts:72
Gets the confidence matcher instance for configuration
Returns
ConfidenceMatcher
The confidence matcher instance
getSynonymResolver()
getSynonymResolver(): SynonymResolver;
Defined in: CommandConverter.ts:81
Gets the synonym resolver instance
Returns
The synonym resolver instance
processTranscription()
processTranscription(transcription, speakerId?): Promise<GameCommand[]>;
Defined in: CommandConverter.ts:186
Processes new transcription text by tokenizing it and checking each token against the CommandLibrary using multiple matching strategies:
- Direct command match
- Registered synonym match
- API-based synonym match
- Confidence/phonetic matching
For each matched command:
- Logs it to the command log with a timestamp
- Logs it to the logger with full details
- Automatically executes the command's action/callback function
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The new transcribed text from getTranscribed() |
|
| Optional speaker identifier for multi-speaker mode |
Returns
Promise<GameCommand[]>
Array of matched commands found in the transcription
getInstance()
static getInstance(): CommandConverter;
Defined in: CommandConverter.ts:61
Returns the singleton instance of CommandConverter.
Returns
CommandConverter
The single shared instance.