Class: RMMSeg::Ferret::PunctuationFilter::Dictionary

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rmmseg/ferret.rb

Overview

The punctuation dictionary.

Constant Summary collapse

DIC_FILE =
File.join(File.dirname(__FILE__),
"..",
"..",
"data",
"punctuation.dic")

Instance Method Summary collapse

Constructor Details

#initializeDictionary

Returns a new instance of Dictionary.



70
71
72
73
74
75
76
77
# File 'lib/rmmseg/ferret.rb', line 70

def initialize
  @dic = Hash.new
  File.open(DIC_FILE, "r") do |f|
    f.each_line { |line|
      @dic[line.chomp.freeze] = nil
    }
  end
end

Instance Method Details

#include?(str) ⇒ Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/rmmseg/ferret.rb', line 79

def include?(str)
  @dic.has_key?(str)
end