You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by ma...@apache.org on 2012/11/20 18:44:33 UTC

svn commit: r1411758 [2/2] - in /incubator/ctakes/trunk/ctakes-assertion: .settings/ resources/launch/ src/main/java/org/apache/ctakes/assertion/cr/ src/main/java/org/apache/ctakes/assertion/eval/ src/main/java/org/apache/ctakes/assertion/medfacts/clea...

Added: incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java?rev=1411758&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java (added)
+++ incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/PolarityCleartkAnalysisEngine.java Tue Nov 20 17:44:30 2012
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.assertion.medfacts.cleartk;
+
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+import org.cleartk.classifier.Instance;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+
+public class PolarityCleartkAnalysisEngine extends AssertionCleartkAnalysisEngine {
+
+	public void setClassLabel(IdentifiedAnnotation entityMention, Instance<String> instance) throws AnalysisEngineProcessException {
+	      if (this.isTraining())
+	      {
+	        String polarity = (entityMention.getPolarity() == -1) ? "negated" : "present";
+	        instance.setOutcome(polarity);
+	        if ("negated".equals(polarity))
+	        {
+	          logger.info("TRAINING: " + polarity);
+	        }
+	        this.dataWriter.write(instance);
+	      } else
+	      {
+	        String label = this.classifier.classify(instance.getFeatures());
+	        int polarity = 1;
+	        if (label!= null && label.equals("present"))
+	        {
+	          polarity = 0;
+	        } else if (label != null && label.equals("negated"))
+	        {
+	          polarity = -1;
+	        }
+	        entityMention.setPolarity(polarity);
+	        if ("negated".equals(label))
+	        {
+	          logger.info(String.format("DECODING/EVAL: %s//%s [%d-%d] (%s)", label, polarity, entityMention.getBegin(), entityMention.getEnd(), entityMention.getClass().getName()));
+	        }
+	      }
+	}
+}

Added: incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/SubjectCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/SubjectCleartkAnalysisEngine.java?rev=1411758&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/SubjectCleartkAnalysisEngine.java (added)
+++ incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/SubjectCleartkAnalysisEngine.java Tue Nov 20 17:44:30 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.assertion.medfacts.cleartk;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.cleartk.classifier.Instance;
+
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+
+public class SubjectCleartkAnalysisEngine extends
+		AssertionCleartkAnalysisEngine {
+
+	@Override
+	public void setClassLabel(IdentifiedAnnotation entityMention,
+			Instance<String> instance) throws AnalysisEngineProcessException {
+		if (this.isTraining())
+	      {
+	        String subj = entityMention.getSubject();
+	        instance.setOutcome(subj);
+	        this.dataWriter.write(instance);
+	      } else
+	      {
+	        String label = this.classifier.classify(instance.getFeatures());
+	        entityMention.setSubject(label);
+	      }
+	}
+
+}

Added: incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java?rev=1411758&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java (added)
+++ incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/UncertaintyCleartkAnalysisEngine.java Tue Nov 20 17:44:30 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.assertion.medfacts.cleartk;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.cleartk.classifier.Instance;
+
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+
+public class UncertaintyCleartkAnalysisEngine extends AssertionCleartkAnalysisEngine {
+
+	@Override
+	public void setClassLabel(IdentifiedAnnotation entityMention, Instance<String> instance) throws AnalysisEngineProcessException {
+		if (this.isTraining())
+	      {
+	        String uncertainty = (entityMention.getUncertainty() == 1) ? "uncertain" : "certain";
+	        instance.setOutcome(uncertainty);
+	        this.dataWriter.write(instance);
+	      } else
+	      {
+	        String label = this.classifier.classify(instance.getFeatures());
+	        int uncertainty = 0;
+	        if (label!= null && label.equals("uncertain"))
+	        {
+	          uncertainty = 1;
+	        } else if (label != null && label.equals("certain"))
+	        {
+	          uncertainty = 0;
+	        }
+	        entityMention.setUncertainty(uncertainty);
+	      }
+	}
+
+}

Added: incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/CtakesFileNamer.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/CtakesFileNamer.java?rev=1411758&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/CtakesFileNamer.java (added)
+++ incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/CtakesFileNamer.java Tue Nov 20 17:44:30 2012
@@ -0,0 +1,87 @@
+package org.apache.ctakes.assertion.pipelines;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.ctakes.core.util.DocumentIDAnnotationUtil;
+import org.apache.uima.UimaContext;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.uimafit.component.initialize.ConfigurationParameterInitializer;
+import org.uimafit.component.xwriter.XWriterFileNamer;
+import org.uimafit.descriptor.ConfigurationParameter;
+import org.uimafit.factory.ConfigurationParameterFactory;
+import org.uimafit.factory.initializable.Initializable;
+
+/**
+ * This is a very simple implementation of XWriterFileNamer that generates file names based on a
+ * prefix string and a incrementing counter.
+ * 
+ * @author Philip Ogren
+ */
+
+public class CtakesFileNamer implements XWriterFileNamer, Initializable {
+
+        /**
+         * The parameter name for the configuration parameter that specifies a fixed prefix for all
+         * returned file names.
+         */
+        public static final String PARAM_PREFIX = ConfigurationParameterFactory
+                        .createConfigurationParameterName(CtakesFileNamer.class, "prefix");
+        @ConfigurationParameter(description = "specify a prefix that is prepended to all returned file names", defaultValue="")
+        private String prefix;
+
+        /**
+         * The parameter name for the configuration parameter that specifies a fixed suffix for all
+         * returned file names.
+         */
+        public static final String PARAM_SUFFIX = ConfigurationParameterFactory
+                        .createConfigurationParameterName(CtakesFileNamer.class, "suffix");
+        @ConfigurationParameter(description = "specify a suffix that is appended to all returned file names", defaultValue="")
+        private String suffix;
+
+        int i = 1;
+
+        public String nameFile(JCas jcas)
+        {
+          String sourceFileName = DocumentIDAnnotationUtil.getDocumentID(jcas);
+          StringBuilder b = new StringBuilder();
+          if (prefix != null && !prefix.isEmpty())
+          { b.append(prefix); }
+          
+          if (sourceFileName != null && !sourceFileName.isEmpty())
+          {
+        	  b.append(sourceFileName);
+          } else
+          {
+        	  b.append(i++);
+          }
+          
+          if (suffix != null && !suffix.isEmpty())
+          { b.append(suffix); }
+          
+          String calculatedFilename = b.toString();
+          
+          return calculatedFilename;
+        }
+
+        public void initialize(UimaContext context) throws ResourceInitializationException {
+                ConfigurationParameterInitializer.initialize(this, context);
+        }
+}
\ No newline at end of file

Added: incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipeline.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipeline.java?rev=1411758&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipeline.java (added)
+++ incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipeline.java Tue Nov 20 17:44:30 2012
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.assertion.pipelines;
+
+
+import java.io.IOException;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.collection.CollectionReaderDescription;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.uimafit.component.xwriter.XWriter;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.uimafit.factory.CollectionReaderFactory;
+import org.uimafit.factory.TypeSystemDescriptionFactory;
+import org.uimafit.pipeline.SimplePipeline;
+
+import org.apache.ctakes.assertion.cr.GoldEntityAndAttributeReader;
+import org.apache.ctakes.core.cr.FilesInDirectoryCollectionReader;
+
+/**
+ * 
+ * A class for testing the reader for the gold standard relation data. 
+ * Currently this class runs the reader and saves the resulting annotations as xmi files.
+ * 
+ * @author dmitriy dligach
+ *
+ */
+public class GoldEntityAndAttributeReaderPipeline {
+
+	public static void main(String[] args) throws UIMAException, IOException {
+		
+		TypeSystemDescription typeSystemDescription = 
+				// use the uimafit method of finding available type system
+				// descriptor via META-INF/org.uimafit/types.txt 
+				// (found in ctakes-type-system/src/main/resources)
+			TypeSystemDescriptionFactory.createTypeSystemDescription();
+		
+		CollectionReaderDescription collectionReader = CollectionReaderFactory.createDescription(
+				FilesInDirectoryCollectionReader.class,
+				typeSystemDescription,
+				"InputDirectory",
+				//"/Users/m081914/work/data/sharp/Seed Corpus/Mayo/UMLS_CEM/ss1_batch04/Knowtator/text"
+				"/work/medfacts/sharp/data/2012-10-16_full_data_set_updated/Seed_Corpus/sandbox/batch02_mayo/text"
+				);
+		
+		AnalysisEngineDescription goldAnnotator = AnalysisEngineFactory.createPrimitiveDescription(
+				GoldEntityAndAttributeReader.class,
+				typeSystemDescription,
+				"InputDirectory",
+				"/work/medfacts/sharp/data/2012-10-16_full_data_set_updated/Seed_Corpus/sandbox/batch02_mayo/knowtator/");
+
+    AnalysisEngineDescription xWriter = AnalysisEngineFactory.createPrimitiveDescription(
+        XWriter.class,
+        typeSystemDescription,
+        XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
+        //"/Users/m081914/work/sharpattr/assertion/output"
+        // "/work/medfacts/sharp/data/2012-10-09_full_data_set/batch02"
+        "/work/medfacts/sharp/data/2012-10-16_full_data_set_updated/Seed_Corpus/sandbox/batch02_mayo/xmi",
+        XWriter.PARAM_FILE_NAMER_CLASS_NAME,
+        CtakesFileNamer.class.getName()
+        );
+    
+		SimplePipeline.runPipeline(collectionReader, goldAnnotator, xWriter);
+	}
+}

Added: incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipelineForSeedCorpus.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipelineForSeedCorpus.java?rev=1411758&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipelineForSeedCorpus.java (added)
+++ incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/pipelines/GoldEntityAndAttributeReaderPipelineForSeedCorpus.java Tue Nov 20 17:44:30 2012
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.assertion.pipelines;
+
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.collection.CollectionReaderDescription;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.uimafit.component.xwriter.XWriter;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.uimafit.factory.CollectionReaderFactory;
+import org.uimafit.factory.TypeSystemDescriptionFactory;
+import org.uimafit.pipeline.SimplePipeline;
+
+import org.apache.ctakes.assertion.cr.GoldEntityAndAttributeReader;
+import org.apache.ctakes.core.cr.FilesInDirectoryCollectionReader;
+
+/**
+ * 
+ * A class for testing the reader for the gold standard relation data. 
+ * Currently this class runs the reader and saves the resulting annotations as xmi files.
+ * 
+ * @author dmitriy dligach
+ * @author matt coarr
+ *
+ */
+public class GoldEntityAndAttributeReaderPipelineForSeedCorpus {
+	
+	static final Logger logger = Logger.getLogger(GoldEntityAndAttributeReaderPipelineForSeedCorpus.class.getName());
+
+	public static void main(String[] args) throws UIMAException, IOException {
+		
+		logger.warn("This should be run with one command-line argument that is the parent UMLS_CEM directory.");
+		logger.warn("Also, make sure each ss1_batch* directory has both a Knowtator/text directory and a Knowtator_XML directory (not the underscore in the xml directory, not a space)");
+		
+		if (args.length != 1)
+		{
+			System.out.println("Requires one parameter that is the UMLS_CEM main directory (e.g. the \"Seed_Corpus/Mayo/UMLS_CEM\" or \"Seattle Group Health/UMLS_CEM\"). The path should be fully specified.");
+		}
+		
+		String parentDirectoryString = args[0];
+		//String parentDirectoryString = "/work/medfacts/sharp/data/2012-10-16_full_data_set_updated/Seed_Corpus/Seattle Group Health/UMLS_CEM";
+		logger.info("parent directory: " + parentDirectoryString);
+		File parentDirectory = new File(parentDirectoryString);
+		if (!parentDirectory.exists())
+		{
+			logger.fatal("parent directory does not exist! exiting!");
+			return;
+		}
+		
+		File batchDirectories[] = parentDirectory.listFiles(new FileFilter() {
+			
+			@Override
+			public boolean accept(File pathname) {
+				return pathname.isDirectory();
+			}
+		});
+		
+		for (File currentBatchDirectory : batchDirectories)
+		{
+			
+			logger.info("current batch directory: " + currentBatchDirectory.getName());
+			
+			if (!currentBatchDirectory.exists())
+			{
+				logger.fatal(String.format("current batch directory does not exist! exiting! [\"%s\"]", currentBatchDirectory.toString()));
+				continue;
+			}
+			
+			File knowtatorDirectory = new File(currentBatchDirectory, "Knowtator");
+			File textDirectory = new File(knowtatorDirectory, "text");
+			File xmlDirectory = new File(currentBatchDirectory, "Knowtator_XML");
+			File xmiDirectory = new File(currentBatchDirectory, "Knowtator_XMI");
+			
+			if (!knowtatorDirectory.isDirectory() ||
+					!textDirectory.isDirectory() ||
+					!xmlDirectory.isDirectory())
+			{
+				logger.error("one of the directories does not exist! skipping...");
+				continue;
+			}
+			
+			if (!xmiDirectory.isDirectory())
+			{
+				xmiDirectory.mkdir();
+			}
+				
+			
+			TypeSystemDescription typeSystemDescription = 
+					// use the uimafit method of finding available type system
+					// descriptor via META-INF/org.uimafit/types.txt 
+					// (found in ctakes-type-system/src/main/resources)
+				TypeSystemDescriptionFactory.createTypeSystemDescription();
+			
+			CollectionReaderDescription collectionReader = CollectionReaderFactory.createDescription(
+					FilesInDirectoryCollectionReader.class,
+					typeSystemDescription,
+					"InputDirectory",
+					//"/Users/m081914/work/data/sharp/Seed Corpus/Mayo/UMLS_CEM/ss1_batch04/Knowtator/text"
+					//"/work/medfacts/sharp/data/2012-10-16_full_data_set_updated/Seed_Corpus/sandbox/batch02_mayo/text"
+					textDirectory.toString()
+					);
+			
+			AnalysisEngineDescription goldAnnotator = AnalysisEngineFactory.createPrimitiveDescription(
+					GoldEntityAndAttributeReader.class,
+					typeSystemDescription,
+					"InputDirectory",
+					//"/work/medfacts/sharp/data/2012-10-16_full_data_set_updated/Seed_Corpus/sandbox/batch02_mayo/knowtator/"
+					xmlDirectory.toString() + "/"
+					);
+
+	    AnalysisEngineDescription xWriter = AnalysisEngineFactory.createPrimitiveDescription(
+	        XWriter.class,
+	        typeSystemDescription,
+	        XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
+	        //"/Users/m081914/work/sharpattr/assertion/output"
+	        // "/work/medfacts/sharp/data/2012-10-09_full_data_set/batch02"
+	        //"/work/medfacts/sharp/data/2012-10-16_full_data_set_updated/Seed_Corpus/sandbox/batch02_mayo/xmi",
+	        xmiDirectory.toString(),
+	        XWriter.PARAM_FILE_NAMER_CLASS_NAME,
+	        CtakesFileNamer.class.getName()
+	        );
+	    
+			SimplePipeline.runPipeline(collectionReader, goldAnnotator, xWriter);
+		}
+		
+		logger.info("Finished!");
+		
+	}
+}

Added: incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/relationextractor/cr/Mapper.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/relationextractor/cr/Mapper.java?rev=1411758&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/relationextractor/cr/Mapper.java (added)
+++ incubator/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/relationextractor/cr/Mapper.java Tue Nov 20 17:44:30 2012
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.relationextractor.cr;
+
+import org.apache.ctakes.typesystem.type.constants.CONST;
+
+/**
+ * Map various category names to their ctakes integer id. 
+ * If an entity type that cannot be extracted by CTAKEs
+ * automatically is passed, "unknown relation" id is returned.
+ *  
+ * @author dmitriy dligach
+ *
+ */
+public class Mapper {
+
+	/**
+	 * Map entity type to its integer id.
+	 */
+	public static int getEntityTypeId(String entityType) {
+
+		if(entityType.equals("Disease_Disorder")) return CONST.NE_TYPE_ID_DISORDER;
+	  else if(entityType.equals("Procedure")) return CONST.NE_TYPE_ID_PROCEDURE;
+	  else if(entityType.equals("Medications/Drugs")) return CONST.NE_TYPE_ID_DRUG;
+	  else if(entityType.equals("Sign_symptom")) return CONST.NE_TYPE_ID_FINDING;
+	  else if(entityType.equals("Anatomical_site")) return CONST.NE_TYPE_ID_ANATOMICAL_SITE;
+	  else return CONST.NE_TYPE_ID_UNKNOWN;
+	}
+	
+	/**
+	 * Map modifier type to its integer id.
+	 */
+	public static int getModifierTypeId(String modifierType) {
+		
+		if(modifierType.equals("course_class")) return CONST.MODIFIER_TYPE_ID_COURSE_CLASS;
+		else if(modifierType.equals("severity_class")) return CONST.MODIFIER_TYPE_ID_SEVERITY_CLASS;
+		else if(modifierType.equals("lab_interpretation_indicator")) return CONST.MODIFIER_TYPE_ID_LAB_INTERPRETATION_INDICATOR;
+		else return CONST.MODIFIER_TYPE_ID_UNKNOWN;
+	}
+}