[Tutor] language aid (various)

Emmanuel Ruellan emmanuel.ruellan at laposte.net
Sat Feb 6 17:20:06 CET 2010


On Fri, Feb 5, 2010 at 12:29 PM, Owain Clarke <simbobo at cooptel.net> wrote:

>
>
>   Seems to be a bit of a consensus here about dictionaries.  Let me just
> restate my reluctance, using examples from Spanish.
>
> esperar = to hope
> esperar = to wait
> tambien = too [i.e. also]
> demasiado = too [i.e. excessive]
>
> So there are repeats in both languages.  I would like to end up with a file
> which I can use to generate flash cards, either to or from English, and I
> suppose I want the flexibility to have 1 word with 1 definition.
>
>
I'd use a database table to handle the many-to-many relationships between
English words and Spanish words. You can use the lightweight SQLite database
engine, which comes with Python (http://docs.python.org/library/sqlite3.html
).

The table would have just two columns: one for the English word and one for
the Spanish word. Each row represents a possible association of an English
word with a Spanish word.

    en              es

    dream        soñar
    hope          esperar
    wait           esperar
    too            también
    too            demasiado


With a table structured like this, you can retrieve all the English words
associated with a particular Spanish word, or all the Spanish words
associated with a particular English word.

For example, with the data above, stored in a table named 'translation' with
columns named 'en' and 'es', the following SQL query,

select en from translations where es = 'esperar'

... would return:

hope
wait


--
Emmanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100206/58ef70f4/attachment.htm>


More information about the Tutor mailing list