id
stringlengths
36
36
text
stringlengths
1
1.25M
d9b2b25a-ac22-4e41-8a70-5791a404a7c9
public Boolean getIncludeExtension() { return includeExtension; }
b5457963-07a8-440c-b901-ef04d68a55c3
@CreoleParameter( comment="If all subdirectories should be recursively be used too", defaultValue="false") public void setRecurseDirectories(Boolean yesno) { recurseDirectories = yesno; }
f68340b7-c5ee-4113-80b2-925826b13d14
public Boolean getRecurseDirectories() { return recurseDirectories; }
f1e53601-ad3c-4078-a87c-b3ad70ae6512
@CreoleParameter( comment="A regular expression pattern that must match for the file to be used", defaultValue="") public void setFilenamePattern(String pattern) { filenamePattern = pattern; }
b52d5cd1-5ee5-4842-b393-7c31b526f45a
public String getFilenamePattern() { return filenamePattern; }
0f510931-29b8-4175-8483-6e20d8562944
public List<String> soso() { return fileNames; }
b466bd3b-1b2b-43a4-a7ce-adf43f4a4dbc
public Resource init() throws ResourceInstantiationException { if(getDirectoryURL() == null) { throw new ResourceInstantiationException("directoryURL must not be empty"); } File theDir = gate.util.Files.fileFromURL(getDirectoryURL()); try { theDir = theDir.getCanonicalFile(); } catch (IO...
519108d0-b99f-4175-8c98-3a6700644851
private String getRelativePathName(File theDir, File theFile) { String dirName = theDir.getAbsolutePath(); String fileName = theFile.getAbsolutePath(); return fileName.substring(dirName.length()+1); }
b51176f0-7134-4f5d-8555-ad987055b80f
@Override public int getTotalNumberOfDocuments() { return fileNames.size(); }
6d7ea66c-d366-452a-8642-ab11428fc52e
public void open() { fileNamesIterator = fileNames.iterator(); }
204b1c61-56ec-4aa1-a1b0-4207eae09b71
public void close() { fileNamesIterator = null; }
7ae93299-769d-419f-a8af-30b7c2d3da89
public boolean hasNext() { return fileNamesIterator.hasNext(); }
5fef5c8d-9970-4b6f-9ed7-75592405aa3d
public Document next() { Document doc = null; if(!fileNamesIterator.hasNext()) { return null; } String fileName = fileNamesIterator.next(); // TODO: get the document and return it // if there is an error and we do not fail on conversion, return null try { // TODO: create the full...
8f003b00-b11f-44b1-afdf-d4d127e56af4
public String getStringFromFile(String filename) throws FileNotFoundException, IOException { String content = ""; // if input compression is allowed, check if the name ends in .gz // if yes, read the file using a decompressing stream, otherwise using // a normal stream InputStream isorig = new F...
1e4c1374-e846-45fd-aa35-a42b11c614ae
@Option(shortName="l",longName="listfrom",pattern="^stdin|file|dir|dircorpus$",defaultValue="dir",description="Where to get the list of filenames from: stdin, file, dir, dircorpus (default: dir)") String getListFrom();
a98c73d2-f138-42dc-b1fc-d3c9e3324833
boolean isListFrom();
25f55cc1-38f1-406c-ab15-69470d4749a4
@Option(longName="indir",defaultValue="",description="Directory that contains the files to process (default: current)") String getInDir();
4769209e-7022-4f11-bf5c-808442f549b3
boolean isInDir();
5c1eaade-edfd-425e-9327-c242886c7793
@Option(longName="outdir",defaultValue="",description="Directory where processed files are strored (default: same es indir)") String getOutDir();
3d1502fb-b6db-4be4-9bbe-63db34c154aa
boolean isOutDir();
ee839dfb-4352-4952-a235-924aae05205e
@Option(shortName="c",longName="controller",description="Name of the controller/pipeline file") String getController();
9c4d2a19-790b-403c-987a-b26e116d1650
@Option(longName="saveas",defaultValue="xml",description="Save as xml, xmlorig, xmlfull, string (default: xml, ignored for dircorpus)") String getSaveAs();
bf8c1cdd-96eb-44f2-8c30-1f3fea5a1707
boolean isSaveAs();
3cb0a6f7-a666-4c0b-9d21-df953cbec166
@Option(longName="saveto",defaultValue="file",description="Save to file, none, stdout (default: file, ignored for dircorpus)") String getSaveTo();
c355caf9-7c83-4f17-9f24-636dec4e8348
boolean isSaveTo();
f59737b9-3fc6-4582-8675-b1430de58665
@Option(longName="replext",description="Replace existing extension with this (include dot, ignored for dircorpus)") String getReplExt();
85d574e5-7833-40a0-a6e2-cc7826101369
boolean isReplExt();
f8d213a6-15e1-49b0-b487-135e20303efd
@Option(longName="pluginsdir",description="The directory where the needed plugins are located") String getPluginsDir();
d3325d4f-d436-4a7a-9ecb-b06a1150846a
boolean isPluginsDir();
d0841faf-ec2d-4301-b2b2-52c28f278b0f
@Option(longName="compressout",description="If output should be compressed using gzip") boolean isCompressOut();
357b8bef-4bbe-468e-acff-6313da758765
@Option(longName="allowcompressedin",description="If specified, .gz indicates compressed files") boolean isAllowCompressedIn();
d1f83b88-f99a-40b9-8c81-c1dabed9f1fc
@Option(longName="namepattern",description="Regular expression pattern that must match a name for it to be used") String getNamePattern();
9e8825be-be9b-43c7-bd8e-47b578005867
boolean isNamePattern();
3082d151-6d5f-47ee-bed7-3333fbe4425a
@Option(longName="outputEncoding",description="Encoding to use for the output if string, default is system encoding, XML is always encoded as UTF-8") String getOutputEncoding();
74b57f0a-ca77-4222-bca1-c8af50aba8d8
boolean isOutputEncoding();
eb6074f1-67be-4fd7-85c5-8c722dc1003c
@Option(longName="inputEncoding",description="Encoding to use for the input, default is system encoding for non XML files, XML is always read as UTF-8") String getInputEncoding();
4aabefdf-4995-4552-bea5-36bb04dcaa4c
boolean isInputEncoding();
8781a0c7-d971-4203-a55b-25da4fad395a
@Option(longName="nrthreads",defaultValue="1",description="Number of threads to use. Use with care!") String getNrThreads();
e73c0c5d-7063-45ce-b3d0-b7486db9b0d2
@Option(longName="log4jconfig",description="Path to a log4j configuration properties file") String getLog4jConfig();
d7f52ba4-c970-4b7e-a204-b16197858a92
boolean isLog4jConfig();
8b144b36-8331-4ade-8e13-8ae2d8c17b7a
@Option(shortName="d") boolean isDebug();
282f16cd-8ff3-4a14-8d6a-dbaed73ff961
@Option(helpRequest=true,description="Display help and exit") boolean isHelp();
58e42904-ce06-4f43-8d9a-f5ce251ddd93
@Unparsed List<String> getArgs();
5e116145-b6d5-4575-9355-7b21140a4be8
boolean isArgs();
a65574f2-4cc4-4b3f-9eba-d9eb40d38d5f
public static void main( String[] args ) throws MalformedURLException, GateException { try { options = CliFactory.parseArguments(BatchProcessingOptions.class, args); } catch(ArgumentValidationException e) { System.err.println("Error parsing options: "+e); System.e...
9a9ea5e8-38ee-482a-8492-a2c8494f69e9
public static void runUsingGetters (DocumentGetter getter) { int optionNrThreads = Integer.parseInt(options.getNrThreads()); if(mDocumentGetter == null) { System.err.println("Could not initialize the file getter for filefrom "+optionListFrom+"\n"); System.exit(2); } runners = new...
96a43733-3077-41e9-a27f-67e9f0025db1
private static void shutdownAndAwaitTermination(ExecutorService pool) { System.err.println("Requesting shutdown"); pool.shutdown(); // Disable new tasks from being submitted try { // Wait half an hour for all tasks to complete if (!pool.awaitTermination(60 * 30, TimeUnit.SECONDS)) { Syst...
c4d99097-5197-44f2-9168-b32381e8fcc6
protected static PipelineRunner getRunner() throws InterruptedException { PipelineRunner runner = runners.take(); System.err.println("Getting running nr "+runner.getNr()+ " size is now "+runners.size()); return runner; }
66b82306-1fca-4270-8303-c918c2985313
protected static void putRunner(PipelineRunner runner) throws InterruptedException { System.err.println("Putting back running nr "+runner.getNr()); runners.put(runner); }
6d5b3b29-323e-49cd-812e-f477cac8050e
public static void runUsingGettersOld (DocumentGetter getter) { if(mDocumentGetter == null) { System.err.println("Could not initialize the file getter for filefrom "+optionListFrom+"\n"); System.exit(2); } // TODO: make this multithreaded . // Maybe by doing this: if n threads a...
46a9a193-592a-4772-92b9-0c0b375b7b7c
public static void runUsingCorpus (Corpus corpus) throws ExecutionException { // load the processing pipeline description from the file // specified File controllerFile = new File(optionController); gate.CorpusController controller = null; try { controller = (gate.CorpusC...
a5fad7c0-5cfd-4acc-b026-4499cb9a049e
static public void saveStringToFile( String string, OutputStream out, BatchProcessingOptions options) throws UnsupportedEncodingException, IOException { // convert the string to a byte buffer using the encoding specified // as an option or the default encoding if the output format is string, // ot...
afacfcc2-d644-4599-a4b6-18e45c93dc04
static public String getStringFromFile(String filename, String indir, BatchProcessingOptions options) throws FileNotFoundException, IOException { String content = ""; // if input compression is allowed, check if the name ends in .gz // if yes, read the file using a decompressing stream, otherwise using ...
9cb7aaed-d3f2-41ee-9324-2d5725dbff5a
static public String getDefaultEncoding() { return Charset.defaultCharset().toString(); }
c926b68d-ce53-4f47-9504-e4cbc35f22a2
static public Document newDocument(String content, String fileName) throws ResourceInstantiationException { return Factory.newDocument(content); }
b198dc9d-4662-428b-a7b1-aefac4db6749
public abstract gate.Document getNextDocument();
3c9d9d57-e3e7-414f-b7dc-4f8493f8491b
public boolean haveNext() { return mHaveNext; }
a6250cff-a2fa-498f-9f95-1eb00163ccdf
public abstract void init();
d4f18f74-562d-4d54-8298-07919e2585ee
public abstract void close();
24579425-42d4-4486-a047-21878c1faca1
public String getFileName() { return null; }
31989c37-423a-4bcd-9efe-a78ac6f4d8ae
public void setDebug(Boolean onOff) { mDebug = onOff; }
b6e288cf-a6b0-4bf3-a40f-2a644b0e221d
public DocumentGetterFileNamesFromDir(BatchProcessingOptions options, String filepath) { mOptions = options; mIndirName = filepath; init(); }
8f60a1d5-9c27-400d-959c-e72ac5b39130
public void setIndir(String inDirName) { mIndirName = inDirName; System.err.println("Set input directory to: "+mIndirName+"\n"); }
98b68d47-5b33-4a1a-bf97-8964477545a5
public void init() { File theDir = new File(mIndirName); System.err.println("Getting filenames in directory "+theDir.toString()); if(!theDir.isDirectory()) { System.err.println("Not a directory: "+theDir.getAbsolutePath()); System.exit(2); } String[] filenames = theDir.list(); for(St...
92ba021a-cf6b-433a-b59a-78b90788bf14
public void setDebug(Boolean onOff) { mDebug = onOff; }
8dbddf2a-933e-4733-a261-da694dca7549
public String getFileName() { return mFileName; }
f415a445-bdc3-4e73-bfcc-342b1e27c073
public gate.Document getNextDocument() { gate.Document d = null; String fileName = null; if(!fileNamesIterator.hasNext()) { mHaveNext = false; mFileName = null; return null; } else { mFileName = fileNamesIterator.next(); } fileName = mFileName; if(mDebug.booleanValue...
fae46821-4974-4517-a864-0edd46dd2e1f
public void close() {}
f26fc628-29cb-4a38-bf80-c0d6f842919d
public DocumentGetterFileNamesFromStdin(BatchProcessingOptions options) { mOptions = options; }
d4a5201f-56db-4c2a-a99f-e8ec37360852
public void setIndir(String inDirName) { mIndirName = inDirName; System.err.println("Set input directory to: "+mIndirName+"\n"); }
7eaec7fb-6ae4-448f-99ee-a5f82d1dd2f1
public void init() { mReader = new BufferedReader(new InputStreamReader(System.in)); }
ab1e5da1-d308-4bdf-b928-b232be178eaf
public void setDebug(Boolean onOff) { mDebug = onOff; }
311796da-f74c-486e-9f39-b8cc53fb3d12
public String getFileName() { return mFileName; }
c0fbfaf2-d909-431d-8402-1918e1260237
public gate.Document getNextDocument() { gate.Document d = null; String fileName = null; try { fileName = mReader.readLine(); while(fileName != null && !isAcceptableFileName(fileName)) { fileName = mReader.readLine(); } } catch (IOException ioe) { System.err.println("IO ...
418e12e3-73c1-48b8-9a1a-608131982af0
public void close() { // close mReader here? }
1417e98d-50b3-40ce-853f-edeed882fb22
public void setDocument(Document doc, String filename) { mDocument = doc; mFileName = filename; }
47c30fec-b55f-4cbe-9e6e-c609902aba9a
public int getNr() { return mThreadNr; }
302a6029-b0a3-4f02-a91a-aca86779a7fe
private PipelineRunner() {}
5b868cd8-3e54-43bb-9a8e-fff786fdc93e
public PipelineRunner(BatchProcessingOptions options, int nr) throws ResourceInstantiationException { mOptions = options; mThreadNr = nr; String filename = options.getController(); File controllerFile = new File(filename); try { mController = (gate.CorpusController)gate.u...
7c82a6e7-76fc-4923-96eb-356d794c8843
public void run() { if(mOptions.isDebug()) { System.err.println("Processing document "+mDocument.getName()+" in thread "+mThreadNr+" using "+mController.getName()+"\n"); } mCorpus.add(mDocument); try { mController.execute(); System.err.println("Document "+mDocument.getName()+" pro...
b05ba5e4-e7ae-42af-bbe5-409e84d154f4
protected void saveStringToFile( String string, OutputStream out) throws UnsupportedEncodingException, IOException { // convert the string to a byte buffer using the encoding specified // as an option or the default encoding if the output format is string, // otherwise use UTF-8 String outputE...
722497dc-cd0c-471d-85f7-0ff2c748957e
protected Document newDocumentFromFile(String fileName) { Document d = null; mFileName = fileName; if(mOptions.isAllowCompressedIn()) { mFileName = mFileName.replaceAll(".gz$", ""); } try { String content = Utils.getStringFromFile(fileName, mIndirName, mOptions); d = Utils.newDocum...
d9586162-5346-48ef-940b-7ab9a03c2d9a
protected boolean isAcceptableFileName(String name) { boolean acceptable = true; if(mOptions.isNamePattern()) { // compile the pattern only once if(mPattern == null) { mPattern = Pattern.compile(mOptions.getNamePattern()); } acceptable = mPattern.matcher(name).matches(); } ...
3d458dff-6da8-411c-9753-38e405c7bb91
public DocumentGetterFileNamesFromFile(BatchProcessingOptions options, String filepath) { mOptions = options; mFileName = filepath; init(); }
17af74e2-75e2-40e3-8af9-13f4c6616e8a
public void setIndir(String inDirName) { mIndirName = inDirName; System.err.println("Set input directory to: "+mIndirName+"\n"); }
15adb398-123e-4334-ad34-59b8dc17ed7f
public void init() { File filenamesFile = new File(mFileName); System.err.println("Reading filenames from file "+filenamesFile.toString()); FileReader inFileStream = null; try { inFileStream = new FileReader(filenamesFile); } catch(IOException ioe) { System.err.println("IO error trying ...
f8384a0e-64fd-45c4-9187-79e2c7324f35
public void setDebug(Boolean onOff) { mDebug = onOff; }
94d21e13-de32-40e3-99c8-e708d550a415
public String getFileName() { return mFileName; }
5158c7ff-d8f7-4da1-9749-c84bd8460312
public gate.Document getNextDocument() { gate.Document d = null; String fileName = null; try { fileName = mInstream.readLine(); while(fileName != null && !isAcceptableFileName(fileName)) { fileName = mInstream.readLine(); } } catch (IOException ioe) { System.err.println...
8773ba36-1326-4907-a4ca-f91444b3071e
public void close() { try { mInstream.close(); } catch (IOException ex) { throw new GateRuntimeException("Error when closing file: "+ex); } }
f5b9394d-e28b-434f-bb64-27485c1d8b81
public abstract Document next();
2a7f86b2-2fb3-4c61-beff-68a8cd7afa61
public abstract boolean hasNext();
fea9ce72-1528-4fa8-b96b-a7aff71a2d30
public abstract Resource init() throws ResourceInstantiationException;
c6e422f2-8272-4ee0-bc41-b3f2acc6e8d2
public abstract void open();
90cb22e5-6480-4c0b-a1ff-ae375958a80b
public abstract void close();
015ce07c-def1-4532-8302-cb8bf40e5bd1
public int getTotalNumberOfDocuments() { return -1; }
491aa0f8-528d-4a9b-b186-357c6e2e1979
public void remove() { throw new MethodNotImplementedException("Remove not implemented for DocSource"); }
8400b150-7a7c-428d-a79c-8746e0e0df3d
@CreoleParameter( comment="Directory that should contain the random index data", defaultValue = "true") public void setFailOnConversionError(Boolean yesno) { failOnConversionError = yesno; }
3a3f8063-0e22-4f2a-98c3-d1ee0660c0b6
public Boolean getFailOnConversionError() { return failOnConversionError; }
51b6c315-b0cb-4042-94ed-6d3a228a7b96
public void init(final FilterConfig config) throws ServletException { // Empty method }