Skip to content

Instantly share code, notes, and snippets.

View linamy85's full-sized avatar

Amy Lin linamy85

View GitHub Profile
# --------- Load word embedding --------- #
words, embeddings = pickle.load(open('/tmp2/eee/polyglot-zh.pkl', 'rb'), encoding='latin1')
print ('%d Zh word embeddings are loaded.' % len(words))
word2id = { w:i for (i,w) in enumerate(words) }
def toVec(seg):
ans = []
for word in seg.split():
index = word2id.get(word)
if index == None: # Word not found in Polyglot
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vim-Plug {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()