class TwitterCldr::Segmentation::SegmentIterator
Attributes
rule_set[R]
Public Class Methods
new(rule_set)
click to toggle source
# File lib/twitter_cldr/segmentation/segment_iterator.rb, line 11 def initialize(rule_set) @rule_set = rule_set end
Public Instance Methods
each_boundary(str) { |0| ... }
click to toggle source
# File lib/twitter_cldr/segmentation/segment_iterator.rb, line 23 def each_boundary(str, &block) return to_enum(__method__, str) unless block_given? # implicit start of text boundary yield 0 cursor = create_cursor(str) rule_set.each_boundary(cursor, &block) end
each_segment(str) { |str, start, stop| ... }
click to toggle source
# File lib/twitter_cldr/segmentation/segment_iterator.rb, line 15 def each_segment(str) return to_enum(__method__, str) unless block_given? each_boundary(str).each_cons(2) do |start, stop| yield str[start...stop], start, stop end end
Private Instance Methods
create_cursor(str)
click to toggle source
# File lib/twitter_cldr/segmentation/segment_iterator.rb, line 35 def create_cursor(str) Cursor.new(str) end