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.13.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.12.1 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.12.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.11.5 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.11.4 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.11.3 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.11.2 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.11.1 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.11.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.10.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.9.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.8.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.7.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.6.2 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.6.1 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.6.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.5.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.4.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.3.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb
twitter_cldr-6.2.0 lib/twitter_cldr/segmentation/dictionary_break_engine.rb