Commit 1393f590 authored by Tien's avatar Tien
Browse files

Fixed minor bugs

parent 05c78f85
...@@ -26,7 +26,7 @@ jar: ...@@ -26,7 +26,7 @@ jar:
cp SciDetect_Local`date +%Y-%m-%d`.jar SciDetect_Local.jar cp SciDetect_Local`date +%Y-%m-%d`.jar SciDetect_Local.jar
run: run:
java -jar SciDetect_local.jar -l checklog.txt -c Test java -jar SciDetect_Local`date +%Y-%m-%d`.jar -l checklog.txt -c Test
clean: clean:
rm -r classes; rm -r doc; rm -r classes; rm -r doc;
No preview for this file type
application.args=-c /home/tien/Test_demo/xml/2978-3-319-20608-0_Book_PrintPDF.pdf -d -noclean application.args=-c /home/tien/Downloads/ReSciDetect/119514_1371359.pdf -noclean
compile.on.save=true compile.on.save=true
do.depend=false do.depend=false
do.jar=true do.jar=true
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group/>
<file>file:/home/tien/NetBeansProjects/ScigenChecker_Local/src/fr/imag/forge/scidetect/Checker/Utils/DistancesSet.java</file>
<file>file:/home/tien/NetBeansProjects/ScigenChecker_Local/src/fr/imag/forge/scidetect/Logger/Log.java</file>
<file>file:/home/tien/NetBeansProjects/ScigenChecker_Local/src/fr/imag/forge/scidetect/scigenchecker_local/ScigenChecker_Local.java</file>
</group>
</open-files> </open-files>
</project-private> </project-private>
...@@ -72,6 +72,7 @@ public class Reader { ...@@ -72,6 +72,7 @@ public class Reader {
} }
} }
} }
br.close();
} }
...@@ -90,6 +91,7 @@ public class Reader { ...@@ -90,6 +91,7 @@ public class Reader {
readsamples(listOfFile[j].getPath()); readsamples(listOfFile[j].getPath());
} else if (listOfFile[j].getName().endsWith(".pdf") || listOfFile[j].getName().endsWith(".xml") || listOfFile[j].getName().endsWith(".xtx") || (listOfFile[j].getName().endsWith(".txt") && !listOfFile[j].getName().startsWith("INDEX-"))) { } else if (listOfFile[j].getName().endsWith(".pdf") || listOfFile[j].getName().endsWith(".xml") || listOfFile[j].getName().endsWith(".xtx") || (listOfFile[j].getName().endsWith(".txt") && !listOfFile[j].getName().startsWith("INDEX-"))) {
ArrayList<Text> text = new ArrayList<Text>(); ArrayList<Text> text = new ArrayList<Text>();
// System.out.println(listOfFile[j].getName());
TextProcessor textprocessor = new TextProcessor(); TextProcessor textprocessor = new TextProcessor();
text = textprocessor.newtext(listOfFile[j], listOfFile); text = textprocessor.newtext(listOfFile[j], listOfFile);
for (int i = 0; i < text.size(); i++) { for (int i = 0; i < text.size(); i++) {
...@@ -109,9 +111,9 @@ public class Reader { ...@@ -109,9 +111,9 @@ public class Reader {
* @return test corpus * @return test corpus
* @throws IOException * @throws IOException
*/ */
public Corpus readtests(String foldername, Corpus Samplecorpus, Boolean savedetaillog) throws IOException { public String readtests(String foldername, Corpus Samplecorpus, Boolean savedetaillog) throws IOException {
File folder = new File(foldername); File folder = new File(foldername);
String conclusion = new String();
if (folder.isDirectory()) { if (folder.isDirectory()) {
File[] listOfFile = folder.listFiles(); File[] listOfFile = folder.listFiles();
for (int j = 0; j < listOfFile.length; j++) { for (int j = 0; j < listOfFile.length; j++) {
...@@ -125,18 +127,7 @@ public class Reader { ...@@ -125,18 +127,7 @@ public class Reader {
for (int i = 0; i < text.size(); i++) { for (int i = 0; i < text.size(); i++) {
test.put(text.get(i)); test.put(text.get(i));
} }
DistancesSet distant = new DistancesSet();
DistantCalculator dc = new DistantCalculator();
distant = dc.caldistant(Samplecorpus, test);
Classifier cl = new Classifier();
String conclusion = cl.classify(distant);
System.out.println(conclusion);
Log log = new Log();
log.savelog(conclusion);
if (savedetaillog) {
log.savedetaillog(distant);
}
} }
} }
...@@ -150,20 +141,21 @@ public class Reader { ...@@ -150,20 +141,21 @@ public class Reader {
for (int i = 0; i < text.size(); i++) { for (int i = 0; i < text.size(); i++) {
test.put(text.get(i)); test.put(text.get(i));
} }
DistancesSet distant = new DistancesSet();
DistantCalculator dc = new DistantCalculator(); }
distant = dc.caldistant(Samplecorpus, test); DistancesSet distant = new DistancesSet();
Classifier cl = new Classifier(); DistantCalculator dc = new DistantCalculator();
String conclusion = cl.classify(distant); distant = dc.caldistant(Samplecorpus, test);
System.out.println(conclusion); Classifier cl = new Classifier();
Log log = new Log(); conclusion = cl.classify(distant);
log.savelog(conclusion); System.out.println(conclusion);
Log log = new Log();
if (savedetaillog) { log.savelog(conclusion);
log.savedetaillog(distant);
} if (savedetaillog) {
log.savedetaillog(distant);
} }
return test; return conclusion;
} }
......
...@@ -62,7 +62,7 @@ public class TextProcessor { ...@@ -62,7 +62,7 @@ public class TextProcessor {
+ original.getName().substring(0, + original.getName().substring(0,
original.getName().lastIndexOf(".")) original.getName().lastIndexOf("."))
+ ".txt"; + ".txt";
String content = ""; String content = null;
if (Arrays.asList(listOfFile).toString().contains(indexname)) { if (Arrays.asList(listOfFile).toString().contains(indexname)) {
// System.out.println("lets read from index file"); // System.out.println("lets read from index file");
......
...@@ -44,7 +44,7 @@ public class SciDetect_Local { ...@@ -44,7 +44,7 @@ public class SciDetect_Local {
private String testpath; private String testpath;
//private String logtime; //private String logtime;
public Corpus samples = new Corpus(); public Corpus samples = new Corpus();
private Corpus tests = new Corpus(); //private Corpus tests = new Corpus();
private String SamplesFolder; private String SamplesFolder;
//private HashMap<String, HashMap<String, Double>> distant = new HashMap<String, HashMap<String, Double>>(); //private HashMap<String, HashMap<String, Double>> distant = new HashMap<String, HashMap<String, Double>>();
DistancesSet distant = new DistancesSet(); DistancesSet distant = new DistancesSet();
...@@ -102,7 +102,7 @@ public class SciDetect_Local { ...@@ -102,7 +102,7 @@ public class SciDetect_Local {
reader.readconfig(); reader.readconfig();
samples = reader.readsamples(SamplesFolder); samples = reader.readsamples(SamplesFolder);
tests = reader.readtests(testpath, samples, savedetaillog); conclusion=reader.readtests(testpath, samples, savedetaillog);
} catch (Exception e) { } catch (Exception e) {
System.out.println("* Something went wrong during:"); System.out.println("* Something went wrong during:");
......
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