On Thu, Feb 4, 2010 at 5:43 AM, Owain Clarke <simb...@cooptel.net> wrote:
My question is, that if I proceed like this I will end up with a single list
of potentially several hundred strings of the form "frword:engword". In
terms of performance, is this a reasonable way to do it, or will the program
increasingly slow down?
From: "Carnell, James E" <jecarn...@saintfrancis.com>
A dictionary (associative array of keys and values) seems a good datatype to use. vocab = {} vocab[frenchword]?= englishword
?
.......
Cheers!!
Albert-Jan

Sure, a dict is the obvious choice. For saving into file, if the app is
to be used internally, you can even print it in the form of a python
dict (with the '{}', ':' & ',') so that reading the dict data is just
importing:
    import french_english

Denis

I 3rd the dictionary choice. They (for me at least) aren't as clean on
the computer screen as arrays, but once you get good at it you can even
have multiple definitions and weights for how relevant that word is. You
(in the future when you get comfortable with dictionaries) can take it
into networkx or something and draw pictures of it, and really start
messing around with it (using subnetworks to try and get context
information). Google has some tech talks on  youtube concerning Language
Processing using networks etc if that kind of thing interests you.

Sincerely,

Bad answer man
What a helpful forum - much thanks to all who've commented. 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.

Having said that, I obviously recognise the expertise of the group, so I will probably pursue this option.

Owain

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to