Mercurial > hg > fulltextIndexer
comparison src/de/mpiwg/dwinter/fulltextIndexer/harvester/CLI/OCRHarvesterCLI.java @ 0:dc7622afcfea default tip
initial
author | dwinter |
---|---|
date | Wed, 03 Nov 2010 12:33:16 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:dc7622afcfea |
---|---|
1 /* */ package de.mpiwg.dwinter.fulltextIndexer.harvester.CLI; | |
2 /* */ | |
3 /* */ import de.mpiwg.dwinter.fulltextIndexer.harvester.OCRHarvesterThreaded; | |
4 /* */ import java.io.File; | |
5 /* */ import java.io.IOException; | |
6 /* */ import java.io.PrintStream; | |
7 /* */ import org.apache.lucene.index.CorruptIndexException; | |
8 /* */ import org.apache.lucene.store.LockObtainFailedException; | |
9 /* */ | |
10 /* */ public class OCRHarvesterCLI | |
11 /* */ { | |
12 /* */ public static void main(String[] args) | |
13 /* */ throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException | |
14 /* */ { | |
15 /* 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>"; | |
16 /* */ | |
17 /* 24 */ if ((args.length != 3) && (args.length != 2)) { | |
18 /* 25 */ System.err.println("Usage: " + usage); | |
19 /* 26 */ System.exit(1); | |
20 /* */ } | |
21 /* */ | |
22 /* 34 */ File docDir = new File(args[0]); | |
23 /* 35 */ if ((!docDir.exists()) || (!docDir.canRead())) { | |
24 /* 36 */ System.out.println("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); | |
25 /* 37 */ System.exit(1); | |
26 /* */ } | |
27 /* */ | |
28 /* 40 */ File index_dir = new File(args[1]); | |
29 /* */ | |
30 /* 42 */ if (args.length == 2) { | |
31 /* 43 */ doTheHarvest(docDir, index_dir, null); | |
32 /* */ } | |
33 /* */ else { | |
34 /* 46 */ String[] options = args[2].split("="); | |
35 /* 47 */ if (options.length != 2) { | |
36 /* 48 */ System.err.println("wrong options:" + args[2]); | |
37 /* 49 */ System.exit(1); | |
38 /* */ } | |
39 /* */ | |
40 /* 52 */ if (options[0].equals("--lang")) { | |
41 /* 53 */ doTheHarvestLanguage(docDir, index_dir, options[1]); | |
42 /* 54 */ } else if (options[0].equals("--langfile")) { | |
43 /* 55 */ doTheHarvest(docDir, index_dir, options[1]); | |
44 /* */ } else { | |
45 /* 57 */ System.err.println("wrong options:" + options[0]); | |
46 /* 58 */ System.exit(1); | |
47 /* */ } | |
48 /* */ } | |
49 /* */ } | |
50 /* */ | |
51 /* */ protected static void doTheHarvestLanguage(File docDir, File index_dir, String lang) throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException | |
52 /* */ { | |
53 /* 65 */ OCRHarvesterThreaded harvester = new OCRHarvesterThreaded(docDir, index_dir, null, null, lang); | |
54 /* 66 */ harvester.harvestFolder(); | |
55 /* */ } | |
56 /* */ | |
57 /* */ protected static void doTheHarvest(File docDir, File index_dir, String languageFile) | |
58 /* */ throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException | |
59 /* */ { | |
60 /* 72 */ OCRHarvesterThreaded harvester = new OCRHarvesterThreaded(docDir, index_dir, languageFile, null); | |
61 /* 73 */ harvester.harvestFolder(); | |
62 /* */ } | |
63 /* */ } | |
64 | |
65 /* Location: /private/tmp/fulltextIndexer.jar | |
66 * Qualified Name: de.mpiwg.dwinter.fulltextIndexer.harvester.CLI.OCRHarvesterCLI | |
67 * JD-Core Version: 0.5.4 | |
68 */ |