incubator-ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1396711 [3/4] - in /incubator/ctakes/trunk: ctakes-chunker/src/test/ ctakes-chunker/src/test/data/ ctakes-chunker/src/test/data/output/ ctakes-chunker/src/test/data/text-files/ ctakes-chunker/src/test/desc/ ctakes-chunker/src/test/java/ ct...
Date Wed, 10 Oct 2012 17:59:45 GMT
Modified: incubator/ctakes/trunk/ctakes-drug-ner/resources/launch/UIMA_CVD--Drug NER.launch
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-drug-ner/resources/launch/UIMA_CVD--Drug%20NER.launch?rev=1396711&r1=1396710&r2=1396711&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-drug-ner/resources/launch/UIMA_CVD--Drug NER.launch (original)
+++ incubator/ctakes/trunk/ctakes-drug-ner/resources/launch/UIMA_CVD--Drug NER.launch Wed Oct 10 17:59:40 2012
@@ -1,15 +1,17 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/ctakes-drug-ner"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_default"/>
-<stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_default"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.uima.tools.annot_view.Gladis"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-drug-ner"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="&quot;-Djava.util.logging.config.file=${env_var:UIMA_HOME}/Logger.properties&quot;  -Xms500M -Xmx900M"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/ctakes-drug-ner"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_default"/>
+<stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_default"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.uima.tools.annot_view.Gladis"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-drug-ner"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="&quot;-Djava.util.logging.config.file=${env_var:UIMA_HOME}/Logger.properties&quot;  -Xms500M -Xmx900M"/>
+</launchConfiguration>

Modified: incubator/ctakes/trunk/ctakes-ne-contexts/resources/launch/NE_context.launch
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/resources/launch/NE_context.launch?rev=1396711&r1=1396710&r2=1396711&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/resources/launch/NE_context.launch (original)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/resources/launch/NE_context.launch Wed Oct 10 17:59:40 2012
@@ -1,16 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/ctakes-ne-contexts"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=Context Annotator"/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-ne-contexts"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/ctakes-ne-contexts"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=Context Annotator"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-ne-contexts"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+</launchConfiguration>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/NegationAnnotator.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/NegationAnnotator.xml?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/NegationAnnotator.xml (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/NegationAnnotator.xml Wed Oct 10 17:59:40 2012
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+  <primitive>true</primitive>
+  <annotatorImplementationName>org.apache.ctakes.necontexts.ContextAnnotator</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name>NegationAnnotator</name>
+    <configurationParameters>
+      <configurationParameter>
+        <name>MaxLeftScopeSize</name>
+        <description/>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>MaxRightScopeSize</name>
+        <description/>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ScopeOrder</name>
+        <description/>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextAnalyzerClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextHitConsumerClass</name>
+        <description/>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>WindowAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>FocusAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+    </configurationParameters>
+    <configurationParameterSettings>
+      <nameValuePair>
+        <name>MaxLeftScopeSize</name>
+        <value>
+          <integer>10</integer>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>MaxRightScopeSize</name>
+        <value>
+          <integer>10</integer>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ScopeOrder</name>
+        <value>
+          <array>
+            <string>LEFT</string>
+            <string>RIGHT</string>
+          </array>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextHitConsumerClass</name>
+        <value>
+          <string>org.apache.ctakes.necontexts.negation.NegationContextHitConsumer</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>WindowAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.textspan.Sentence</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>FocusAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.syntax.BaseToken</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextAnalyzerClass</name>
+        <value>
+          <string>org.apache.ctakes.necontexts.negation.NegationContextAnalyzer</string>
+        </value>
+      </nameValuePair>
+    </configurationParameterSettings>
+    <typeSystemDescription>
+      <imports>
+      </imports>
+    </typeSystemDescription>
+    <typePriorities/>
+    <fsIndexCollection/>
+    <capabilities>
+      <capability>
+        <inputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+        </inputs>
+        <outputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.necontexts.type.ContextAnnotation</type>
+        </outputs>
+        <languagesSupported/>
+      </capability>
+    </capabilities>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+  <resourceManagerConfiguration/>
+</taeDescription>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SegmentTokenSentenceAggregate.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SegmentTokenSentenceAggregate.xml?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SegmentTokenSentenceAggregate.xml (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SegmentTokenSentenceAggregate.xml Wed Oct 10 17:59:40 2012
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+  <primitive>false</primitive>
+  <delegateAnalysisEngineSpecifiers>
+    <delegateAnalysisEngine key="TokenizerAnnotator">
+      <import location="TokenizerAnnotator.xml"/>
+    </delegateAnalysisEngine>
+    <delegateAnalysisEngine key="SentenceDetectorAnnotator">
+      <import location="SentenceDetectorAnnotator.xml"/>
+    </delegateAnalysisEngine>
+    <delegateAnalysisEngine key="SimpleSegmentAnnotator">
+      <import location="SimpleSegmentAnnotator.xml"/>
+    </delegateAnalysisEngine>
+  </delegateAnalysisEngineSpecifiers>
+  <analysisEngineMetaData>
+    <name>NegationAggregate</name>
+    <description/>
+    <version>1.0</version>
+    <vendor/>
+    <configurationParameters searchStrategy="language_fallback"/>
+    <configurationParameterSettings/>
+    <flowConstraints>
+      <fixedFlow>
+        <node>SimpleSegmentAnnotator</node>
+        <node>TokenizerAnnotator</node>
+        <node>SentenceDetectorAnnotator</node>
+      </fixedFlow>
+    </flowConstraints>
+    <typePriorities/>
+    <fsIndexCollection/>
+    <capabilities>
+      <capability>
+        <inputs/>
+        <outputs/>
+        <languagesSupported/>
+      </capability>
+    </capabilities>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+  <resourceManagerConfiguration/>
+</analysisEngineDescription>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SentenceDetectorAnnotator.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SentenceDetectorAnnotator.xml?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SentenceDetectorAnnotator.xml (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SentenceDetectorAnnotator.xml Wed Oct 10 17:59:40 2012
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+<primitive>true</primitive>
+<annotatorImplementationName>org.apache.ctakes.core.ae.SentenceDetector</annotatorImplementationName>
+<analysisEngineMetaData>
+<name>Sentence Detector annotator</name>
+<description>Discovers sentence boundaries.</description>
+<version>2.1</version>
+<vendor>Mayo Clinic</vendor>
+<configurationParameters/>
+<configurationParameterSettings/>
+<typeSystemDescription>
+<imports>
+</imports>
+</typeSystemDescription>
+<capabilities>
+<capability>
+<inputs>
+<type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+</inputs>
+<outputs>
+<type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.Sentence</type>
+</outputs>
+<languagesSupported/>
+</capability>
+</capabilities>
+<operationalProperties>
+<modifiesCas>true</modifiesCas>
+<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+<outputsNewCASes>false</outputsNewCASes>
+</operationalProperties>
+</analysisEngineMetaData>
+<externalResourceDependencies>
+<externalResourceDependency>
+<key>MaxentModel</key>
+<description></description>
+<interfaceName>org.apache.ctakes.core.resource.MaxentModelResource</interfaceName>
+<optional>false</optional>
+</externalResourceDependency>
+</externalResourceDependencies>
+<resourceManagerConfiguration>
+<externalResources>
+<externalResource>
+<name>MaxentModelFile</name>
+<description></description>
+<fileResourceSpecifier>
+<fileUrl>file:sentdetect/sample_sd_included.mod</fileUrl>
+</fileResourceSpecifier>
+<implementationName>org.apache.ctakes.core.resource.SuffixMaxentModelResourceImpl</implementationName>
+</externalResource>
+</externalResources>
+<externalResourceBindings>
+<externalResourceBinding>
+<key>MaxentModel</key>
+<resourceName>MaxentModelFile</resourceName>
+</externalResourceBinding>
+</externalResourceBindings>
+</resourceManagerConfiguration>
+</taeDescription>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SimpleSegmentAnnotator.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SimpleSegmentAnnotator.xml?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SimpleSegmentAnnotator.xml (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/SimpleSegmentAnnotator.xml Wed Oct 10 17:59:40 2012
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+  <primitive>true</primitive>
+  <annotatorImplementationName>org.apache.ctakes.core.ae.SimpleSegmentAnnotator</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name>SimpleSegmentAnnotator</name>
+    <description/>
+    <version>2.1</version>
+    <vendor>Mayo Clinic</vendor>
+    <configurationParameters>
+      <configurationParameter>
+        <name>SegmentID</name>
+        <description/>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+    </configurationParameters>
+    <configurationParameterSettings/>
+    <typeSystemDescription>
+      <imports>
+      </imports>
+    </typeSystemDescription>
+    <typePriorities/>
+    <fsIndexCollection/>
+    <capabilities>
+      <capability>
+        <inputs/>
+        <outputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.Segment</type>
+        </outputs>
+        <languagesSupported/>
+      </capability>
+    </capabilities>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+  <resourceManagerConfiguration/>
+</taeDescription>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/StatusAnnotator.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/StatusAnnotator.xml?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/StatusAnnotator.xml (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/StatusAnnotator.xml Wed Oct 10 17:59:40 2012
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+  <primitive>true</primitive>
+  <annotatorImplementationName>org.apache.ctakes.necontexts.ContextAnnotator</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name>StatusAnnotator</name>
+    <configurationParameters>
+      <configurationParameter>
+        <name>MaxLeftScopeSize</name>
+        <description/>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>MaxRightScopeSize</name>
+        <description/>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ScopeOrder</name>
+        <description/>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextAnalyzerClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextHitConsumerClass</name>
+        <description/>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>WindowAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>FocusAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+    </configurationParameters>
+    <configurationParameterSettings>
+      <nameValuePair>
+        <name>MaxLeftScopeSize</name>
+        <value>
+          <integer>7</integer>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>MaxRightScopeSize</name>
+        <value>
+          <integer>7</integer>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ScopeOrder</name>
+        <value>
+          <array>
+            <string>LEFT</string>
+            <string>RIGHT</string>
+          </array>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextHitConsumerClass</name>
+        <value>
+          <string>org.apache.ctakes.necontexts.status.StatusContextHitConsumer</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>WindowAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.textspan.Sentence</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>FocusAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.syntax.BaseToken</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextAnalyzerClass</name>
+        <value>
+          <string>org.apache.ctakes.necontexts.status.StatusContextAnalyzer</string>
+        </value>
+      </nameValuePair>
+    </configurationParameterSettings>
+    <typeSystemDescription>
+      <imports>
+      </imports>
+    </typeSystemDescription>
+    <typePriorities/>
+    <fsIndexCollection/>
+    <capabilities>
+      <capability>
+        <inputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.Sentence</type>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+        </inputs>
+        <outputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.necontexts.type.ContextAnnotation</type>
+        </outputs>
+        <languagesSupported/>
+      </capability>
+    </capabilities>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+  <resourceManagerConfiguration/>
+</taeDescription>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TestContextAnnotator.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TestContextAnnotator.xml?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TestContextAnnotator.xml (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TestContextAnnotator.xml Wed Oct 10 17:59:40 2012
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+  <primitive>true</primitive>
+  <annotatorImplementationName>org.apache.ctakes.necontexts.ContextAnnotator</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name>NegationAnnotator</name>
+    <configurationParameters>
+      <configurationParameter>
+        <name>MaxLeftScopeSize</name>
+        <description/>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>MaxRightScopeSize</name>
+        <description/>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ScopeOrder</name>
+        <description/>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextAnalyzerClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextHitConsumerClass</name>
+        <description/>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>WindowAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>FocusAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>ContextAnnotationClass</name>
+        <type>String</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+    </configurationParameters>
+    <configurationParameterSettings>
+      <nameValuePair>
+        <name>MaxLeftScopeSize</name>
+        <value>
+          <integer>8</integer>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>MaxRightScopeSize</name>
+        <value>
+          <integer>4</integer>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ScopeOrder</name>
+        <value>
+          <array>
+            <string>LEFT</string>
+            <string>RIGHT</string>
+            <string>MIDDLE</string>
+          </array>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextHitConsumerClass</name>
+        <value>
+          <string>org.apache.ctakes.necontexts.ContextHitConsumerAdapter</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>WindowAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.textspan.Sentence</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>FocusAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.syntax.BaseToken</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextAnnotationClass</name>
+        <value>
+          <string>org.apache.ctakes.typesystem.type.syntax.BaseToken</string>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>ContextAnalyzerClass</name>
+        <value>
+          <string>org.apache.ctakes.necontexts.ContextAnalyzerAdapter</string>
+        </value>
+      </nameValuePair>
+    </configurationParameterSettings>
+    <typeSystemDescription>
+      <imports>
+      </imports>
+    </typeSystemDescription>
+    <typePriorities/>
+    <fsIndexCollection/>
+    <capabilities>
+      <capability>
+        <inputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+        </inputs>
+        <outputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.necontexts.type.ContextAnnotation</type>
+        </outputs>
+        <languagesSupported/>
+      </capability>
+    </capabilities>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+  <resourceManagerConfiguration/>
+</taeDescription>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TokenizerAnnotator.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TokenizerAnnotator.xml?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TokenizerAnnotator.xml (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/desc/TokenizerAnnotator.xml Wed Oct 10 17:59:40 2012
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+  <primitive>true</primitive>
+  <annotatorImplementationName>org.apache.ctakes.core.ae.TokenizerAnnotator</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name>TokenizerAnnotator</name>
+    <description>Discovers tokens in the given text.  These tokens consist of words, punctuation, etc...</description>
+    <version>2.1</version>
+    <vendor>Mayo Clinic</vendor>
+    <configurationParameters>
+      <configurationParameter>
+        <name>SegmentsToSkip</name>
+        <description>Segments to skip.</description>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+      <configurationParameter>
+        <name>FreqCutoff</name>
+        <description>Frequency cutoff for hyphen entries.</description>
+        <type>Integer</type>
+        <multiValued>false</multiValued>
+        <mandatory>true</mandatory>
+      </configurationParameter>
+    </configurationParameters>
+    <configurationParameterSettings>
+      <nameValuePair>
+        <name>SegmentsToSkip</name>
+        <value>
+          <array/>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+        <name>FreqCutoff</name>
+        <value>
+          <integer>0</integer>
+        </value>
+      </nameValuePair>
+    </configurationParameterSettings>
+    <typeSystemDescription>
+      <imports>
+      </imports>
+    </typeSystemDescription>
+    <typePriorities/>
+    <fsIndexCollection/>
+    <capabilities>
+      <capability>
+        <inputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.Segment</type>
+        </inputs>
+        <outputs>
+          <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+        </outputs>
+        <languagesSupported/>
+      </capability>
+    </capabilities>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+  <externalResourceDependencies>
+    <externalResourceDependency>
+      <key>HyphFreqTable</key>
+      <description/>
+      <interfaceName>org.apache.ctakes.core.resource.StringIntegerMapResource</interfaceName>
+      <optional>true</optional>
+    </externalResourceDependency>
+  </externalResourceDependencies>
+  <resourceManagerConfiguration>
+    <externalResources>
+      <externalResource>
+        <name>HyphFreqFile</name>
+        <description/>
+        <fileResourceSpecifier>
+          <fileUrl>file:tokenizer/hyphenated.txt</fileUrl>
+        </fileResourceSpecifier>
+        <implementationName>org.apache.ctakes.core.resource.StringIntegerMapResourceImpl</implementationName>
+      </externalResource>
+    </externalResources>
+    <externalResourceBindings>
+      <externalResourceBinding>
+        <key>HyphFreqTable</key>
+        <resourceName>HyphFreqFile</resourceName>
+      </externalResourceBinding>
+    </externalResourceBindings>
+  </resourceManagerConfiguration>
+</taeDescription>

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/ContextAnnotatorTests.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/ContextAnnotatorTests.java?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/ContextAnnotatorTests.java (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/ContextAnnotatorTests.java Wed Oct 10 17:59:40 2012
@@ -0,0 +1,515 @@
+/**
+ * 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.necontexts;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.junit.Test;
+
+import org.apache.ctakes.core.TestUtil;
+import org.apache.ctakes.typesystem.type.syntax.BaseToken;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+import org.apache.ctakes.typesystem.type.syntax.PunctuationToken;
+import org.apache.ctakes.typesystem.type.textspan.Sentence;
+
+public class ContextAnnotatorTests {
+
+	static String unexpectedParamValueMsg = "unexpected parameter value for descriptor file test/desc/ContextTestAnnotator.xml for param: ";
+
+	/**
+	 * This test tests ContextAnnotator.getLeftScopeTokens(JCas, Annotation,
+	 * Annotation). The method takes in annotations for the focus and window so
+	 * the descriptor file parameter settings for FocusAnnotationClass and
+	 * WindowAnnotationClass are effectively ignored by the method. This means
+	 * we can pass any annotation in as the focus and window test the results.
+	 * 
+	 * @see ContextAnnotator#getLeftScopeContextAnnotations(JCas, Annotation, Annotation)
+	 * @throws ResourceInitializationException
+	 * @throws AnalysisEngineProcessException
+	 */
+	@Test
+	public void testLeftScopeTokens() throws ResourceInitializationException, AnalysisEngineProcessException {
+
+		String descriptor = "test/desc/TestContextAnnotator.xml";
+		AnalysisEngine contextAE = TestUtil.getAE(new File(descriptor));
+		UimaContext uimaContext = contextAE.getUimaContext();
+		ContextAnnotator contextAnnotator = new ContextAnnotator();
+		contextAnnotator.initialize(uimaContext);
+
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.MAX_LEFT_SCOPE_SIZE_PARAM, new Integer(8));
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.syntax.BaseToken");
+
+		AnalysisEngine segmentTokenSentenceAE = TestUtil.getAE(new File("test/desc/SegmentTokenSentenceAggregate.xml"));
+		// this gives us a JCas that has segments, tokens, and sentences
+		JCas jCas = TestUtil
+				.processAE(
+						segmentTokenSentenceAE,
+						"A farmer went trotting upon his gray mare, Bumpety, bumpety, bump, With his daughter behind him, so rosy and fair, Lumpety, lumpety, lump.");
+
+		BaseToken firstToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 0);
+		BaseToken secondToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 1);
+		BaseToken thirdToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 2);
+		BaseToken fifthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 4);
+		BaseToken eighthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 7);
+		BaseToken ninthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 8);
+		BaseToken tenthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 9);
+		BaseToken penultimateToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 30);
+		BaseToken lastToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 31);
+		Sentence sentence = TestUtil.getFeatureStructureAtIndex(jCas, Sentence.class, 0);
+
+		// perform some sanity checks to make sure that we have the annotations
+		// we think we have.
+		assertEquals("A", firstToken.getCoveredText());
+		assertEquals("farmer", secondToken.getCoveredText());
+		assertEquals("went", thirdToken.getCoveredText());
+		assertEquals("upon", fifthToken.getCoveredText());
+		assertEquals("mare", eighthToken.getCoveredText());
+		assertEquals(",", ninthToken.getCoveredText());
+		assertEquals("Bumpety", tenthToken.getCoveredText());
+		assertEquals("lump", penultimateToken.getCoveredText());
+		assertEquals(".", lastToken.getCoveredText());
+		assertEquals(0, sentence.getBegin());
+		assertEquals(138, sentence.getEnd());
+
+		// if focus is the first token then the left tokens should be empty
+		Annotation focus = firstToken;
+		List<Annotation> leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(0, leftScopeTokens.size());
+
+		// if focus is the second token then the left tokens should contain the
+		// first token
+		focus = secondToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+
+		// if focus is the third token then the left tokens should contain the
+		// first two tokens
+		focus = thirdToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(2, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+		assertEquals(secondToken, leftScopeTokens.get(1));
+
+		// if focus is the ninth token then the left tokens should contain the
+		// first eight tokens
+		focus = ninthToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(8, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+		assertEquals(secondToken, leftScopeTokens.get(1));
+		assertEquals(thirdToken, leftScopeTokens.get(2));
+		assertEquals(eighthToken, leftScopeTokens.get(7));
+
+		// if focus is the tenth token then the left tokens should contain the
+		// eight tokens beginning with the second
+		focus = tenthToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(8, leftScopeTokens.size());
+		assertEquals(secondToken, leftScopeTokens.get(0));
+		assertEquals(thirdToken, leftScopeTokens.get(1));
+		assertEquals(eighthToken, leftScopeTokens.get(6));
+		assertEquals(ninthToken, leftScopeTokens.get(7));
+
+		focus = new PunctuationToken(jCas, 2, 12);
+		assertEquals("farmer wen", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+		focus = new PunctuationToken(jCas, 1, 13);
+		assertEquals(" farmer went", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+
+		// if focus is a token that overlaps on the left with other tokens, the
+		// leftScopeTokens
+		// should not include the partially overlapping tokens on the left
+		focus = new PunctuationToken(jCas, 3, 11);
+		assertEquals("armer we", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+		// it should be the same if the focus type is different
+		focus = new IdentifiedAnnotation(jCas, 3, 11);
+		assertEquals("armer we", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+
+		// if focus annotation is the last token then there should be 8 tokens
+		// returned.
+		focus = lastToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(8, leftScopeTokens.size());
+
+		// "A farmer went trotting upon his gray mare"
+		focus = new IdentifiedAnnotation(jCas, 9, 27);
+		assertEquals("went trotting upon", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(2, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+		assertEquals(secondToken, leftScopeTokens.get(1));
+
+		focus = new IdentifiedAnnotation(jCas, 7, 27);
+		assertEquals("r went trotting upon", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+
+		focus = new IdentifiedAnnotation(jCas, 11, 27);
+		assertEquals("nt trotting upon", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(2, leftScopeTokens.size());
+		assertEquals(firstToken, leftScopeTokens.get(0));
+		assertEquals(secondToken, leftScopeTokens.get(1));
+
+		// If there are no complete words to left of focus because the window
+		// cuts off the token - e.g. farmer, then
+		// the token farmer should not be returned as part of left tokens
+		sentence = new Sentence(jCas, 5, 27);
+		assertEquals("mer went trotting upon", sentence.getCoveredText());
+		focus = new IdentifiedAnnotation(jCas, 9, 27);
+		assertEquals("went trotting upon", focus.getCoveredText());
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(0, leftScopeTokens.size());
+
+		// there are no complete tokens to the left of "went" inside the new
+		// window
+		focus = thirdToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(0, leftScopeTokens.size());
+
+		// there are two complete tokens to the left of "upon" inside the new
+		// window
+		focus = fifthToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(2, leftScopeTokens.size());
+		assertEquals(thirdToken, leftScopeTokens.get(0));
+		assertEquals("trotting", leftScopeTokens.get(1).getCoveredText());
+
+		/*
+		 * there are three complete tokens to the left of the first comma (the
+		 * tenth token) inside the new window but the tenth token itself is not
+		 * inside the window and so an empty array is returned.
+		 */
+		focus = tenthToken;
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(0, leftScopeTokens.size());
+
+		focus = new BaseToken(jCas, 13,14);
+		leftScopeTokens = contextAnnotator.getLeftScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, leftScopeTokens.size());
+
+	}
+
+	
+	/**
+	 * This test tests ContextAnnotator.getRightScopeTokens(JCas, Annotation,
+	 * Annotation). The method takes in annotations for the focus and window so
+	 * the descriptor file parameter settings for FocusAnnotationClass and
+	 * WindowAnnotationClass are effectively ignored by the method. This means
+	 * we can pass any annotation in as the focus and window test the results.
+	 * 
+	 * @see ContextAnnotator#getRightScopeContextAnnotations(JCas, Annotation, Annotation)
+	 * @throws ResourceInitializationException
+	 * @throws AnalysisEngineProcessException
+	 */
+	@Test
+	public void testRightScopeTokens() throws ResourceInitializationException, AnalysisEngineProcessException {
+
+		String descriptor = "test/desc/TestContextAnnotator.xml";
+		AnalysisEngine contextAE = TestUtil.getAE(new File(descriptor));
+		UimaContext uimaContext = contextAE.getUimaContext();
+		ContextAnnotator contextAnnotator = new ContextAnnotator();
+		contextAnnotator.initialize(uimaContext);
+
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.MAX_RIGHT_SCOPE_SIZE_PARAM, new Integer(4));
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.syntax.BaseToken");
+
+		AnalysisEngine segmentTokenSentenceAE = TestUtil.getAE(new File("test/desc/SegmentTokenSentenceAggregate.xml"));
+		// this gives us a JCas that has segments, tokens, and sentences
+		JCas jCas = TestUtil
+				.processAE(
+						segmentTokenSentenceAE,
+						"A farmer went trotting upon his gray mare, Bumpety, bumpety, bump, With his daughter behind him, so rosy and fair, Lumpety, lumpety, lump.");
+
+		BaseToken firstToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 0);
+		BaseToken secondToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 1);
+		BaseToken thirdToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 2);
+		BaseToken fifthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 4);
+		BaseToken eighthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 7);
+		BaseToken ninthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 8);
+		BaseToken tenthToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 9);
+		BaseToken fifthFromEndToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 27);
+		BaseToken fourthFromEndToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 28);
+		BaseToken thirdFromEndToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 29);
+		BaseToken penultimateToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 30);
+		BaseToken lastToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 31);
+		Sentence sentence = TestUtil.getFeatureStructureAtIndex(jCas, Sentence.class, 0);
+
+		// perform some sanity checks to make sure that we have the annotations
+		// we think we have.
+		assertEquals("A", firstToken.getCoveredText());
+		assertEquals("farmer", secondToken.getCoveredText());
+		assertEquals("went", thirdToken.getCoveredText());
+		assertEquals("upon", fifthToken.getCoveredText());
+		assertEquals("mare", eighthToken.getCoveredText());
+		assertEquals(",", ninthToken.getCoveredText());
+		assertEquals("Bumpety", tenthToken.getCoveredText());
+		assertEquals(",", fifthFromEndToken.getCoveredText());
+		assertEquals("lumpety", fourthFromEndToken.getCoveredText());
+		assertEquals(",", thirdFromEndToken.getCoveredText());
+		assertEquals("lump", penultimateToken.getCoveredText());
+		assertEquals(".", lastToken.getCoveredText());
+		assertEquals(0, sentence.getBegin());
+		assertEquals(138, sentence.getEnd());
+
+		// if focus is the first token then the right tokens should number 4
+		Annotation focus = firstToken;
+		List<Annotation> rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(4, rightScopeTokens.size());
+		assertEquals(secondToken, rightScopeTokens.get(0));
+		assertEquals(thirdToken, rightScopeTokens.get(1));
+		assertEquals("trotting", rightScopeTokens.get(2).getCoveredText());
+		assertEquals(fifthToken, rightScopeTokens.get(3));
+		
+		// if focus is the second token then the right tokens should number 4
+		focus = secondToken;
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(4, rightScopeTokens.size());
+		assertEquals(thirdToken, rightScopeTokens.get(0));
+		assertEquals("trotting", rightScopeTokens.get(1).getCoveredText());
+		assertEquals(fifthToken, rightScopeTokens.get(2));
+		assertEquals("his", rightScopeTokens.get(3).getCoveredText());
+
+		// if focus is the ninth token then the left tokens should number 4
+		focus = ninthToken;
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(4, rightScopeTokens.size());
+		assertEquals("Bumpety", rightScopeTokens.get(0).getCoveredText());
+		assertEquals(",", rightScopeTokens.get(1).getCoveredText());
+		assertEquals("bumpety", rightScopeTokens.get(2).getCoveredText());
+		assertEquals(",", rightScopeTokens.get(3).getCoveredText());
+
+		focus = new PunctuationToken(jCas, 2, 12);
+		assertEquals("farmer wen", focus.getCoveredText());
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(4, rightScopeTokens.size());
+		assertEquals("trotting", rightScopeTokens.get(0).getCoveredText());
+		assertEquals("upon", rightScopeTokens.get(1).getCoveredText());
+		assertEquals("his", rightScopeTokens.get(2).getCoveredText());
+		assertEquals("gray", rightScopeTokens.get(3).getCoveredText());
+		
+		// if focus annotation is the last token then the right tokens should number 0
+		focus = lastToken;
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(0, rightScopeTokens.size());
+
+		// if focus annotation is the fifth-from-end token then the right tokens should number 4
+		focus = fifthFromEndToken;
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(4, rightScopeTokens.size());
+		assertEquals(fourthFromEndToken, rightScopeTokens.get(0));
+		assertEquals(thirdFromEndToken, rightScopeTokens.get(1));
+		assertEquals(penultimateToken, rightScopeTokens.get(2));
+		assertEquals(lastToken, rightScopeTokens.get(3));
+
+		// if focus annotation is the fourth-from-end token then the right tokens should number 3
+		focus = fourthFromEndToken;
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(3, rightScopeTokens.size());
+		assertEquals(thirdFromEndToken, rightScopeTokens.get(0));
+		assertEquals(penultimateToken, rightScopeTokens.get(1));
+		assertEquals(lastToken, rightScopeTokens.get(2));
+
+		// if focus annotation is the third-from-end token then the right tokens should number 2
+		focus = thirdFromEndToken;
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(2, rightScopeTokens.size());
+		assertEquals(penultimateToken, rightScopeTokens.get(0));
+		assertEquals(lastToken, rightScopeTokens.get(1));
+
+		focus = new IdentifiedAnnotation(jCas, 9, 27);
+		assertEquals("went trotting upon", focus.getCoveredText());
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(4, rightScopeTokens.size());
+		assertEquals("his", rightScopeTokens.get(0).getCoveredText());
+		assertEquals("gray", rightScopeTokens.get(1).getCoveredText());
+		assertEquals("mare", rightScopeTokens.get(2).getCoveredText());
+		assertEquals(",", rightScopeTokens.get(3).getCoveredText());
+
+		focus = new IdentifiedAnnotation(jCas, 9, 29);
+		assertEquals("went trotting upon h", focus.getCoveredText());
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals("gray", rightScopeTokens.get(0).getCoveredText());
+		assertEquals("mare", rightScopeTokens.get(1).getCoveredText());
+		assertEquals(ninthToken, rightScopeTokens.get(2));
+		assertEquals(tenthToken, rightScopeTokens.get(3));
+
+		focus = new BaseToken(jCas, 27, 28);
+		assertEquals(" ", focus.getCoveredText());
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals("his", rightScopeTokens.get(0).getCoveredText());
+		assertEquals("gray", rightScopeTokens.get(1).getCoveredText());
+		assertEquals("mare", rightScopeTokens.get(2).getCoveredText());
+		assertEquals(",", rightScopeTokens.get(3).getCoveredText());
+
+		
+		sentence = new Sentence(jCas, 120, 136);
+		System.out.println(sentence.getCoveredText());
+		assertEquals("ty, lumpety, lum", sentence.getCoveredText());
+		focus = new IdentifiedAnnotation(jCas, 124, 131);
+		assertEquals("lumpety", focus.getCoveredText());
+		rightScopeTokens = contextAnnotator.getRightScopeContextAnnotations(jCas, focus, sentence);
+		assertEquals(1, rightScopeTokens.size());
+
+	}
+
+	
+	/**
+	 * The test tests ContextAnnotator.getMiddleScopeTokens(JCas, Annotation).
+	 * The method takes in an annotation for the focus and so the descriptor
+	 * file parameter setting for FocusAnnotationClass is effectively ignored by
+	 * the method. This means we can pass any annotation in as the focus and
+	 * test the results. Similarly, the WindowAnnotationClass can be ignored as
+	 * this is used to determine the focus annotations before this method is
+	 * called. However, the list of returned annotations will be of the type
+	 * specified in the parameter TokenAnnotationClass.
+	 * 
+	 * @see ContextAnnotator#getMiddleScopeContextAnnotations(JCas, Annotation)
+	 * @throws ResourceInitializationException
+	 * @throws AnalysisEngineProcessException
+	 */
+	@Test
+	public void testMiddleScopeTokens() throws ResourceInitializationException, AnalysisEngineProcessException {
+
+		String descriptor = "test/desc/TestContextAnnotator.xml";
+		AnalysisEngine contextAE = TestUtil.getAE(new File(descriptor));
+		UimaContext uimaContext = contextAE.getUimaContext();
+		ContextAnnotator contextAnnotator = new ContextAnnotator();
+		contextAnnotator.initialize(uimaContext);
+
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.syntax.BaseToken");
+
+
+		AnalysisEngine segmentTokenSentenceAE = TestUtil.getAE(new File("test/desc/SegmentTokenSentenceAggregate.xml"));
+		// this gives us a JCas that has segments, tokens, and sentences
+		JCas jCas = TestUtil
+				.processAE(
+						segmentTokenSentenceAE,
+						"A farmer went trotting upon his gray mare, Bumpety, bumpety, bump, With his daughter behind him, so rosy and fair, Lumpety, lumpety, lump.");
+
+		BaseToken firstToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 0);
+		BaseToken secondToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 1);
+		BaseToken thirdToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 2);
+		BaseToken penultimateToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 30);
+		BaseToken lastToken = TestUtil.getFeatureStructureAtIndex(jCas, BaseToken.class, 31);
+		Sentence sentence = TestUtil.getFeatureStructureAtIndex(jCas, Sentence.class, 0);
+
+		// some sanity checks to verify that we have the tokens and sentence we
+		// think we have.
+		assertEquals("A", firstToken.getCoveredText());
+		assertEquals("farmer", secondToken.getCoveredText());
+		assertEquals("went", thirdToken.getCoveredText());
+		assertEquals("lump", penultimateToken.getCoveredText());
+		assertEquals(".", lastToken.getCoveredText());
+		assertEquals(0, sentence.getBegin());
+		assertEquals(138, sentence.getEnd());
+
+		// if focus is the first token then the middle tokens should consist of
+		// that token
+		Annotation focus = firstToken;
+		List<Annotation> middleScopeTokens = contextAnnotator.getMiddleScopeContextAnnotations(jCas, focus);
+		assertEquals(1, middleScopeTokens.size());
+		assertEquals(focus, middleScopeTokens.get(0));
+
+		// if focus is the sentence, then the middle tokens should consist of
+		// all of the tokens in the sentence
+		focus = sentence;
+		middleScopeTokens = contextAnnotator.getMiddleScopeContextAnnotations(jCas, focus);
+		assertEquals(32, middleScopeTokens.size());
+		assertEquals(firstToken, middleScopeTokens.get(0));
+		assertEquals(secondToken, middleScopeTokens.get(1));
+		assertEquals(penultimateToken, middleScopeTokens.get(30));
+		assertEquals(lastToken, middleScopeTokens.get(31));
+
+		// if focus is a token that contains within it other tokens, then the
+		// middle tokens should consist of only the tokens that are completely
+		// inside the token and not tokens that are partially inside and not the
+		// large token itself.
+		focus = new PunctuationToken(jCas, 2, 12);
+		assertEquals("farmer wen", focus.getCoveredText());
+		middleScopeTokens = contextAnnotator.getMiddleScopeContextAnnotations(jCas, focus);
+		assertEquals(1, middleScopeTokens.size());
+		assertEquals(secondToken, middleScopeTokens.get(0));
+		focus = new PunctuationToken(jCas, 1, 13);
+		assertEquals(" farmer went", focus.getCoveredText());
+		middleScopeTokens = contextAnnotator.getMiddleScopeContextAnnotations(jCas, focus);
+		assertEquals(2, middleScopeTokens.size());
+		assertEquals(secondToken, middleScopeTokens.get(0));
+		assertEquals("went", middleScopeTokens.get(1).getCoveredText());
+
+		// if focus is a token overlaps with other tokens, but does not
+		// completely contain other tokens, then middle tokens should contain
+		// that one token
+		focus = new PunctuationToken(jCas, 3, 11);
+		assertEquals("armer we", focus.getCoveredText());
+		middleScopeTokens = contextAnnotator.getMiddleScopeContextAnnotations(jCas, focus);
+		assertEquals(1, middleScopeTokens.size());
+
+		// if focus is a named entity that overlaps with other tokens, but does
+		// not completely contain other tokens, then middle tokens should should
+		// be empty
+		focus = new IdentifiedAnnotation(jCas, 3, 11);
+		assertEquals("armer we", focus.getCoveredText());
+		middleScopeTokens = contextAnnotator.getMiddleScopeContextAnnotations(jCas, focus);
+		assertEquals(0, middleScopeTokens.size());
+
+		focus = new IdentifiedAnnotation(jCas, 0, 13);
+		assertEquals("A farmer went", focus.getCoveredText());
+		middleScopeTokens = contextAnnotator.getMiddleScopeContextAnnotations(jCas, focus);
+		assertEquals(3, middleScopeTokens.size());
+		assertEquals(firstToken, middleScopeTokens.get(0));
+		assertEquals(secondToken, middleScopeTokens.get(1));
+		assertEquals(thirdToken, middleScopeTokens.get(2));
+
+	}
+
+	@Test
+	public void testParseScopeOrder() throws AnnotatorConfigurationException {
+		ContextAnnotator ca = new ContextAnnotator();
+		ca.parseScopeOrder(new String[] { "MIDDLE", "LEFT", "RIGHT", "ALL" });
+		assertEquals(4, ca.scopes.size());
+		assertEquals(ContextAnnotator.MIDDLE_SCOPE, (int)ca.scopes.get(0));
+		assertEquals(ContextAnnotator.LEFT_SCOPE, (int)ca.scopes.get(1));
+		assertEquals(ContextAnnotator.RIGHT_SCOPE, (int)ca.scopes.get(2));
+		assertEquals(ContextAnnotator.ALL_SCOPE, (int)ca.scopes.get(3));
+	}
+}

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/NegationAnnotatorTests.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/NegationAnnotatorTests.java?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/NegationAnnotatorTests.java (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/NegationAnnotatorTests.java Wed Oct 10 17:59:40 2012
@@ -0,0 +1,146 @@
+/**
+ * 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.necontexts;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.junit.Test;
+
+import org.apache.ctakes.core.TestUtil;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+
+public class NegationAnnotatorTests {
+
+	static String unexpectedParamValueMsg = "unexpected parameter value for descriptor file test/desc/NegationAnnotator.xml for param: ";
+
+	@Test
+	public void testNegationExamples() throws ResourceInitializationException, AnalysisEngineProcessException {
+
+		String descriptor = "test/desc/NegationAnnotator.xml";
+		AnalysisEngine contextAE = TestUtil.getAE(new File(descriptor));
+		UimaContext uimaContext = contextAE.getUimaContext();
+		ContextAnnotator negationAnnotator = new ContextAnnotator();
+		negationAnnotator.initialize(uimaContext);
+
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.MAX_LEFT_SCOPE_SIZE_PARAM, new Integer(10));
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.MAX_RIGHT_SCOPE_SIZE_PARAM, new Integer(10));
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.SCOPE_ORDER_PARAM, "LEFT", 0);
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.SCOPE_ORDER_PARAM, "RIGHT", 1);
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_ANALYZER_CLASS_PARAM, "org.apache.ctakes.necontexts.negation.NegationContextAnalyzer");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_HIT_CONSUMER_CLASS_PARAM, "org.apache.ctakes.necontexts.negation.NegationContextHitConsumer");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.WINDOW_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.textspan.Sentence");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.FOCUS_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.syntax.BaseToken");
+
+		AnalysisEngine segmentTokenSentenceAE = TestUtil.getAE(new File("test/desc/SegmentTokenSentenceAggregate.xml"));
+
+		String text;
+		JCas jCas;
+
+		text = "No evidence of ankle edema is noted.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		IdentifiedAnnotation ne1 = addNE(jCas, 21, 26, "edema");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+		text = "evidence of ankle edema is noted.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 18, 23, "edema");
+		negationAnnotator.process(jCas);
+		assertEquals(0, ne1.getPolarity());
+
+		text = "He denies gastric reflux symptoms, and he denies any symptoms referable to his to his genitourinary system.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 18, 24, "reflux");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+		text = "He has no history of cardiac-related problems and no family history of coronary artery disease.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 71, 94, "coronary artery disease");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+		text = "He is a lifetime nonsmoker, reports he walks for 30-minutes 4-5 times a week and has no history of hypoglycemia.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 99, 111, "hypoglycemia");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+		text = "Electrocardiogram was negative for ischemia, PVC's were less than 5 per minute.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 35, 43, "ischemia");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+		text = "He does not have diabetes.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 17, 25, "diabetes");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+		text = "She denies any loss of vision, double-vision, dysarthria, or dysphagia.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 15, 29, "loss of vision");
+		IdentifiedAnnotation ne2 = addNE(jCas, 31, 44, "double-vision");
+		IdentifiedAnnotation ne3 = addNE(jCas, 46, 56, "dysarthria");
+		IdentifiedAnnotation ne4 = addNE(jCas, 61, 70, "dysphagia");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+		assertEquals(-1, ne2.getPolarity());
+		assertEquals(-1, ne3.getPolarity());
+		assertEquals(-1, ne4.getPolarity());
+		
+		text = "Her pain problem began gradually in June of 2000 without prior incident, injury, or illness.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 73, 79, "injury");
+		ne2 = addNE(jCas, 84, 91, "illness");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+		assertEquals(-1, ne2.getPolarity());
+
+		text = "I found no evidence for cancer in this examination.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 24, 30, "cancer");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+		text = "Careful examination of the head, face, and neck reveal no skin cancers.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 58, 70, "skin cancers");
+		negationAnnotator.process(jCas);
+		assertEquals(-1, ne1.getPolarity());
+
+	}
+
+	private IdentifiedAnnotation addNE(JCas jCas, int neBegin, int neEnd, String neText) throws ResourceInitializationException, AnalysisEngineProcessException {
+		IdentifiedAnnotation namedEntity = new IdentifiedAnnotation(jCas, neBegin, neEnd);
+		namedEntity.addToIndexes();
+		assertEquals(neText, namedEntity.getCoveredText());
+		return namedEntity;
+	}
+
+}

Added: incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/StatusAnnotatorTests.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/StatusAnnotatorTests.java?rev=1396711&view=auto
==============================================================================
--- incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/StatusAnnotatorTests.java (added)
+++ incubator/ctakes/trunk/ctakes-ne-contexts/src/test/java/org/apache/ctakes/necontexts/StatusAnnotatorTests.java Wed Oct 10 17:59:40 2012
@@ -0,0 +1,161 @@
+/**
+ * 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.necontexts;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.junit.Test;
+
+import org.apache.ctakes.core.TestUtil;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+
+public class StatusAnnotatorTests {
+
+	@Test
+	public void testNegationExamples() throws ResourceInitializationException, AnalysisEngineProcessException {
+
+		String descriptor = "test/desc/StatusAnnotator.xml";
+		AnalysisEngine contextAE = TestUtil.getAE(new File(descriptor));
+		UimaContext uimaContext = contextAE.getUimaContext();
+		ContextAnnotator statusAnnotator = new ContextAnnotator();
+		statusAnnotator.initialize(uimaContext);
+
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.MAX_LEFT_SCOPE_SIZE_PARAM, new Integer(7));
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.MAX_RIGHT_SCOPE_SIZE_PARAM, new Integer(7));
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.SCOPE_ORDER_PARAM, "LEFT", 0);
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.SCOPE_ORDER_PARAM, "RIGHT", 1);
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_ANALYZER_CLASS_PARAM, "org.apache.ctakes.necontexts.status.StatusContextAnalyzer");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_HIT_CONSUMER_CLASS_PARAM, "org.apache.ctakes.necontexts.status.StatusContextHitConsumer");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.WINDOW_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.textspan.Sentence");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.FOCUS_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.IdentifiedAnnotation");
+		TestUtil.testConfigParam(uimaContext, descriptor, ContextAnnotator.CONTEXT_ANNOTATION_CLASS_PARAM, "org.apache.ctakes.typesystem.type.syntax.BaseToken");
+
+		AnalysisEngine segmentTokenSentenceAE = TestUtil.getAE(new File("test/desc/SegmentTokenSentenceAggregate.xml"));
+
+		String text;
+		JCas jCas;
+
+		text = "Electrocardiogram taken earlier today was read by Dr. Xxxxx X. Xxxxxx, cardiologist at Mayo, as \"marked sinus bradycardia, left atrial enlargement, possible inferior infarct, T-wave abnormality, consider lateral ischemia.";
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		IdentifiedAnnotation ne1 = addNE(jCas, 104, 121, "sinus bradycardia");
+		IdentifiedAnnotation ne2 = addNE(jCas, 104, 109, "sinus");
+		IdentifiedAnnotation ne3 = addNE(jCas, 110, 121, "bradycardia");
+		IdentifiedAnnotation ne4 = addNE(jCas, 123, 146, "left atrial enlargement");
+		IdentifiedAnnotation ne5 = addNE(jCas, 135, 146, "enlargement");
+		IdentifiedAnnotation ne6 = addNE(jCas, 166, 173, "infarct");
+		IdentifiedAnnotation ne7 = addNE(jCas, 175, 176, "T");
+		IdentifiedAnnotation ne8 = addNE(jCas, 182, 193, "abnormality");
+		IdentifiedAnnotation ne9 = addNE(jCas, 212, 220, "ischemia");
+		statusAnnotator.process(jCas);
+		assertEquals(3, ne1.getUncertainty()); // 3 means probable, possible, etc
+		assertEquals(3, ne2.getUncertainty());
+		assertEquals(3, ne3.getUncertainty());
+		assertEquals(3, ne4.getUncertainty());
+		assertEquals(3, ne5.getUncertainty());
+		assertEquals(3, ne6.getUncertainty());
+		assertEquals(3, ne7.getUncertainty());
+		assertEquals(3, ne8.getUncertainty());
+		assertEquals(0, ne9.getUncertainty()); // 0 since window size prevents "possible" from being applied to "ischemia"
+
+		text = "It is my impression that Mr. Xxxxxx presents with acute-on-chronic hypercapnic respiratory failure which likely precipitated his underlying lung disease which is multifactorial."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 67, 98, "hypercapnic respiratory failure");
+		ne2 = addNE(jCas, 79, 98 , "respiratory failure");
+		ne3 = addNE(jCas, 140, 152, "lung disease");
+		ne4 = addNE(jCas, 145, 152, "disease");
+		statusAnnotator.process(jCas);
+		assertEquals(0, ne1.getUncertainty());
+		assertEquals(0, ne2.getUncertainty());
+		assertEquals(3, ne3.getUncertainty());
+		assertEquals(3, ne4.getUncertainty());
+
+		text = "#4 Obesity and hyperventilation with probable sleep-disordered breathing"; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 3, 10, "Obesity");
+		ne2 = addNE(jCas, 15, 31 , "hyperventilation");
+		statusAnnotator.process(jCas);
+		assertEquals(3, ne1.getUncertainty());
+		assertEquals(3, ne2.getUncertainty());
+
+		text = "He has suffered from excessive daytime sleepiness since adolescence, and he was first diagnosed with narcolepsy in 2000, based on history and pupillography."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 101, 111, "narcolepsy");
+		statusAnnotator.process(jCas);
+		assertEquals(1, ne1.getUncertainty()); // 1 means History of
+
+		text = "She has a known history of atrial fibrillation."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 27, 46, "atrial fibrillation");
+		ne2 = addNE(jCas, 34, 46, "fibrillation");
+		statusAnnotator.process(jCas);
+		assertEquals(1, ne1.getUncertainty());
+		assertEquals(1, ne2.getUncertainty());
+
+		text = "No history of stroke."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 14, 20, "stroke");
+		statusAnnotator.process(jCas);
+		assertEquals(1, ne1.getUncertainty());
+
+		text = "History of hypertension."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 11, 23, "hypertension");
+		statusAnnotator.process(jCas);
+		assertEquals(1, ne1.getUncertainty());
+
+		text = "(5) History of atrial fibrillation."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 15, 34, "atrial fibrillation");
+		ne2 = addNE(jCas, 22, 34, "fibrillation");
+		statusAnnotator.process(jCas);
+		assertEquals(1, ne1.getUncertainty());
+		assertEquals(1, ne2.getUncertainty());
+
+		text = "Family history is largely unremarkable save a strong family history of cancer of uncertain primary."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 71, 77, "cancer");
+		statusAnnotator.process(jCas);
+		assertEquals(2, ne1.getUncertainty()); // 2 means Family history of
+
+		text = "He has no history of cardiac-related problems and no family history of coronary artery disease."; 
+		jCas = TestUtil.processAE(segmentTokenSentenceAE, text);
+		ne1 = addNE(jCas, 37, 45, "problems");
+		ne2 = addNE(jCas, 71, 94 , "coronary artery disease");
+		ne3 = addNE(jCas, 87, 94, "disease");
+		statusAnnotator.process(jCas);
+		assertEquals(2, ne1.getUncertainty());
+		assertEquals(2, ne2.getUncertainty());
+		assertEquals(2, ne3.getUncertainty());
+
+	}
+
+	private IdentifiedAnnotation addNE(JCas jCas, int neBegin, int neEnd, String neText) throws ResourceInitializationException, AnalysisEngineProcessException {
+		IdentifiedAnnotation IdentifiedAnnotation = new IdentifiedAnnotation(jCas, neBegin, neEnd);
+		IdentifiedAnnotation.addToIndexes();
+		assertEquals(neText, IdentifiedAnnotation.getCoveredText());
+		return IdentifiedAnnotation;
+	}
+}

Modified: incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA CAS Visual Debugger (Drug NER).launch
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA%20CAS%20Visual%20Debugger%20%28Drug%20NER%29.launch?rev=1396711&r1=1396710&r2=1396711&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA CAS Visual Debugger (Drug NER).launch (original)
+++ incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA CAS Visual Debugger (Drug NER).launch Wed Oct 10 17:59:40 2012
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
 <listEntry value="/ctakes-drug-ner"/>
@@ -16,9 +16,11 @@
 <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/CNI/build/classes&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
 <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;DrugNER&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
 </listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
 <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.uima.annot_view.Gladis"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-drug-ner"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="&quot;-Djava.util.logging.config.file=${env_var:UIMA_HOME}/Logger.properties&quot;  -Xms700M -Xmx700M"/>
 <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:Abbreviation Annotator}"/>
 </launchConfiguration>

Modified: incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA CAS Visual Debugger (PAD Term Spotter).launch
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA%20CAS%20Visual%20Debugger%20%28PAD%20Term%20Spotter%29.launch?rev=1396711&r1=1396710&r2=1396711&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA CAS Visual Debugger (PAD Term Spotter).launch (original)
+++ incubator/ctakes/trunk/ctakes-pad-term-spotter/launch/UIMA CAS Visual Debugger (PAD Term Spotter).launch Wed Oct 10 17:59:40 2012
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
 <listEntry value="/ctakes-pad-term-spotter"/>
@@ -9,8 +9,10 @@
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 <stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_default"/>
 <stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_default"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.uima.annot_view.Gladis"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ctakes-pad-term-spotter"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="&quot;-Djava.util.logging.config.file=${env_var:UIMA_HOME}/Logger.properties&quot;  -Xms700M -Xmx700M"/>
 <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:core}"/>
 </launchConfiguration>



Mime
View raw message