ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1487444 - in /ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference: ae/GoldCoreferenceReader.java eval/EvaluationOfCoreferencePairs.java
Date Wed, 29 May 2013 11:50:28 GMT
Author: tmill
Date: Wed May 29 11:50:27 2013
New Revision: 1487444

URL: http://svn.apache.org/r1487444
Log:
ctakes-199: Added a few lines for reading gold code and simplifying training pipeline.

Modified:
    ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/GoldCoreferenceReader.java
    ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfCoreferencePairs.java

Modified: ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/GoldCoreferenceReader.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/GoldCoreferenceReader.java?rev=1487444&r1=1487443&r2=1487444&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/GoldCoreferenceReader.java
(original)
+++ ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/GoldCoreferenceReader.java
Wed May 29 11:50:27 2013
@@ -79,6 +79,7 @@ public class GoldCoreferenceReader exten
 				CoreferenceRelation rel = new CoreferenceRelation(jcas);
 				rel.setArg1(arg1);
 				rel.setArg2(arg2);
+				rel.addToIndexes();
 				// TODO - continue along this line...
 //				goldPairs.add(new int[]{goldSpan2id.get(spanPair[0]), goldSpan2id.get(spanPair[1])});
 				//			ppt_arr.add(new int[]{span2id.get(p[0]), span2id.get(p[1])});

Modified: ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfCoreferencePairs.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfCoreferencePairs.java?rev=1487444&r1=1487443&r2=1487444&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfCoreferencePairs.java
(original)
+++ ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/eval/EvaluationOfCoreferencePairs.java
Wed May 29 11:50:27 2013
@@ -41,6 +41,7 @@ import org.apache.uima.jcas.JCas;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.util.XMLSerializer;
 import org.cleartk.classifier.jar.JarClassifierBuilder;
+import org.cleartk.classifier.libsvm.LIBSVMStringOutcomeDataWriter;
 import org.cleartk.eval.AnnotationStatistics;
 import org.cleartk.eval.Evaluation_ImplBase;
 import org.cleartk.util.ViewURIUtil;
@@ -92,19 +93,25 @@ public class EvaluationOfCoreferencePair
 	@Override
 	protected void train(CollectionReader collectionReader, File directory)
 			throws Exception {
-	  AggregateBuilder aggregateBuilder = this.getPreprocessorAggregateBuilder();
+	  AggregateBuilder aggregateBuilder = new AggregateBuilder();
  
-	  aggregateBuilder.add(NamedEntityCoreferenceResolver.createAnnotatorDescription(directory));
+	  // TODO: Annotator to add everything to gold standard view?
+	  
+	  aggregateBuilder.add(
+	      NamedEntityCoreferenceResolver.createDataWriterDescription(
+	          LIBSVMStringOutcomeDataWriter.class,
+	          directory));
     SimplePipeline.runPipeline(collectionReader, aggregateBuilder.createAggregate());
 
-    HideOutput hider = new HideOutput();
+    // TODO: Restore hider when operational
+//    HideOutput hider = new HideOutput();
     // libsvm:
     JarClassifierBuilder.trainAndPackage(directory,  "-t", "0", "-c", "10");
     // tksvmlight with no tk features:
 //    JarClassifierBuilder.trainAndPackage(directory, "-t", "0", "-c", "10", "-N", "0");
 //    JarClassifierBuilder.trainAndPackage(directory,  "-t", "5", "-S", "0", "-N", "3", "-C",
"+", "-T", "1.0");
-    hider.restoreOutput();
-    hider.close();
+//    hider.restoreOutput();
+//    hider.close();
 	}
 
 	@Override
@@ -114,21 +121,17 @@ public class EvaluationOfCoreferencePair
 		return null;
 	}
 
-  protected AggregateBuilder getPreprocessorAggregateBuilder() throws Exception {
-    return this.xmiExists
-        ? this.getXMIReadingPreprocessorAggregateBuilder()
-        : this.getXMIWritingPreprocessorAggregateBuilder();
-  }
-
-  protected AggregateBuilder getXMIReadingPreprocessorAggregateBuilder() throws UIMAException
{
-    AggregateBuilder aggregateBuilder = new AggregateBuilder();
-    aggregateBuilder.add(UriToDocumentTextAnnotator.getDescription());
-//    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(
-//        XMIReader.class,
-//        XMIReader.PARAM_XMI_DIRECTORY,
-//        this.xmiDirectory));
-    return aggregateBuilder;
-  }
+//  protected AggregateBuilder getPreprocessorAggregateBuilder() throws Exception {
+//    return this.xmiExists
+//        ? this.getXMIReadingPreprocessorAggregateBuilder()
+//        : this.getXMIWritingPreprocessorAggregateBuilder();
+//  }
+//
+//  protected AggregateBuilder getXMIReadingPreprocessorAggregateBuilder() throws UIMAException
{
+//    AggregateBuilder aggregateBuilder = new AggregateBuilder();
+//    aggregateBuilder.add(UriToDocumentTextAnnotator.getDescription());
+//    return aggregateBuilder;
+//  }
 
   protected AggregateBuilder getXMIWritingPreprocessorAggregateBuilder()
       throws Exception {



Mime
View raw message