Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xliu78 committed Sep 17, 2018
2 parents 8fb647e + 2a84d59 commit 9fcdfcc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
17 changes: 14 additions & 3 deletions src/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public class Main {
private static String methdName = "";
private static String indexPath = "";
private static boolean useDefaultScore = true;
private static String paragraphPath = "";
private static String pagePath = "";
private static String qrelPath = "";

public static void main(String[] args) throws IOException, ParseException, CborException {
System.setProperty("file.encoding", "UTF-8");
// String methdName = "";
Expand All @@ -30,6 +34,12 @@ public static void main(String[] args) throws IOException, ParseException, CborE
///Users/xinliu/Documents/UNH/18Fall/cs853/index /Users/xinliu/Documents/UNH/18Fall/cs853/test200/test200-train/train.pages.cbor-paragraphs.cbor
String defualtScore = args[0];
indexPath = args[1];
paragraphPath = args[2];
pagePath = args[3];
qrelPath = args[4];



useDefaultScore = Boolean.valueOf(defualtScore);
if (useDefaultScore){
methdName = "default";
Expand All @@ -40,10 +50,11 @@ public static void main(String[] args) throws IOException, ParseException, CborE
}


ReadData readData = new ReadData(paragraphPath,pagePath,qrelPath);
List<Paragraph> paragraphsList = readData.getParagraphList();
// List<Paragraph> paragraphsList = ReadData.getParagraphList();

List<Paragraph> paragraphsList = ReadData.getParagraphList();

List<Page> pageList = ReadData.getPageList();
List<Page> pageList = readData.getPageList();

List<Rank> rankList = getRankList(paragraphsList,pageList,useDefaultScore,methdName,indexPath);

Expand Down
36 changes: 26 additions & 10 deletions src/main/ReadData.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,41 @@

public class ReadData {

private static String paragPath = "";
private static String pagePath = "";
private static String qrelPath = "";


public ReadData(){

}

public ReadData(String paragraphPath,String pagedir, String qreldir){
this.paragPath = paragraphPath;
this.pagePath = pagedir;
this.qrelPath = qreldir;
}


public static void main(String args[]){
// if (args.length < 1){
// System.out.println("command line argument : FileDirectory");
// }

// String filePath = args[0];


System.out.println("reading data");


paragPath = args[0];
pagePath = args[1];
qrelPath = args[2];

}


public static List<Paragraph> getParagraphList() {
List<Paragraph> paragraphsList = new ArrayList<>();
String fileDir = "./test200-train/train.pages.cbor-paragraphs.cbor";
File file = new File(fileDir);
// String fileDir = "./test200-train/train.pages.cbor-paragraphs.cbor";
System.out.println(pagePath);
File file = new File(paragPath);

FileInputStream stream = null;
try {
Expand Down Expand Up @@ -59,9 +75,9 @@ public static List<Paragraph> getParagraphList() {
public static List<Page> getPageList(){
List<Page> pageList = new ArrayList<>();

String fileDir = "./test200-train/train.pages.cbor-outlines.cbor";
// String fileDir = "./test200-train/train.pages.cbor-outlines.cbor";

File file = new File(fileDir);
File file = new File(pagePath);

FileInputStream stream = null;
try {
Expand Down Expand Up @@ -91,10 +107,10 @@ public static List<Page> getPageList(){
public static TreeMap<String, List<String>> getRelevant(){
TreeMap<String,List<String>> res = new TreeMap<>();

String path = "./test200-train/train.pages.cbor-article.qrels";
// String path = "./test200-train/train.pages.cbor-article.qrels";
BufferedReader bufferedReader = null;

File file = new File(path);
File file = new File(qrelPath);
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
Expand Down
Binary file modified target/classes/main/Main.class
Binary file not shown.

0 comments on commit 9fcdfcc

Please sign in to comment.