My new possession: Lyrics and vocabulary learning with intone

Laszlo KREKACS laszlo.krekacs.list at gmail.com
Fri Sep 4 16:50:02 CEST 2009


Dear list,

I thought I share my newest hobby using the Freerunner.
I downloaded lyrics to my musics automatically[1], and when I
listen to the music, I mark the words, which I dont know,
and later I download them from wiktionary.com with the
pronounced .ogg file. And I put them into a 'dict'
directory like:
-rw-r--r--    1 root     root        15122 Sep  3 18:41 assured.ogg
-rw-r--r--    1 root     root          368 Sep  3 18:44 assured.txt
-rw-r--r--    1 root     root        12086 Sep  3 18:41 hound.ogg
-rw-r--r--    1 root     root         1464 Sep  3 18:41 hound.txt
-rw-r--r--    1 root     root        12443 Sep  3 18:41 possession.ogg
-rw-r--r--    1 root     root          316 Sep  3 18:41 possession.txt


For learning the vocabulary, I select the 'dict' folder from
the folders/playlist, and I hear again, and again the
words until I memorized enough.
In the lyrics view I have the definition of all words.

Later, when I learned more or less the words, I
put newlines into the definition, so I only
see the word (what is pronounced), but I
need to scroll for the definition. Thats way
I only check the words, which I forgot.

I think Freerunner became an ideal language learning platform.

c_c wrote:
> Can you send me a link - or put up the script on Intone's wiki page. Th
> should help people.

Ok, here is my quick&dirty script. Feel free to contribute, and make
the script better. It works for me(TM).
It has problems, if the lyrics contain utf8 char (example: dash), it fails
to download.
It happened 12 times from 500 music files. So I didnt care to fix it.


1. Download lyric: http://pypi.python.org/pypi/lyricwiki/0.1.9
2. Put into a dir and make the 'lyrics_downloader' variable
accordingly.
3. Save the script into the same dir as your downloadable
music files are. call the script with no argument.

Hope it is useful to someone.

Best regards,
 Laszlo

#! /usr/bin/python

import os
import subprocess

lyrics_downloader = '/home/looser/Desktop/down/lyrics'

def extract_keywords(filename):
    keywords = filename.replace('0', '')
    keywords = keywords.replace('1', '')
    keywords = keywords.replace('2', '')
    keywords = keywords.replace('3', '')
    keywords = keywords.replace('4', '')
    keywords = keywords.replace('5', '')
    keywords = keywords.replace('6', '')
    keywords = keywords.replace('7', '')
    keywords = keywords.replace('8', '')
    keywords = keywords.replace('9', '')
    keywords = keywords.replace('&', '')
    keywords = keywords.replace(' - ', ' ')
    keywords = keywords.strip()
    return keywords

def dump_to_file(keywords, filename):
    global lyrics_downloader
    res = subprocess.Popen([lyrics_downloader, keywords], stdout =
subprocess.PIPE)
    result = res.stdout.read()
    fd = open(filename+'.txt', 'w')
    fd.write(result)
    fd.close()
    return


for root, dirs, files in os.walk('.'):
    for file in files:
        j = file.rfind('.mp3')
        filename = file[:j]
        keywords = extract_keywords(filename)
        print filename, ":", keywords
        dump_to_file(keywords, filename)



More information about the community mailing list