# -*- coding: utf-8 -*-
from scipy import io
from q84 import make_word_index

ppmi_file = 'ppmi.txt'
matrix_file = 'matrix_d'
word = 'United_States'

def get_word_vector(word, t_idx):
    matrix_d = io.loadmat(matrix_file)['matrix_d']
    if word not in t_idx.keys():
        return 'Not exist. Word=%s' % (word)
    else:
        return matrix_d[int(t_idx[word])]

def main():
    t_idx = make_word_index(ppmi_file, 0)
    word_vector = gett_word_vector(word, t_idx)
    print word_vector

if __name__ == '__main__':
    main()
