Mercurial > hg > fulltextIndexer
diff src/de/mpiwg/dwinter/fulltextIndexer/harvester/CLI/.svn/text-base/OCRHarvesterCLI.java.svn-base @ 0:dc7622afcfea default tip
initial
author | dwinter |
---|---|
date | Wed, 03 Nov 2010 12:33:16 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltextIndexer/harvester/CLI/.svn/text-base/OCRHarvesterCLI.java.svn-base Wed Nov 03 12:33:16 2010 +0100 @@ -0,0 +1,68 @@ +/* */ package de.mpiwg.dwinter.fulltextIndexer.harvester.CLI; +/* */ +/* */ import de.mpiwg.dwinter.fulltextIndexer.harvester.OCRHarvesterThreaded; +/* */ import java.io.File; +/* */ import java.io.IOException; +/* */ import java.io.PrintStream; +/* */ import org.apache.lucene.index.CorruptIndexException; +/* */ import org.apache.lucene.store.LockObtainFailedException; +/* */ +/* */ public class OCRHarvesterCLI +/* */ { +/* */ public static void main(String[] args) +/* */ throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException +/* */ { +/* 21 */ String usage = "java de.mpiwg.itgroup.fulltext.harvester.OCRHarvesterCLI <root_directory> <index_dir> --lang=<language>\njava de.mpiwg.itgroup.fulltext.harvester.OCRHarvesterCLI <root_directory> <index_dir> --langfile=<languageFile>\njava de.mpiwg.itgroup.fulltext.harvester.OCRHarvesterCLI <root_directory> <index_dir>"; +/* */ +/* 24 */ if ((args.length != 3) && (args.length != 2)) { +/* 25 */ System.err.println("Usage: " + usage); +/* 26 */ System.exit(1); +/* */ } +/* */ +/* 34 */ File docDir = new File(args[0]); +/* 35 */ if ((!docDir.exists()) || (!docDir.canRead())) { +/* 36 */ System.out.println("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); +/* 37 */ System.exit(1); +/* */ } +/* */ +/* 40 */ File index_dir = new File(args[1]); +/* */ +/* 42 */ if (args.length == 2) { +/* 43 */ doTheHarvest(docDir, index_dir, null); +/* */ } +/* */ else { +/* 46 */ String[] options = args[2].split("="); +/* 47 */ if (options.length != 2) { +/* 48 */ System.err.println("wrong options:" + args[2]); +/* 49 */ System.exit(1); +/* */ } +/* */ +/* 52 */ if (options[0].equals("--lang")) { +/* 53 */ doTheHarvestLanguage(docDir, index_dir, options[1]); +/* 54 */ } else if (options[0].equals("--langfile")) { +/* 55 */ doTheHarvest(docDir, index_dir, options[1]); +/* */ } else { +/* 57 */ System.err.println("wrong options:" + options[0]); +/* 58 */ System.exit(1); +/* */ } +/* */ } +/* */ } +/* */ +/* */ protected static void doTheHarvestLanguage(File docDir, File index_dir, String lang) throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException +/* */ { +/* 65 */ OCRHarvesterThreaded harvester = new OCRHarvesterThreaded(docDir, index_dir, null, null, lang); +/* 66 */ harvester.harvestFolder(); +/* */ } +/* */ +/* */ protected static void doTheHarvest(File docDir, File index_dir, String languageFile) +/* */ throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException +/* */ { +/* 72 */ OCRHarvesterThreaded harvester = new OCRHarvesterThreaded(docDir, index_dir, languageFile, null); +/* 73 */ harvester.harvestFolder(); +/* */ } +/* */ } + +/* Location: /private/tmp/fulltextIndexer.jar + * Qualified Name: de.mpiwg.dwinter.fulltextIndexer.harvester.CLI.OCRHarvesterCLI + * JD-Core Version: 0.5.4 + */ \ No newline at end of file