-
Notifications
You must be signed in to change notification settings - Fork 2
/
ikasl.js
48 lines (35 loc) · 1.52 KB
/
ikasl.js
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
/**
* Created by supun on 6/17/18.
*/
var express = require('express');
var router = express.Router();
var exec = require('child_process').exec;
router.get('/', (req, res) => {
res.render('ikasl');
});
router.get('/:dataset', (req, res) => {
res.render('Executing.....');
var dataset = req.params.dataset;
var dataset_path = '/media/supun/New\\ Volume/FYP/Discussion\\ Pathways/IKASL\\ Java\\ Implementation/datasets/' + dataset + '/';
// execute the java-ikasl giving the dataset paths
var command = 'java -cp TextFeatureExtractor.jar ExtractFeatures -f daily -p ' + dataset_path;
exec(command, (err, stdout, stderr) => {
if (err){
return res.send("Error: " + err);
}
res.send("Preprocessing done. Running IKASL...");
command = 'java -cp IKASL.jar com.algorithms.test.TestIKASL_TextDatabased_EventDetection_new_data -p '+ dataset_path + '-htf 0.5';
exec(command, (err, stdout, stderr) => {
if (err) return res.send("Error :" + err);
res.send("IKASL completed. Results Saved");
// now the results are saved
// next is to run the python script process_layers
command = 'python process_layers.py --dataset ' + dataset;
exec(command, (err, stdout, stderr) => {
if (err) return res.send("Error: " + err);
return res.send("JSON Created successfully!. Now it is time for Chamod's visualization :-P")
});
});
});
});
module.exports = router;