-
Notifications
You must be signed in to change notification settings - Fork 1
/
DBpediaSpotlight.java
62 lines (48 loc) · 1.28 KB
/
DBpediaSpotlight.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
package vocabulary.extended.eis.de;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
public class DBpediaSpotlight implements QAComponent {
public DBpediaSpotlight() {
// TODO Auto-generated constructor stub
}
public String getQuestion()
{
String path="/Users/kulsingh/Documents/workspace/Pipeline/src/vocabulary/extended/eis/de/Question";// path to the file
String question = "";
try{
BufferedReader bReader = new BufferedReader(new FileReader(path));
question = bReader.readLine();
}catch(Exception e)
{
e.printStackTrace();
}
return question;
}
public static void replaceQuestion(String question)
{
String path = "src/vocabulary/extended/eis/de/Question";// path to the file
try{
BufferedWriter bWriter = new BufferedWriter(new FileWriter(path,false));
bWriter.write(question);
bWriter.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
@Override
public String process(Object inputString){
// TODO Auto-generated method stub
System.out.println(inputString);
if(inputString instanceof String)
return simulateOutput((String)inputString);
else
return null;
}
private String simulateOutput(String val){
return "Json Object";
}
}