Skip to content

Commit

Permalink
Structural improvements for separating test data into plain text files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceefour committed Jul 11, 2014
1 parent 7ef54f8 commit c85d4c9
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 70 deletions.
28 changes: 26 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="relex">
<project basedir="." default="build" name="relex" xmlns:artifact="antlib:org.eclipse.aether.ant">
<property name="VERSION" value="1.5"/> <!-- this is relex version 1.5.1 -->
<property name="REVISION" value="1.5.1"/> <!-- this is relex version 1.5.1 -->

Expand Down Expand Up @@ -59,10 +59,30 @@
<!-- OpenNLP-1.4 and older require xerces -->
<pathelement location="${ALTPREFIX}/xercesImpl.jar"/>
</path>

<path id="aether-ant-tasks.classpath" path="antlib/aether-ant-tasks-uber.jar" />
<typedef resource="org/eclipse/aether/ant/antlib.xml"
uri="antlib:org.eclipse.aether.ant"
classpathref="aether-ant-tasks.classpath" />

<!-- Steps to take on initialization -->
<target name="init">
<mkdir dir="bin"/>
<get src="http://search.maven.org/remotecontent?filepath=org/eclipse/aether/aether-ant-tasks/1.0.0.v20140518/aether-ant-tasks-1.0.0.v20140518-uber.jar"
dest="antlib/aether-ant-tasks-uber.jar" verbose="true" skipexisting="true"/>
<fail message="Checksum mismatch for 'antlib/aether-ant-tasks-uber.jar'. Please delete it and rerun ant to redownload.">
<condition>
<not>
<checksum file="antlib/aether-ant-tasks-uber.jar" algorithm="SHA"
property="95dadd03392a75564904da45108cf048abe6e5bb" verifyproperty="checksum.matches"/>
</not>
</condition>
</fail>
<artifact:pom file="pom.xml" />
<artifact:resolve>
<path refid="cp.compile" classpath="compile"/>
<path refid="cp.test" classpath="test" />
<path refid="cp.runtime" classpath="runtime"/>
</artifact:resolve>
</target>

<!-- conditional compilation, check for OWL -->
Expand Down Expand Up @@ -112,6 +132,7 @@
<exclude name="**/OWLView.java" unless="OWL.present" />
<exclude name="**/DocSplitterOpenNLP15Impl.java" unless="OpenNLP15.present" />
<exclude name="**/DocSplitterOpenNLP14Impl.java" unless="OpenNLP14.present" />
<classpath refid="cp.compile"/>
<classpath refid="relex.classpath"/>
<!-- <compilerarg value="-Wno-deadCode"/> -->
<!-- <compilerarg value="-Wno-unused"/> -->
Expand All @@ -124,6 +145,7 @@
includeantruntime="false"
source="${source}" target="${target}">
<src path="src/java_test"/>
<classpath refid="cp.test"/>
<classpath refid="relex.classpath"/>
</javac>
</target>
Expand Down Expand Up @@ -161,12 +183,14 @@
<java classname="relex.test.TestStanford" failonerror="true" fork="yes">
<jvmarg line="-Xmx1024m"/>
<jvmarg line="-Djava.library.path=/usr/lib/jni:/usr/lib:/usr/local/lib/jni:/usr/local/lib"/>
<classpath refid="cp.test"/>
<classpath refid="relex.classpath"/>
<arg line=""/>
</java>
<java classname="relex.test.TestRelEx" failonerror="true" fork="yes">
<jvmarg line="-Xmx1024m"/>
<jvmarg line="-Djava.library.path=/usr/lib/jni:/usr/lib:/usr/local/lib/jni:/usr/local/lib"/>
<classpath refid="cp.test"/>
<classpath refid="relex.classpath"/>
<arg line=""/>
</java>
Expand Down
29 changes: 20 additions & 9 deletions src/java_test/relex/test/TestRelEx.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,28 @@
import java.util.ArrayList;
import java.util.Collections;

import org.junit.Test;

import relex.ParsedSentence;
import relex.RelationExtractor;
import relex.Sentence;
import relex.output.SimpleView;

public class TestRelEx
{
private RelationExtractor re;
private static RelationExtractor re;
private int pass;
private int fail;
private int subpass;
private int subfail;
private static ArrayList<String> sentfail= new ArrayList<String>();

public static void setUpClass() {
re = new RelationExtractor();
}

public TestRelEx()
{
re = new RelationExtractor();
pass = 0;
fail = 0;
subpass = 0;
Expand Down Expand Up @@ -82,7 +87,7 @@ public boolean test_sentence (String sent, String sf)
//parser-unary-relation-output arrayList "urgot" for unary relationships
for (int i=0; i< exp.size(); i++)
{
if(!brgot.contains((String)exp.get(i)))
if(!brgot.contains(exp.get(i)))
{
if(!urgot.contains(exp.get(i)))
{
Expand Down Expand Up @@ -821,19 +826,25 @@ public boolean test_extraposition()

public static void main(String[] args)
{
setUpClass();
TestRelEx ts = new TestRelEx();
ts.runTests();
}

@Test
public void runTests() {
boolean rc = true;

rc &= ts.test_comparatives();
rc &= ts.test_extraposition();
rc &= ts.test_Conjunction();
rc &= test_comparatives();
rc &= test_extraposition();
rc &= test_Conjunction();

if (rc) {
System.err.println("Tested " + ts.pass + " sentences, test passed OK");
System.err.println("Tested " + pass + " sentences, test passed OK");
} else {
System.err.println("Test failed\n\t" +
ts.fail + " sentences failed\n\t" +
ts.pass + " sentences passed");
fail + " sentences failed\n\t" +
pass + " sentences passed");
}

System.err.println("******************************");
Expand Down
Loading

0 comments on commit c85d4c9

Please sign in to comment.