[Tutor] html color coding: where to start

Alan Gauld alan.gauld at btinternet.com
Thu Sep 17 19:32:28 CEST 2009


"Emad Nawfal (عماد نوفل)" <emadnawfal at gmail.com> wrote

> 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

I'd create a dictionary with the parts of speech as keys and the colors(as 
html strings) as values.

I'd then arrange your data into tuples of (wordpart, speechpart)
So
('Al', DET)('wlAy',NOUN)....

Then you can print with
for item in tuples:
    htmlstr += colors[item[1]] + item[0]   # might need to add a closing 
tag too...

Does that help?

Alan G. 




More information about the Tutor mailing list