From chaney@dans.comSun May 28 09:09:47 1995
Date: Sat, 27 May 1995 07:28:14 -0400 (EDT)
From: Dan Chaney <chaney@dans.com>
To: ears-list@ms.uky.edu
Subject: README for act.c
[ Here is a program that parses the output of 'listen' and provides a VERY rudimentary C-program to build and execute commands with 'listen'. This code is fairly atrocious, but if I don't send it on to people on the ears-list@ms.uky.edu soon, it will be of even less use. -dan ]
README file for act.c 5/95 chaney@dans.com
This is the README file, the sections are:
- What this is (and why)
- What it does, briefly
- Definitions (Because sometimes, I make no sense...)
- What to do to build the program: (This is what you're looking for)
- List of words to say (and the tokens they return)
- What this is (and why) This program is designed to run with Ralf W. Stephan's <ralf@ark.franken.de> 'listen' program from his ears package. This program, 'act', parses the output of 'listen' and builds a sentence based on the output. That sentence may be executed, corrected or dumped entirely. This code is so young (and so bad :) I suspect it will be something to tinker with and then say 'I could do that better if....' Please update the rest of us when you do :-)
Why? Because I don't know c++ well and wanted a C program to tinker with in order to get the voice recognition to execution shell commands.
- What it does (briefly) I found parsing is a much easier thing if you have the words printed by listen (I call them tokens) encased in brackets. Single character tokens such as letters, numbers and punctuation are more easily handled if they are marked as such, (ie [letter-0], [letter-1], [letter-~], etc.)
As a word is spoken and recognized, the []-delimited token is printed by 'listen' and read by 'act'. 'Act' checks to see if the token has special meaning (see 'command tokens') and, if not, adds it into the sentence. Unless the token is marked as a letter (ie, letter-d], a space is added into the sentence between tokens. (A space may be specically added, using the [space] token. Spaces and dashes are important to the Unix command line, so they are handled slightly differently.)
So, given a set of []-delimited words, 'act' will build a string (even allowing you to backspace verbally by saying 'wrong' or 'backspace' or even 'clear'.
- Definitions (Because sometimes, I make no sense...)
Token - the string 'listen' prints out in response to a word.
'act' will ignore anything not in []'s Sentence - the list of tokens printed from 'listen' to 'act' Commands - tokens that 'act' performs on
- What to do to build the program: (This is what you've been looking for)
- Set your default.words file to output the words within brackets. (Edit default.words, put the second word in brackets like [this])
- Check the list of tokens below. 'Act' knows to watch for them and some (marked below) are special to 'act'. Otherwise, the word is just added into the sentence (and may be executed).
- Compile the program up (gcc act.c -o act) and run it (listen | act)
- List of words to say (and the tokens they return)
What you say: listen's output Comments ------------- --------------- ----------------------- edit [vi] Note, two words can have the same vi [vi] token if their meaning is the same exit [quit] quit [quit] list [less] more [less] less [less] no [no] yes [yes] return [return] logout [logout] cdplayer [cdplayer] Bad choice, play a CD, make more noise play [play] My alias for cdplayer info [info] Used with cdplayer stop [stop] Used with 'cdplayer' volume [vol] Adjusts speaker volume phone [phone] Shell script to show phone's status uptime [uptime]
--------------- These are tokens with special meaning to 'act' ------------
execute [execute] Send current sentence to system() call
doit [execute]
wrong [wrong] Remove last token from sentence
space [space] Add a space into the sentence
dash [-] Add a dash into the sentence
backspace [backspace] Remove one space from sentence
clear [clear] Clear current sentence (start over)
show [show] Show current sentence
abort [abort] Exit 'listen' completely
restart [restart] Tries to restart 'listen | act' command
mute [mute] Toggle whether words are added to
the sentence.
computer [computer] Check to see if program is running
--------------- These are tokens that 'act' converts to commands -----------
call [call] Convert 'call' into 'cu -l /dev/ttyS2' xterm [xterm] Convert 'xterm' into 'xterm &' Mosaic [Mosaic] Convert 'call' into 'Mosaic &'
--------------- These are single-character tokens for spelling and numbers
slash [letter-/] dot [letter-.] tilde [letter-~] Zero [letter-0] One [letter-1] Two [letter-2] Three [letter-3] Four [letter-4] Five [letter-5] Six [letter-6] Seven [letter-7] Eight [letter-8] Nine [letter-9] alfa [letter-a] bravo [letter-b] charlie [letter-c] delta [letter-d] echo [letter-e] bad choice since its a Unix command foxtrot [letter-f] golf [letter-g] hotel [letter-h] india [letter-i] juliet [letter-j] kilo [letter-k] lima [letter-l] mike [letter-m] november [letter-n] oscar [letter-o] papa [letter-p] quebec [letter-q] romeo [letter-r] sierra [letter-s] tango [letter-t] uniform [letter-u] victor [letter-v] whiskey [letter-w] x-ray [letter-x] yankee [letter-y] zulu [letter-z] comma [letter-,]
Comments, suggestions and code updates welcome, chaney@dans.com
--
-- Daniel Chaney From home, work or play... Fax: 606-253-2495 --
-- 715 Patterson Office Tower, Lexington, KY 40526-0027 606-257-2150 --
-- {uunet and the like}!ukma!chaney chaney@ms.uky.edu chaney@dans.com --
-- "I'll have time enough for sleep when I'm dead and in the ground" --
