You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by tw...@apache.org on 2007/11/22 18:27:30 UTC

svn commit: r597458 [3/3] - in /incubator/uima/sandbox/trunk/BSFAnnotator: ./ desc/ lib/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/uima/ src/main/java/org/apache/uima/annotator/ src/main/java/or...

Added: incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestAggregated.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestAggregated.java?rev=597458&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestAggregated.java (added)
+++ incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestAggregated.java Thu Nov 22 09:27:22 2007
@@ -0,0 +1,73 @@
+/*
+ * 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.uima.annotator.bsf;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.test.junit_extension.AnnotatorTester;
+import org.apache.uima.test.junit_extension.JUnitExtension;
+
+
+/**
+ * Testclass for the BSF annotator.
+ */
+public class TestAggregated extends TestCase
+{
+	private AnnotatorTester annotAggregTester;
+	
+	/**
+	 * @see junit.framework.TestCase#setUp()
+	 */
+	protected void setUp() throws Exception
+	{
+		this.annotAggregTester = new AnnotatorTester(JUnitExtension.getFile("BSFAggregatedAE.xml"));
+	}
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+      super.tearDown();
+      this.annotAggregTester = null;
+    }
+    
+
+	public void testAnnotatorAggregated() throws Exception
+	{
+		//retrieve Annotator sample text
+		String text = AnnotatorTester.readFileContent(JUnitExtension.getFile("Nicknames.txt"), "UTF-8");
+		
+		//execute sample text
+		CAS cas = this.annotAggregTester.performTest(text,"en");
+		
+		//define result interested in
+		String[] tofs = {"org.apache.uima.annotator.bsf.types.Token", "org.apache.uima.annotator.bsf.types.Firstname", "org.apache.uima.annotator.bsf.types.Nickname"};
+		
+		//compare results
+		File outputFile = new File(JUnitExtension.getFile("NicknamesRef.txt").getParent(), "NicknamesRef_testoutput.txt") ;
+		AnnotatorTester.checkResult(cas, tofs, JUnitExtension.getFile("NicknamesRef.txt"), outputFile);		
+	}
+
+
+}

Added: incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestBeanshell.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestBeanshell.java?rev=597458&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestBeanshell.java (added)
+++ incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestBeanshell.java Thu Nov 22 09:27:22 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.uima.annotator.bsf;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.test.junit_extension.AnnotatorTester;
+import org.apache.uima.test.junit_extension.JUnitExtension;
+
+
+/**
+ * Testclass for the BSF annotator.
+ */
+public class TestBeanshell extends TestCase
+{
+	private AnnotatorTester annotBshTester;
+	
+	/**
+	 * @see junit.framework.TestCase#setUp()
+	 */
+	protected void setUp() throws Exception
+	{
+		this.annotBshTester = new AnnotatorTester(JUnitExtension.getFile("BeanshellTestAnnotator.xml"));
+	}
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+      super.tearDown();
+      this.annotBshTester = null;
+    }
+    
+	public void testAnnotatorBeanshell() throws Exception
+	{
+		//retrieve Annotator sample text
+		String text = AnnotatorTester.readFileContent(JUnitExtension.getFile("testdoc.txt"), "UTF-8");
+		
+		//execute sample text
+		CAS cas = this.annotBshTester.performTest(text,"en");
+		
+		//define result interested in
+		String[] tofs = {"org.apache.uima.annotator.bsf.types.Token"};
+		
+		//compare results
+		File outputFile = new File(JUnitExtension.getFile("testdocRef.txt").getParent(), "testdocRef_testoutput.txt") ;
+		AnnotatorTester.checkResult(cas, tofs, JUnitExtension.getFile("testdocRef.txt"), outputFile);		
+	}
+
+
+}

Added: incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestRhino.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestRhino.java?rev=597458&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestRhino.java (added)
+++ incubator/uima/sandbox/trunk/BSFAnnotator/src/test/java/org/apache/uima/annotator/bsf/TestRhino.java Thu Nov 22 09:27:22 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.uima.annotator.bsf;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.test.junit_extension.AnnotatorTester;
+import org.apache.uima.test.junit_extension.JUnitExtension;
+
+
+/**
+ * Testclass for the BSF annotator.
+ */
+public class TestRhino extends TestCase
+{
+	private AnnotatorTester annotRhinoTester;
+	
+	/**
+	 * @see junit.framework.TestCase#setUp()
+	 */
+	protected void setUp() throws Exception
+	{
+		this.annotRhinoTester = new AnnotatorTester(JUnitExtension.getFile("RhinoTestAnnotator.xml"));
+	}
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+      super.tearDown();
+      this.annotRhinoTester = null;
+    }
+    
+	public void testAnnotatorRhino() throws Exception
+	{
+		//retrieve Annotator sample text
+		String text = AnnotatorTester.readFileContent(JUnitExtension.getFile("testdoc.txt"), "UTF-8");
+		
+		//execute sample text
+		CAS cas = this.annotRhinoTester.performTest(text,"en");
+		
+		//define result interested in
+		String[] tofs = {"org.apache.uima.annotator.bsf.types.Token"};
+		
+		//compare results
+		File outputFile = new File(JUnitExtension.getFile("testdocRef.txt").getParent(), "testdocRef_testoutput.txt") ;
+		AnnotatorTester.checkResult(cas, tofs, JUnitExtension.getFile("testdocRef.txt"), outputFile);		
+	}
+
+}

Added: incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/Nicknames.txt
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/Nicknames.txt?rev=597458&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/Nicknames.txt (added)
+++ incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/Nicknames.txt Thu Nov 22 09:27:22 2007
@@ -0,0 +1,14 @@
+A Brief Discussion of
+Nicknames and Diminutives
+
+
+
+First things first: the word nickname derives from the Middle English phrase "an eke-name" where "eke" means "additional." A nickname is a name, any kind of name, that one is called in place of one's real name. Some nicknames are affectionate phrases used to describe a person. Shorty Smith is presumably short, for example. Slim Pickings is skinny, and Red Cooper may have red hair, while Scarface Capone has a scarred face. During the Middle Ages, many of these descriptive nicknames evolved to become surnames (last names, family names, etc.). Thus, an ancestor of Neil Armstrong must have had strong arms, and Jane White had an ancestor with a pale complexion or hair.
+
+But the most common type of nickname is the Diminutive, usually a shortened or otherwise altered version of one's true name, such as Jim, for James, Jack for John, Ted for Theodore, or Betty for Elizabeth. Diminutives are usually used with inferiors or equals, such as children and servants, or close friends or relatives. Usually meant affectionately, often times there are varying degrees of diminutives. A man is William to his acquaintances, Will to his friends, and Willie to his mother. Nicknames of this sort are among the oldest parts of language still used. Jack remained a nickname for John for centuries after its origianl connection and lost. Until the 20th century, one could still find Neds and Nans for Edwards and Anns, again, alghouh the original connotations have long since past. Some connections are so old that we do not really undestand how it happened, as in Peggy/Margaret or Polly/Mary or Billy/William.
+
+"Diminutives" are formed by corrupting, shortening, or otherwise changing a person's given name into something different. This happens in a variety of ways:
+
+Sometimes, longer names are contracted, as in Margaret to Greta, Konradt to Kurt, Teresa to Tessa, or Henrietta to Hetty.
+
+Other times a letter (usually "r" ) is dropped, as we see in Maggie from Margaret, Kit from Christopher, Biddy from Bridget, Fanny from Frances, and Hattie from Harriet.

Added: incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/NicknamesRef.txt
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/NicknamesRef.txt?rev=597458&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/NicknamesRef.txt (added)
+++ incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/NicknamesRef.txt Thu Nov 22 09:27:22 2007
@@ -0,0 +1,36 @@
+Firstname(341,346): Smith
+Nickname(670,674): Jane
+Nickname(865,868): Jim
+Firstname(874,879): James
+Nickname(881,885): Jack
+Nickname(890,894): John
+Nickname(896,899): Ted
+Firstname(904,912): Theodore
+Nickname(917,922): Betty
+Firstname(927,936): Elizabeth
+Firstname(1148,1155): William
+Nickname(1178,1182): Will
+Nickname(1203,1209): Willie
+Nickname(1299,1303): Jack
+Nickname(1328,1332): John
+Nickname(1614,1619): Peggy
+Firstname(1620,1628): Margaret
+Nickname(1632,1637): Polly
+Firstname(1638,1642): Mary
+Nickname(1646,1651): Billy
+Firstname(1652,1659): William
+Firstname(1870,1878): Margaret
+Firstname(1906,1912): Teresa
+Nickname(1916,1921): Tessa
+Firstname(1926,1935): Henrietta
+Nickname(1939,1944): Hetty
+Nickname(2010,2016): Maggie
+Firstname(2022,2030): Margaret
+Nickname(2032,2035): Kit
+Firstname(2041,2052): Christopher
+Nickname(2054,2059): Biddy
+Firstname(2065,2072): Bridget
+Nickname(2074,2079): Fanny
+Firstname(2085,2092): Frances
+Nickname(2098,2104): Hattie
+Firstname(2110,2117): Harriet

Added: incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdoc.txt
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdoc.txt?rev=597458&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdoc.txt (added)
+++ incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdoc.txt Thu Nov 22 09:27:22 2007
@@ -0,0 +1,2 @@
+Hi! My name is Joe and you?
+My name is David but my friends use to call me Dave.

Added: incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdocRef.txt
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdocRef.txt?rev=597458&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdocRef.txt (added)
+++ incubator/uima/sandbox/trunk/BSFAnnotator/src/test/resources/testdocRef.txt Thu Nov 22 09:27:22 2007
@@ -0,0 +1,3 @@
+Token(15,18): Joe
+Token(40,45): David
+Token(76,80): Dave