Sha256: 35ed1bbade3e08b2d1cd7a801f45b5965900cd7b290fbf3a2e9c4c11652b44e2

Contents?: true

Size: 776 Bytes

Versions: 26

Compression:

Stored size: 776 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

module TwitterCldr
  module Segmentation
    class DictionaryBreakEngine

      def each_boundary(cursor, &block)
        return to_enum(__method__, cursor) unless block_given?

        stop = cursor.position

        while !cursor.eos? && word_set.include?(cursor.codepoints[stop])
          stop += 1
        end

        divide_up_dictionary_range(cursor, stop, &block)
      end

      def word_set(*args)
        raise NotImplementedError, "#{__method__} must be defined in derived classes"
      end

      private

      def divide_up_dictionary_range(*args)
        raise NotImplementedError, "#{__method__} must be defined in derived classes"
      end

    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
twitter_cldr-6.1.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.0.2 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.0.1 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.0.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-5.4.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-5.3.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb