class Krikri::Enrichments::StripEndingPunctuation
Strip ending punctuation
StripEndingPunctuation.new .enrich_value("moomin!...!;,.",) # => "moomin"
Leaves quotation marks and closing parentheses & brackets. Also leaves periods when they follow a one or two letter abbreviation.
Public Instance Methods
enrich_value(value)
click to toggle source
# File lib/krikri/enrichments/strip_ending_punctuation.rb, line 14 def enrich_value(value) return value unless value.is_a? String value.gsub!(/[^\p{Alnum}\'\"\)\]\}]*$/, '') unless value.match /\s+[a-z]{1,2}\.$/i value end