As partial exams just passed at my work (devine.be), the job of carefully entering grades takes a lot of time. A common workflow is
- Correct grades on paper
- Input grades in a spreadsheet with partial grades
- Double-check grades on paper with grades in spreadsheet
- Merge partial grades in a new spreadsheet with global grades
- Input grades in school system
As I was working I was thinking about how nice it would be if I could just speak to my computer and the grades would be filled in automatically.
So I started looking at the possibilities of OSX to transform speech to text, and hooray! There is a class (NSSpeechRecognizer) which makes this possible. That was all I needed to know to create ‘DictaPoint’. A OSX app which has the option to load a csv file with students and then grade them by just talking to my computer. Just to be clear: this is a prototype project and is NOT being used to grade students, but I think it’s a nice and innovative new way of entering grades (and I could play around within the world of mac development ;-), something I hadn’t done before). It’s actually quite easy to go from IOS development to Mac development. I think I had everything up’n’ running in under 3 hours.
NSSpeechRecognizer is a really easy class to use. You provide an array with all the commands it has to recognize and then you just listen to it’s delegate.
[self.speech setCommands:@[@"One",@"Two",@"Three",@"Four",@"Five",@"Six", @"Seven",@"Eight",@"Nine",@"Ten",@"Eleven",@"Twelve",@"Thirteen",@"Fourteen",@"Fifteen",@"Sixteen",@"Seventeen",@"Eighteen",@"Nineteen",@"Twenty", @"Next", @"Previous", @"Export"]];
Objective-CWhen the delegate speechRecognizer:didRecognizeCommand gets triggered, you can check with an if-statement which command has been found and the execute appropriate code.
- (void)speechRecognizer:(NSSpeechRecognizer *)sender didRecognizeCommand:(id)command {
NSLog(@"Detected speech %@", command);
NSString *c = (NSString *)command;
if( [c isEqualToString:@"Next"] ){
// do stuff
}
// ...
}
Objective-CAnd that’s quite it … Below a little screencap of the working app.
Screencap
The code
I’ve put the source code of this project on GitHub, so you check it out for yourself.