Commit 573a63ac authored by Tien's avatar Tien

Hot fix short text bug

parent f4acfdaf
......@@ -8,7 +8,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
/**
* @author
* @author Nguyen Minh Tien minh-tien.nguyen@imag.fr
*/
public class ThresholdsSet extends HashMap<String, Double[]> {
......
......@@ -46,7 +46,8 @@ public class TextProcessor {
ArrayList<Text> text = new ArrayList<Text>();
/**
* Process a File (pdf,xml) to create clean set of text (incase of need to split)
* Process a File (pdf,xml) to create clean set of text (incase of need to
* split)
*
* @param original file
* @param listOfFile
......@@ -78,7 +79,7 @@ public class TextProcessor {
content = a.xmlextract(original);
}
//lets deal with long file over here
//lets deal with long file over here
//split content and the index part by part
if (content.length() < maxlength) {
......@@ -112,11 +113,13 @@ public class TextProcessor {
return text;
}
/**
* Read the index file if it is avaiable
* @param path to the index file
* @return hashmap of indexs
*/
/**
* Read the index file if it is avaiable
*
* @param path to the index file
* @return hashmap of indexs
*/
private HashMap<String, Integer> readindexfile(String path) throws IOException {
File index = new File(path);
BufferedReader br;
......@@ -153,8 +156,12 @@ public class TextProcessor {
lower = upper;
upper = content.length();
part[i] = (content.substring(lower, upper));
if (content.substring(lower, upper).length() < maxlength / 3) {
part[i - 1] = part[i - 1] + content.substring(lower, upper);
part = Arrays.copyOf(part, part.length - 1);
} else {
part[i] = (content.substring(lower, upper));
}
}
return part;
}
......
......@@ -81,9 +81,13 @@ public class SciDetect_Local {
}
/**
* This should be where all the components be called,
* It can be used as an interface for a stand alone SciDetect API library.
* @throws IOException
*/
private void compute() throws IOException {
public void compute(String[] args) throws IOException {
readconfig();
readargs(args);
if (testpath != null) {
DateFormat dateFormat = new SimpleDateFormat("HH:mm dd.MM.yyyy");
Date date = new Date();
......@@ -147,14 +151,14 @@ public class SciDetect_Local {
}
/**
* To print usage (-h)
* To print usage (-h).
*/
private static void printUsage() {
System.out.println("***** Scigen & Co Checker \n");
System.out.println("To test all files in a directory <pathToFilesDirToTest>:");
System.out.println("java -jar ScigenChecker_local.jar -l <pathToLogFile> -c <pathToFilesDirToTest> \n");
System.out.println("java -jar SciDetect_local.jar -l <pathToLogFile> -c <pathToFilesDirToTest> \n");
System.out.println("To print usage:");
System.out.println("java -jar ScigenChecker_local.jar -h \n");
System.out.println("java -jar SciDetect_local.jar -h \n");
System.out.println("***** \n");
}
......@@ -171,9 +175,7 @@ public class SciDetect_Local {
public static void main(String[] args) throws IOException {
SciDetect_Local a = new SciDetect_Local();
a.readconfig();
a.readargs(args);
a.compute();
a.compute(args);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment