-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathmain.cpp
64 lines (55 loc) · 1.36 KB
/
main.cpp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// main.cpp
// RelationExtraction
//
// Created by Feng Jun on 06/12/2016.
// Copyright © 2016 Feng Jun. All rights reserved.
//
#include <iostream>
#include "test.h"
#include "RL.h"
#include "RLPre.h"
double GetDoubleNum(string s)
{
double tmp = 0;
int startIndex = -1;
for (int i = 0; i < s.size(); i ++)
{
if (s[i] == '.')
{
startIndex = i + 1;
break;
}
tmp = tmp * 10 + s[i] - '0';
}
double base = 0.1;
for (int i = startIndex; i < s.size(); i ++)
{
tmp += (s[i] - '0') * base;
base /= 10;
}
return tmp;
}
//vector<double *> testSentence;
int main(int argc, const char * argv[]) {
// srand( (unsigned)time( NULL ) );
// if (strcmp(argv[2], "server") == 0)
// pathString = serverPathString;
// else pathString = localPathString;
pathString = serverPathString;
outString = pathString + "out/" + argv[1] + "/";
// outString = pathString + "/data/pretrain/orignalcnn";
if (strcmp(argv[1], "test") == 0)
{
outString = pathString + "out/rl/";
test::beginTest(0);
return 0;
}
method = argv[1];
InitialAlpha = GetDoubleNum(argv[2]);
if (strcmp(argv[1], "rl") == 0)
RL::beginTrain();
if (strcmp(argv[1], "rlpre") == 0)
RLPre::beginTrain();
return 0;
}