Version 2008.10.19.testing

andrew_c
October 19, 2008, 09:48 PM posted in General Discussion

WeLoveChinesePod 2008.10.19.testing has been released. This release contains a  bug fix and a new feature:

  • As reported by ChenHongJie, certain Pinyin were missing in the Vocabulary section.  The bug which caused this has been fixed.
  • The lesson, dialogue, and audio review mp3 files are now downloaded.

 For more information see the WeLoveChinesePod web page. If you accept the license and disclaimer at the bottom of the WeLoveChinesePod web page, then feel free to download WeLoveChinesePod 2008.10.19.testing

Profile picture
ajonard
October 31, 2008, 09:39 AM

Hi, As I said (see Taiwan groop) I tried the new template.

Nice. I may think to change it to have a good printable PDF version visible on my Palm TX when I listen to the podcast. Do you have a list of the tags used in your xsl? It would help me?

To inform you. The bopomofo of 綠 (green) is not comming. The pinyin lü4 is correct.

Alexandre

Profile picture
jwlee
December 23, 2008, 11:06 PM

I was wondering the same question myself, Andrew, given Firefox's "View -> Page Style -> ..." menu.  A Google search for "web switch stylesheet" suggests that for CSS stylesheets, this should be doable for non-IE browsers simply by specifying additional "link rel" tags; quite a few cross-platform JavaScript solutions are provided, too.  I get the sense that changing XML stylesheets might be quite a bit more involved, since you'd have then manually load the XML and XSL files, process them, and write them to the HTML document; I hope I'm wrong!

I think I'm in the same boat as you are, actually -- the only JavaScript I've successfully written is the anti-spam e-mail script on my webpage, and I learned XSL and XML from studying the WLCP files you created. :)

Profile picture
ajonard
November 03, 2008, 09:50 AM

I was thinking more of the tags used in the xls. etc.

I will share the results of course. But It ,ot be easy to get something better than what you did.

綠. Is in the lesson colors.

A+

Alexandre

 

Profile picture
andrew_c
November 03, 2008, 02:51 PM

I looked into it.  The reason it doesn't work is because pinyin_bopomofo_dictionary is missing all of the Pinyin/Zhuyin which use an umlaut.  I think that the reason for this is that the first Zhuyin <--> Pinyin table I found left all of those  out... But I found another which includes them and will add them in, once I get the chance.

Profile picture
andrew_c
November 15, 2008, 02:36 PM

I still haven't gotten a chance to fix the pinyin <--> zhuyin dictionary...

I wanted to share an idea that I had for the XSL.   Let me first say my motivation.  I just started learning characters seriously.

When I study using the WLCP produced lesson documents, just about every single character is annotated with pinyin (or zhuyin)...  I don't want that, I just want the characters that I haven't yet studied to be annotated.  This will force me to read the characters that I've studied before.

So I think that this will be the next new feature for WLCP: to only annotate characters which are not on some user-defined list of already studied characters.

I also want to ask, does anyone have other ideas for making the WLCP documents more useful as a tool for studying characters?

Profile picture
andrew_c
November 16, 2008, 07:27 PM

Done!  Thankfully, it just required changing the welovechinesepod.xsl file:

  1. simplified+pinyin
  2. traditional+zhuyin.

If you open up the XSL in Notepad or some other text editor, at the top of the XSL file is a variable "characters_to_ignore", which currently contains the 100 most common characters.  Feel free to add or remove characters from this list as you see fit.

The idea is that as you learn characters you should add them to the characters_to_ignore list so you won't be tempted to use the pinyin/zhuyin as a crutch.

Here's a screenshot of one lesson with the 100 most common characters ignored:

Screenshot of WLCP with specified characters dropped

 

Everything else (Fixed zhuyin dictionary, Pleco 2 export) is still on its way.

Profile picture
jwlee
December 11, 2008, 11:07 PM

Hi Andrew,

I've implemented tooltips into the XSL file; you can find the new files at http://math.stanford.edu/~jlee/cpod/.  It's all done with CSS; it's pretty clean, but one disadvantage of this is that tooltips can sometimes overflow beyond the bottom of the page.

There are other things I'll probably implement soon, too.

Jon

Profile picture
jwlee
December 14, 2008, 12:25 AM

So, I got around to making some more changes; like last time, the altered files are at http://math.stanford.edu/~jlee/cpod/. The XSLT and CSS files have been mostly rewritten, the Python script was altered to produce the supporting XML elements, and a nice flash mp3 player was downloaded from http://www.flash-mp3-player.net/players/maxi/download/.

Changes:

  • tooltips that are actually readable
  • removal of inter-word whitespace in HTML output
  • speaker identification in dialogues
  • reviewed character headings in expansion (simplified only, sadly)
  • vocabulary tables
  • mp3 support

Problems

  • Firefox's behaviour with CSS and XSL mean that text is initially improperly formatted (ignoring screen bounds); forcing a refresh (say, by resizing the window) fixes this
  • a ridiculous number of Flash objects (one per sound file) are loaded, which makes page load time kind of slow; a better solution may be to have one object and control it using JavaScript (which currently is not used at all)
  • the layout in general could be improved

To come

Hopefully, this makes using it on a slow internet connection easier.

Jon

Profile picture
calkins
December 14, 2008, 01:36 AM

andrew_c said:

...Pleco 2 export is still on its way.

A Pleco 2 export would be an amazing tool!  To be able to study a lesson at night on the desktop, then to be able to review that lesson's vocab. in the morning using Pleco flashcards.....awesome.

Andrew and Jon, thanks for these great tools...CPod should hire you guys!

Profile picture
andrew_c
December 14, 2008, 02:18 AM

Jon: That's great work! I love the new features.  The tooltips are a huge improvement over the current expansion/dialogue tab.  The player buttons are great.  The table for the vocab was definitely long overdue.

By: "removal of inter-word whitespace in HTML output?"  are you referring to the spacing between characters when the literal translation or pinyin are too wide?  Or something else?

Brent:

Here it is. wlcp_to_pleco.xsl

Since I am guessing that the Pleco software doesn't perform XSL transformations, you'll need to process the WLCP-XML file with xsltproc on your computer and then copy the resulting XML to your Pleco device.  Your Mac should have xsltproc available at the command line.  In case you haven't used the command line and/or xsltproc much before, here's an example as to how it's used for the night-cat lesson:

xsltproc wlcp_to_pleco.xsl night-cat.xml  > night-cat-pleco.xml

Let me know how it goes, or if you have any questions.  I don't have Pleco, so I have no way to test it myself.

Profile picture
andrew_c
October 31, 2008, 11:13 AM

If you open up welovechinesepod.css that lists all of the tags (and their formatting).  Is that what you meant?

If you come up with any changes please consider sharing the xsl or css with the rest of us.  I really had a lot of trouble just getting what you see so far.  The vocabulary section, in particular, could use a lot of work.

I'd like to take a look into this problem with 綠, in which lesson did you encounter it?

Profile picture
andrew_c
December 14, 2008, 03:41 AM

Jon, I see now what you mean about the spacing.  It became really apparent once I decreased the character size.

Profile picture
jwlee
December 17, 2008, 06:26 AM

Thanks, Andrew and Brent!

I finished hacking some more code, and with luck, there are no bugs and I'm done! The new files (a few more this time) are at http://math.stanford.edu/~jlee/cpod/.

Changes/side-effects:

  • the tooltips now follow the mouse, and have hyperlinks to a stroke-order database and two dictionaries of various sorts
  • other links have been added to the HTML output
  • reorganization of the directory structure: during my own development, it became easier to subsume settings.txt by a full-fledged welovechinesepod.ini file with other options, such as storing downloaded lessons in a separate directory
  • the generated HTML files are now larger than the XML ones (!)
  • a LaTeX XSLT file (wlcpod-latex.xsl) has been created (perhaps somebody could volunteer to add PDF generation into the python script)
  • my linguistic preferences/biases with regards to Chinese are more obvious

Hope you like the changes; I'm curious to see what modifications you make!

Jon

p.s.  On Ubuntu, install the texlive-latex-extra, texlive-latex-recommended and latex-cjk-chinese packages before trying to compile the LaTeX file

Profile picture
calkins
December 17, 2008, 10:04 AM

Jon,

The new changes sound great, thanks!

I wasn't able to get the new files to work correctly.  I tried on Communication in the Office and Stuffy Room, with the same results.

When I run WLCP.py, I initially get this error code:

 

 

 

 

 

 

 

That was an easy fix, just did what it suggested.

The other problem was that it didn't remember my settings.txt and forced me to enter my email address and password.

Everything seemed to run properly at that point, downloading all the files and creating the lesson xml file.

Then when I opened the xml file in Firefox, the entire page looked like this (I have Ruby Support installed):

 

 

 

 

 

 

I'm not sure if this is a problem with Python, but I had it running properly before using these revised files.

Just thought I'd let you know.  Is anyone else having these issues?

Thanks.

Profile picture
andrew_c
December 17, 2008, 01:36 PM

Brent: It's nothing to do with Python.  That's just Firefox displaying the XML data without a stylesheet.  So it looks like it's not finding its XSL stylesheet.  Make sure that welovechinesepod.xsl is in the same folder as the communication-in-the-office.xml file.  This is just a hint though (I'm no longer the expert here), but it came to mind since Jon wrote above that files can now be downloaded to different locations.

Jon:

I'm overwhelmed, these new features are awesome.  I just wish I had a subscription at the moment to try them all out.

When people run into problems and send the log file it would be helpful that we know in particular which version they're running, so I would like to suggest updating the version number.  I would also suggest starting a new thread so that there aren't parallel discussions about different versions, which can get confusing.

For PDF generation, would it just be a matter of calling pdflatex via Popen?

 

Profile picture
andrew_c
December 17, 2008, 02:02 PM

Brent, It's no longer using settings.txt, see welovechinesepod.ini.  Also, note this comment Jon left in there:

for pages to view properly, this directory should contain welovechinesepod.css, welovechinesepod.xsl and player_mp3_maxi.swf  NOTE: if lessondir is to ".", then the behaviour will be the same as old.  default: lessondir = lessons



Profile picture
calkins
December 17, 2008, 02:23 PM

Thanks Andrew.  I put all the lesson files back into the parent directory and it's working fine again. 

And I agree, these new features are really awesome!  Thanks so much guys.

Profile picture
jwlee
December 18, 2008, 12:04 AM

Thanks for the comments!

Brent: thanks for pointing out the indentation issue -- I've removed the offending spaces from the Python script.

Andrew: Sure, the version number has been updated.  I'll repackage things and start a new thread once I test things a bit more and write some documentation.

In terms of making PDFs, I think you're right, in that it would suffice to call pdflatex -halt-on-error and xsltproc via Popen.  It's not so clear what to do about logging, though, other than making PDF generation an advanced option disabled by default and expecting all LaTeX-related issues to be easily reproducible.

Jon

Profile picture
andrew_c
December 20, 2008, 04:21 PM

Is there a way to write some code, JavaScript I guess, to give the user the option of changing the CSS and XSL stylesheets once the XML document is already loaded in the browser.  Then if the user changes the stylesheet, the document would automatically be refreshed to use the new stylesheet(s).  It would be best if the JavaScript could automatically detect various css and xsl files in a particular directory to let the user choose from.

I don't know any JavaScript, and using XSL, XML, and CSS were really pushing my limits as I'm not a web programmer at all.  I'd appreciate any help with this.

Profile picture
andrew_c
December 14, 2008, 03:07 AM

First of all, I don't want Jon's much more important work above to get lost, so make sure check out what his posts a few posts up from this one :-)

I have one thing I wanted to get share for those of you forced to upgrade to 2008.10.19 once 2008.08.14 stopped working.

WLCP Classic XSL

This displays the XML data without Ruby character annotation, and thus is much faster and supported by probably any browser:

screen shot using WLCP Classic XSL

It uses a table for the vocab similar to what Jon posted above.