Sha256: 34076f3904f3e590961a61e4e2cd544a4094c91200adc1cbdc81d8b93aa9bd88

Contents?: true

Size: 796 Bytes

Versions: 3

Compression:

Stored size: 796 Bytes

Contents

module PragmaticSegmenter
  module Languages
    class Urdu
      class Process < PragmaticSegmenter::Process
        private

        def sentence_boundary_punctuation(txt)
          PragmaticSegmenter::Languages::Urdu::SentenceBoundaryPunctuation.new(text: txt).split
        end

        def punctuation_array
          PragmaticSegmenter::Languages::Urdu::Punctuation.new.punct
        end
      end

      class SentenceBoundaryPunctuation < PragmaticSegmenter::SentenceBoundaryPunctuation
        SENTENCE_BOUNDARY = /.*?[۔؟!\?]|.*?$/

        def split
          text.scan(SENTENCE_BOUNDARY)
        end
      end

      class Punctuation < PragmaticSegmenter::Punctuation
        PUNCT = ['?', '!', '۔', '؟']

        def punct
          PUNCT
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pragmatic_segmenter-0.0.3 lib/pragmatic_segmenter/languages/urdu.rb
pragmatic_segmenter-0.0.2 lib/pragmatic_segmenter/languages/urdu.rb
pragmatic_segmenter-0.0.1 lib/pragmatic_segmenter/languages/urdu.rb