forked from monikkinom/ner-lstm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.py
27 lines (21 loc) · 761 Bytes
/
input.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import random
import numpy as np
import pickle
def get_dummy_data(num):
emb = [[[random.random() for _ in range(300)] for i in range(50)] for j in range(num)]
tag = [np.array([ [0 for i in range(5)] for j in range(50)]) for i in range(num)]
for t in tag:
t[random.randint(0,len(t)-1)] = 1
return emb,tag
def get_train_data():
emb = pickle.load(open('5cls_50seq_train_rvec','rb'))
tag = pickle.load(open('5cls_50seq_train_tag','rb'))
return emb,tag
def get_test_data():
emb = pickle.load(open('5cls_50seq_test_rvec','rb'))
tag = pickle.load(open('5cls_50seq_test_tag','rb'))
return emb,tag
def get_indi_data():
emb = pickle.load(open('t','rb'))
tag = pickle.load(open('tag','rb'))
return emb,tag