Class: HG::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/zipf/hg.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label = nil, cat = nil, outgoing = [], incoming = [], score = nil) ⇒ Node



13
14
15
16
17
18
19
# File 'lib/zipf/hg.rb', line 13

def initialize label=nil, cat=nil, outgoing=[], incoming=[], score=nil
  @label    = label
  @cat      = cat
  @outgoing = outgoing
  @incoming = incoming
  @score    = nil
end

Instance Attribute Details

#catObject

Returns the value of attribute cat.



11
12
13
# File 'lib/zipf/hg.rb', line 11

def cat
  @cat
end

#incomingObject

Returns the value of attribute incoming.



11
12
13
# File 'lib/zipf/hg.rb', line 11

def incoming
  @incoming
end

#labelObject

Returns the value of attribute label.



11
12
13
# File 'lib/zipf/hg.rb', line 11

def label
  @label
end

#outgoingObject

Returns the value of attribute outgoing.



11
12
13
# File 'lib/zipf/hg.rb', line 11

def outgoing
  @outgoing
end

#scoreObject

Returns the value of attribute score.



11
12
13
# File 'lib/zipf/hg.rb', line 11

def score
  @score
end

Instance Method Details

#to_sObject



21
22
23
# File 'lib/zipf/hg.rb', line 21

def to_s
  "Node<label:\"#{@label}\", cat:\"#{@cat}\", outgoing:#{@outgoing.size}, incoming:#{@incoming.size}>"
end