add bert script

This commit is contained in:
s440058 2021-06-21 13:01:15 +02:00
commit e77c9e41d1
2 changed files with 4 additions and 4 deletions

BIN
geval Executable file

Binary file not shown.

View File

@ -51,9 +51,9 @@ def use_word2vec():
return w2v
def document_vector(w2v, x_train, x_dev, x_test):
x_train = [np.mean([w2v[w] for w in doc if w in w2v] or [np.zeros(300)], axis = 0) for doc in x_train]
x_dev = [np.mean([w2v[w] for w in doc if w in w2v] or [np.zeros(300)], axis = 0) for doc in x_dev]
x_test = [np.mean([w2v[w] for w in doc if w in w2v] or [np.zeros(300)], axis = 0) for doc in x_test]
x_train = [np.mean([w2v[word] for word in doc if word in w2v] or [np.zeros(300)], axis = 0) for doc in x_train]
x_dev = [np.mean([w2v[word] for word in doc if word in w2v] or [np.zeros(300)], axis = 0) for doc in x_dev]
x_test = [np.mean([w2v[word] for word in doc if word in w2v] or [np.zeros(300)], axis = 0) for doc in x_test]
return x_train, x_dev, x_test
@ -119,5 +119,5 @@ def main():
y_dev, y_test = prediction(nn_model, BATCH_SIZE, x_dev, x_test)
get_result(y_dev, y_test)
if __name__ == '__main__':
if _name_ == '_main_':
main()