@@ -0,0 +1,2451 @@
+/**%0A * This file is part of CERMINE project.%0A * Copyright (c) 2011-2013 ICM-UW%0A *%0A * CERMINE is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * CERMINE is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with CERMINE. If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage pl.edu.icm.cermine.pubmed;%0A%0Aimport java.io.File;%0Aimport java.io.FileReader;%0Aimport java.io.FileWriter;%0Aimport java.io.IOException;%0Aimport java.util.Collection;%0Aimport java.util.List;%0Aimport org.apache.commons.cli.ParseException;%0Aimport org.apache.commons.io.FileUtils;%0Aimport pl.edu.icm.cermine.exception.AnalysisException;%0Aimport pl.edu.icm.cermine.exception.TransformationException;%0Aimport pl.edu.icm.cermine.structure.model.BxPage;%0Aimport pl.edu.icm.cermine.structure.transformers.BxDocumentToTrueVizWriter;%0Aimport pl.edu.icm.cermine.structure.transformers.TrueVizToBxDocumentReader;%0A%0Apublic class DocumentShrinker %7B%0A%0A    public static void main(String%5B%5D args) throws TransformationException, IOException, AnalysisException, ParseException, CloneNotSupportedException %7B%0A        String inDir = args%5B0%5D;%0A%0A        File dir = new File(inDir);%0A        %0A        Collection%3CFile%3E files = FileUtils.listFiles(dir, new String%5B%5D%7B%22cxml%22%7D, true);%0A        %0A        int i = 0;%0A        for (File f : files) %7B%0A            System.out.println(f.getPath());%0A            TrueVizToBxDocumentReader tvReader = new TrueVizToBxDocumentReader();%0A            List%3CBxPage%3E pages = tvReader.read(new FileReader(f));%0A            %0A            File newF = new File(f.getPath().replaceFirst(%22%5C%5C.%5C%5Cd+%5C%5C.cxml%22, %22.cxml%22));%0A            System.out.println(newF.getName());%0A            BxDocumentToTrueVizWriter writer = new BxDocumentToTrueVizWriter();%0A            FileWriter fw = new FileWriter(newF);%0A            writer.write(fw, pages, BxDocumentToTrueVizWriter.MINIMAL_OUTPUT_SIZE);%0A            fw.close();%0A            i++;%0A            %0A            System.out.println(%22Progress: %22+((double)i*100./(double)files.size()));%0A        %7D%0A%09%7D%0A%7D%0A

document schrinker added