TalknType: Difference between revisions
mNo edit summary |
(form) |
||
(24 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Olpcboxtop|toptext=[[{{PAGENAME}}|TalknType]]}} |
|||
This will eventually be an Activity based on the 1970s toy, [[http://en.wikipedia.org/wiki/Speak_%26_Spell_%28toy%29 Speak&Spell]]. |
|||
{{ OBX activity |[[Image:Talkntype_icon_plain.svg]]|extra<!--|{{{text}}}--> }} |
|||
{{ OBX source dev|activities/talkntype}} |
|||
{{ OBX team |[[user:Tomhannen|TomHannen]]...}} |
|||
<small>see more [[:Category:OBX templates|templates]] or [[OBX proposals|propose new]]</small> |
|||
{{Olpcboxbottom}} |
|||
This will eventually be an Activity based on the 1970s toy, [http://en.wikipedia.org/wiki/Speak_%26_Spell_%28toy%29 Speak&Spell]. |
|||
[[Image:TI_SpeakSpell_no_shadow.jpg|thumb|right|The original Speak & Spell toy from the 1970s.]] |
[[Image:TI_SpeakSpell_no_shadow.jpg|thumb|right|The original Speak & Spell toy from the 1970s.]] |
||
== Initial Activity Idea == |
== Initial Activity Idea == |
||
* User opens the activity, and is presented with a skill level (1 to 4). |
* User opens the activity, and is presented with a skill level (1 to 4). |
||
* The activity speaks, using the eSpeak [[Speech_synthesis|Speech Synthesis]] software |
* The activity speaks, using the eSpeak [[Speech_synthesis|Speech Synthesis]] software |
||
* The activity asks the user to spell a word from the dictionary (one of four, based on the skill level). |
* The activity asks the user to spell a word from the dictionary (one of four, based on the skill level). |
||
* As the user types each letter, the activity reads the letters out loud. |
* As the user types each letter, the activity reads the letters out loud. |
||
Line 10: | Line 18: | ||
* The activity compares the entered letters with the real word, and informs the user whether the word was spelt correctly or not. |
* The activity compares the entered letters with the real word, and informs the user whether the word was spelt correctly or not. |
||
* Another random word is offered for the user, etc, etc. |
* Another random word is offered for the user, etc, etc. |
||
== Video demo == |
|||
Extremely blurry demo of how the app works currently... The sound is more important than the video... |
|||
<youtube>ZvYlJVfyJsg</youtube> |
|||
== Installing == |
== Installing == |
||
The code |
The code [[http://dev.laptop.org/git?p=activities/talkntype here]] isn't ready for general use yet - it doesn't use the Sugar user interface, and only uses the terminal within sugar. |
||
* You will need to save the code at the bottom of the page as '''talkntype.py''' in a directory. |
|||
* You will need a copy of the '''sugar-speechd''' speech server. |
|||
* You will need three audio files for the '''correct.wav''' '''incorrect.wav''' and '''begin.wav'''. |
|||
* Make sure your loudspeaker volume is turned up, using the keyboard keys. |
* Make sure your loudspeaker volume is turned up, using the keyboard keys. |
||
* Open a copy of the Terminal activity. Change to root user: |
* Open a copy of the Terminal activity. Change to root user: |
||
su - |
su - |
||
* Download the code and associated files into a directory: |
|||
[[git-clone]] git://dev.laptop.org/activities/talkntype |
|||
*note: you might need to install git-core for this to work. To do that, type |
|||
yum install git-core |
|||
* Make sure the '''sugar-speechd''' and '''talkntype.py''' files are executable |
|||
cd talkntype |
|||
chmod a+x 01talkntype.py |
|||
chmod a+x sugar-speechd |
|||
* Get out of root user, and do the rest of the instructions as the OLPC user. |
|||
exit |
|||
* Then run the '''sugar-speechd''' speech server: |
* Then run the '''sugar-speechd''' speech server: |
||
./sugar-speechd |
./sugar-speechd |
||
* The terminal will appear frozen, but this is ok. It means the server is running. Go back to the desktop (Home), and open another Terminal activity. |
* The terminal will appear frozen, but this is ok. It means the server is running. Go back to the desktop (Home), and open another Terminal activity. |
||
* |
* Go to the directory that '''talkntype.py''' is stored in by typing |
||
cd talkntype |
|||
* |
*run it by typing: |
||
python |
python 01talkntype.py |
||
* You will need to type quite slowly. |
* You will need to type quite slowly. |
||
* There is no Backspace key |
* There is no Backspace key. |
||
* To exit the program, press |
* To exit the program, press 9 instead of entering a word. |
||
== To do == |
== To do == |
||
* Sugarise the idea into something usable by normal people! I have no real programming knowledge, so all help would be greatly appreciated! Please contact me via my [[User:tomhannen|userpage]]. |
* Sugarise the idea into something usable by normal people! I have no real programming knowledge, so all help would be greatly appreciated! Please contact me via my [[User:tomhannen|userpage]]. |
||
* Make an icon |
|||
* Include collaborative elements - spelling against a friend? |
* Include collaborative elements - spelling against a friend? |
||
* Upload the code somewhere (but I don't know how git and dev.laptop really operate...) |
|||
* Upload the 3 audio files called in the code below. |
|||
== Code == |
== Code == |
||
The code (such as it is so far) can be found at [[http://dev.laptop.org/git?p=activities/talkntype http://dev.laptop.org/git?p=activities/talkntype]] |
|||
Below is the code for the '''talkntype.py''' program. |
|||
== Dictionaries == |
|||
#!/bin/env python |
|||
The code above only uses the simplest (level 1) dictionary, and doesn't have any of the vocabulary refinements of the original toy (ie doesn't say "spell FOR, as in for me", or "spell FOUR, as in number four". |
|||
import sys |
|||
import os |
|||
The original dictionaries are presented below, as comma separated variable sets: |
|||
import dbus |
|||
import random |
|||
'''Dictionary Level 1:''' |
|||
import time |
|||
"above","angel","answer","calf","does","earth","echo","extra","for","four","guess","half","health","iron","learn","ocean","once","one","oven","pint","pull","range","says","ski","sure","swap","talk","to","touch","two","view","warm","was","wash","word" |
|||
wordlist = [ "above","angel","answer","calf","does","earth","echo","extra","for","four","guess","half","health","iron","learn","ocean","once","one","oven","pint","pull","range","says","ski","sure","swap","talk","to","touch","two","view","warm","was","wash","word" ] |
|||
'''Dictionary Level 2:''' |
|||
bus = dbus.SessionBus() |
|||
"another","beauty","beige","blood","bullet","carry","chalk","child","danger","early","eight","flood","floor","front","guide","haste","heaven","linger","mirror","other","priest","ready","rural","school","squad","squat","sugar","today","union","watch","water","yield" |
|||
APLAY = "/usr/bin/aplay" |
|||
'''Dictionary Level 3:''' |
|||
size = len(wordlist) |
|||
"already","believe","built","bushel","comfort","coming","couple","cousin","enough","finger","guard","healthy","heavy","instead","laugh","measure","mother","niece","outdoor","period","plague","police","promise","quiet","ranger","relief","remove","search","shield","should","shovel","someone","source","statue","terror","trouble","welcome","wolves","woman","wonder","worth" |
|||
index = random.randint(0, size-1) |
|||
elem = wordlist[index] |
|||
'''Dictionary Level 4:''' |
|||
espeak_object = bus.get_object('org.laptop.Speech','/org/laptop/Speech') |
|||
answer = "" |
|||
"abscess","ancient","anything","brother","bureau","butcher","caravan","circuit","corsage","couldn't","courage","discover","dungeon","earnest","feather","freight","greater","jealous","journey","language","laughter","leisure","lettuce","machine","minute","pierce","pleasure","plunger","poultry","quotient","reindeer","rhythm","schedule","scissors","serious","shoulder","stomach","stranger","surgeon","tomorrow","treasure","workman","yacht" |
|||
clearit = "" # Because I couldn't null a string |
|||
'''Interface Words:''' |
|||
# My class for key detection |
|||
"a","as in","b","c","correct","d","e","eight","f","five","four","g","h","here is your score","i","i win","is","j","k","l","m","n","next spell","nine","now spell","now try","o","one","p","perfect score","q","r","s","say it","seven","six","spell","t","ten","that is correct","that is incorrect","that is right","three","try","two","u","v","w","wrong","wrong try again","x","y","you are correct","you are right","you win","z","zero" |
|||
class _Getch: |
|||
"""Gets a single character from standard input. Does not echo to the screen.""" |
|||
== Personal Spelling Lists == |
|||
def __init__(self): |
|||
I've had a lot of fun with this activity by entering in personal spelling lists for my users. I created a custom list with abiword. |
|||
try: |
|||
*Open Write, then abiword. Directions for this are at http://olpcnews.com/forum/index.php?topic=41.msg5536#msg5536. |
|||
self.impl = _GetchWindows() |
|||
*Open a word list by going into File then Open. |
|||
except ImportError: |
|||
*This will open a dialog box. On the "name" side, click on the talkntype folder. |
|||
self.impl = _GetchUnix() |
|||
*Select a word list. I choose words_d.txt |
|||
*edit the list, keeping the comma between the words |
|||
def __call__(self): return self.impl() |
|||
*You will not be able to save over the original list. So do a save as in the default folder, which should be olpc. Enter "words_d" in the title box and make sure you save as a .txt file. |
|||
*Repeat the process for the "pronounce_d.txt" file. |
|||
class _GetchUnix: |
|||
*Now it's time to move the files into the right place by exiting abiword and going into terminal. |
|||
def __init__(self): |
|||
*To do that, first I typed: |
|||
import tty, sys |
|||
su |
|||
*Then |
|||
def __call__(self): |
|||
cd /home/olpc/talkntype |
|||
import sys, tty, termios |
|||
*Make a backup file of the word list you will change. I picked word list d: |
|||
fd = sys.stdin.fileno() |
|||
mv words_d.txt words_d.txt.old |
|||
old_settings = termios.tcgetattr(fd) |
|||
mv pronounce_d.txt pronounce_d.txt.old |
|||
try: |
|||
*now move your word files into talkntype |
|||
tty.setraw(sys.stdin.fileno()) |
|||
cd /home/olpc |
|||
ch = sys.stdin.read(1) |
|||
mv words_d.txt talkntype/words_d.txt |
|||
finally: |
|||
mv pronouce_d.txt talkntype/pronouce_d.txt |
|||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) |
|||
*close terminal |
|||
return ch |
|||
*follow the instructions above to launch the program. Choose difficulty level 4 to activate the new words. |
|||
class _GetchWindows: |
|||
def __init__(self): |
|||
import msvcrt |
|||
def __call__(self): |
|||
import msvcrt |
|||
return msvcrt.getch() |
|||
getch = _Getch() |
|||
# MAIN LOOP |
|||
os.popen("aplay --quiet begin.wav") # play sound |
|||
for x in range(35): |
|||
index = random.randint(0, size-1) |
|||
elem = wordlist[index] |
|||
answer = clearit # null the string again |
|||
print "Spell..." |
|||
espeak_object.SayText("Spell " + elem) |
|||
# get an answer |
|||
print 'Type your answer, or press the spacebar to repeat the word, or 1 to quit' |
|||
for longestinput in range(15): |
|||
inkey = _Getch() |
|||
import sys |
|||
for i in xrange(sys.maxint): |
|||
k=inkey() |
|||
if k<>'':break |
|||
print k, |
|||
espeak_object.SayText(k) |
|||
answer = answer + k |
|||
if k == " ": # if the user wants the word repeated |
|||
espeak_object.SayText(elem) |
|||
answer = clearit + k # because I don't know how to null a string |
|||
print |
|||
if k == "1": |
|||
espeak_object.SayText("goodbye") |
|||
sys.exit() # quit the program |
|||
if k == "\r":break |
|||
# say the answer |
|||
answer = answer.strip() # remove any whitespace from the user's answer |
|||
print # because I don't know how to do linebreaks |
|||
print "You typed", answer |
|||
espeak_object.SayText("You typed " + answer) |
|||
# check for correct |
|||
if answer == elem: |
|||
os.popen("aplay --quiet correct.wav") # play sound |
|||
print "Correct!" |
|||
espeak_object.SayText("Correct") |
|||
answer = clearit # null the string again |
|||
# check for incorrect |
|||
else: |
|||
os.popen("aplay --quiet incorrect.wav") # play sound |
|||
print "Incorrect answer." |
|||
espeak_object.SayText("Incorrect answer...") |
|||
print "The correct spelling of " + elem + " is " |
|||
espeak_object.SayText("The correct spelling of " + elem + "... is ") |
|||
def shout(string): |
|||
for character in string: |
|||
print character + " " |
|||
espeak_object.SayText(character) |
|||
shout(elem) |
|||
time.sleep(0.5) |
|||
print elem |
|||
espeak_object.SayText(elem) # say the word again in full with some pauses at each end |
|||
time.sleep(0.5) |
|||
print |
|||
answer = clearit # null the string again |
|||
== Other links == |
== Other links == |
||
* [[Screen_Reader]] Another OLPC activity using the eSpeak modules. |
* [[Screen_Reader]] Another OLPC activity using the eSpeak modules. |
||
* [[Speech_synthesis]] Speech Synthesis on the OLPC. |
* [[Speech_synthesis]] Speech Synthesis on the OLPC. |
||
* [[Listen_and_Spell]] A suggestion for a further developed version of TalknType |
|||
* [[http://www.speaknspell.co.uk/]] Flash version of the Speak & Spell |
* [[http://www.speaknspell.co.uk/]] Flash version of the Speak & Spell |
||
* [[http://www.handheld.remakes.org/online/speaknspell.htm]] Another Speak & Spell emulator |
* [[http://www.handheld.remakes.org/online/speaknspell.htm]] Another Speak & Spell emulator |
||
* [[http://en.wikipedia.org/wiki/Speak_%26_Spell_%28toy%29 Speak&Spell] Wikipedia article] |
* [[http://en.wikipedia.org/wiki/Speak_%26_Spell_%28toy%29 Speak&Spell]] Wikipedia article] |
||
[[Category:Software]] |
|||
[[Category:Software ideas]] |
|||
[[Category:Speech Synthesis]] |
|||
{{Activity page |
|||
|icon=Image:Talkntype_icon_plain.svg |
|||
|genre=Games |
|||
|short description=This will eventually be an Activity based on the 1970s toy, Speak&Spell. |
|||
|contact person=User:Tomhannen |
|||
|activity source=http://dev.laptop.org/git?p=activities/talkntype |
|||
|devel status=2. Pre-Alpha |
|||
}} |
Latest revision as of 00:09, 8 August 2008
see more templates or propose new |
This will eventually be an Activity based on the 1970s toy, Speak&Spell.
Initial Activity Idea
- User opens the activity, and is presented with a skill level (1 to 4).
- The activity speaks, using the eSpeak Speech Synthesis software
- The activity asks the user to spell a word from the dictionary (one of four, based on the skill level).
- As the user types each letter, the activity reads the letters out loud.
- When the user presses Enter, the activity reads the entered letters as a word.
- The activity compares the entered letters with the real word, and informs the user whether the word was spelt correctly or not.
- Another random word is offered for the user, etc, etc.
Video demo
Extremely blurry demo of how the app works currently... The sound is more important than the video... <youtube>ZvYlJVfyJsg</youtube>
Installing
The code [here] isn't ready for general use yet - it doesn't use the Sugar user interface, and only uses the terminal within sugar.
- Make sure your loudspeaker volume is turned up, using the keyboard keys.
- Open a copy of the Terminal activity. Change to root user:
su -
- Download the code and associated files into a directory:
git-clone git://dev.laptop.org/activities/talkntype
- note: you might need to install git-core for this to work. To do that, type
yum install git-core
- Make sure the sugar-speechd and talkntype.py files are executable
cd talkntype chmod a+x 01talkntype.py chmod a+x sugar-speechd
- Get out of root user, and do the rest of the instructions as the OLPC user.
exit
- Then run the sugar-speechd speech server:
./sugar-speechd
- The terminal will appear frozen, but this is ok. It means the server is running. Go back to the desktop (Home), and open another Terminal activity.
- Go to the directory that talkntype.py is stored in by typing
cd talkntype
- run it by typing:
python 01talkntype.py
- You will need to type quite slowly.
- There is no Backspace key.
- To exit the program, press 9 instead of entering a word.
To do
- Sugarise the idea into something usable by normal people! I have no real programming knowledge, so all help would be greatly appreciated! Please contact me via my userpage.
- Include collaborative elements - spelling against a friend?
Code
The code (such as it is so far) can be found at [http://dev.laptop.org/git?p=activities/talkntype]
Dictionaries
The code above only uses the simplest (level 1) dictionary, and doesn't have any of the vocabulary refinements of the original toy (ie doesn't say "spell FOR, as in for me", or "spell FOUR, as in number four".
The original dictionaries are presented below, as comma separated variable sets:
Dictionary Level 1:
"above","angel","answer","calf","does","earth","echo","extra","for","four","guess","half","health","iron","learn","ocean","once","one","oven","pint","pull","range","says","ski","sure","swap","talk","to","touch","two","view","warm","was","wash","word"
Dictionary Level 2:
"another","beauty","beige","blood","bullet","carry","chalk","child","danger","early","eight","flood","floor","front","guide","haste","heaven","linger","mirror","other","priest","ready","rural","school","squad","squat","sugar","today","union","watch","water","yield"
Dictionary Level 3:
"already","believe","built","bushel","comfort","coming","couple","cousin","enough","finger","guard","healthy","heavy","instead","laugh","measure","mother","niece","outdoor","period","plague","police","promise","quiet","ranger","relief","remove","search","shield","should","shovel","someone","source","statue","terror","trouble","welcome","wolves","woman","wonder","worth"
Dictionary Level 4:
"abscess","ancient","anything","brother","bureau","butcher","caravan","circuit","corsage","couldn't","courage","discover","dungeon","earnest","feather","freight","greater","jealous","journey","language","laughter","leisure","lettuce","machine","minute","pierce","pleasure","plunger","poultry","quotient","reindeer","rhythm","schedule","scissors","serious","shoulder","stomach","stranger","surgeon","tomorrow","treasure","workman","yacht"
Interface Words:
"a","as in","b","c","correct","d","e","eight","f","five","four","g","h","here is your score","i","i win","is","j","k","l","m","n","next spell","nine","now spell","now try","o","one","p","perfect score","q","r","s","say it","seven","six","spell","t","ten","that is correct","that is incorrect","that is right","three","try","two","u","v","w","wrong","wrong try again","x","y","you are correct","you are right","you win","z","zero"
Personal Spelling Lists
I've had a lot of fun with this activity by entering in personal spelling lists for my users. I created a custom list with abiword.
- Open Write, then abiword. Directions for this are at http://olpcnews.com/forum/index.php?topic=41.msg5536#msg5536.
- Open a word list by going into File then Open.
- This will open a dialog box. On the "name" side, click on the talkntype folder.
- Select a word list. I choose words_d.txt
- edit the list, keeping the comma between the words
- You will not be able to save over the original list. So do a save as in the default folder, which should be olpc. Enter "words_d" in the title box and make sure you save as a .txt file.
- Repeat the process for the "pronounce_d.txt" file.
- Now it's time to move the files into the right place by exiting abiword and going into terminal.
- To do that, first I typed:
su
- Then
cd /home/olpc/talkntype
- Make a backup file of the word list you will change. I picked word list d:
mv words_d.txt words_d.txt.old mv pronounce_d.txt pronounce_d.txt.old
- now move your word files into talkntype
cd /home/olpc mv words_d.txt talkntype/words_d.txt mv pronouce_d.txt talkntype/pronouce_d.txt
- close terminal
- follow the instructions above to launch the program. Choose difficulty level 4 to activate the new words.
Other links
- Screen_Reader Another OLPC activity using the eSpeak modules.
- Speech_synthesis Speech Synthesis on the OLPC.
- Listen_and_Spell A suggestion for a further developed version of TalknType
- [[1]] Flash version of the Speak & Spell
- [[2]] Another Speak & Spell emulator
- [Speak&Spell] Wikipedia article]
Activity Summary
Icon: | Sugar icon::Image:Talkntype_icon_plain.svg |
Genre: | Activity genre::Games |
Activity group: | ,|x|Activity group::x}} |
Short description: | Short description::This will eventually be an Activity based on the 1970s toy, Speak&Spell. |
Description: | |
Maintainers: | ,|x|Contact person::x}} |
Repository URL: | Source code::http://dev.laptop.org/git?p=activities/talkntype |
Available languages: | ,|x|Available languages::x}} |
Available languages (codes): | ,|x|Language code::x}} |
Pootle URL: | |
Related projects: | Related projects,|x|Related projects::x}} |
Contributors: | ,|x|Team member::x}} |
URL from which to download the latest .xo bundle | Activity bundle:: |
Last tested version number: | |
The releases with which this version of the activity has been tested. | ,|x|Software release::x}} |
Development status: | Devel status::2. Pre-Alpha |
Ready for testing (development has progressed to the point where testers should try it out): | ,|x|Ready for testing::x}} |
smoke tested : | |
test plan available : | |
test plan executed : | |
developer response to testing : |