Sha256: 4a31ffe048aa8996f98d47ff92b7cdd9c48af943c9d9d4a0a4e2b40dcf9148aa

Contents?: true

Size: 1004 Bytes

Versions: 4

Compression:

Stored size: 1004 Bytes

Contents

# -*- encoding : utf-8 -*-

module PragmaticSegmenter
  module Rules
    # This class searches for ellipses within a string and
    # replaces the periods.

    # http://www.dailywritingtips.com/in-search-of-a-4-dot-ellipsis/
    # http://www.thepunctuationguide.com/ellipses.html

    module EllipsisRules
      # Rubular: http://rubular.com/r/i60hCK81fz
      ThreeConsecutiveRule = Rule.new(/\.\.\.(?=\s+[A-Z])/, '☏.')

      # Rubular: http://rubular.com/r/Hdqpd90owl
      FourConsecutiveRule = Rule.new(/(?<=\S)\.{3}(?=\.\s[A-Z])/, 'ƪ')

      # Rubular: http://rubular.com/r/YBG1dIHTRu
      ThreeSpaceRule = Rule.new(/(\s\.){3}\s/, '♟')

      # Rubular: http://rubular.com/r/2VvZ8wRbd8
      FourSpaceRule = Rule.new(/(?<=[a-z])(\.\s){3}\.(\z|$|\n)/, '♝')

      OtherThreePeriodRule = Rule.new(/\.\.\./, 'ƪ')

      All = [
        ThreeSpaceRule,
        FourSpaceRule,
        FourConsecutiveRule,
        ThreeConsecutiveRule,
        OtherThreePeriodRule
      ]

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pragmatic_segmenter-0.0.4 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.3 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.2 lib/pragmatic_segmenter/ellipsis.rb
pragmatic_segmenter-0.0.1 lib/pragmatic_segmenter/ellipsis.rb