Sha256: 51510c64597a3f46bbaf41ba8dd1fe168e45851186065e599fdf32515b03c2f2
Contents?: true
Size: 552 Bytes
Versions: 14
Compression:
Stored size: 552 Bytes
Contents
module WordCountAnalyzer class HyphenatedWord # Rubular: http://rubular.com/r/RjZ7qi0uFf DASHED_LINE_REGEX = /\s-{2,}(\s|$)|\A-{2,}(\s|$)/ attr_reader :token def initialize(token:) @token = token.gsub(DASHED_LINE_REGEX, '') end def hyphenated_word? (token.include?('-') || token.include?('﹘')) && !WordCountAnalyzer::Hyperlink.new(string: token).hyperlink? end def count_as_multiple token.split(/[﹘,-]/).length end def replace token.split(/[﹘,-]/).join(' ') end end end
Version data entries
14 entries across 14 versions & 1 rubygems