You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by ja...@apache.org on 2012/10/31 06:26:55 UTC
svn commit: r1403989 [17/28] - in /incubator/ctakes/branches/SHARPn-cTAKES:
Constituency Parser/src/org/chboston/cnlp/ctakes/parser/ Constituency
Parser/src/org/chboston/cnlp/ctakes/parser/uima/ae/ Constituency
Parser/src/org/chboston/cnlp/ctakes/parse...
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/DocumentIDAnnotationUtil.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/DocumentIDAnnotationUtil.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/DocumentIDAnnotationUtil.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/DocumentIDAnnotationUtil.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,28 +14,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.util;
-
+package edu.mayo.bmi.uima.core.util;
+
import org.apache.uima.cas.FSIterator;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JFSIndexRepository;
import org.apache.uima.jcas.cas.TOP;
import edu.mayo.bmi.uima.core.type.structured.DocumentID;
-
-public class DocumentIDAnnotationUtil
-{
- public static String getDocumentID(JCas jcas)
- {
- try
- {
- JFSIndexRepository indexes = jcas.getJFSIndexRepository();
- FSIterator<TOP> documentIDIterator = indexes.getAllIndexedFS(DocumentID.type);
- DocumentID documentIDAnnotation = (DocumentID) documentIDIterator.next();
- String documentID = documentIDAnnotation.getDocumentID();
- return documentID;
- }
- catch(Exception e) { return null;}
- }
-
-}
+
+public class DocumentIDAnnotationUtil
+{
+ public static String getDocumentID(JCas jcas)
+ {
+ try
+ {
+ JFSIndexRepository indexes = jcas.getJFSIndexRepository();
+ FSIterator<TOP> documentIDIterator = indexes.getAllIndexedFS(DocumentID.type);
+ DocumentID documentIDAnnotation = (DocumentID) documentIDIterator.next();
+ String documentID = documentIDAnnotation.getDocumentID();
+ return documentID;
+ }
+ catch(Exception e) { return null;}
+ }
+
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/FSUtil.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/FSUtil.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/FSUtil.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/FSUtil.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.util;
-
+package edu.mayo.bmi.uima.core.util;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -41,35 +34,35 @@ import org.apache.uima.jcas.JFSIndexRepo
import org.apache.uima.jcas.tcas.Annotation;
import edu.mayo.bmi.uima.core.type.textsem.IdentifiedAnnotation;
-
-public class FSUtil {
-
- @Deprecated
- public static FSIterator getAnnotationsInSpanIterator(JCas jcas, int type, int beginSpan, int endSpan)
- {
- ConstraintFactory constraintFactory = jcas.getConstraintFactory();
- FSIntConstraint windowConstraint = constraintFactory.createIntConstraint();
- windowConstraint.gt(beginSpan-1);
- windowConstraint.lt(endSpan);
-
- Type annotType = jcas.getCasType(type);
- Feature beginSpanFeature = annotType.getFeatureByBaseName("begin");
- Feature endSpanFeature = annotType.getFeatureByBaseName("end");
-
- FeaturePath beginFeaturePath = jcas.createFeaturePath();
- beginFeaturePath.addFeature(beginSpanFeature);
- FSMatchConstraint beginSpanConstraint = constraintFactory.embedConstraint(beginFeaturePath, windowConstraint);
-
- FeaturePath endFeaturePath = jcas.createFeaturePath();
- endFeaturePath.addFeature(endSpanFeature);
- FSMatchConstraint endSpanConstraint = constraintFactory.embedConstraint(endFeaturePath, windowConstraint);
-
- FSMatchConstraint spanConstraint = constraintFactory.and(beginSpanConstraint, endSpanConstraint);
-
- JFSIndexRepository indexes = jcas.getJFSIndexRepository();
- FSIndex annotIndex = indexes.getAnnotationIndex(type);
- FSIterator annotsInSpanItr = jcas.createFilteredIterator(annotIndex.iterator(), spanConstraint);
- return annotsInSpanItr;
+
+public class FSUtil {
+
+ @Deprecated
+ public static FSIterator getAnnotationsInSpanIterator(JCas jcas, int type, int beginSpan, int endSpan)
+ {
+ ConstraintFactory constraintFactory = jcas.getConstraintFactory();
+ FSIntConstraint windowConstraint = constraintFactory.createIntConstraint();
+ windowConstraint.gt(beginSpan-1);
+ windowConstraint.lt(endSpan);
+
+ Type annotType = jcas.getCasType(type);
+ Feature beginSpanFeature = annotType.getFeatureByBaseName("begin");
+ Feature endSpanFeature = annotType.getFeatureByBaseName("end");
+
+ FeaturePath beginFeaturePath = jcas.createFeaturePath();
+ beginFeaturePath.addFeature(beginSpanFeature);
+ FSMatchConstraint beginSpanConstraint = constraintFactory.embedConstraint(beginFeaturePath, windowConstraint);
+
+ FeaturePath endFeaturePath = jcas.createFeaturePath();
+ endFeaturePath.addFeature(endSpanFeature);
+ FSMatchConstraint endSpanConstraint = constraintFactory.embedConstraint(endFeaturePath, windowConstraint);
+
+ FSMatchConstraint spanConstraint = constraintFactory.and(beginSpanConstraint, endSpanConstraint);
+
+ JFSIndexRepository indexes = jcas.getJFSIndexRepository();
+ FSIndex annotIndex = indexes.getAnnotationIndex(type);
+ FSIterator annotsInSpanItr = jcas.createFilteredIterator(annotIndex.iterator(), spanConstraint);
+ return annotsInSpanItr;
}
/**
@@ -88,7 +81,7 @@ public class FSUtil {
FSIterator itr = annIdx.subiterator(ann);
ann.removeFromIndexes();
return itr;
- }
+ }
/**
* Does not use {@link #getAnnotationsInSpan(JCas, int, int, int, int[])} so we don't create a collection
@@ -165,5 +158,5 @@ public class FSUtil {
public static boolean isAnnotationPresentInSpan(JCas jcas, int type, int beginSpan, int endSpan)
{
return (countAnnotationsInSpan(jcas, type, beginSpan, endSpan)>0);
- }
-}
+ }
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/JCasUtil.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/JCasUtil.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/JCasUtil.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/JCasUtil.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,33 +14,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.util;
-
-import java.lang.reflect.Field;
-
-import org.apache.uima.jcas.cas.TOP;
-import org.apache.uima.jcas.tcas.Annotation;
-
-public class JCasUtil {
-
- public static int getType(String className) {
- try {
- Class<?> cls = Class.forName(className);
- Class<? extends TOP> annotationCls = cls.asSubclass(Annotation.class);
- return JCasUtil.getType(annotationCls);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public static int getType(Class<? extends TOP> cls) {
- try {
- Field typeField = cls.getDeclaredField("type");
- // return value of static field
- return typeField.getInt(null);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
-
- }
-}
+package edu.mayo.bmi.uima.core.util;
+
+import java.lang.reflect.Field;
+
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
+
+public class JCasUtil {
+
+ public static int getType(String className) {
+ try {
+ Class<?> cls = Class.forName(className);
+ Class<? extends TOP> annotationCls = cls.asSubclass(Annotation.class);
+ return JCasUtil.getType(annotationCls);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static int getType(Class<? extends TOP> cls) {
+ try {
+ Field typeField = cls.getDeclaredField("type");
+ // return value of static field
+ return typeField.getInt(null);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+
+ }
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ListFactory.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ListFactory.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ListFactory.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ListFactory.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,53 +14,53 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.util;
-
-import org.apache.uima.jcas.cas.EmptyFSList;
-import org.apache.uima.jcas.cas.FSList;
-import org.apache.uima.jcas.cas.NonEmptyFSList;
-import org.apache.uima.jcas.cas.TOP;
-import org.apache.uima.jcas.JCas;
-
-/**
- * Factory to build List of built-in CAS types such as FloatList, IntegerList,
- * StringList, and FSList.
- *
- * @author Mayo Clinic
- */
-public class ListFactory {
-
- /**
- * Builds a FSList from an array of JCas objects.
- * @param jcas The current JCas.
- * @param objArr Array of JCas objects (objects must extend from TOP).
- * @return FSList populated with the JCas objects.
- */
- public static FSList buildList(JCas jcas, TOP[] objArr)
- {
- if (objArr.length == 0)
- {
- return new EmptyFSList(jcas);
- }
-
- NonEmptyFSList firstList = new NonEmptyFSList(jcas);
- NonEmptyFSList list = firstList;
- for (int i=0; i < objArr.length; i++)
- {
- list.setHead(objArr[i]);
- list.addToIndexes();
-
- if ((i+1) < objArr.length)
- {
- NonEmptyFSList nextList = new NonEmptyFSList(jcas);
- list.setTail(nextList);
- list = nextList;
- }
- }
-
- // set tail to empty list
- list.setTail(new EmptyFSList(jcas));
-
- return firstList;
- }
-}
+package edu.mayo.bmi.uima.core.util;
+
+import org.apache.uima.jcas.cas.EmptyFSList;
+import org.apache.uima.jcas.cas.FSList;
+import org.apache.uima.jcas.cas.NonEmptyFSList;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.JCas;
+
+/**
+ * Factory to build List of built-in CAS types such as FloatList, IntegerList,
+ * StringList, and FSList.
+ *
+ * @author Mayo Clinic
+ */
+public class ListFactory {
+
+ /**
+ * Builds a FSList from an array of JCas objects.
+ * @param jcas The current JCas.
+ * @param objArr Array of JCas objects (objects must extend from TOP).
+ * @return FSList populated with the JCas objects.
+ */
+ public static FSList buildList(JCas jcas, TOP[] objArr)
+ {
+ if (objArr.length == 0)
+ {
+ return new EmptyFSList(jcas);
+ }
+
+ NonEmptyFSList firstList = new NonEmptyFSList(jcas);
+ NonEmptyFSList list = firstList;
+ for (int i=0; i < objArr.length; i++)
+ {
+ list.setHead(objArr[i]);
+ list.addToIndexes();
+
+ if ((i+1) < objArr.length)
+ {
+ NonEmptyFSList nextList = new NonEmptyFSList(jcas);
+ list.setTail(nextList);
+ list = nextList;
+ }
+ }
+
+ // set tail to empty list
+ list.setTail(new EmptyFSList(jcas));
+
+ return firstList;
+ }
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ParamUtil.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ParamUtil.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ParamUtil.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/src/edu/mayo/bmi/uima/core/util/ParamUtil.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,54 +14,54 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.util;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-
+package edu.mayo.bmi.uima.core.util;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+
import org.apache.uima.UimaContext;
-import org.apache.uima.analysis_engine.annotator.AnnotatorContextException;
+import org.apache.uima.analysis_engine.annotator.AnnotatorContextException;
import org.apache.uima.resource.ResourceAccessException;
-
-public class ParamUtil {
-
- /**
- *
- * @param parameterName
- * @param annotatorContext
- * @return does not return null - but will return empty set if parameter is
- * optional or not set.
- * @throws AnnotatorContextException
- */
- public static Set<String> getStringParameterValuesSet(String parameterName, UimaContext annotatorContext)
- throws ResourceAccessException {
- Set<String> returnValues = new HashSet<String>();
- String[] strings = (String[]) annotatorContext.getConfigParameterValue(parameterName);
- if (strings == null)
- return returnValues;
-
- for (int i = 0; i < strings.length; i++) {
- returnValues.add(strings[i]);
- }
- return returnValues;
- }
-
- public static Map<String, String> getStringParameterValuesMap(String parameterName,
- UimaContext annotatorContext, String keyValueDelimiter) throws ResourceAccessException {
- String[] paramValues = (String[]) annotatorContext.getConfigParameterValue(parameterName);
- Map<String, String> map = new HashMap<String, String>();
- for (int i = 0; i < paramValues.length; i++) {
- int delimiterIndex = paramValues[i].lastIndexOf(keyValueDelimiter);
- if (delimiterIndex == -1)
- continue;
- String key = paramValues[i].substring(0, delimiterIndex);
- String value = paramValues[i].substring(delimiterIndex + 1);
- map.put(key, value);
- }
- return map;
- }
-
-}
+
+public class ParamUtil {
+
+ /**
+ *
+ * @param parameterName
+ * @param annotatorContext
+ * @return does not return null - but will return empty set if parameter is
+ * optional or not set.
+ * @throws AnnotatorContextException
+ */
+ public static Set<String> getStringParameterValuesSet(String parameterName, UimaContext annotatorContext)
+ throws ResourceAccessException {
+ Set<String> returnValues = new HashSet<String>();
+ String[] strings = (String[]) annotatorContext.getConfigParameterValue(parameterName);
+ if (strings == null)
+ return returnValues;
+
+ for (int i = 0; i < strings.length; i++) {
+ returnValues.add(strings[i]);
+ }
+ return returnValues;
+ }
+
+ public static Map<String, String> getStringParameterValuesMap(String parameterName,
+ UimaContext annotatorContext, String keyValueDelimiter) throws ResourceAccessException {
+ String[] paramValues = (String[]) annotatorContext.getConfigParameterValue(parameterName);
+ Map<String, String> map = new HashMap<String, String>();
+ for (int i = 0; i < paramValues.length; i++) {
+ int delimiterIndex = paramValues[i].lastIndexOf(keyValueDelimiter);
+ if (delimiterIndex == -1)
+ continue;
+ String key = paramValues[i].substring(0, delimiterIndex);
+ String value = paramValues[i].substring(delimiterIndex + 1);
+ map.put(key, value);
+ }
+ return map;
+ }
+
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/SimpleSegmentAnnotatorTests.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/SimpleSegmentAnnotatorTests.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/SimpleSegmentAnnotatorTests.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/SimpleSegmentAnnotatorTests.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,29 +14,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.ae.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-
-import org.apache.uima.analysis_engine.AnalysisEngine;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceInitializationException;
-import org.junit.Test;
-
-import edu.mayo.bmi.uima.core.test.TestUtil;
-import edu.mayo.bmi.uima.core.type.textspan.Segment;
-
-public class SimpleSegmentAnnotatorTests {
-
- @Test
- public void testSimpleSegment() throws ResourceInitializationException {
- AnalysisEngine ae = TestUtil.getAE(new File("desc/test/analysis_engine/SimpleSegmentAnnotator.xml"));
- JCas jCas = TestUtil.processAE(ae, "data/test/mother_goose/OneMistyMorning.txt");
- Segment segment = TestUtil.getFeatureStructureAtIndex(jCas, Segment.class, 0);
- assertEquals(0, segment.getBegin());
- assertEquals(42, segment.getEnd());
- assertEquals("seg1234", segment.getId());
- }
-}
+package edu.mayo.bmi.uima.core.ae.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.junit.Test;
+
+import edu.mayo.bmi.uima.core.test.TestUtil;
+import edu.mayo.bmi.uima.core.type.textspan.Segment;
+
+public class SimpleSegmentAnnotatorTests {
+
+ @Test
+ public void testSimpleSegment() throws ResourceInitializationException {
+ AnalysisEngine ae = TestUtil.getAE(new File("desc/test/analysis_engine/SimpleSegmentAnnotator.xml"));
+ JCas jCas = TestUtil.processAE(ae, "data/test/mother_goose/OneMistyMorning.txt");
+ Segment segment = TestUtil.getFeatureStructureAtIndex(jCas, Segment.class, 0);
+ assertEquals(0, segment.getBegin());
+ assertEquals(42, segment.getEnd());
+ assertEquals("seg1234", segment.getId());
+ }
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/TokenizerAnnotatorPTBTests.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/TokenizerAnnotatorPTBTests.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/TokenizerAnnotatorPTBTests.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ae/test/TokenizerAnnotatorPTBTests.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2011 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.ae.test;
-
+package edu.mayo.bmi.uima.core.ae.test;
+
import static org.junit.Assert.assertEquals;
import java.io.File;
@@ -41,8 +34,8 @@ import edu.mayo.bmi.uima.core.type.synta
import edu.mayo.bmi.uima.core.type.syntax.PunctuationToken;
import edu.mayo.bmi.uima.core.type.syntax.SymbolToken;
import edu.mayo.bmi.uima.core.type.syntax.WordToken;
-
-public class TokenizerAnnotatorPTBTests {
+
+public class TokenizerAnnotatorPTBTests {
TestData<SimpleToken []>[] tests;
private static final Logger logger = Logger.getLogger(TokenizerAnnotatorPTBTests.class.getName());
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ci/test/HyphenTextModifierImplTests.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ci/test/HyphenTextModifierImplTests.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ci/test/HyphenTextModifierImplTests.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/ci/test/HyphenTextModifierImplTests.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,98 +14,98 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- *
- */
-package edu.mayo.bmi.uima.core.ci.test;
-
-import java.util.ArrayList;
-
-import org.junit.Test;
-
-import edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl;
-
-/**
- * @author Mayo Clinic
- *
- */
-public class HyphenTextModifierImplTests {
-
- /**
- * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#HyphenTextModifierImpl(java.lang.String, int)}.
- */
- // @Test
- // public void testHyphenTextModifierImpl() {
- // fail("Not yet implemented"); // TODO
- // }
-
- /**
- * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#modify(java.lang.String)}.
- */
- // @Test
- // public void testModify() {
- // fail("Not yet implemented"); // TODO
- // }
-
- /**
- * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#test(edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl, java.lang.String)}.
- * Performs two tests - one that has two blanks between some words that could be hyphenated. Since there are two blanks,
- * the text is not modified (the blanks are not replaced by hyphens).
- * For the second test, the appropriate blanks are replaced by hyphens.
- */
- @Test
- public void testTest() {
-
- // The messages about "UNSUPPORTED" go to stderr, and are not returned by test()
- // Same for "New: (new text not generated, see previous messages)"
- String [] expectedMessages = {
- // "UNSUPPORTED: TextModification with offset changes.",
- // "UNSUPPORTED: TextModification with offset changes.",
- // "UNSUPPORTED: TextModification with offset changes.",
- "Orig: Non Hodgkin's the x ray without any non small cell complications.",
- // "New: (new text not generated, see previous messages)",
- "Non-Hodgkin Orig: 0-12 New: 0-11",
- "x-ray Orig: 19-25 New: 18-23",
- "non-small-cell Orig: 38-53 New: 36-50",
-
- "Orig: Non Hodgkin's the x ray without any non small cell complications.",
- "New: Non-Hodgkin's the x-ray without any non-small-cell complications.",
- "Non-Hodgkin Orig: 0-11 New: 0-11",
- "x-ray Orig: 18-23 New: 18-23",
- "non-small-cell Orig: 36-50 New: 36-50",
- };
- String [] expectedStderr = {
- "UNSUPPORTED: TextModification with offset changes.",
- "UNSUPPORTED: TextModification with offset changes.",
- "UNSUPPORTED: TextModification with offset changes.",
- "New: (new text not generated, see previous messages)",
- };
- String [] receivedMessages = new String[expectedMessages.length];
-
- int errCount = expectedStderr.length;
- System.out.println("OK to see the following " + errCount + " had been written to stderr:");
- for (String s: expectedStderr) {
- System.out.println(s);
- }
-
- String filename = "resources/tokenizer/hyphenated.txt";
- HyphenTextModifierImpl tm = new HyphenTextModifierImpl(filename, 7);
- ArrayList<String> messages;
- String t = "Non Hodgkin's the x ray without any non small cell complications.";
- messages = HyphenTextModifierImpl.test(tm, t); // extra blanks
- assert(messages.toArray(receivedMessages).equals(expectedMessages));
- t = t.replace(" ", " "); // change text to only have single blanks between words
- // t = "Non Hodgkin's the x ray without any non small cell complications.";
- messages = HyphenTextModifierImpl.test(tm, t); // single blanks
-
- }
-
- /**
- * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#main(java.lang.String[])}.
- */
- // @Test
- // public void testMain() {
- // fail("Not yet implemented"); // TODO
- // }
-
-}
+/**
+ *
+ */
+package edu.mayo.bmi.uima.core.ci.test;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+
+import edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl;
+
+/**
+ * @author Mayo Clinic
+ *
+ */
+public class HyphenTextModifierImplTests {
+
+ /**
+ * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#HyphenTextModifierImpl(java.lang.String, int)}.
+ */
+ // @Test
+ // public void testHyphenTextModifierImpl() {
+ // fail("Not yet implemented"); // TODO
+ // }
+
+ /**
+ * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#modify(java.lang.String)}.
+ */
+ // @Test
+ // public void testModify() {
+ // fail("Not yet implemented"); // TODO
+ // }
+
+ /**
+ * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#test(edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl, java.lang.String)}.
+ * Performs two tests - one that has two blanks between some words that could be hyphenated. Since there are two blanks,
+ * the text is not modified (the blanks are not replaced by hyphens).
+ * For the second test, the appropriate blanks are replaced by hyphens.
+ */
+ @Test
+ public void testTest() {
+
+ // The messages about "UNSUPPORTED" go to stderr, and are not returned by test()
+ // Same for "New: (new text not generated, see previous messages)"
+ String [] expectedMessages = {
+ // "UNSUPPORTED: TextModification with offset changes.",
+ // "UNSUPPORTED: TextModification with offset changes.",
+ // "UNSUPPORTED: TextModification with offset changes.",
+ "Orig: Non Hodgkin's the x ray without any non small cell complications.",
+ // "New: (new text not generated, see previous messages)",
+ "Non-Hodgkin Orig: 0-12 New: 0-11",
+ "x-ray Orig: 19-25 New: 18-23",
+ "non-small-cell Orig: 38-53 New: 36-50",
+
+ "Orig: Non Hodgkin's the x ray without any non small cell complications.",
+ "New: Non-Hodgkin's the x-ray without any non-small-cell complications.",
+ "Non-Hodgkin Orig: 0-11 New: 0-11",
+ "x-ray Orig: 18-23 New: 18-23",
+ "non-small-cell Orig: 36-50 New: 36-50",
+ };
+ String [] expectedStderr = {
+ "UNSUPPORTED: TextModification with offset changes.",
+ "UNSUPPORTED: TextModification with offset changes.",
+ "UNSUPPORTED: TextModification with offset changes.",
+ "New: (new text not generated, see previous messages)",
+ };
+ String [] receivedMessages = new String[expectedMessages.length];
+
+ int errCount = expectedStderr.length;
+ System.out.println("OK to see the following " + errCount + " had been written to stderr:");
+ for (String s: expectedStderr) {
+ System.out.println(s);
+ }
+
+ String filename = "resources/tokenizer/hyphenated.txt";
+ HyphenTextModifierImpl tm = new HyphenTextModifierImpl(filename, 7);
+ ArrayList<String> messages;
+ String t = "Non Hodgkin's the x ray without any non small cell complications.";
+ messages = HyphenTextModifierImpl.test(tm, t); // extra blanks
+ assert(messages.toArray(receivedMessages).equals(expectedMessages));
+ t = t.replace(" ", " "); // change text to only have single blanks between words
+ // t = "Non Hodgkin's the x ray without any non small cell complications.";
+ messages = HyphenTextModifierImpl.test(tm, t); // single blanks
+
+ }
+
+ /**
+ * Test method for {@link edu.mayo.bmi.uima.core.ci.HyphenTextModifierImpl#main(java.lang.String[])}.
+ */
+ // @Test
+ // public void testMain() {
+ // fail("Not yet implemented"); // TODO
+ // }
+
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/test/TestUtil.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/test/TestUtil.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/test/TestUtil.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/core/test/edu/mayo/bmi/uima/core/test/TestUtil.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
/*
- * Copyright: (c) 2009 Mayo Foundation for Medical Education and
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- *
- * Licensed 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
- *
+ * 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
@@ -21,208 +14,208 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package edu.mayo.bmi.uima.core.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-
-import org.apache.uima.UIMAFramework;
-import org.apache.uima.UimaContext;
-import org.apache.uima.analysis_engine.AnalysisEngine;
-import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.cas.FSIndex;
-import org.apache.uima.cas.FSIterator;
-import org.apache.uima.collection.CollectionReader;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.cas.TOP;
-import org.apache.uima.resource.ResourceInitializationException;
-import org.apache.uima.resource.ResourceSpecifier;
-import org.apache.uima.util.FileUtils;
-import org.apache.uima.util.InvalidXMLException;
-import org.apache.uima.util.XMLInputSource;
-import org.apache.uima.util.XMLParser;
-
-
-public class TestUtil {
-
- /**
- * This method simply calls
- * {@link #createAnalysisEngineJCas(File, File, String)} with the
- * charSetName equal to "UTF-8".
- *
- * @param analysisEngineDescriptorFile
- * a descriptor file for a UIMA Analysis Engine.
- * @param textFile
- * a file that contains text that the analysis engine will
- * process.
- * @return a JCas that represents the analysis engine's processing of the
- * text file.
- * @throws ResourceInitializationException
- * @see {@link #createAnalysisEngineJCas(File, File, String)}
- */
- public static JCas processAE(AnalysisEngine ae, File textFile) throws ResourceInitializationException {
- return processAE(ae, textFile, "UTF-8");
- }
-
- /**
- * This method reads in the text from the text file using the provided
- * character set and then calls {@link #getJCas(File, String)}
- *
- * @param analysisEngineDescriptorFile
- * a descriptor file for a UIMA Analysis Engine.
- * @param textFile
- * a file that contains text that the analysis engine will
- * process.
- * @param charSetName
- * the name of the character encoding of the file
- * @return a JCas that represents the analysis engine's processing of the
- * text file.
- * @throws ResourceInitializationException
- * @see {@link #getJCas(File, String)}
- * @see Charset
- */
- public static JCas processAE(AnalysisEngine ae, File textFile, String charSetName)
- throws ResourceInitializationException {
-
- try {
- String text = FileUtils.file2String(textFile, charSetName);
- return processAE(ae, text);
- } catch (IOException ioe) {
- throw new ResourceInitializationException(ioe);
- }
- }
-
- /**
- * This method creates a JCas for the provided analysis engine descriptor
- * file and then processes the provided text and returns the JCas. This
- * method is convenient for unit testing because the first line of a unit
- * test can be. <br>
- *
- * <pre>
- * JCas jCas = createAnalysisEngineJCas(someAEDescriptorFile, someText);
- * </pre>
- *
- * <br>
- * The subsequent lines can then be assertions that query the expected
- * contents of the JCas.
- *
- * @param analysisEngineDescriptorFile
- * a descriptor file for a UIMA Analysis Engine.
- * @param text
- * text that the analysis engine will process.
- *
- * @return a JCas that represents the analysis engine's processing of the
- * text file.
- * @throws ResourceInitializationException
- *
- * The code for this method was found here:
- * http://article.gmane.org/gmane.comp.apache.uima.general/880/match=push+documents+into+cpe+collectionreader
- *
- */
-
- public static JCas processAE(AnalysisEngine ae, String text) throws ResourceInitializationException {
- try {
- JCas jCas = ae.newJCas();
- jCas.setDocumentText(text);
- ae.process(jCas);
- return jCas;
- } catch (AnalysisEngineProcessException aepe) {
- throw new ResourceInitializationException(aepe);
- }
- }
-
- public static AnalysisEngine getAE(File analysisEngineDescriptorFile) throws ResourceInitializationException {
- try {
- XMLInputSource xmlInputSource = new XMLInputSource(analysisEngineDescriptorFile);
- XMLParser xmlParser = UIMAFramework.getXMLParser();
- ResourceSpecifier resourceSpecifier = xmlParser.parseResourceSpecifier(xmlInputSource);
- AnalysisEngine analysisEngine = UIMAFramework.produceAnalysisEngine(resourceSpecifier);
- return analysisEngine;
- } catch (IOException ioe) {
- throw new ResourceInitializationException(ioe);
- } catch (InvalidXMLException ixe) {
- throw new ResourceInitializationException(ixe);
- }
-
- }
-
- public static CollectionReader getCR(File collectionReaderDescriptorFile) throws ResourceInitializationException {
- try {
- XMLInputSource xmlInputSource = new XMLInputSource(collectionReaderDescriptorFile);
- XMLParser xmlParser = UIMAFramework.getXMLParser();
- ResourceSpecifier resourceSpecifier = xmlParser.parseResourceSpecifier(xmlInputSource);
- CollectionReader collectionReader = UIMAFramework.produceCollectionReader(resourceSpecifier);
- return collectionReader;
- } catch (IOException ioe) {
- throw new ResourceInitializationException(ioe);
- } catch (InvalidXMLException ixe) {
- throw new ResourceInitializationException(ixe);
- }
-
- }
-
- public static <T extends TOP> int getFeatureStructureSize(JCas jCas, Class<T> cls) {
-
- try {
-
- int type = (Integer) cls.getField("type").get(null);
- FSIndex fsIndex = jCas.getAnnotationIndex(type);
-
- FSIterator iterator = fsIndex.iterator();
- int size = 0;
- while (iterator.hasNext()) {
- iterator.next();
- size++;
- }
- return size;
-
- } catch (IllegalAccessException iae) {
- throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(), iae);
- } catch (NoSuchFieldException nsfe) {
- throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(), nsfe);
- }
-
- }
-
- public static <T extends TOP> T getFeatureStructureAtIndex(JCas jCas, Class<T> cls, int index) {
-
- try {
- int type = (Integer) cls.getField("type").get(null);
- FSIndex fsIndex = jCas.getAnnotationIndex(type);
- if (index < 0)
- throw new IllegalArgumentException("index less than zero: index=" + index);
- if (index >= fsIndex.size())
- throw new IllegalArgumentException("index greater than or equal to fsIndex.size(): index=" + index);
-
- FSIterator iterator = fsIndex.iterator();
- Object obj = null;
- for (int i = 0; i <= index; i++) {
- obj = iterator.next();
- }
- return cls.cast(obj);
- } catch (IllegalAccessException iae) {
- throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(),
- iae);
- } catch (NoSuchFieldException nsfe) {
- throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(),
- nsfe);
- }
- }
-
- static String unexpectedParamValueMsg = "unexpected parameter value for descriptor file %1$s for param: %2$s";
-
- public static void testConfigParam(UimaContext uimaContext, String descriptorFile, String paramName, Object paramValue) {
- testConfigParam(uimaContext, descriptorFile, paramName, paramValue, null);
- }
- public static void testConfigParam(UimaContext uimaContext, String descriptorFile, String paramName, Object paramValue, Integer arrayIndex) {
- if(arrayIndex == null) {
- assertEquals(String.format(unexpectedParamValueMsg, descriptorFile, paramName), paramValue, uimaContext
- .getConfigParameterValue(paramName));
- } else
- assertEquals(String.format(unexpectedParamValueMsg, descriptorFile, paramName), paramValue, ((Object[])uimaContext
- .getConfigParameterValue(paramName))[arrayIndex]);
- }
-}
+package edu.mayo.bmi.uima.core.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.collection.CollectionReader;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.util.FileUtils;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.apache.uima.util.XMLParser;
+
+
+public class TestUtil {
+
+ /**
+ * This method simply calls
+ * {@link #createAnalysisEngineJCas(File, File, String)} with the
+ * charSetName equal to "UTF-8".
+ *
+ * @param analysisEngineDescriptorFile
+ * a descriptor file for a UIMA Analysis Engine.
+ * @param textFile
+ * a file that contains text that the analysis engine will
+ * process.
+ * @return a JCas that represents the analysis engine's processing of the
+ * text file.
+ * @throws ResourceInitializationException
+ * @see {@link #createAnalysisEngineJCas(File, File, String)}
+ */
+ public static JCas processAE(AnalysisEngine ae, File textFile) throws ResourceInitializationException {
+ return processAE(ae, textFile, "UTF-8");
+ }
+
+ /**
+ * This method reads in the text from the text file using the provided
+ * character set and then calls {@link #getJCas(File, String)}
+ *
+ * @param analysisEngineDescriptorFile
+ * a descriptor file for a UIMA Analysis Engine.
+ * @param textFile
+ * a file that contains text that the analysis engine will
+ * process.
+ * @param charSetName
+ * the name of the character encoding of the file
+ * @return a JCas that represents the analysis engine's processing of the
+ * text file.
+ * @throws ResourceInitializationException
+ * @see {@link #getJCas(File, String)}
+ * @see Charset
+ */
+ public static JCas processAE(AnalysisEngine ae, File textFile, String charSetName)
+ throws ResourceInitializationException {
+
+ try {
+ String text = FileUtils.file2String(textFile, charSetName);
+ return processAE(ae, text);
+ } catch (IOException ioe) {
+ throw new ResourceInitializationException(ioe);
+ }
+ }
+
+ /**
+ * This method creates a JCas for the provided analysis engine descriptor
+ * file and then processes the provided text and returns the JCas. This
+ * method is convenient for unit testing because the first line of a unit
+ * test can be. <br>
+ *
+ * <pre>
+ * JCas jCas = createAnalysisEngineJCas(someAEDescriptorFile, someText);
+ * </pre>
+ *
+ * <br>
+ * The subsequent lines can then be assertions that query the expected
+ * contents of the JCas.
+ *
+ * @param analysisEngineDescriptorFile
+ * a descriptor file for a UIMA Analysis Engine.
+ * @param text
+ * text that the analysis engine will process.
+ *
+ * @return a JCas that represents the analysis engine's processing of the
+ * text file.
+ * @throws ResourceInitializationException
+ *
+ * The code for this method was found here:
+ * http://article.gmane.org/gmane.comp.apache.uima.general/880/match=push+documents+into+cpe+collectionreader
+ *
+ */
+
+ public static JCas processAE(AnalysisEngine ae, String text) throws ResourceInitializationException {
+ try {
+ JCas jCas = ae.newJCas();
+ jCas.setDocumentText(text);
+ ae.process(jCas);
+ return jCas;
+ } catch (AnalysisEngineProcessException aepe) {
+ throw new ResourceInitializationException(aepe);
+ }
+ }
+
+ public static AnalysisEngine getAE(File analysisEngineDescriptorFile) throws ResourceInitializationException {
+ try {
+ XMLInputSource xmlInputSource = new XMLInputSource(analysisEngineDescriptorFile);
+ XMLParser xmlParser = UIMAFramework.getXMLParser();
+ ResourceSpecifier resourceSpecifier = xmlParser.parseResourceSpecifier(xmlInputSource);
+ AnalysisEngine analysisEngine = UIMAFramework.produceAnalysisEngine(resourceSpecifier);
+ return analysisEngine;
+ } catch (IOException ioe) {
+ throw new ResourceInitializationException(ioe);
+ } catch (InvalidXMLException ixe) {
+ throw new ResourceInitializationException(ixe);
+ }
+
+ }
+
+ public static CollectionReader getCR(File collectionReaderDescriptorFile) throws ResourceInitializationException {
+ try {
+ XMLInputSource xmlInputSource = new XMLInputSource(collectionReaderDescriptorFile);
+ XMLParser xmlParser = UIMAFramework.getXMLParser();
+ ResourceSpecifier resourceSpecifier = xmlParser.parseResourceSpecifier(xmlInputSource);
+ CollectionReader collectionReader = UIMAFramework.produceCollectionReader(resourceSpecifier);
+ return collectionReader;
+ } catch (IOException ioe) {
+ throw new ResourceInitializationException(ioe);
+ } catch (InvalidXMLException ixe) {
+ throw new ResourceInitializationException(ixe);
+ }
+
+ }
+
+ public static <T extends TOP> int getFeatureStructureSize(JCas jCas, Class<T> cls) {
+
+ try {
+
+ int type = (Integer) cls.getField("type").get(null);
+ FSIndex fsIndex = jCas.getAnnotationIndex(type);
+
+ FSIterator iterator = fsIndex.iterator();
+ int size = 0;
+ while (iterator.hasNext()) {
+ iterator.next();
+ size++;
+ }
+ return size;
+
+ } catch (IllegalAccessException iae) {
+ throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(), iae);
+ } catch (NoSuchFieldException nsfe) {
+ throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(), nsfe);
+ }
+
+ }
+
+ public static <T extends TOP> T getFeatureStructureAtIndex(JCas jCas, Class<T> cls, int index) {
+
+ try {
+ int type = (Integer) cls.getField("type").get(null);
+ FSIndex fsIndex = jCas.getAnnotationIndex(type);
+ if (index < 0)
+ throw new IllegalArgumentException("index less than zero: index=" + index);
+ if (index >= fsIndex.size())
+ throw new IllegalArgumentException("index greater than or equal to fsIndex.size(): index=" + index);
+
+ FSIterator iterator = fsIndex.iterator();
+ Object obj = null;
+ for (int i = 0; i <= index; i++) {
+ obj = iterator.next();
+ }
+ return cls.cast(obj);
+ } catch (IllegalAccessException iae) {
+ throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(),
+ iae);
+ } catch (NoSuchFieldException nsfe) {
+ throw new IllegalArgumentException("class passed in caused an exception: class=" + cls.getCanonicalName(),
+ nsfe);
+ }
+ }
+
+ static String unexpectedParamValueMsg = "unexpected parameter value for descriptor file %1$s for param: %2$s";
+
+ public static void testConfigParam(UimaContext uimaContext, String descriptorFile, String paramName, Object paramValue) {
+ testConfigParam(uimaContext, descriptorFile, paramName, paramValue, null);
+ }
+ public static void testConfigParam(UimaContext uimaContext, String descriptorFile, String paramName, Object paramValue, Integer arrayIndex) {
+ if(arrayIndex == null) {
+ assertEquals(String.format(unexpectedParamValueMsg, descriptorFile, paramName), paramValue, uimaContext
+ .getConfigParameterValue(paramName));
+ } else
+ assertEquals(String.format(unexpectedParamValueMsg, descriptorFile, paramName), paramValue, ((Object[])uimaContext
+ .getConfigParameterValue(paramName))[arrayIndex]);
+ }
+}
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AbstractClassifier.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AbstractClassifier.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AbstractClassifier.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AbstractClassifier.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnaphoricityAttributeCalculator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnaphoricityAttributeCalculator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnaphoricityAttributeCalculator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnaphoricityAttributeCalculator.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotOffsetComparator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotOffsetComparator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotOffsetComparator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotOffsetComparator.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationCounter.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationCounter.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationCounter.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationCounter.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationSelector.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationSelector.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationSelector.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AnnotationSelector.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AttributeCalculator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AttributeCalculator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AttributeCalculator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/AttributeCalculator.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/CorefConsts.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/CorefConsts.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/CorefConsts.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/CorefConsts.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/EditDistance.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/EditDistance.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/EditDistance.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/EditDistance.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FSIteratorToList.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FSIteratorToList.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FSIteratorToList.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FSIteratorToList.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FeatureVector.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FeatureVector.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FeatureVector.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/FeatureVector.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/GoldStandardLabeler.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/GoldStandardLabeler.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/GoldStandardLabeler.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/GoldStandardLabeler.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/HobbsTreeNavigator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/HobbsTreeNavigator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/HobbsTreeNavigator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/HobbsTreeNavigator.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableDepUtils.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableDepUtils.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableDepUtils.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableDepUtils.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableTreeUtils.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableTreeUtils.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableTreeUtils.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/MarkableTreeUtils.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/PairAttributeCalculator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/PairAttributeCalculator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/PairAttributeCalculator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/PairAttributeCalculator.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/ParentPtrTree.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/ParentPtrTree.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/ParentPtrTree.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/ParentPtrTree.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmUtils.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmUtils.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmUtils.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmUtils.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmVectorCreator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmVectorCreator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmVectorCreator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SvmVectorCreator.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SyntaxAttributeCalculator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SyntaxAttributeCalculator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SyntaxAttributeCalculator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/SyntaxAttributeCalculator.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/TextMatch.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/TextMatch.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/TextMatch.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/edu/mayo/bmi/coref/util/TextMatch.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/B3Type.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/B3Type.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/B3Type.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/B3Type.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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
Modified: incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/CEAFType.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/CEAFType.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/CEAFType.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/coref-resolver/src/org/chboston/cnlp/ctakes/coref/eval/helpers/CEAFType.java Wed Oct 31 05:26:43 2012
@@ -1,8 +1,10 @@
-/* Copyright 2011 Children's Hospital Boston
- Licensed 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
-
+ * 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