This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => 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() |