[Tutor] language aid

Alan Plum alan.plum at uni-koeln.de
Thu Feb 4 19:19:47 CET 2010


On Do, 2010-02-04 at 16:11 +0000, Owain Clarke wrote:
> Thanks for your input.  I had discounted the idea of a dictionary
> because all the keys need to be unique, so whether the key is the
> English or non-English word, it couldn't cope with for example "too",
> or a similar word in the other language.

I recently began writing a word trainer myself. I used YAML files as
source, but the problems were the same.

If you have word pairs where either word can be duplicate (e.g. "love"
as a verb or a noun) you can deal with that by using a list of tuples.

words = []
w = ('aimer', 'love')
words.append(w)

The only problem with this approach is that it's not as easy to use as a
dict, but as I was doing a word trainer, it was supposed to be randomly
accessed anyway.


Cheers,

Alan Plum



More information about the Tutor mailing list