[Python-bugs-list] [ python-Bugs-766541 ] string.title() doesn't understand apostrophes

SourceForge.net noreply@sourceforge.net
Mon, 07 Jul 2003 23:59:10 -0700


Bugs item #766541, was opened at 2003-07-06 02:17
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=766541&group_id=5470

Category: Python Library
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Steve Greenland (vmole)
Assigned to: Nobody/Anonymous (nobody)
Summary: string.title() doesn't understand apostrophes

Initial Comment:
Consider the following:

steveg@speedy:~/jbox$ python 
Python 2.2.3 (#1, Jun  4 2003, 02:54:59) 
[GCC 3.3 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> "I've fallen and i can't get up".title()
"I'Ve Fallen And I Can'T Get Up"
>>> 

That looks fairly non-standard to me. Apparently, the
title()
method treats apostrophes as whitespace/word
seperators/something.

Thanks,
Steve

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-07-08 08:59

Message:
Logged In: YES 
user_id=21627

Thanks, Raymond, for this investigation. 

Closing it as wont-fix - if you want an algorithm that
follows the English language rules, you have to implement
that yourself.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-07-08 08:15

Message:
Logged In: YES 
user_id=80475

The determination of what actually constitutes a word is 
language-dependent.  For instance, in French, l'arbre is 
considered two words.  See:  
http://www.unicode.org/reports/tr21/tr21-5d3.html

Also, I tried the VB and MS-Excel implementations (they call 
it "proper" instead of "title") and they match the current 
Python behavior.  I found no equivalent string method in 
Java.



----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2003-07-06 17:53

Message:
Logged In: YES 
user_id=593130

If the ' directly follows a letter, then it is being used for a 
contraction and not for indirect speech, and the following 
letter should not be uppercased.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-07-06 11:32

Message:
Logged In: YES 
user_id=21627

Unfortunately, this usage of the apostrophe is specific to
the English language. Martin says, 'if the apostrophe is
used for indirect speech, upper-casing after it is correct'.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=766541&group_id=5470