Example #1
0
from keras import Input, Model
from keras.layers import Embedding, Conv1D, Dropout, MaxPooling1D, Flatten, merge, Dense

import globalvar as gl
from preprocess.data_preprocessor import preprocess, generateWord2VectorMatrix, loadEmbeddingsIndex

#全局变量

gl.set_train_rela_files("train_case_rela.txt")
gl.set_train_ques_file("train_case_ques.txt")
gl.set_train_label_file("train_case_label.txt")
gl.set_test_rela_files("test_case_rela.txt")
gl.set_test_ques_file("test_case_ques.txt")
gl.set_test_label_file("test_case_label.txt")
gl.set_preprocessWordVector_files("TencentPreTrain.txt")
gl.set_preprocessWordVector_path("/data/zjy/")
gl.set_MAX_NB_WORDS(30)
gl.set_EMBEDDING_DIM(200)
gl.set_LSTM_DIM(150)

train_rela_files = gl.get_train_rela_files()
train_ques_file = gl.get_train_ques_file()
train_label_file = gl.get_train_label_file()
test_rela_files = gl.get_test_rela_files()
test_ques_file = gl.get_test_ques_file()
test_label_file = gl.get_test_label_file()
preprocessWordVector_files = gl.get_preprocessWordVector_files()
preprocessWordVector_path = gl.get_preprocessWordVector_path()
MAX_NB_WORDS = gl.get_MAX_NB_WORDS()
EMBEDDING_DIM = gl.get_EMBEDDING_DIM()
LSTM_DIM = gl.get_LSTM_DIM()
Example #2
0
import keras.backend as K
K.set_image_dim_ordering('tf')
import numpy as np
import globalvar as gl
from preprocess.data_preprocessor import generateWord2VectorMatrix, loadEmbeddingsIndex, preprocess_all_words
from model.loadModel import creatCNNModel
#全局变量

gl.set_train_rela_files("train_case_rela.txt")
gl.set_train_ques_file("train_case_ques.txt")
gl.set_train_label_file("train_case_label.txt")
gl.set_test_rela_files("test_case_rela.txt")
gl.set_test_ques_file("test_case_ques.txt")
gl.set_test_label_file("test_case_label.txt")
gl.set_preprocessWordVector_files("reducedW2V.txt")
gl.set_preprocessWordVector_path("/data/ylx/ylx/data/")
gl.set_MAX_NB_WORDS(50)
gl.set_EMBEDDING_DIM(200)
gl.set_LSTM_DIM(150)

train_rela_files = gl.get_train_rela_files()
train_ques_file = gl.get_train_ques_file()
train_label_file = gl.get_train_label_file()
test_rela_files = gl.get_test_rela_files()
test_ques_file = gl.get_test_ques_file()
test_label_file = gl.get_test_label_file()
preprocessWordVector_files = gl.get_preprocessWordVector_files()
preprocessWordVector_path = gl.get_preprocessWordVector_path()
train_data_path = gl.get_preprocessWordVector_path()
MAX_NB_WORDS = gl.get_MAX_NB_WORDS()
EMBEDDING_DIM = gl.get_EMBEDDING_DIM()