Case tagging and python
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Thu Jul 31 07:13:35 EDT 2008
Fred Mangusta:
> Could I use the join function to reform the string?
You can write a function to split the words, for example taking in
account the points too, etc.
> And, regarding the casetest() function, what do you suggest to do?
Python strings have isupper, islower, istitle methods, they may be
enough for your purposes.
> -open input file
> -open output file
> -get line of text
> -split line into words
> -for each word
> -tag = checkCase(word)
> -newword = lowercase(word) + append(tag)
> rejoin words into line
> write line into output file
It seems good. To join the words of a line there's str.join. Now you
can write a function that splits lines, and another to check the case,
then you can show them to us.
Yet, I don't see how much use can have your output file :-)
Bye,
bearophile
More information about the Python-list
mailing list