Skip to content

A ruby gem implementation based on Google's Word2Vec.

License

Notifications You must be signed in to change notification settings

anhad13/RubyWordToVec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RubyWordToVec: A ruby gem implementation based on Google's Word2Vec.

####Contributors: Anhad Mohananey, Yashovardhan Chaturvedi

Steps to build & install the gem:

  • Run : 'gem build word_to_vec.gemspec'
  • Install : 'gem install ./word_to_vec-1.0.0.gem'

Using the gem:

require 'word_to_vec'
corpus=['<sentence 1>', '<sentence 2>']
Eg: corpus=['this is great', 'I am great']
model=WordToVec.build_from_corpus(
  corpus,
  <No of dimensions of final vector>,
  <No of iterations(default=10)>,
  <Size of context(default=3)>,
  <n, where print every nth iteration(default=5)>,
  <step_size of stochastic gradient descent(default=)>
  )

Like so,

WordToVec.build_from_corpus corpus,dimensions, num_iterations=10,context=3 ,print_every=5, step_size=0.01

To get input vector for word:

model.print_inputV(<word>)

To get output vector for word:

model.print_outputV(<word>)

To get word closest to representation:

model.closest(<word>)

About

A ruby gem implementation based on Google's Word2Vec.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages