Sha256: f1da1c4505788cd3121a7a4353f2441204795aa9b2e62b8833898f37c777b134

Contents?: true

Size: 670 Bytes

Versions: 7

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

module PragmaticSegmenter
  module Languages
    module Persian
      include Languages::Common

      SENTENCE_BOUNDARY_REGEX = /.*?[:\.!\?؟]|.*?\z|.*?$/
      Punctuations = ['?', '!', ':', '.', '؟'].freeze

      ReplaceColonBetweenNumbersRule = Rule.new(/(?<=\d):(?=\d)/, '♭')
      ReplaceNonSentenceBoundaryCommaRule = Rule.new(/،(?=\s\S+،)/, '♬')

      class AbbreviationReplacer < AbbreviationReplacer
        SENTENCE_STARTERS = [].freeze

        private

        def scan_for_replacements(txt, am, index, character_array)
          txt.gsub!(/(?<=#{am})\./, '∯')
          txt
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pragmatic_segmenter-0.3.24 lib/pragmatic_segmenter/languages/persian.rb
pragmatic_segmenter-0.3.23 lib/pragmatic_segmenter/languages/persian.rb
pragmatic_segmenter-0.3.22 lib/pragmatic_segmenter/languages/persian.rb
pragmatic_segmenter-0.3.21 lib/pragmatic_segmenter/languages/persian.rb
pragmatic_segmenter-0.3.20 lib/pragmatic_segmenter/languages/persian.rb
pragmatic_segmenter-0.3.19 lib/pragmatic_segmenter/languages/persian.rb
pragmatic_segmenter-0.3.18 lib/pragmatic_segmenter/languages/persian.rb