__author__ = 'Ruth Wang'


import pickle as pkl

import numpy as np
from bert_serving.client import BertClient


bc = BertClient()

with open('sents.pkl', 'rb') as f:
     sents = pkl.load(f)

n = len(sents)

embs = np.zeros((n, 50, 1024))

for i, person in enumerate(sents):
    cur_emb = bc.encode(person)
    cur_n = len(person)
    embs[i, :cur_n, :] = cur_emb[:50, ...]
    # emb_mean = np.mean(cur_emb, axis=0)
    # emb_max = np.max(cur_emb, axis=0)
    # emb = np.hstack((emb_mean, emb_max))
    # embs.append(emb)

# embs = np.vstack(embs)

with open('embs.pkl', 'wb') as f:
    pkl.dump(embs, f)

c5b4688df6901991d3205d92895e081389fa345d
<mask token>

<mask token>
with open('sents.pkl', 'rb') as f:
    sents = pkl.load(f)
<mask token>
for i, person in enumerate(sents):
    cur_emb = bc.encode(person)
    cur_n = len(person)
    embs[i, :cur_n, :] = cur_emb[:50, ...]
with open('embs.pkl', 'wb') as f:
    pkl.dump(embs, f)

__author__ = 'Ruth Wang'
<mask token>
bc = BertClient()
with open('sents.pkl', 'rb') as f:
    sents = pkl.load(f)
n = len(sents)
embs = np.zeros((n, 50, 1024))
for i, person in enumerate(sents):
    cur_emb = bc.encode(person)
    cur_n = len(person)
    embs[i, :cur_n, :] = cur_emb[:50, ...]
with open('embs.pkl', 'wb') as f:
    pkl.dump(embs, f)

__author__ = 'Ruth Wang'
import pickle as pkl
import numpy as np
from bert_serving.client import BertClient
bc = BertClient()
with open('sents.pkl', 'rb') as f:
    sents = pkl.load(f)
n = len(sents)
embs = np.zeros((n, 50, 1024))
for i, person in enumerate(sents):
    cur_emb = bc.encode(person)
    cur_n = len(person)
    embs[i, :cur_n, :] = cur_emb[:50, ...]
with open('embs.pkl', 'wb') as f:
    pkl.dump(embs, f)

__author__ = 'Ruth Wang'


import pickle as pkl

import numpy as np
from bert_serving.client import BertClient


bc = BertClient()

with open('sents.pkl', 'rb') as f:
     sents = pkl.load(f)

n = len(sents)

embs = np.zeros((n, 50, 1024))

for i, person in enumerate(sents):
    cur_emb = bc.encode(person)
    cur_n = len(person)
    embs[i, :cur_n, :] = cur_emb[:50, ...]
    # emb_mean = np.mean(cur_emb, axis=0)
    # emb_max = np.max(cur_emb, axis=0)
    # emb = np.hstack((emb_mean, emb_max))
    # embs.append(emb)

# embs = np.vstack(embs)

with open('embs.pkl', 'wb') as f:
    pkl.dump(embs, f)
