July 23, 2009

Tuple unpacking in django templates

I was stuck for about an hour on getting the tuple unpacking in django templates right. If one has a list of tuples say

mylst = [(a, b, c), (x, y, z), (l, m, n)],

then the easiest way to unpack this list in the template file is as follows.
In my case I had a list of tuples which contained the URL, title, and summary of a document.

{\% for item in mylst \%}
{{ item.0 }} {{ item.1}} {{ item.2 }}
{\% endfor \%}

One need not follow complex steps as mentioned in http://stackoverflow.com/questions/271077/django-how-to-do-tuple-unpacking-in-a-template-for-loop.

July 15, 2009

Online Text to Speech Converter

My neighbor, who is teaching me French, was not well for the last few days. She also requested me to continue with the lessons due to the shortage of time. The lessons were filled with new words and I did not know if I was pronouncing them correctly. Some of the new words for me were travailler, Est-ce que, pour, cher, etc. This motivated me to search for some online text to speech translators. I had to verify whether they were correct, and the best way was to check with commonly used words and sentences whose pronunciations were fresh in my mind, and that had some accents, for example, Bonjour Madame, Avez-vous , Bonne journée, and Je n'ai plus de croissant.

On searching on google, there were many tools that converted text to speech in english, however, only one gave me satisfactory results for French: the AT&T Text to Speech Converter. The demo version of this text to speech converter is available at the following link [AT&T Text to Speech Converter - Demo]. There are two voices available for French, Alain - the male voice, and Juliette - the female voice. One can try typing their names to confirm their pronunciations in French, the basic test which it had to pass ;).

I haven't tried using it for other languages, and hence cannot comment on its usefulness for other languages, however, I found it as a very useful French text to speech converter.