Sha256: 8795bcabf4b945b6ea9927ea79ba439ddda27537cdeb3faa2e5005051c2a7797

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

module PragmaticSegmenter
  module Rules
    # Rubular: http://rubular.com/r/EUbZCNfgei
    EmailRule = Rule.new(/(\w)(\.)(\w)/, '\1∮\3')

    # Rubular: http://rubular.com/r/G2opjedIm9
    GeoLocationRule = Rule.new(/(?<=[a-zA-z]°)\.(?=\s*\d+)/, '∯')

    SingleNewLineRule = Rule.new(/\n/, 'ȹ')

    ExtraWhiteSpaceRule = Rule.new(/\s{3,}/, ' ')

    # Rubular: http://rubular.com/r/aXPUGm6fQh
    QuestionMarkInQuotationRule = Rule.new(/\?(?=(\'|\"))/, 'ᓷ')

    module ExclamationPointRules
      # Rubular: http://rubular.com/r/XS1XXFRfM2
      InQuotationRule = Rule.new(/\!(?=(\'|\"))/, 'ᓴ')

      # Rubular: http://rubular.com/r/sl57YI8LkA
      BeforeCommaMidSentenceRule = Rule.new(/\!(?=\,\s[a-z])/, 'ᓴ')

      # Rubular: http://rubular.com/r/f9zTjmkIPb
      MidSentenceRule = Rule.new(/\!(?=\s[a-z])/, 'ᓴ')

      All = [ InQuotationRule, BeforeCommaMidSentenceRule, MidSentenceRule ]
    end

    module DoublePuctationRules
      FirstRule = Rule.new(/\?!/, '☉')
      SecondRule = Rule.new(/!\?/, '☈')
      ThirdRule = Rule.new(/\?\?/, '☇')
      ForthRule = Rule.new(/!!/, '☄')

      All = [ FirstRule, SecondRule, ThirdRule, ForthRule ]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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