Class: TextRank::CharFilter::StripPossessive
- Inherits:
-
Object
- Object
- TextRank::CharFilter::StripPossessive
- Defined in:
- lib/text_rank/char_filter/strip_possessive.rb
Overview
Character filter to remove apostrophe from possessives.
= Example
StripPosessive.new.filter!("to loathe one's very being and yet to hold it fast") => "to loathe one very being and yet to hold it fast"
Instance Method Summary collapse
-
#filter!(text) ⇒ String
Perform the filter.
Instance Method Details
#filter!(text) ⇒ String
Perform the filter
16 17 18 19 20 |
# File 'lib/text_rank/char_filter/strip_possessive.rb', line 16 def filter!(text) text.gsub!(/([a-z]+)'s\b/) do Regexp.last_match(1) end end |