# coding=utf-8 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()
# coding=utf-8 import io import numpy as np from keras.utils import np_utils from keras.preprocessing.sequence import pad_sequences import globalvar as gl from model.classification_model import test_cnn #全局变量 from preprocess.data_preprocessor import tokenize, loadEmbeddingsIndex, generateWord2VectorMatrix gl.set_train_rela_files("train_case_rela_fenlei_label.txt") gl.set_train_ques_file("train_case_ques_fenlei.txt") gl.set_test_rela_files("test_case_rela_fenlei_label.txt") gl.set_test_ques_file("test_case_ques.txt") gl.set_preprocessWordVector_files("TencentPreTrain.txt") gl.set_preprocessWordVector_path("/data/zjy/") 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() test_rela_files = gl.get_test_rela_files() test_ques_file = gl.get_test_ques_file()