@@ -0,0 +1,3087 @@
+package de.exciteproject.refext.extract;%0A%0Aimport java.io.BufferedWriter;%0Aimport java.io.File;%0Aimport java.io.FileWriter;%0Aimport java.io.IOException;%0Aimport java.time.Duration;%0Aimport java.time.Instant;%0Aimport java.util.List;%0A%0Aimport org.apache.commons.io.FilenameUtils;%0A%0Aimport de.exciteproject.refext.util.CsvUtils;%0Aimport de.exciteproject.refext.util.TextUtils;%0Aimport pl.edu.icm.cermine.exception.AnalysisException;%0Aimport pl.edu.icm.cermine.structure.model.BxLine;%0A%0A/**%0A * Extension of %7B@link CermineLineExtractor%7D to also store layout information on%0A * the inividual lines.%0A */%0Apublic class CermineFileLineLayoutExtractor extends CermineLineExtractor %7B%0A%0A    /**%0A     *%0A     * @param args%0A     *            args%5B0%5D: directory containing pdf files and/or subfolders with%0A     *            pdf files %3C/br%3E%0A     *            args%5B1%5D: directory in which the outputfiles are stored,%0A     *            including the subdirectories%0A     *%0A     * @throws IOException%0A     * @throws AnalysisException%0A     */%0A    public static void main(String%5B%5D args) throws IOException, AnalysisException %7B%0A        File inputFile = new File(args%5B0%5D);%0A        File outputDir = new File(args%5B1%5D);%0A        long pdfFileSizeLimit = Long.parseLong(args%5B2%5D);%0A%0A        if (!outputDir.exists()) %7B%0A            outputDir.mkdirs();%0A        %7D%0A%0A        CermineFileLineLayoutExtractor cermineLineLayoutExtractor = new CermineFileLineLayoutExtractor();%0A%0A        Instant start = Instant.now();%0A        System.out.println(%22processing: %22 + inputFile);%0A        if (inputFile.length() %3E pdfFileSizeLimit) %7B%0A            System.out.println(%22skipping with size: %22 + inputFile.length());%0A            System.exit(0);%0A        %7D%0A%0A        String outputFileName = FilenameUtils.removeExtension(inputFile.getName()) + %22.txt%22;%0A        File outputFile = new File(outputDir.getAbsolutePath() + File.separator + outputFileName);%0A%0A        // skip computation if outputFile already exists%0A        if (outputFile.exists()) %7B%0A            System.exit(0);%0A        %7D%0A%0A        List%3CString%3E lines = cermineLineLayoutExtractor.extract(inputFile);%0A        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(outputFile));%0A        for (String line : lines) %7B%0A            if (line.split(%22%5C%5Ct%22).length == 6) %7B%0A                bufferedWriter.write(line);%0A                bufferedWriter.newLine();%0A            %7D%0A        %7D%0A        bufferedWriter.close();%0A%0A        Instant end = Instant.now();%0A        System.out.println(%22Done. Execution time: %22 + Duration.between(start, end));%0A    %7D%0A%0A    public CermineFileLineLayoutExtractor() throws AnalysisException %7B%0A        super();%0A    %7D%0A%0A    /**%0A     * TODO add explanation to x/y/height/width/zoneID%0A     */%0A    @Override%0A    protected String extractFromLine(BxLine bxLine) %7B%0A        String fixedLine = TextUtils.fixAccents(bxLine.toText());%0A        fixedLine = CsvUtils.normalize(fixedLine);%0A        fixedLine += %22%5Ct%22 + bxLine.getX() + %22%5Ct%22 + bxLine.getY() + %22%5Ct%22 + bxLine.getHeight() + %22%5Ct%22 + bxLine.getWidth()%0A                + %22%5Ct%22 + bxLine.getParent().getId();%0A        return fixedLine;%0A%0A    %7D%0A%0A%7D%0A

Add CermineFileLineLayoutExtractor (temporarily)