From 08852b31280487c30fbac13e6f878a6a13c09442 Mon Sep 17 00:00:00 2001 From: t170815518 Date: Wed, 30 Sep 2020 14:18:08 +0800 Subject: [PATCH] Fix bug when entities include whitespace, by improving file reading process with ifstream --- TransE/Train_TransE.cpp | 141 +++++++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 61 deletions(-) diff --git a/TransE/Train_TransE.cpp b/TransE/Train_TransE.cpp index 65fe39d..f510969 100644 --- a/TransE/Train_TransE.cpp +++ b/TransE/Train_TransE.cpp @@ -8,6 +8,7 @@ #include #include #include +#include using namespace std; @@ -73,8 +74,8 @@ class Train{ void run(int n_in,double rate_in,double margin_in,int method_in) { n = n_in; - rate = rate_in; - margin = margin_in; + rate = rate_in; + margin = margin_in; method = method_in; relation_vec.resize(relation_num); for (int i=0; i 0) n = atoi(argv[i + 1]); - if ((i = ArgPos((char *)"-margin", argc, argv)) > 0) margin = atoi(argv[i + 1]); - if ((i = ArgPos((char *)"-method", argc, argv)) > 0) method = atoi(argv[i + 1]); - cout<<"size = "< 0) n = atoi(argv[i + 1]); + if ((i = ArgPos((char *)"-margin", argc, argv)) > 0) margin = atoi(argv[i + 1]); + if ((i = ArgPos((char *)"-method", argc, argv)) > 0) method = atoi(argv[i + 1]); + cout<<"size = "<