You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2012/12/11 23:09:47 UTC

svn commit: r1420458 [1/3] - in /uima/sandbox/trunk/uimaFIT/uimafit-examples: ./ .settings/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/uimafit/ src/main/java/org/uimafit/examples/ src/main/java/org/uimafit/examples/experiment/ s...

Author: schor
Date: Tue Dec 11 22:09:37 2012
New Revision: 1420458

URL: http://svn.apache.org/viewvc?rev=1420458&view=rev
Log:
[UIMA-2470] initial import

Added:
    uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.eclipse.jdt.core.prefs
    uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.maven.ide.eclipse.prefs
    uima/sandbox/trunk/uimaFIT/uimafit-examples/pom.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/BaselineTagger.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/Evaluator.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/GoldTagger.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/LineReader.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/RunExperiment.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/SentenceAndTokenCopier.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/ViewNames.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/package-info.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickAE.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickDescriptor.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickPipeline.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/package-info.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/ExternalResourceExample.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/package-info.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorDescriptor.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorPipeline.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/package-info.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotator.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotatorPipeline.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/package-info.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource_impl.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/UimaAcronymAnnotator.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/UimaMeetingAnnotator.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/package-info.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/DateAnnotation.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/DateAnnotation_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/DateTimeAnnotation.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/DateTimeAnnotation_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/Meeting.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/Meeting_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/RoomNumber.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/RoomNumber_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/TimeAnnotation.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/TimeAnnotation_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/UimaAcronym.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/UimaAcronym_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/UimaMeeting.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/type/UimaMeeting_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/type/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/type/Sentence.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/type/Sentence_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/type/Token.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/type/Token_Type.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/META-INF/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/META-INF/org.uimafit/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/META-INF/org.uimafit/types.txt   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/TypeSystem.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/pos/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/pos/sample.txt.pos
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/ex1/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/ex6/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/ex6/UimaAcronymAnnotator.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/ex6/UimaMeetingAnnotator.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/ex6/UimaMeetingDetectorTAE.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/ex6/uimaAcronyms.txt   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/DateAnnotaton.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/DateTimeAnnotation.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/Meeting.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/RoomNumber.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/TimeAnnotation.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/UimaAcronym.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/tutorial/type/UimaMeeting.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/type/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/type/Sentence.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/type/Token.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/xmi/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/examples/xmi/1.xmi
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/tutorial/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/tutorial/ex1/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/resources/org/uimafit/tutorial/ex1/RoomNumberAnnotator.xml   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/LicenseTest.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/tutorial/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/tutorial/ExamplesTestBase.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/tutorial/ex1/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator1Test.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator2Test.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/xmi/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/java/org/uimafit/examples/xmi/XmiTest.java   (with props)
    uima/sandbox/trunk/uimaFIT/uimafit-examples/src/test/resources/
    uima/sandbox/trunk/uimaFIT/uimafit-examples/target/
Modified:
    uima/sandbox/trunk/uimaFIT/uimafit-examples/   (props changed)

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Dec 11 22:09:37 2012
@@ -0,0 +1,2 @@
+.classpath
+.project

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.eclipse.jdt.core.prefs?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.eclipse.jdt.core.prefs (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.eclipse.jdt.core.prefs Tue Dec 11 22:09:37 2012
@@ -0,0 +1,6 @@
+#Tue Dec 11 16:46:19 EST 2012
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.maven.ide.eclipse.prefs
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.maven.ide.eclipse.prefs?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.maven.ide.eclipse.prefs (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/.settings/org.maven.ide.eclipse.prefs Tue Dec 11 22:09:37 2012
@@ -0,0 +1,8 @@
+#Tue Dec 11 16:46:01 EST 2012
+version=1
+resolveWorkspaceProjects=true
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/pom.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/pom.xml?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/pom.xml (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/pom.xml Tue Dec 11 22:09:37 2012
@@ -0,0 +1,48 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<artifactId>uimafit-parent</artifactId>
+		<groupId>org.uimafit</groupId>
+		<version>1.5.0-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>uimafit-examples</artifactId>
+	<name>uimaFIT Examples</name>
+	<description>Factories, Injection, and Testing library for UIMA</description>
+	<url>http://uimafit.googlecode.com</url>
+	<dependencies>
+		<dependency>
+			<groupId>org.uimafit</groupId>
+			<artifactId>uimafit</artifactId>
+			<version>1.5.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.uima</groupId>
+			<artifactId>uimaj-tools</artifactId>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+	<licenses>
+		<license>
+			<name>The Apache Software License, Version 2.0</name>
+			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+			<distribution>repo</distribution>
+		</license>
+	</licenses>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<excludes>
+						<exclude>org/uimafit/tutorial/AbstractTest.java</exclude>
+					</excludes>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/BaselineTagger.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/BaselineTagger.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/BaselineTagger.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/BaselineTagger.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,50 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.experiment.pos;
+
+import static org.uimafit.util.JCasUtil.select;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.examples.type.Token;
+
+/**
+ * This "baseline" part-of-speech tagger isn't very sophisticated! Notice,
+ * however, that the tagger operates on the default view. This will be mapped to
+ * the "system" view when we run our experiment.
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class BaselineTagger extends JCasAnnotator_ImplBase {
+
+	@Override
+	public void process(JCas jCas) throws AnalysisEngineProcessException {
+		for (Token token : select(jCas, Token.class)) {
+			String word = token.getCoveredText();
+			if (word.equals("a") || word.equals("the")) {
+				token.setPos("DT");
+			}
+			else {
+				token.setPos("NN");
+			}
+		}
+	}
+
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/BaselineTagger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/Evaluator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/Evaluator.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/Evaluator.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/Evaluator.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,94 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.experiment.pos;
+
+import static org.uimafit.examples.experiment.pos.ViewNames.GOLD_VIEW;
+import static org.uimafit.examples.experiment.pos.ViewNames.SYSTEM_VIEW;
+import static org.uimafit.util.JCasUtil.select;
+import static org.uimafit.util.JCasUtil.selectCovered;
+
+import java.text.NumberFormat;
+import java.util.List;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.descriptor.SofaCapability;
+import org.uimafit.examples.type.Sentence;
+import org.uimafit.examples.type.Token;
+
+/**
+ * This AE evaluates the system part-of-speech tags against the gold
+ * part-of-speech tags. This is a very simple approach to evaluation of
+ * part-of-speech tags that will not likely suffice in real-world scenarios for
+ * a number of reasons (e.g. no confusion matrix, assumes gold-standard tokens
+ * and sentences in the system view, etc.)
+ * 
+ * @author Philip Ogren
+ * 
+ */
+@SofaCapability(inputSofas = { GOLD_VIEW, SYSTEM_VIEW })
+public class Evaluator extends JCasAnnotator_ImplBase {
+
+	private int totalCorrect = 0;
+
+	private int totalWrong = 0;
+
+	@Override
+	public void process(JCas jCas) throws AnalysisEngineProcessException {
+		try {
+			JCas goldView = jCas.getView(GOLD_VIEW);
+			JCas systemView = jCas.getView(SYSTEM_VIEW);
+
+			for (Sentence goldSentence : select(goldView, Sentence.class)) {
+				List<Token> goldTokens = selectCovered(goldView, Token.class, goldSentence);
+				List<Token> systemTokens = selectCovered(systemView, Token.class, goldSentence);
+				if (goldTokens.size() == systemTokens.size()) {
+					for (int i = 0; i < goldTokens.size(); i++) {
+						String goldPos = goldTokens.get(i).getPos();
+						String systemPos = systemTokens.get(i).getPos();
+						if (goldPos.equals(systemPos)) {
+							totalCorrect++;
+						}
+						else {
+							totalWrong++;
+						}
+					}
+				}
+				else {
+					throw new RuntimeException("number of tokens in gold view differs from number of tokens in system view");
+				}
+			}
+		}
+		catch (CASException ce) {
+			throw new AnalysisEngineProcessException(ce);
+		}
+
+	}
+
+	@Override
+	public void collectionProcessComplete() throws AnalysisEngineProcessException {
+		int total = totalCorrect + totalWrong;
+		System.out.println("total tokens: " + total);
+		System.out.println("correct: " + totalCorrect);
+		System.out.println("wrong: " + totalWrong);
+		float accuracy = (float) totalCorrect / total;
+		System.out.println("accuracy: " + NumberFormat.getPercentInstance().format(accuracy));
+	}
+
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/Evaluator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/GoldTagger.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/GoldTagger.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/GoldTagger.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/GoldTagger.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,92 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.experiment.pos;
+
+import static org.uimafit.examples.experiment.pos.ViewNames.GOLD_VIEW;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.component.ViewCreatorAnnotator;
+import org.uimafit.descriptor.SofaCapability;
+import org.uimafit.examples.type.Sentence;
+import org.uimafit.examples.type.Token;
+
+/**
+ * This AE assumes that their is part-of-speech tagged text in the default view
+ * with the format "word/tag word/tag...". It converts this data into Token
+ * objects and plain text which are posted to the GOLD_VIEW.
+ * 
+ * @author Philip
+ * 
+ */
+@SofaCapability(inputSofas = CAS.NAME_DEFAULT_SOFA, outputSofas = GOLD_VIEW)
+public class GoldTagger extends JCasAnnotator_ImplBase {
+
+	@Override
+	public void process(JCas jCas) throws AnalysisEngineProcessException {
+		try {
+			JCas defaultView = jCas.getView(CAS.NAME_DEFAULT_SOFA); // see
+																	// javadoc
+																	// comment
+																	// for
+																	// SofaCapability
+																	// for why
+																	// we have
+																	// to
+																	// retrieve
+																	// the
+																	// default
+																	// view from
+																	// the JCas
+			String tagData = defaultView.getDocumentText();
+
+			JCas goldView = ViewCreatorAnnotator.createViewSafely(jCas, GOLD_VIEW);
+
+			String[] wordTagPairs = tagData.split("\\s+");
+			StringBuffer text = new StringBuffer();
+			int offset = 0;
+			List<Token> tokens = new ArrayList<Token>();
+			for (String wordTagPair : wordTagPairs) {
+				String word = wordTagPair.split("/")[0];
+				String tag = wordTagPair.split("/")[1];
+				text.append(word);
+				Token token = new Token(goldView, offset, text.length());
+				token.setPos(tag);
+				tokens.add(token);
+				text.append(" ");
+				offset += word.length() + 1;
+			}
+
+			goldView.setDocumentText(text.toString().trim());
+			new Sentence(goldView, 0, goldView.getDocumentText().length()).addToIndexes();
+
+			for (Token token : tokens) {
+				token.addToIndexes();
+			}
+		}
+		catch (CASException ce) {
+			throw new AnalysisEngineProcessException(ce);
+		}
+	}
+
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/GoldTagger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/LineReader.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/LineReader.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/LineReader.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/LineReader.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,79 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.experiment.pos;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.uima.UimaContext;
+import org.apache.uima.collection.CollectionException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.pear.util.FileUtil;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.Progress;
+import org.apache.uima.util.ProgressImpl;
+import org.uimafit.component.JCasCollectionReader_ImplBase;
+import org.uimafit.descriptor.ConfigurationParameter;
+import org.uimafit.factory.ConfigurationParameterFactory;
+
+/**
+ * This collection reader is meant for example purposes only. For a much more
+ * robust and complete line reader implementation, please see
+ * org.cleartk.util.linereader.LineReader.
+ * 
+ * This collection reader takes a single file and produces one JCas for each
+ * line in the file putting the text of the line into the default view.
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class LineReader extends JCasCollectionReader_ImplBase {
+
+	public static final String PARAM_INPUT_FILE = ConfigurationParameterFactory.createConfigurationParameterName(LineReader.class, "inputFile");
+
+	@ConfigurationParameter
+	private File inputFile;
+
+	private String[] lines;
+
+	private int lineIndex = 0;
+
+	@Override
+	public void initialize(UimaContext uimaContext) throws ResourceInitializationException {
+		try {
+			lines = FileUtil.loadListOfStrings(inputFile);
+		}
+		catch (IOException e) {
+			throw new ResourceInitializationException(e);
+		}
+	}
+
+	public boolean hasNext() throws IOException, CollectionException {
+		return lineIndex < lines.length;
+	}
+
+	public void getNext(JCas jCas) throws IOException, CollectionException {
+		jCas.setDocumentText(lines[lineIndex]);
+		lineIndex++;
+	}
+
+	public Progress[] getProgress() {
+		Progress progress = new ProgressImpl(lineIndex, lines.length, Progress.ENTITIES);
+		return new Progress[] { progress };
+	}
+
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/LineReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/RunExperiment.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/RunExperiment.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/RunExperiment.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/RunExperiment.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,118 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.experiment.pos;
+
+import java.io.IOException;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.collection.CollectionReader;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.uimafit.component.ViewTextCopierAnnotator;
+import org.uimafit.component.xwriter.XWriter;
+import org.uimafit.factory.AggregateBuilder;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.uimafit.factory.CollectionReaderFactory;
+import org.uimafit.factory.TypeSystemDescriptionFactory;
+import org.uimafit.pipeline.SimplePipeline;
+
+/**
+ * This class demonstrates a very common (though simplified) experimental setup in which gold
+ * standard data is available for some task and you want to evaluate how well your analysis engine
+ * works against that data. Here we are evaluating "BaselineTagger" which is a (ridiculously) simple
+ * part-of-speech tagger against the part-of-speech tags found in
+ * "src/main/resources/org/uimafit/examples/pos/sample.txt.pos".
+ * <p>
+ * The basic strategy is as follows:
+ * <ul>
+ * <li>post the data "as is" into the default view</li>
+ * <li>parse the gold-standard tokens and part-of-speech tags and put the results into another view
+ * we will call GOLD_VIEW</li>
+ * <li>create another view called SYSTEM_VIEW and copy the text and Token annotations from the
+ * GOLD_VIEW into this view</li>
+ * <li>Run the BaselineTagger on the SYSTEM_VIEW over the copied Token annoations</lI>
+ * <li>Evaluate the part-of-speech tags found in the SYSTEM_VIEW with those in the GOLD_VIEW</li>
+ * </ul>
+ * 
+ * Please see comments in the code for details on how the UIMA pipeline is set up and run for this
+ * task.
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class RunExperiment {
+
+	public static void main(String[] args) throws UIMAException, IOException {
+		String samplePosFileName = "src/main/resources/org/uimafit/examples/pos/sample.txt.pos";
+
+		TypeSystemDescription typeSystem = TypeSystemDescriptionFactory
+				.createTypeSystemDescription();
+
+		// The lineReader simply copies the lines from the input file into the
+		// default view - one line per CAS
+		CollectionReader lineReader = CollectionReaderFactory.createCollectionReader(
+				LineReader.class, typeSystem, LineReader.PARAM_INPUT_FILE, samplePosFileName);
+
+		AggregateBuilder builder = new AggregateBuilder();
+
+		// The goldTagger parses the data in the default view into Token objects
+		// along with their part-of-speech tags which will be added to the
+		// GOLD_VIEW
+		AnalysisEngineDescription goldTagger = AnalysisEngineFactory.createPrimitiveDescription(
+				GoldTagger.class, typeSystem);
+		builder.add(goldTagger);
+
+		// The textCopier creates the SYSTEM_VIEW and set the text of this view
+		// to that of the text found in GOLD_VIEW
+		AnalysisEngineDescription textCopier = AnalysisEngineFactory.createPrimitiveDescription(
+				ViewTextCopierAnnotator.class, typeSystem,
+				ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, ViewNames.GOLD_VIEW,
+				ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, ViewNames.SYSTEM_VIEW);
+		builder.add(textCopier);
+
+		// The sentenceAndTokenCopier copies Token and Sentence annotations in
+		// the GOLD_VIEW into the SYSTEM_VIEW
+		AnalysisEngineDescription sentenceAndTokenCopier = AnalysisEngineFactory
+				.createPrimitiveDescription(SentenceAndTokenCopier.class, typeSystem);
+		builder.add(sentenceAndTokenCopier, ViewNames.VIEW1, ViewNames.GOLD_VIEW, ViewNames.VIEW2,
+				ViewNames.SYSTEM_VIEW);
+
+		// The baselineTagger is run on the SYSTEM_VIEW
+		AnalysisEngineDescription baselineTagger = AnalysisEngineFactory
+				.createPrimitiveDescription(BaselineTagger.class, typeSystem);
+		builder.add(baselineTagger, CAS.NAME_DEFAULT_SOFA, ViewNames.SYSTEM_VIEW);
+
+		// The evaluator will compare the part-of-speech tags in the SYSTEM_VIEW
+		// with those in the GOLD_VIEW
+		AnalysisEngineDescription evaluator = AnalysisEngineFactory.createPrimitiveDescription(
+				Evaluator.class, typeSystem);
+		builder.add(evaluator);
+
+		// The xWriter writes out the contents of each CAS (one per sentence) to
+		// an XMI file. It is instructive to open one of these
+		// xmi files in the CAS Visual Debugger and look at the contents of each
+		// view.
+		AnalysisEngineDescription xWriter = AnalysisEngineFactory.createPrimitiveDescription(
+				XWriter.class, typeSystem, XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
+				"src/main/resources/org/uimafit/examples/pos/xmi");
+		builder.add(xWriter);
+
+		// runs the collection reader and the aggregate AE.
+		SimplePipeline.runPipeline(lineReader, builder.createAggregate());
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/RunExperiment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/SentenceAndTokenCopier.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/SentenceAndTokenCopier.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/SentenceAndTokenCopier.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/SentenceAndTokenCopier.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,59 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.experiment.pos;
+
+import static org.uimafit.examples.experiment.pos.ViewNames.VIEW1;
+import static org.uimafit.examples.experiment.pos.ViewNames.VIEW2;
+import static org.uimafit.util.JCasUtil.select;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.descriptor.SofaCapability;
+import org.uimafit.examples.type.Sentence;
+import org.uimafit.examples.type.Token;
+
+/**
+ * This simple AE copies tokens and sentences from one view to another.
+ * 
+ * @author Philip
+ * 
+ */
+
+@SofaCapability(inputSofas = { VIEW1, VIEW2 })
+public class SentenceAndTokenCopier extends JCasAnnotator_ImplBase {
+
+	@Override
+	public void process(JCas jCas) throws AnalysisEngineProcessException {
+		try {
+			JCas view1 = jCas.getView(VIEW1);
+			JCas view2 = jCas.getView(VIEW2);
+
+			for (Token token1 : select(view1, Token.class)) {
+				new Token(view2, token1.getBegin(), token1.getEnd()).addToIndexes();
+			}
+
+			for (Sentence sentence1 : select(view1, Sentence.class)) {
+				new Sentence(view2, sentence1.getBegin(), sentence1.getEnd()).addToIndexes();
+			}
+		}
+		catch (CASException ce) {
+			throw new AnalysisEngineProcessException(ce);
+		}
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/SentenceAndTokenCopier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/ViewNames.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/ViewNames.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/ViewNames.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/ViewNames.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,33 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.experiment.pos;
+
+/**
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class ViewNames {
+
+	public static final String GOLD_VIEW = "GOLD_VIEW";
+
+	public static final String SYSTEM_VIEW = "SYSTEM_VIEW";
+
+	public static final String VIEW1 = "VIEW1";
+
+	public static final String VIEW2 = "VIEW2";
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/ViewNames.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/package-info.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/package-info.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/package-info.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/package-info.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright 2010
+ * Ubiquitous Knowledge Processing (UKP) Lab
+ * Technische Universität Darmstadt
+ *
+ * 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
+ *
+ *   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.
+ ******************************************************************************/
+
+/**
+ * Example for an UIMA-based experiment running an analysis and evaluating the results.
+ */
+package org.uimafit.examples.experiment.pos;

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/experiment/pos/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickAE.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickAE.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickAE.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickAE.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,37 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.getstarted;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.descriptor.ConfigurationParameter;
+
+/**
+ * @author Philip Ogren
+ */
+public class GetStartedQuickAE extends JCasAnnotator_ImplBase {
+
+	public static final String PARAM_STRING = "stringParam";
+	@ConfigurationParameter(name = PARAM_STRING)
+	private String stringParam;
+
+	@Override
+	public void process(JCas jCas) throws AnalysisEngineProcessException {
+		System.out.println("Hello world!  Say 'hi' to " + stringParam);
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickAE.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickDescriptor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickDescriptor.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickDescriptor.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickDescriptor.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,48 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.getstarted;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.xml.sax.SAXException;
+
+/**
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class GetStartedQuickDescriptor {
+
+	public static void main(String[] args) throws ResourceInitializationException,
+			FileNotFoundException, SAXException, IOException {
+		// uimaFIT automatically uses all type systems listed in META-INF/org.uimafit/types.txt
+		
+		// Instantiate the analysis engine using the value "uimaFIT" for the parameter
+		// PARAM_STRING ("stringParam").
+		AnalysisEngineDescription analysisEngineDescription = AnalysisEngineFactory
+				.createPrimitiveDescription(GetStartedQuickAE.class,
+						GetStartedQuickAE.PARAM_STRING, "uimaFIT");
+		
+		// Write the descriptor to an XML file
+		analysisEngineDescription.toXML(new FileOutputStream("GetStartedQuickAE.xml"));
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickPipeline.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickPipeline.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickPipeline.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickPipeline.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,48 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.getstarted;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.uimafit.factory.JCasFactory;
+
+/**
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class GetStartedQuickPipeline {
+
+	public static void main(String[] args) throws UIMAException {
+		// uimaFIT automatically uses all type systems listed in META-INF/org.uimafit/types.txt
+
+		// uimaFIT doesn't provide any collection readers - so we will just instantiate a JCas and
+		// run it through our AE
+		JCas jCas = JCasFactory.createJCas();
+		
+		// Instantiate the analysis engine using the value "uimaFIT" for the parameter
+		// PARAM_STRING ("stringParam").
+		AnalysisEngine analysisEngine = AnalysisEngineFactory.createPrimitive(
+				GetStartedQuickAE.class, 
+				GetStartedQuickAE.PARAM_STRING, "uimaFIT");
+		
+		// run the analysis engine and look for a special greeting in your console.
+		analysisEngine.process(jCas);
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/GetStartedQuickPipeline.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/package-info.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/package-info.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/package-info.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/package-info.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright 2010
+ * Ubiquitous Knowledge Processing (UKP) Lab
+ * Technische Universität Darmstadt
+ *
+ * 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
+ *
+ *   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.
+ ******************************************************************************/
+
+/**
+ * Example for a simple analysis engine and pipeline.
+ */
+package org.uimafit.examples.getstarted;

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/getstarted/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/ExternalResourceExample.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/ExternalResourceExample.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/ExternalResourceExample.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/ExternalResourceExample.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,170 @@
+/*
+ Copyright 2011
+ Ubiquitous Knowledge Processing (UKP) Lab
+ Technische Universitaet Darmstadt
+ All rights reserved.
+
+ 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
+
+ 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.uimafit.examples.resource;
+
+import static org.junit.Assert.assertTrue;
+import static org.uimafit.factory.AnalysisEngineFactory.createAggregate;
+import static org.uimafit.factory.AnalysisEngineFactory.createAggregateDescription;
+import static org.uimafit.factory.AnalysisEngineFactory.createPrimitiveDescription;
+import static org.uimafit.factory.ExternalResourceFactory.bindResource;
+import static org.uimafit.factory.ExternalResourceFactory.createExternalResourceDescription;
+
+import java.io.File;
+
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.DataResource;
+import org.apache.uima.resource.ExternalResourceDescription;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.SharedResourceObject;
+import org.junit.Test;
+import org.uimafit.component.Resource_ImplBase;
+import org.uimafit.descriptor.ExternalResource;
+
+/**
+ * Example for the use of external resources with uimaFIT.
+ *
+ * @author Richard Eckart de Castilho
+ */
+public class ExternalResourceExample {
+	/**
+	 * Simple model that only stores the URI it was loaded from. Normally data would be loaded from
+	 * the URI instead and made accessible through methods in this class. This simple example only
+	 * allows to access the URI.
+	 */
+	public static final class SharedModel implements SharedResourceObject {
+		private String uri;
+
+		public void load(DataResource aData) throws ResourceInitializationException {
+			uri = aData.getUri().toString();
+		}
+
+		public String getUri() {
+			return uri;
+		}
+	}
+	
+	/**
+	 * Example annotator that uses the share model object. In the process() we only test if the
+	 * model was properly initialized by uimaFIT
+	 */
+	public static class Annotator extends org.uimafit.component.JCasAnnotator_ImplBase {
+		final static String MODEL_KEY = "Model";
+		@ExternalResource(key = MODEL_KEY)
+		private SharedModel model;
+
+		@Override
+		public void process(JCas aJCas) throws AnalysisEngineProcessException {
+			assertTrue(model.getUri().endsWith("somemodel.bin"));
+			// Prints the instance ID to the console - this proves the same instance
+			// of the SharedModel is used in both Annotator instances.
+			System.out.println(getClass().getSimpleName() + ": " + model);
+		}
+	}
+
+	/**
+	 * JUnit test that illustrates how to configure the annotator with the shared model object
+	 */
+	@Test
+	public void configureAnnotatorsIndividuallyExample() throws Exception {
+		ExternalResourceDescription extDesc = createExternalResourceDescription(
+				SharedModel.class, new File("somemodel.bin"));
+		
+		// Binding external resource to each Annotator individually
+		AnalysisEngineDescription aed1 = createPrimitiveDescription(Annotator.class,
+				Annotator.MODEL_KEY, extDesc);
+		AnalysisEngineDescription aed2 = createPrimitiveDescription(Annotator.class,
+				Annotator.MODEL_KEY, extDesc);
+
+		// Check the external resource was injected
+		AnalysisEngineDescription aaed = createAggregateDescription(aed1, aed2);
+		AnalysisEngine ae = createAggregate(aaed);
+		ae.process(ae.newJCas());
+	}
+	
+	/**
+	 * JUnit test that illustrates how to configure the Annotator with the SharedModel.
+	 * You should avoid this approach unless you are absolutely sure you need this. For this
+	 * approach to work it must be guaranteed that no two components in the aggregate use the
+	 * same resource key for different resoures, e.g. one "model" for different kinds of models.
+	 */
+	@Test
+	public void configureAggregatedExample() throws Exception {
+		AnalysisEngineDescription aed1 = createPrimitiveDescription(Annotator.class);
+		AnalysisEngineDescription aed2 = createPrimitiveDescription(Annotator.class);
+
+		// Bind external resource to the aggregate
+		AnalysisEngineDescription aaed = createAggregateDescription(aed1, aed2);
+		bindResource(aaed, Annotator.MODEL_KEY, SharedModel.class, new File("somemodel.bin")
+				.toURI().toURL().toString());
+
+		// Check the external resource was injected
+		AnalysisEngine ae = createAggregate(aaed);
+		ae.process(ae.newJCas());
+	}
+	
+	/**
+	 * Simple example resource that can use another resource.
+	 */
+	public static class ChainableResource extends Resource_ImplBase {
+		public final static String PARAM_CHAINED_RESOURCE = "chainedResource";
+		@ExternalResource(key = PARAM_CHAINED_RESOURCE, mandatory=false)
+		private ChainableResource chainedResource;
+
+		@Override
+		public void afterResourcesInitialized() {
+			// init logic that requires external resources
+			System.out.println(getClass().getSimpleName() + ": " + chainedResource);
+		}
+	}
+
+	/**
+	 * Example annotator that uses the resource. In the process() we only test if the
+	 * model was properly initialized by uimaFIT
+	 */
+	public static class Annotator2 extends org.uimafit.component.JCasAnnotator_ImplBase {
+		final static String MODEL_KEY = "Model";
+		@ExternalResource(key = MODEL_KEY)
+		private ChainableResource model;
+
+		@Override
+		public void process(JCas aJCas) throws AnalysisEngineProcessException {
+			System.out.println(getClass().getSimpleName() + ": " + model);
+		}
+	}
+
+	/**
+	 * JUnit test that illustrates how to configure the annotator with a chainable resource
+	 */
+	@Test
+	public void configureAnnotatorWithChainedResource() throws Exception {
+		AnalysisEngineDescription aed = createPrimitiveDescription(Annotator2.class,
+				Annotator2.MODEL_KEY, createExternalResourceDescription(
+						ChainableResource.class,
+						ChainableResource.PARAM_CHAINED_RESOURCE, createExternalResourceDescription(
+								ChainableResource.class)));
+
+		// Check the external resource was injected
+		AnalysisEngine ae = createAggregate(aed);
+		ae.process(ae.newJCas());
+	}
+}
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/ExternalResourceExample.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/package-info.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/package-info.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/package-info.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/package-info.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright 2010
+ * Ubiquitous Knowledge Processing (UKP) Lab
+ * Technische Universität Darmstadt
+ *
+ * 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
+ *
+ *   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.
+ ******************************************************************************/
+
+/**
+ * Examples for using the {@link org.uimafit.descriptor.ExternalResource} annotation.
+ */
+package org.uimafit.examples.resource;

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/resource/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,78 @@
+/*
+ * 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.uimafit.examples.tutorial.ex1;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.uima.jcas.JCas;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.descriptor.TypeCapability;
+import org.uimafit.examples.tutorial.type.RoomNumber;
+
+/**
+ * Here, the type capabilities are annotated using the @TypeCapability
+ * annotation which are used by the AnalysisEngineFactory to specify this
+ * information in the descriptors returned by, e.g.
+ * AnalysisEngineFactory.createPrimitive().
+ *
+ * This class was copied from the uimaj-examples project and modified in
+ * following ways:
+ * <ul>
+ * <li>The package name was changed to org.uimafit.tutorial.ex1</li>
+ * <li>The super class was changed to
+ * org.uimafit.component.JCasAnnotator_ImplBase</li>
+ * <li>The class is annotated with org.uimafit.descriptor.TypeCapability</li>
+ * </ul>
+ *
+ * @author unknown
+ *
+ */
+@TypeCapability(outputs = { "org.apache.uima.tutorial.RoomNumber", "org.apache.uima.tutorial.RoomNumber:building" })
+public class RoomNumberAnnotator extends JCasAnnotator_ImplBase {
+	private Pattern mYorktownPattern = Pattern.compile("\\b[0-4]\\d-[0-2]\\d\\d\\b");
+
+	private Pattern mHawthornePattern = Pattern.compile("\\b[G1-4][NS]-[A-Z]\\d\\d\\b");
+
+	/**
+	 * @see JCasAnnotator_ImplBase#process(JCas)
+	 */
+	@Override
+	public void process(JCas aJCas) {
+		// get document text
+		String docText = aJCas.getDocumentText();
+		// search for Yorktown room numbers
+		Matcher matcher = mYorktownPattern.matcher(docText);
+		while (matcher.find()) {
+			// found one - create annotation
+			RoomNumber annotation = new RoomNumber(aJCas, matcher.start(), matcher.end());
+			annotation.setBuilding("Yorktown");
+			annotation.addToIndexes();
+		}
+		// search for Hawthorne room numbers
+		matcher = mHawthornePattern.matcher(docText);
+		while (matcher.find()) {
+			// found one - create annotation
+			RoomNumber annotation = new RoomNumber(aJCas, matcher.start(), matcher.end());
+			annotation.setBuilding("Hawthorne");
+			annotation.addToIndexes();
+		}
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorDescriptor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorDescriptor.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorDescriptor.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorDescriptor.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,54 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.tutorial.ex1;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.uimafit.factory.TypeSystemDescriptionFactory;
+
+/**
+ * This class provides a main method which shows how to generate an xml descriptor file using the
+ * RoomNumberAnnotator class definition. The resulting XML descriptor file is the same as the one
+ * provided in the uimaj-examples except that instead of building the file in parallel with the
+ * class definition, it is now built completely by using the class definition.
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class RoomNumberAnnotatorDescriptor {
+
+	public static AnalysisEngineDescription createDescriptor()
+			throws ResourceInitializationException {
+		TypeSystemDescription typeSystemDescription = TypeSystemDescriptionFactory
+				.createTypeSystemDescription();
+		return AnalysisEngineFactory.createPrimitiveDescription(RoomNumberAnnotator.class,
+				typeSystemDescription);
+	}
+
+	public static void main(String[] args) throws Exception {
+		File outputDirectory = new File("target/example-output/ex1/");
+		outputDirectory.mkdirs();
+		AnalysisEngineDescription aed = createDescriptor();
+		aed.toXML(new FileOutputStream(new File(outputDirectory, "RoomNumberAnnotator.xml")));
+	}
+
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorPipeline.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorPipeline.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorPipeline.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorPipeline.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,51 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.tutorial.ex1;
+
+import static org.uimafit.factory.AnalysisEngineFactory.createPrimitive;
+import static org.uimafit.factory.JCasFactory.createJCas;
+import static org.uimafit.factory.TypeSystemDescriptionFactory.createTypeSystemDescription;
+import static org.uimafit.util.JCasUtil.select;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.uimafit.examples.tutorial.type.RoomNumber;
+
+/**
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class RoomNumberAnnotatorPipeline {
+
+	public static void main(String[] args) throws UIMAException {
+		String text = "The meeting was moved from Yorktown 01-144 to Hawthorne 1S-W33.";
+		TypeSystemDescription tsd = createTypeSystemDescription(
+				"org.uimafit.examples.tutorial.type.RoomNumber");
+		JCas jCas = createJCas(tsd);
+		jCas.setDocumentText(text);
+		AnalysisEngine analysisEngine = createPrimitive(RoomNumberAnnotator.class, tsd);
+		analysisEngine.process(jCas);
+
+		for (RoomNumber roomNumber : select(jCas, RoomNumber.class)) {
+			System.out.println(roomNumber.getCoveredText() + "\tbuilding = "
+					+ roomNumber.getBuilding());
+		}
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/RoomNumberAnnotatorPipeline.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/package-info.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/package-info.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/package-info.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/package-info.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright 2010
+ * Ubiquitous Knowledge Processing (UKP) Lab
+ * Technische Universität Darmstadt
+ *
+ * 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
+ *
+ *   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.
+ ******************************************************************************/
+
+/**
+ * Example for using the {@link org.uimafit.descriptor.TypeCapability} annotation.
+ */
+package org.uimafit.examples.tutorial.ex1;

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex1/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotator.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotator.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotator.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,85 @@
+/*
+ * 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.uimafit.examples.tutorial.ex2;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.util.Level;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.descriptor.ConfigurationParameter;
+import org.uimafit.descriptor.TypeCapability;
+import org.uimafit.examples.tutorial.type.RoomNumber;
+
+/**
+ * This class demonstrates annotating member variables with the @ConfigurationParameter
+ * annotation. Defining configuration parameters in this way in combination with
+ * using the {@link JCasAnnotator_ImplBase uimaFIT's JCasAnnotator_ImplBase} class obviates the
+ * need for an initialize method at all because the super class initialize
+ * method calls {@link ConfigurationParameterInitializer#initializeConfigurationParameters}. This
+ * method initializes member variables annotated as configuration parameters
+ * using the configuration parameter information provided in the UimaContext.
+ *
+ * This class was copied from the uimaj-examples project and modified in
+ * following ways:
+ * <ul>
+ * <li>The package name was changed to org.uimafit.tutorial.ex2</li>
+ * <li>The super class was changed to
+ * org.uimafit.component.JCasAnnotator_ImplBase</li>
+ * <li>The class is annotated with org.uimafit.descriptor.TypeCapability</li>
+ * <li>mPatterns and mLocations is annotated with @ConfigurationParameters</li>
+ * <li>the initialize method was removed</li>
+ * </ul>
+ *
+ * @author unknown
+ */
+
+@TypeCapability(outputs = { "org.apache.uima.tutorial.RoomNumber", "org.apache.uima.tutorial.RoomNumber:building" })
+public class RoomNumberAnnotator extends JCasAnnotator_ImplBase {
+
+	@ConfigurationParameter(name = "Patterns")
+	private Pattern[] mPatterns;
+
+	@ConfigurationParameter(name = "Locations")
+	private String[] mLocations;
+
+	/**
+	 * @see JCasAnnotator_ImplBase#process(JCas)
+	 */
+	@Override
+	public void process(JCas aJCas) throws AnalysisEngineProcessException {
+		// get document text
+		String docText = aJCas.getDocumentText();
+
+		// loop over patterns
+		for (int i = 0; i < mPatterns.length; i++) {
+			Matcher matcher = mPatterns[i].matcher(docText);
+			while (matcher.find()) {
+				// found one - create annotation
+				RoomNumber annotation = new RoomNumber(aJCas, matcher.start(), matcher.end());
+				annotation.setBuilding(mLocations[i]);
+				annotation.addToIndexes();
+				getContext().getLogger().log(Level.FINEST, "Found: " + annotation);
+			}
+		}
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotatorPipeline.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotatorPipeline.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotatorPipeline.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotatorPipeline.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,50 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ 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 
+
+ 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.uimafit.examples.tutorial.ex2;
+
+import static org.uimafit.factory.AnalysisEngineFactory.createPrimitive;
+import static org.uimafit.util.JCasUtil.select;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.examples.tutorial.type.RoomNumber;
+
+/**
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class RoomNumberAnnotatorPipeline {
+
+	public static void main(String[] args) throws UIMAException {
+		AnalysisEngine analysisEngine = createPrimitive(RoomNumberAnnotator.class, "Patterns",
+				new String[] { "\\b[0-4]\\d-[0-2]\\d\\d\\b", "\\b[G1-4][NS]-[A-Z]\\d\\d\\b" },
+				"Locations", new String[] { "Downtown", "Uptown" });
+
+		JCas jCas = analysisEngine.newJCas();
+		String text = "The meeting was moved from Yorktown 01-144 to Hawthorne 1S-W33.";
+		jCas.setDocumentText(text);
+
+		analysisEngine.process(jCas);
+
+		for (RoomNumber roomNumber : select(jCas, RoomNumber.class)) {
+			System.out.println(roomNumber.getCoveredText() + "\tbuilding = "
+					+ roomNumber.getBuilding());
+		}
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/RoomNumberAnnotatorPipeline.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/package-info.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/package-info.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/package-info.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/package-info.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright 2010
+ * Ubiquitous Knowledge Processing (UKP) Lab
+ * Technische Universität Darmstadt
+ *
+ * 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
+ *
+ *   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.
+ ******************************************************************************/
+
+/**
+ * Example for using the {@link org.uimafit.descriptor.ConfigurationParameter} annotation.
+ */
+package org.uimafit.examples.tutorial.ex2;

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex2/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,30 @@
+/*
+ * 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.uimafit.examples.tutorial.ex6;
+
+/**
+ * 
+ * @author unknown
+ * 
+ */
+
+public interface StringMapResource {
+	String get(String aKey);
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource_impl.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource_impl.java?rev=1420458&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource_impl.java (added)
+++ uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource_impl.java Tue Dec 11 22:09:37 2012
@@ -0,0 +1,75 @@
+/*
+ * 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.uimafit.examples.tutorial.ex6;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.uima.resource.DataResource;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.SharedResourceObject;
+
+/**
+ * 
+ * @author unknown
+ * 
+ */
+public class StringMapResource_impl implements StringMapResource, SharedResourceObject {
+	private Map<String, String> mMap = new HashMap<String, String>();
+
+	/**
+	 * @see org.apache.uima.resource.SharedResourceObject#load(DataResource)
+	 */
+	public void load(DataResource aData) throws ResourceInitializationException {
+		InputStream inStr = null;
+		try {
+			// open input stream to data
+			inStr = aData.getInputStream();
+			// read each line
+			BufferedReader reader = new BufferedReader(new InputStreamReader(inStr));
+			String line;
+			while ((line = reader.readLine()) != null) {
+				// the first tab on each line separates key from value.
+				// Keys cannot contain whitespace.
+				int tabPos = line.indexOf('\t');
+				String key = line.substring(0, tabPos);
+				String val = line.substring(tabPos + 1);
+				mMap.put(key, val);
+			}
+		}
+		catch (IOException e) {
+			throw new ResourceInitializationException(e);
+		}
+		finally {
+			IOUtils.closeQuietly(inStr);
+		}
+	}
+
+	/**
+	 * @see StringMapResource#get(String)
+	 */
+	public String get(String aKey) {
+		return mMap.get(aKey);
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/uimafit-examples/src/main/java/org/uimafit/examples/tutorial/ex6/StringMapResource_impl.java
------------------------------------------------------------------------------
    svn:eol-style = native