2009/9/17 Emad Nawfal (عماد نوفل) <emadnaw...@gmail.com>: > Hi Tutors, > I want to color-code the different parts of the word in a morphologically > complex natural language. The file I have looks like this, where the fisrt > column is the word, and the second is the composite part of speech tag. For > example, Al is a DETERMINER, wlAy is a NOUN and At is a PLURAL NOUN SUFFIX > > Al+wlAy+At DET+NOUN+NSUFF_FEM_PL > Al+mtHd+p DET+ADJ+NSUFF_FEM_SG > > The output I want is one on which the word has no plus signs, and each > segment is color-coded with a grammatical category. For example, the noun is > red, the det is green, and the suffix is orange. Like on this page here: > http://docs.google.com/View?id=df7jv9p9_3582pt63cc4 > I am stuck with the html part and I don't know where to start. I have no > experience with html, but I have this skeleton (which may not be the right > thing any way)
Doing a "view source" on that page shows, in part <div style="text-align: left;"><span style="color: rgb(255, 153, 0);">Al</span><span style="color: rgb(255, 0, 0);">wlAy</span><span style="color: rgb(0, 0, 255);">At</span><br><span style="color: rgb(255, 153, 0);">Al</span><span style="color: rgb(116, 27, 71);">mtHd</span><span style="color: rgb(0, 0, 255);">p</span><br></div> which should give you a hint on the HTML though you would be better off using CSS styling. If you use the part of speech as the CSS class then you can color with a stylesheet that defines the colors for each part of speech. You are probably going to have to learn at least a little HTML to do this - google HTML tutorial. This recent package looks like a simple way to generate HTML programmatically: http://pypi.python.org/pypi/html/1.4 Kent _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor