[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GFlash

> Kyle,how hard would it be to add an input database to GFlash and some
> plug in means of extracting the data based on some critera such as right
> or wrong answers. It seems like it wouldn't take much to make GFlash
> really useful.

The way it's written now, you could just grep the output for '[response]'.
Here's a sample output I just produced:
[question]: "1 - What is the sound of one hand clapping?"
[response]:  "silence"

[question]: "2 - What is the color of music?"
[response]:  "green"

[question]: "3 - Can a dog smile?"
[response]:  "no"

[question]: "4 - how many fingers am I holding up?"
[response]:  "D"

[question]: "5 - what does this logo sound like?

  Press the 'Run' button, and remember
  to close the other application before continuing
[response]:  "an excs"
4,"an excs"

You could use something like a simple perl script to match up the questions 
with the responses.  at that point, you could put them into any format you 
wanted.  The following perl code does just that and produces CSV (comma
seporated value) output, but it could just as easily be modified to 
insert the data into a database, or whatever else you can write code to do.

#!/usr/bin/perl -w
use strict;

undef $/;
my $entire_text = <STDIN>;

my @questions = ($entire_text =~ /\[question\]:\s+("[^"]+")/g);
my @responses = ($entire_text =~ /\[response\]:\s+("[^"]+")/g);

#print "Questions:\n", join("\n",@questions), "\n\n";
#print "Responses:\n", join("\n",@responses), "\n\n";

if( @questions != @responses ) {
  die "Error, number of questions: ", scalar(@questions),
    " doesn't match the number of responses: ", scalar(@questions), "\n";

# for example, output as a csv file...
my $i;
for( $i = 0; $i < @responses; ++$i ) {
  print join(',',($i+1),$responses[$i]), "\n";

And for the above sample, this is what we get as output:

5,"an excs"

The input file/language should be easy to produce given a dataset also.
If you let me know what you have in mind (input format[s]/output format[s]),
I might be better able to help -- perhaps even code something for you.

Working with gflash output, it should be a simple matter of a few regular
expressions (as in the perl code).  I could add something in to the code for
gflash itself if that's a request, but I'd need to know what format(s) would
be most useful -- and easy to code (as my time is usualy limited).



Much of the excitement we get out of our work is that we don't really know
what we are doing. 
    -- E. Dijkstra 
mortis@voicenet.com                            http://www.voicenet.com/~mortis