Get Vector - Method

A method of Embedding class to get embedding vector for a word.

Getting Started

Get Vector function provides the embedding vector for a given input argument.

Example
# coding:utf-8
from indicLP.preproccessing import Embedding

language = "ta"

word = "புத்தகம்"
embedder = Embedding(lang=language)

print(embedder.get_vector(word))

#Output is:
# [-0.38245687 -0.43007085  0.75659156 -0.029661    0.42061085 -0.78045815
# -0.28127694 -1.0599478  -0.1264891  -0.42795     0.39396504 -0.79804516
#  0.03756442  0.24138477 -0.1513924   0.31122482  0.46426052 -1.2080644
# -0.40227187  0.7438162  -0.4533786   0.40707597 -0.25478044  0.19656514
#  0.5389387   0.2874967   0.43010154  0.13535404 -0.4051279   0.03866816 ...

Input Arguments

Following are the input arguments to be provided while using get_vector method:

  • word: A string representing the word for which the vector is needed.

Reference Materials

Following are some reference materials for Get Vector Method

  • Word Embedding: A reference blogpost discussing the usage of Embedding Class in hardcoded string.
  • Stanford RCpedia: RCpedia NLP slides on word embeddings provided by Stanford.