module TactfulTokenizer
Constants
- VERSION
Public Instance Methods
is_alphabetic?()
click to toggle source
Simple regex to check if a string is alphabetic.
# File lib/tactful_tokenizer.rb, line 34 def is_alphabetic? !/[[:lower:][:upper:][:space:]]+/u.match(self).nil? end
is_upper_case?()
click to toggle source
Check for upper case. Surprisingly, this is faster than a regex in benchmarks. Using the trinary operator is faster than to_s
# File lib/tactful_tokenizer.rb, line 41 def is_upper_case? self == self.upcase end