Skip to content

Commit

Permalink
Improvements for preparation to separate test data into plain text fi…
Browse files Browse the repository at this point in the history
…les.

Refs opencog#103.
  • Loading branch information
ceefour committed Jul 11, 2014
1 parent 7ef54f8 commit d8ca1e7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 6 deletions.
26 changes: 25 additions & 1 deletion 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
20 changes: 17 additions & 3 deletions src/java_test/relex/test/TestRelEx.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,30 @@
import java.util.ArrayList;
import java.util.Collections;

import org.junit.BeforeClass;
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>();

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

public TestRelEx()
{
re = new RelationExtractor();
pass = 0;
fail = 0;
subpass = 0;
Expand Down Expand Up @@ -82,7 +89,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,7 +828,14 @@ public boolean test_extraposition()

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

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

rc &= ts.test_comparatives();
Expand Down
17 changes: 15 additions & 2 deletions src/java_test/relex/test/TestStanford.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,29 @@
import java.util.ArrayList;
import java.util.Collections;

import org.junit.BeforeClass;
import org.junit.Test;

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

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

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

public TestStanford()
{
re = new RelationExtractor();
re.do_stanford = true;
pass = 0;
fail = 0;
Expand Down Expand Up @@ -135,7 +142,13 @@ public boolean test_tagged_sentence (String sent, String sf)

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

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

// The parses below were compared to the Stanford parser, circa
Expand Down

0 comments on commit d8ca1e7

Please sign in to comment.