ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1749702 - /ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
Date Wed, 22 Jun 2016 13:58:37 GMT
Author: dligach
Date: Wed Jun 22 13:58:36 2016
New Revision: 1749702

URL: http://svn.apache.org/viewvc?rev=1749702&view=rev
Log:
now passing output files as command-line arguments

Modified:
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java

Modified: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java?rev=1749702&r1=1749701&r2=1749702&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
(original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
Wed Jun 22 13:58:36 2016
@@ -57,9 +57,6 @@ import com.lexicalscope.jewel.cli.Option
  * @author dmitriy dligach
  */
 public class PositiveAndNegativeExamplePrinter {
-
-  public static final String trainDataFile = "/Users/Dima/Temp/train.txt";
-  public static final String devDataFile = "/Users/Dima/Temp/dev.txt";
   
   static interface Options {
 
@@ -68,22 +65,28 @@ public class PositiveAndNegativeExampleP
 
     @Option(longName = "patients")
     public CommandLine.IntegerRanges getPatients();
+    
+    @Option(longName = "output-train")
+    public File getTrainOutputDirectory();
+    
+    @Option(longName = "output-test")
+    public File getTestOutputDirectory();
   }
 
   public static void main(String[] args) throws Exception {
     
-    File trainFile = new File(trainDataFile);
+    Options options = CliFactory.parseArguments(Options.class, args);
+    
+    File trainFile = options.getTrainOutputDirectory();
     if(trainFile.exists()) {
       trainFile.delete();
     }
     trainFile.createNewFile();
-    File devFile = new File(devDataFile);
+    File devFile = options.getTestOutputDirectory();
     if(devFile.exists()) {
       devFile.delete();
     }
     devFile.createNewFile();
-    
-    Options options = CliFactory.parseArguments(Options.class, args);
 
     List<Integer> patientSets = options.getPatients().getList();
     List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
@@ -97,7 +100,7 @@ public class PositiveAndNegativeExampleP
     AnalysisEngine trainDataWriter = AnalysisEngineFactory.createEngine(
         RelationSnippetPrinter.class,
         "OutputFile",
-        trainDataFile);
+        trainFile.getAbsoluteFile());
     SimplePipeline.runPipeline(trainCollectionReader, trainDataWriter);
     
     // write dev data to file
@@ -105,7 +108,7 @@ public class PositiveAndNegativeExampleP
     AnalysisEngine devDataWriter = AnalysisEngineFactory.createEngine(
         RelationSnippetPrinter.class,
         "OutputFile",
-        devDataFile);
+        devFile.getAbsolutePath());
     SimplePipeline.runPipeline(devCollectionReader, devDataWriter);
   }
 



Mime
View raw message