Class: Glove::TokenPair

Inherits:
Object
  • Object
show all
Defined in:
lib/glove/token_pair.rb

Overview

Holds a token string and its neighbors in an array

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token = '', neighbors = []) ⇒ TokenPair

Get class instance and set token and neighbors variables



11
12
13
# File 'lib/glove/token_pair.rb', line 11

def initialize(token='', neighbors=[])
  @token, @neighbors = token, neighbors
end

Instance Attribute Details

#neighborsArray<(String)>

Returns ] List of neighboring words.

Returns:

  • (Array<(String)>)

    ] List of neighboring words



8
# File 'lib/glove/token_pair.rb', line 8

attr_accessor :token, :neighbors

#tokenString

Returns The word/token.

Returns:

  • (String)

    The word/token



8
9
10
# File 'lib/glove/token_pair.rb', line 8

def token
  @token
end