Sha256: 06198aec417066af9e4b04254efda9ef565791dd1076c0079366c7cd671c7bba
Contents?: true
Size: 571 Bytes
Versions: 28
Compression:
Stored size: 571 Bytes
Contents
module Krikri::Enrichments ## # 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. class StripEndingPunctuation include Audumbla::FieldEnrichment 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 end end
Version data entries
28 entries across 28 versions & 1 rubygems