Class: Eluka::Features

Inherits:
Object
  • Object
show all
Defined in:
lib/eluka/features.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFeatures

Returns a new instance of Features.



5
6
7
8
# File 'lib/eluka/features.rb', line 5

def initialize
  @features = Eluka::Bijection.new
  @f_count  = 0
end

Instance Attribute Details

#f_countObject (readonly)

Returns the value of attribute f_count.



10
11
12
# File 'lib/eluka/features.rb', line 10

def f_count
  @f_count
end

Instance Method Details

#add(term) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/eluka/features.rb', line 12

def add (term)
  unless @features[term] then
    @f_count += 1
    @features[term] = @f_count
  end
  return @features[term]
end

#id(term) ⇒ Object



20
21
22
# File 'lib/eluka/features.rb', line 20

def id (term)
  @features[term]
end

#term(id) ⇒ Object



24
25
26
# File 'lib/eluka/features.rb', line 24

def term (id)
  @features.lookup(id)
end