SPUG: Software to expand contractions?

Tim Maher tim at consultix-inc.com
Sat Oct 25 12:43:01 CDT 2003


Dudes,

I'm getting complaints from some early reviewers of my book
about all the "contractions" I'm using in my writing!
So last night I set out to write a Perl script to make changes
like the following:

	That's => That is
	He's => He is
	They're => They are
	We're => We are

Then I realized that the 's ending usually needs replacement by
"is", so I tried

	"'s" => ' is'
which doesn't quite work, because of the undesirability of changing

	Larry's hat  => Larry is hat

After making an exception for that case, I found other complications,
such as

	wouldn't => would not
	can't => can not

These follow different rules, because the 'wouldn' loses its 'n', but the
'can' doesn't!

So at that point I realized that this is a bigger problem than I first
thought, and decided to look for a solution on CPAN.  Searching for
"contractions" didn't turn up anything relevant, so now I'm wondering if
anybody knows of a module that will do this job -- convert a standard set of English
contractions into their expanded forms.  

Can't y'all gimme the help I'm searchin' for?
 
-Tim
*------------------------------------------------------------*
| Tim Maher (206) 781-UNIX  (866) DOC-PERL  (866) DOC-UNIX   |
| tim(AT)Consultix-Inc.Com  TeachMeUnix.Com  TeachMePerl.Com |
*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
|  UNIX Fundamentals Class: 11/10-13   Perl Class: 12/01-05  |
|  Watch for my Book: "Minimal Perl for Shell Programmers"   |
*------------------------------------------------------------*



More information about the spug-list mailing list