Skip to content

Instantly share code, notes, and snippets.

@drusepth
Created July 18, 2012 04:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drusepth/3134188 to your computer and use it in GitHub Desktop.
Save drusepth/3134188 to your computer and use it in GitHub Desktop.
voice2code demo
Loading voice2code.js ... No errors!
process_speech_input("loop from 1 to 10")
=> Processing: loop from 1 to 10
spoken_code
=> ["loop from 1 to 10"]
generated_code
=> ["for (gpNqkpKMvWYH = 1; gpNqkpKMvWYH <= 10; gpNqkpKMvWYH++) { {{loop_body}} }"]
code_metadata
=> [Object -- iterator: "gpNqkpKMvWYH", type: "loop", __proto__: Object]
process_speech_input("print the number")
=> Processing: print the number
spoken_code
=> ["loop from 1 to 10", "print the number"]
generated_code
=> ["for (gpNqkpKMvWYH = 1; gpNqkpKMvWYH <= 10; gpNqkpKMvWYH++) { console.log(gpNqkpKMvWYH); }"]
process_speech_input("print done")
=> Processing: print done
spoken_code
=> ["loop from 1 to 10", "print the number", "print done"]
generated_code
=> ["for (gpNqkpKMvWYH = 1; gpNqkpKMvWYH <= 10; gpNqkpKMvWYH++) { console.log(gpNqkpKMvWYH); } console.log('done')"]
run_code(generated_code);
=> 1
=> 2
=> 3
=> 4
=> 5
=> 6
=> 7
=> 8
=> 9
=> 10
=> done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment