From decb744c76f82c107bdd3751452a85b2ad9347df Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Thu, 10 Mar 2016 00:44:44 -0300 Subject: [PATCH] Fix capitalize --- lib/text_cleaner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/text_cleaner.rb b/lib/text_cleaner.rb index 1b0659cb0d6..be528936e20 100644 --- a/lib/text_cleaner.rb +++ b/lib/text_cleaner.rb @@ -33,7 +33,7 @@ class TextCleaner # Replace all-caps text with regular case letters text = text.mb_chars.downcase.to_s if opts[:replace_all_upper_case] && (text =~ /[A-Z]+/) && (text == text.upcase) # Capitalize first letter, but only when entire first word is lowercase - text = text.mb_chars.capitalize.to_s if opts[:capitalize_first_letter] && text.split(' ').first == text.split(' ').first.mb_chars.downcase + text = text.mb_chars.capitalize.to_s if opts[:capitalize_first_letter] && (text =~ /\S+/) && text.split(' ').first == text.split(' ').first.mb_chars.downcase # Remove unnecessary periods at the end text.sub!(/([^.])\.+(\s*)\z/, '\1\2') if opts[:remove_all_periods_from_the_end] # Remove extraneous space before the end punctuation