-
Notifications
You must be signed in to change notification settings - Fork 2
/
IntegrateController.java
105 lines (76 loc) · 2.99 KB
/
IntegrateController.java
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package controllers;
import org.apache.commons.io.IOUtils;
import play.mvc.Controller;
import play.mvc.Result;
import play.libs.*;
import util.ConfigManager;
import views.html.*;
import main.*;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import static play.data.Form.form;
/**
* Created by omar on 1/24/2017.
*/
public class IntegrateController extends Controller {
public Result index() {
return ok("<Caex><Dummy>changess from backend and backend and backend</Dummy></Caex>");
}
public Result index2(String id) throws Exception {
String file1 = form().bindFromRequest().get("file1");
String file2 = form().bindFromRequest().get("file2");
String file3 = form().bindFromRequest().get("file3");
String file4 = form().bindFromRequest().get("file4");
File theDir = new File("c://Result");
// if the directory does not exist, create it
if (!theDir.exists()) {
theDir.mkdir();
}
else{
PrintWriter writer = new PrintWriter("c:\\Result\\seed-0.aml", "UTF-8");
writer.println(file1);
writer.close();
writer = new PrintWriter("c:\\Result\\seed-1.aml", "UTF-8");
writer.println(file2);
writer.close();
writer.close();
writer = new PrintWriter("c:\\Result\\PSL\\test\\GoldStandard.txt", "UTF-8");
writer.println(file3);
writer.close();
writer.close();
}
Files2Facts standardFiles = new Files2Facts();
Similar similar = new Similar();
AlligatorMain main = new AlligatorMain();
ConfigManager.filePath = "c://Result/";
main.readConvertStandardFiles();
main.generatePSLDataModel();
main.executePSLAproach();
String everything;
try(FileInputStream inputStream = new FileInputStream("c://Result/PSL/test/graph.txt")) {
everything = IOUtils.toString(inputStream);
// do something with everything string
}
String everything2="<Accuracy>";
String line;
BufferedReader br ;
br = new BufferedReader(
new FileReader(new File("c://Result/PSL/test/Precision/F1NoTraining.txt")));
while ((line = br.readLine()) != null) {
if (line.contains("Precision :")) {
everything2+="<Precison>"+line.replace("Precision :", "")+"</Precison>";
}
if (line.contains("Recall:")) {
everything2+="<Recall>"+line.replace("Recall:", "")+"</Recall>";;
}
if (line.contains("Fmeasure:")) {
everything2+="<Fmeasure>"+line.replace("Fmeasure:", "")+"</Fmeasure>";;
}
}
return ok(everything.replaceAll(" ","")+everything2+"</Accuracy></Result>");
// return ok(file2);
// return ok("<Caex><Dummy>changess from backend and backendsssssss and backend"+receivedText+"</Dummy></Caex>");
}
}