On Aug 9, 2006, at 7:20 PM, Mitchell Koch wrote:

> My solution will at the minimum capitalize the starts of sentences
> just judging by periods.
>
> If supplied with an example source using the -s option, it will try to
> find words that should always be capitalized (I, Ruby, proper nouns in
> general), words that imply that the next word should be capitalized
> (Lake, General)  and words in which punctuation does not imply an end
> of a sentence (abbreviations) although this is only helpful if there
> is some capitalization in the text.

I'm still reading through the code but just a minor tip:

lines like:

if EOSPunc.index word[-1].chr then true else false end

can be replaced with

EOSPunc.index word[-1].chr

it will either be true or false, and then the if statement is giving  
the same thing.

if you really want to have true or false (and not 3 or "hi" or nil,  
even though those will work fine if you treat the variable as a  
boolean) one way to do it is !!var. using not twice gets you true or  
false. there's probably something more readable though.

-- Elliot Temple
http://www.curi.us/blog/