class TextDetector::Dictionary::File
Attributes
depth[R]
Public Instance Methods
lookup(member)
click to toggle source
# File lib/text_detector/dictionary/file.rb, line 9 def lookup(member) @dictionary.include? member end
members()
click to toggle source
# File lib/text_detector/dictionary/file.rb, line 13 def members @dictionary.to_a end
Protected Instance Methods
setup(dictionary)
click to toggle source
# File lib/text_detector/dictionary/file.rb, line 19 def setup(dictionary) @dictionary = Set.new @depth = [] dictionary.each_line do |line| text = TextDetector.normalize(line.chomp) next if text.size == 0 @dictionary << text @depth << text.size end @depth = @depth.sort.uniq end