Update merging
This commit is contained in:
parent
7bbe8284cd
commit
7f5c60caad
0
NGCC/jar/fontbox-2.0.16.jar
Normal file → Executable file
0
NGCC/jar/fontbox-2.0.16.jar
Normal file → Executable file
0
NGCC/jar/pdfbox-2.0.16.jar
Normal file → Executable file
0
NGCC/jar/pdfbox-2.0.16.jar
Normal file → Executable file
BIN
NGCC/jar/pdfbox-app-2.0.16.jar
Executable file
BIN
NGCC/jar/pdfbox-app-2.0.16.jar
Executable file
Binary file not shown.
0
NGCC/jar/pdfbox-debugger-2.0.16.jar
Normal file → Executable file
0
NGCC/jar/pdfbox-debugger-2.0.16.jar
Normal file → Executable file
0
NGCC/jar/pdfbox-tools-2.0.16.jar
Normal file → Executable file
0
NGCC/jar/pdfbox-tools-2.0.16.jar
Normal file → Executable file
BIN
NGCC/jar/preflight-2.0.16.jar
Executable file
BIN
NGCC/jar/preflight-2.0.16.jar
Executable file
Binary file not shown.
BIN
NGCC/jar/preflight-app-2.0.16.jar
Executable file
BIN
NGCC/jar/preflight-app-2.0.16.jar
Executable file
Binary file not shown.
BIN
NGCC/jar/xmpbox-2.0.16.jar
Executable file
BIN
NGCC/jar/xmpbox-2.0.16.jar
Executable file
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
name=PropertiesConfig
|
|
||||||
property.filename = logs
|
|
||||||
appenders = console, file
|
|
||||||
|
|
||||||
appender.console.type = Console
|
|
||||||
appender.console.name = STDOUT
|
|
||||||
appender.console.layout.type = PatternLayout
|
|
||||||
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
|
|
||||||
|
|
||||||
appender.file.type = File
|
|
||||||
appender.file.name = LOGFILE
|
|
||||||
appender.file.fileName=${filename}/propertieslogs.log
|
|
||||||
appender.file.layout.type=PatternLayout
|
|
||||||
appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
|
|
||||||
|
|
||||||
loggers=file
|
|
||||||
logger.file.name = NGCC
|
|
||||||
logger.file.level = debug
|
|
||||||
logger.file.appenderRefs = file
|
|
||||||
logger.file.appenderRef.file.ref = LOGFILE
|
|
||||||
|
|
||||||
rootLogger.level = debug
|
|
||||||
rootLogger.appenderRefs = stdout
|
|
||||||
rootLogger.appenderRef.stdout.ref = STDOUT
|
|
@ -41,7 +41,7 @@ public class Exec implements Callable <Void> {
|
|||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
|
||||||
// Système de subcommand semblable à celui de git permettant d'appeler les classes relatives
|
// Système de subcommand semblable à celui de git permettant d'appeler les classes relatives
|
||||||
|
String[] t = {"-r","-d","pdf"};
|
||||||
CommandLine cmd = new CommandLine (new Exec())
|
CommandLine cmd = new CommandLine (new Exec())
|
||||||
.addSubcommand("-r", new Read(System.out)) // nom commande, objet commande
|
.addSubcommand("-r", new Read(System.out)) // nom commande, objet commande
|
||||||
.addSubcommand("-b", new Build(System.out))
|
.addSubcommand("-b", new Build(System.out))
|
||||||
@ -51,7 +51,7 @@ public class Exec implements Callable <Void> {
|
|||||||
.addSubcommand("-e", new Evaluate(System.out))
|
.addSubcommand("-e", new Evaluate(System.out))
|
||||||
.addSubcommand("help", new HelpCommand()); // Aide générée automatiquement par l'API
|
.addSubcommand("help", new HelpCommand()); // Aide générée automatiquement par l'API
|
||||||
|
|
||||||
cmd.execute(args);
|
cmd.execute(t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package commands;
|
package commands;
|
||||||
|
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
|
|
||||||
import picocli.CommandLine.*;
|
import picocli.CommandLine.*;
|
||||||
import progressbar.ProgressBar;
|
import progressbar.ProgressBar;
|
||||||
|
|
||||||
@ -8,7 +9,8 @@ import java.io.PrintStream;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import config.Config;
|
import config.Config;
|
||||||
import ocr_orm.ControleurOCR;
|
import csv.GenerateCSV;
|
||||||
|
import ocr.GestionnaireCopies;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -105,13 +107,16 @@ public class Read implements Callable <Void> {
|
|||||||
|
|
||||||
|
|
||||||
Config config = new Config(source_path); //Initialise le fichier de configuration selon le path donné
|
Config config = new Config(source_path); //Initialise le fichier de configuration selon le path donné
|
||||||
ControleurOCR ocr = new ControleurOCR(); //Initialise le controle de l'OCR
|
config.readConfig();
|
||||||
|
|
||||||
|
|
||||||
ocr.setConfig(config); //Configure l'OCR en fonction du fichier de configuration initialisé
|
GestionnaireCopies ocr = new GestionnaireCopies(directory_name);
|
||||||
|
GenerateCSV csv = new GenerateCSV(ocr.createHashMapforCSV(),config.getParam().get("Code"), result_name);
|
||||||
|
|
||||||
|
|
||||||
GenerateCSV.createFile(ocr.getNumNote(directory_name),result_name); //Génère le fichier csv à partir de la HMap retournée par l'OCR
|
//ocr.setConfig(config); //Configure l'OCR en fonction du fichier de configuration initialisé
|
||||||
|
|
||||||
|
csv.createFile(); //Génère le fichier csv à partir de la HMap retournée par l'OCR
|
||||||
|
|
||||||
//Done !
|
//Done !
|
||||||
|
|
||||||
|
70
NGCC/src/csv/GenerateCSV.java
Normal file
70
NGCC/src/csv/GenerateCSV.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package csv;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class GenerateCSV {
|
||||||
|
|
||||||
|
HashMap<String,String> etudiants;
|
||||||
|
int numLength;
|
||||||
|
String path = "../export";
|
||||||
|
|
||||||
|
public GenerateCSV(HashMap<String,String> map, String s, String p) {
|
||||||
|
this.etudiants = map;
|
||||||
|
this.numLength = Integer.parseInt(s);
|
||||||
|
this.path = path+"/"+p;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public boolean isValid(String s) {
|
||||||
|
// int i = 0;
|
||||||
|
// if (s.length() == this.numLength) {
|
||||||
|
// while (i < s.length())
|
||||||
|
// {
|
||||||
|
// if (s.charAt(i) != '0' && s.charAt(i) == '1' || s.charAt(i) == '2' || s.charAt(i) == '3'
|
||||||
|
// || s.charAt(i) == '4' || s.charAt(i) == '5' || s.charAt(i) == '6' || s.charAt(i) == '7'
|
||||||
|
// || s.charAt(i) == '8' || s.charAt(i) == '9')
|
||||||
|
// {
|
||||||
|
// return true;
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// return false;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// i++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void createFile() {
|
||||||
|
try (PrintWriter writer = new PrintWriter(new File(this.path))) {
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("Student number");
|
||||||
|
sb.append(';');
|
||||||
|
sb.append("Grade");
|
||||||
|
sb.append(System.getProperty("line.separator"));
|
||||||
|
|
||||||
|
writer.write(sb.toString());
|
||||||
|
|
||||||
|
for (String etud : this.etudiants.keySet()) {
|
||||||
|
|
||||||
|
writer.write(etud+";"+etudiants.get(etud)+System.getProperty("line.separator"));
|
||||||
|
|
||||||
|
}
|
||||||
|
System.out.println("Create File Done!");
|
||||||
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
System.err.println(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package ocr;
|
package ocr;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -37,7 +38,7 @@ public class GestionnaireCopies {
|
|||||||
List<BufferedImage> images = new ArrayList<>(); // stockera les images (resultat)
|
List<BufferedImage> images = new ArrayList<>(); // stockera les images (resultat)
|
||||||
// CONVERT PAGES TO IMAGES
|
// CONVERT PAGES TO IMAGES
|
||||||
try {
|
try {
|
||||||
String pdfFilesDirectory = "C:\\Users\\ph807242\\eclipse-workspace\\PT\\pdf\\";
|
String pdfFilesDirectory = "/Users/louis/Desktop/IUT_S3/PT/pt-s3t-g4/pdf";
|
||||||
// nom du fichier pdf à ouvrir (TODO: changer le chemin)
|
// nom du fichier pdf à ouvrir (TODO: changer le chemin)
|
||||||
List<String> files = pdfAnalyzer.listAllFiles(pdfFilesDirectory, ".pdf");
|
List<String> files = pdfAnalyzer.listAllFiles(pdfFilesDirectory, ".pdf");
|
||||||
for (String fname : files) {
|
for (String fname : files) {
|
||||||
@ -56,9 +57,9 @@ public class GestionnaireCopies {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,String> createHashMapforCSV(){
|
public HashMap<String,String> createHashMapforCSV(){
|
||||||
|
|
||||||
Map<String,String> temp = new HashMap<>();
|
HashMap<String,String> temp = new HashMap<>();
|
||||||
for(Copie c : listeCopie)
|
for(Copie c : listeCopie)
|
||||||
{
|
{
|
||||||
temp.put(c.getBase().gethMapImgs().get("NumEtu").getDescription(), c.getBase().gethMapImgs().get("Note").getDescription());
|
temp.put(c.getBase().gethMapImgs().get("NumEtu").getDescription(), c.getBase().gethMapImgs().get("Note").getDescription());
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ocr;
|
package ocr;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
|
||||||
import net.sourceforge.tess4j.Tesseract;
|
import net.sourceforge.tess4j.Tesseract;
|
||||||
import net.sourceforge.tess4j.TesseractException;
|
import net.sourceforge.tess4j.TesseractException;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class PdfToImage {
|
|||||||
images.add(bim);
|
images.add(bim);
|
||||||
System.out.println("Ajout n°" + pageCounter);
|
System.out.println("Ajout n°" + pageCounter);
|
||||||
}
|
}
|
||||||
// document.close();
|
document.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,15 @@ public class TestQuestion {
|
|||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
void testAddReponse() {
|
void testAddReponse() {
|
||||||
Reponse r1=new Reponse("+ Au collège des ninjas",true);
|
Reponse r1=new Reponse("+ Au coll<EFBFBD>ge des ninjas",true);
|
||||||
Question q=new Question("Selon la serie diffusée en 1991 sur TF1, où le petit Nicolas doit il travailler et s'appliquer ?",false);
|
Question q=new Question("Selon la serie diffus<EFBFBD>e en 1991 sur TF1, o<> le petit Nicolas doit il travailler et s'appliquer ?",false);
|
||||||
q.addReponse(r1.getIntitulé());
|
q.addReponse(r1.getIntitule());
|
||||||
assertEquals("Au collège des ninjas",q.getReponses().get(0).getIntitulé());
|
assertEquals("Au coll<EFBFBD>ge des ninjas",q.getReponses().get(0).getIntitule());
|
||||||
Reponse r2=new Reponse("- A l'académie des ninjas",false);
|
Reponse r2=new Reponse("- A l'acad<EFBFBD>mie des ninjas",false);
|
||||||
q.addReponse(r2.getIntitulé());
|
q.addReponse(r2.getIntitule());
|
||||||
assertEquals("A l'académie des ninjas",q.getReponses().get(1).getIntitulé());
|
assertEquals("A l'acad<EFBFBD>mie des ninjas",q.getReponses().get(1).getIntitule());
|
||||||
q.addReponse("Suite de la question");
|
q.addReponse("Suite de la question");
|
||||||
assertEquals("Selon la serie diffusée en 1991 sur TF1, où le petit Nicolas doit il travailler et s'appliquer ?\nSuite de la question",q.getTitre());
|
assertEquals("Selon la serie diffus<EFBFBD>e en 1991 sur TF1, o<> le petit Nicolas doit il travailler et s'appliquer ?\nSuite de la question",q.getTitre());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import org.junit.jupiter.api.Test;
|
|||||||
public class TestReponse {
|
public class TestReponse {
|
||||||
@Test
|
@Test
|
||||||
void testReponse() {
|
void testReponse() {
|
||||||
Reponse r=new Reponse("Je suis la réponse",true);
|
Reponse r=new Reponse("Je suis la r<EFBFBD>ponse",true);
|
||||||
assertEquals("Je suis la réponse",r.getIntitulé());
|
assertEquals("Je suis la r<EFBFBD>ponse",r.getIntitule());
|
||||||
assertEquals(true,r.isJuste());
|
assertEquals(true,r.isJuste());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
|
|||||||
class TestLog4j {
|
class TestLog4j {
|
||||||
|
|
||||||
|
|
||||||
private static Logger logger = LogManager.getLogger();
|
private static Logger logger = LogManager.getLogger(LogManager.getLogger("ngccLog"));
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
BIN
pdf/testPDFMarks copie.pdf
Normal file
BIN
pdf/testPDFMarks copie.pdf
Normal file
Binary file not shown.
BIN
pdf/testPDFMarks.pdf
Normal file
BIN
pdf/testPDFMarks.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user