Revision: 19848
http://sourceforge.net/p/gate/code/19848
Author: markagreenwood
Date: 2016-12-06 03:19:38 +0000 (Tue, 06 Dec 2016)
Log Message:
-----------
converted to maven
Modified Paths:
--------------
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.classpath
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.project
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/gate/copyAS2AnoDoc/CopyAS2AnoDocMain.java
Added Paths:
-----------
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/pom.xml
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/gate/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/resources/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/resources/creole.xml
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/java/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/java/gate/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/java/gate/copyAS2AnoDoc/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/java/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/resources/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/resources/creole.properties
Removed Paths:
-------------
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/build.xml
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/creole.xml
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/doc/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/lib/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/gate/
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/testData/
Property Changed:
----------------
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/
Index: gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs
===================================================================
--- gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs 2016-12-06
02:22:12 UTC (rev 19847)
+++ gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs 2016-12-06
03:19:38 UTC (rev 19848)
Property changes on: gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs
___________________________________________________________________
Modified: svn:ignore
## -1,3 +1,2 ##
-copyAS2AnoDoc.jar
-build
+target
.settings
Modified: gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.classpath
===================================================================
--- gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.classpath
2016-12-06 02:22:12 UTC (rev 19847)
+++ gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.classpath
2016-12-06 03:19:38 UTC (rev 19848)
@@ -1,7 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry combineaccessrules="false" exported="true" kind="src"
path="/GATE"/>
- <classpathentry kind="output" path="build"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes"
path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes"
path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes"
path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.project
===================================================================
--- gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.project
2016-12-06 02:22:12 UTC (rev 19847)
+++ gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/.project
2016-12-06 03:19:38 UTC (rev 19848)
@@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
Deleted: gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/build.xml
===================================================================
--- gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/build.xml
2016-12-06 02:22:12 UTC (rev 19847)
+++ gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/build.xml
2016-12-06 03:19:38 UTC (rev 19848)
@@ -1,159 +0,0 @@
-<?xml version="1.0"?>
-<!-- $Id: build.xml 3600 2007-03-21 16:37:18Z yaoyong $ -->
-<project name="copyAS2AnoDoc" default="all" basedir=".">
- <description>
- Copy annotations from one file to another file plugin
- see http://gate.ac.uk
- </description>
-
- <!-- Prevent Ant from warning about includeantruntime not being set -->
- <property name="build.sysclasspath" value="ignore" />
-
- <!--
*******************************************************************
- **************** USER OPTIONS ************************************
- *******************************************************************
-
- Make changes to this section of the build file to customise your
- GATE start-up and build script -->
- <!-- Allow overriding of properties via build.properties -->
- <property file="build.properties" />
-
- <!-- Location of GATE - by default assume it's checked out at the same
- level as sins -->
- <property name="gate.home" location="../../" />
-
- <!-- TOOLS.JAR -->
- <!-- GATE will normally try to guess which tools.jar library to use
based on
- your Java installation.
- If you want to set this manually uncomment the line below & edit it -->
- <!-- <property name="tools.jar.location"
value="w:/jdk/jdk1.5.0/lib/tools.jar"/> -->
-
- <!-- RUNTIME MEMORY -->
- <property name="run.memory" value="700M" />
-
- <!--
*******************************************************************
- **************** USER OPTIONS END HERE! **************************
- ******************************************************************* -->
-
- <!-- set global properties for this build -->
-
- <!-- Directories -->
-
- <!-- Sources -->
- <property name="srcDir" location="src" />
-
- <!-- Output directory for the build process -->
- <property name="buildDir" location="build" />
-
- <!-- Libraries directory for the build process -->
- <property name="libDir" location="lib" />
-
- <!-- Directory for the documentation -->
- <property name="doc.dir" location="doc" />
- <property name="javadoc.dir" location="${doc.dir}/javadoc" />
-
- <!-- Use the new 1.3+ compiler -->
- <property name="build.compiler" value="modern" />
-
- <property name="gate.jar" location="${gate.home}/bin/gate.jar" />
- <property name="gate.lib.dir" location="${gate.home}/lib" />
- <property name="gate.compile.maxwarnings" value="10000" />
-
- <fileset id="gate.libs" dir="${gate.lib.dir}">
- <include name="*.jar" />
- <include name="*.zip" />
- </fileset>
-
- <!-- The libraries -->
- <fileset id="libs" dir="${libDir}">
- <include name="*.jar" />
- <include name="*.zip" />
- </fileset>
-
- <!-- The build CLASSPATH - includes learning libs, gate.jar and GATE
libs -->
- <path id="build.class.path">
- <fileset refid="libs" />
- <pathelement location="${gate.jar}" />
- <fileset refid="gate.libs" />
- </path>
-
- <!-- create build directory structure -->
- <target name="prepare">
- <mkdir dir="${buildDir}" />
- </target>
-
- <!-- This target compiles all the classes -->
- <target name="compile" description="compile the source "
depends="prepare">
- <!-- Compile the java code from ${srcDir} into ${buildDir} -->
- <javac srcdir="${srcDir}" destdir="${buildDir}" source="1.5"
target="1.5" encoding="UTF-8" debug="true" debuglevel="lines,source"
classpathref="build.class.path">
- <compilerarg value="-Xmaxwarns" />
- <compilerarg value="${gate.compile.maxwarnings}" />
- <compilerarg value="-Xlint:all" />
- </javac>
- </target>
-
- <target name="jar" depends="compile">
- <jar destfile="copyAS2AnoDoc.jar" update="false" index="true">
- <fileset dir="${buildDir}/" />
- </jar>
- </target>
-
- <!-- Build JavaDoc documentation -->
- <target name="doc.prepare">
- <mkdir dir="${javadoc.dir}" />
- </target>
-
- <target name="javadoc" depends="doc.prepare">
- <javadoc destdir="${javadoc.dir}" packagenames="*"
- classpathref="build.class.path"
- encoding="UTF-8"
- windowtitle="${plugin.name} JavaDoc"
- source="1.6">
- <sourcepath>
- <pathelement location="${srcDir}" />
- </sourcepath>
- <link href="http://docs.oracle.com/javase/6/docs/api/" />
- <link href="http://gate.ac.uk/gate/doc/javadoc/" />
- </javadoc>
- </target>
-
- <!-- Everything! -->
- <target name="all" depends="jar">
- </target>
-
- <!-- Clear all build output -->
- <target name="clean.classes">
- <delete dir="${buildDir}" />
- </target>
-
- <!-- clean resources generated by tests -->
- <target name="test.clean">
- <delete>
- <fileset dir="." includes="TEST*.xml" />
- </delete>
- </target>
-
- <target name="clean" depends="clean.classes, test.clean">
- <delete file="copyAS2AnoDoc.jar" />
- </target>
-
- <!-- Run (some) of the junit tests -->
- <target name="test" depends="jar">
- <junit fork="true" showoutput="yes" printsummary="yes"
maxmemory="${run.memory}">
- <classpath>
- <pathelement location="copyAS2AnoDoc.jar" />
- <path refid="build.class.path" />
- </classpath>
- <formatter type="xml" />
-
- <test name="gate.copyAS2AnoDoc.TestCopyAS2AnoDocPlugin"
/>
- </junit>
- </target>
-
- <!-- Targets used by the main GATE build file -->
- <target name="build" depends="jar" />
- <target name="distro.prepare" depends="clean.classes, test.clean"/>
-
-
-</project>
-
Deleted: gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/creole.xml
===================================================================
--- gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/creole.xml
2016-12-06 02:22:12 UTC (rev 19847)
+++ gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/creole.xml
2016-12-06 03:19:38 UTC (rev 19848)
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!-- $Id$ -->
-<CREOLE-DIRECTORY>
- <!-- Processing Resources -->
- <CREOLE>
- <!-- creole.xml for the Learning PR -->
- <RESOURCE>
- <NAME>Copy Anns to Another Doc PR</NAME>
- <COMMENT>Copy the annotations from one document to another
document.</COMMENT>
-
<HELPURL>http://gate.ac.uk/userguide/sec:misc-creole:copyAS2AnoDoc</HELPURL>
- <CLASS>gate.copyAS2AnoDoc.CopyAS2AnoDocMain</CLASS>
- <JAR>copyAS2AnoDoc.jar</JAR>
-
- <PARAMETER NAME="inputASName"
- COMMENT="The name of the annotation set used for input" RUNTIME="true"
- OPTIONAL="true">java.lang.String</PARAMETER>
-
- <PARAMETER NAME="outputASName"
- COMMENT="The name of the annotation set used for output" RUNTIME="true"
- OPTIONAL="true">java.lang.String</PARAMETER>
-
-
- <PARAMETER NAME="sourceFilesURL"
- COMMENT="The URL referring to the dir for the source files"
RUNTIME="true"
- OPTIONAL="false">java.net.URL</PARAMETER>
-
- <PARAMETER NAME="annotationTypes"
- COMMENT="The name of the annotation types for copying"
- RUNTIME="true" OPTIONAL="true">java.util.List</PARAMETER>
-
- </RESOURCE>
-
- </CREOLE>
-
-
-</CREOLE-DIRECTORY>
-
Added: gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/pom.xml
===================================================================
--- gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/pom.xml
(rev 0)
+++ gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/pom.xml
2016-12-06 03:19:38 UTC (rev 19848)
@@ -0,0 +1,38 @@
+
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>uk.ac.gate.plugins</groupId>
+ <artifactId>base-plugin</artifactId>
+ <!-- this should be the version of GATE you wish to build
against -->
+ <version>9.0-SNAPSHOT</version>
+ <relativePath>../../Plugin_Base/pom.xml</relativePath>
+ </parent>
+
+ <!-- this is the description of this plugin -->
+ <groupId>uk.ac.gate.plugins</groupId>
+ <artifactId>copy-annots-between-docs</artifactId>
+ <version>9.0-SNAPSHOT</version>
+
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License (LGPL), Version
3</name>
+ <url>http://www.gnu.org/licenses/lgpl-3.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <organization>
+ <name>GATE</name>
+ <url>http://gate.ac.uk</url>
+ </organization>
+
+ <dependencies>
+ <!-- add any other libraries your plugin depends on. Any other
GATE plugins
+ you depend on at compile time should use the provided
scope -->
+ </dependencies>
+
+</project>
Modified:
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/gate/copyAS2AnoDoc/CopyAS2AnoDocMain.java
===================================================================
---
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/gate/copyAS2AnoDoc/CopyAS2AnoDocMain.java
2016-12-06 02:22:12 UTC (rev 19847)
+++
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/gate/copyAS2AnoDoc/CopyAS2AnoDocMain.java
2016-12-06 03:19:38 UTC (rev 19848)
@@ -15,6 +15,10 @@
import gate.creole.AbstractLanguageAnalyser;
import gate.creole.ExecutionException;
import gate.creole.ResourceInstantiationException;
+import gate.creole.metadata.CreoleParameter;
+import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.Optional;
+import gate.creole.metadata.RunTime;
import gate.util.ExtensionFileFilter;
import gate.util.Files;
import gate.util.InvalidOffsetException;
@@ -27,6 +31,7 @@
import java.util.HashSet;
import java.util.List;
+@CreoleResource(name="Copy Anns to Another Doc PR", comment="Copy the
annotations from one document to another document",
helpURL="http://gate.ac.uk/userguide/sec:misc-creole:copyAS2AnoDoc")
public class CopyAS2AnoDocMain extends AbstractLanguageAnalyser implements
ProcessingResource {
@@ -171,6 +176,9 @@
return fpos;
}
+ @RunTime
+ @Optional
+ @CreoleParameter(comment="The name of the annotation set used for input")
public void setInputASName(String iasn) {
this.inputASName = iasn;
}
@@ -179,6 +187,9 @@
return this.inputASName;
}
+ @RunTime
+ @Optional
+ @CreoleParameter(comment="The name of the annotation set used for output")
public void setOutputASName(String iasn) {
this.outputASName = iasn;
}
@@ -187,6 +198,8 @@
return this.outputASName;
}
+ @RunTime
+ @CreoleParameter(comment="The URL referring to the dir for the source files")
public void setSourceFilesURL(URL modelU) {
this.sourceFilesURL = modelU;
}
@@ -199,6 +212,9 @@
return this.annotationTypes;
}
+ @RunTime
+ @Optional
+ @CreoleParameter(comment="The name of the annotation types for copying")
public void setAnnotationTypes(List<String> newTypes) {
annotationTypes = newTypes;
}
Deleted:
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
===================================================================
---
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
2016-12-06 02:22:12 UTC (rev 19847)
+++
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/java/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
2016-12-06 03:19:38 UTC (rev 19848)
@@ -1,132 +0,0 @@
-/*
- * TestCopyAS2AnoDocPlugin.java
- *
- * Yaoyong Li 08/10/2007
- *
- * $Id: TestCopyAS2AnoDocPlugin.java, v 1.0 2009-05-10 11:44:16 +0000 yaoyong
$
- */
-package gate.copyAS2AnoDoc;
-
-import gate.AnnotationSet;
-import gate.Corpus;
-import gate.Document;
-import gate.Factory;
-import gate.Gate;
-import gate.GateConstants;
-import gate.util.ExtensionFileFilter;
-import gate.util.GateException;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Vector;
-
-import junit.framework.TestCase;
-
-public class TestCopyAS2AnoDocPlugin extends TestCase {
- private static File learningHome;
- /** Use it to do initialisation only once. */
- private static boolean initialized = false;
-
- /**
- * Construction
- *
- * @throws GateException
- * @throws MalformedURLException
- */
- public TestCopyAS2AnoDocPlugin(String name) throws GateException,
- MalformedURLException {
- super(name);
- if(!initialized) {
- Gate.init();
- learningHome = new File(new File(Gate.getGateHome(), "plugins"),
- "Copy_Annots_Between_Docs");
-
Gate.getCreoleRegister().registerDirectories(learningHome.toURI().toURL());
- initialized = true;
- }
- }
-
- /** Fixture set up */
- public void setUp() {
- } // setUp
-
- /**
- * Put things back as they should be after running tests.
- */
- public void tearDown() throws Exception {
- super.tearDown();
- } // tearDown
-
- /** The test for AnnotationMerging. */
- public void testCopyAS2AnoDocPlugin() throws Exception {
- Boolean savedSpaceSetting = Gate.getUserConfig().getBoolean(
- GateConstants.DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME);
- Gate.getUserConfig().put(
- GateConstants.DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME, Boolean.FALSE);
- //Create a object for merging
- CopyAS2AnoDocMain copyAnnsOne = (CopyAS2AnoDocMain)Factory
- .createResource("gate.copyAS2AnoDoc.CopyAS2AnoDocMain");
- //A corpus
- Corpus corpus = Factory.newCorpus("DataSet");
- ExtensionFileFilter fileFilter = new ExtensionFileFilter();
- fileFilter.addExtension("xml");
- File testData = new File(learningHome, "testData");
- File sourceDir = new File(testData, "source");
- String corpusDirName = new File(testData, "target").getAbsolutePath();
- File[] xmlFiles = new File(corpusDirName).listFiles(fileFilter);
- Arrays.sort(xmlFiles, new Comparator<File>() {
- public int compare(File a, File b) {
- return a.getName().compareTo(b.getName());
- }
- });
- for(File f : xmlFiles) {
- if(!f.isDirectory()) {
- Document doc = Factory.newDocument(f.toURI().toURL(), "UTF-8");
- doc.setName(f.getName());
- corpus.add(doc);
- }
- }
-
- gate.creole.SerialAnalyserController controller;
- controller = (gate.creole.SerialAnalyserController)Factory
- .createResource("gate.creole.SerialAnalyserController");
- controller.setCorpus(corpus);
- controller.add(copyAnnsOne);
- copyAnnsOne.setInputASName("ann1");
- copyAnnsOne.setOutputASName("ann5");
- copyAnnsOne.setSourceFilesURL(sourceDir.toURI().toURL());
- Vector<String>annTypes = new Vector<String>();
- annTypes.add("Os");
- annTypes.add("sent");
- copyAnnsOne.setAnnotationTypes(annTypes);
-
- controller.execute();
-
- Document doc = corpus.get(1);
- AnnotationSet anns = doc.getAnnotations("ann5").get("Os");
- int num;
- num = anns.size();
- assertEquals(num, 3);
- anns = doc.getAnnotations("ann5").get("sent");
- num = anns.size();
-
- assertEquals(num, 18);
- doc.removeAnnotationSet("ann5");
-
- doc = corpus.get(0);
- doc.removeAnnotationSet("ann5");
-
- System.out.println("completed");
- corpus.clear();
- Factory.deleteResource(corpus);
- controller.cleanup();
- Factory.deleteResource(controller);
-
- // finally {
- Gate.getUserConfig().put(
- GateConstants.DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME,
- savedSpaceSetting);
- // }
- }
-}
Copied:
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/resources/creole.xml
(from rev 19847,
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/creole.xml)
===================================================================
---
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/resources/creole.xml
(rev 0)
+++
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/main/resources/creole.xml
2016-12-06 03:19:38 UTC (rev 19848)
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<CREOLE-DIRECTORY>
+
+</CREOLE-DIRECTORY>
+
Copied:
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/java/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
(from rev 19846,
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java)
===================================================================
---
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/java/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
(rev 0)
+++
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/java/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
2016-12-06 03:19:38 UTC (rev 19848)
@@ -0,0 +1,103 @@
+/*
+ * TestCopyAS2AnoDocPlugin.java
+ *
+ * Yaoyong Li 08/10/2007
+ *
+ * $Id: TestCopyAS2AnoDocPlugin.java, v 1.0 2009-05-10 11:44:16 +0000 yaoyong
$
+ */
+package gate.copyAS2AnoDoc;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Vector;
+
+import gate.AnnotationSet;
+import gate.Corpus;
+import gate.Document;
+import gate.Factory;
+import gate.Gate;
+import gate.GateConstants;
+import gate.test.GATEPluginTestCase;
+import gate.util.ExtensionFileFilter;
+import gate.util.Files;
+
+public class TestCopyAS2AnoDocPlugin extends GATEPluginTestCase {
+
+ /** The test for AnnotationMerging. */
+ public void testCopyAS2AnoDocPlugin() throws Exception {
+ Boolean savedSpaceSetting = Gate.getUserConfig().getBoolean(
+ GateConstants.DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME);
+ Gate.getUserConfig().put(
+ GateConstants.DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME, Boolean.FALSE);
+ //Create a object for merging
+ CopyAS2AnoDocMain copyAnnsOne = (CopyAS2AnoDocMain)Factory
+ .createResource("gate.copyAS2AnoDoc.CopyAS2AnoDocMain");
+ //A corpus
+
+ File testData =
Files.fileFromURL(this.getClass().getResource("/creole.properties")).getParentFile();
+
+
+ Corpus corpus = Factory.newCorpus("DataSet");
+ ExtensionFileFilter fileFilter = new ExtensionFileFilter();
+ fileFilter.addExtension("xml");
+
+ File sourceDir = new File(testData, "source");
+ File targetDir = new File(testData, "target");
+
+ File[] xmlFiles = targetDir.listFiles(fileFilter);
+ Arrays.sort(xmlFiles, new Comparator<File>() {
+ public int compare(File a, File b) {
+ return a.getName().compareTo(b.getName());
+ }
+ });
+ for(File f : xmlFiles) {
+ if(!f.isDirectory()) {
+ Document doc = Factory.newDocument(f.toURI().toURL(), "UTF-8");
+ doc.setName(f.getName());
+ corpus.add(doc);
+ }
+ }
+
+ gate.creole.SerialAnalyserController controller;
+ controller = (gate.creole.SerialAnalyserController)Factory
+ .createResource("gate.creole.SerialAnalyserController");
+ controller.setCorpus(corpus);
+ controller.add(copyAnnsOne);
+ copyAnnsOne.setInputASName("ann1");
+ copyAnnsOne.setOutputASName("ann5");
+ copyAnnsOne.setSourceFilesURL(sourceDir.toURI().toURL());
+ Vector<String>annTypes = new Vector<String>();
+ annTypes.add("Os");
+ annTypes.add("sent");
+ copyAnnsOne.setAnnotationTypes(annTypes);
+
+ controller.execute();
+
+ Document doc = corpus.get(1);
+ AnnotationSet anns = doc.getAnnotations("ann5").get("Os");
+ int num;
+ num = anns.size();
+ assertEquals(num, 3);
+ anns = doc.getAnnotations("ann5").get("sent");
+ num = anns.size();
+
+ assertEquals(num, 18);
+ doc.removeAnnotationSet("ann5");
+
+ doc = corpus.get(0);
+ doc.removeAnnotationSet("ann5");
+
+ System.out.println("completed");
+ corpus.clear();
+ Factory.deleteResource(corpus);
+ controller.cleanup();
+ Factory.deleteResource(controller);
+
+ // finally {
+ Gate.getUserConfig().put(
+ GateConstants.DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME,
+ savedSpaceSetting);
+ // }
+ }
+}
Added:
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/resources/creole.properties
===================================================================
---
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/resources/creole.properties
(rev 0)
+++
gate/branches/sawdust2/plugins/Copy_Annots_Between_Docs/src/test/resources/creole.properties
2016-12-06 03:19:38 UTC (rev 19848)
@@ -0,0 +1,3 @@
+groupId=${project.groupId}
+artifactId=${project.artifactId}
+version=${project.version}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs