.title() - annoying mistake

Benjamin Schollnick bschollnick at schollnick.net
Sun Mar 21 18:20:38 EDT 2021


>> Heck, how do we prevent it from titlecasing abbreviations?  (This is plain text not XML….  If it was XML it would be easy!)
> 
> We haven't managed to teach humans how to do that, so I doubt we'll
> ever teach a simple standard library function to do it.
> 
> *cough*XMLHttpRequest*cough*

True, but I was thinking that it would be easy in XML because the XML/HTML would be able to have metadata helping to define the components in the text stream.  

And this is probably more of a pseduo-html, but that’s because I do more work in HTML then I do in pure XML.  XML I usually just tell the system to output, instead of craft by hand…  

<textstring language=US_English>
blah blah this is a sentence that has the abbreviation <abbreviation>NASA</abbreviation> in it.
</textstring>

But that doesn’t help title, because it only handles pure plaintext.  

As many people have pointed out, or I think they meant to point out, there is no place in the text string to put metadata that would help assist parsing the string.  By definition the text can’t have metadata, since it’s plaintext.  

	- Benjamin




More information about the Python-list mailing list