Class: RMMSeg::Ferret::PunctuationFilter::Dictionary
- Inherits:
-
Object
- Object
- RMMSeg::Ferret::PunctuationFilter::Dictionary
- 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
- #include?(str) ⇒ Boolean
-
#initialize ⇒ Dictionary
constructor
A new instance of Dictionary.
Constructor Details
#initialize ⇒ Dictionary
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
79 80 81 |
# File 'lib/rmmseg/ferret.rb', line 79 def include?(str) @dic.has_key?(str) end |