Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#69 - Use WordNet via Maven dependency #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion dkpro-similarity-algorithms-lsr-asl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>dkpro-similarity-asl</artifactId>
<groupId>org.dkpro.similarity</groupId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-asl</relativePath>
</parent>
<artifactId>dkpro-similarity-algorithms-lsr-asl</artifactId> <dependencies>
Expand Down Expand Up @@ -86,6 +86,17 @@
<artifactId>de.tudarmstadt.ukp.dkpro.lexsemresource.wordnet-asl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.extjwnl</groupId>
<artifactId>extjwnl-data-wn30</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
Expand All @@ -99,6 +110,8 @@
<usedDependency>de.tudarmstadt.ukp.dkpro.lexsemresource:de.tudarmstadt.ukp.dkpro.lexsemresource.wikipedia-asl</usedDependency>
<usedDependency>de.tudarmstadt.ukp.dkpro.lexsemresource:de.tudarmstadt.ukp.dkpro.lexsemresource.wiktionary-asl</usedDependency>
<usedDependency>de.tudarmstadt.ukp.dkpro.lexsemresource:de.tudarmstadt.ukp.dkpro.lexsemresource.wordnet-asl</usedDependency>
<!-- Data dependencies are not detected by byte-code analysis -->
<usedDependency>net.sf.extjwnl:extjwnl-data-wn30</usedDependency>
</usedDependencies>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,45 @@

import org.dkpro.similarity.algorithms.lsr.LexSemResourceComparator;
import org.dkpro.similarity.algorithms.lsr.path.PathLengthComparator;
import org.junit.AfterClass;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import de.tudarmstadt.ukp.dkpro.lexsemresource.Entity;
import de.tudarmstadt.ukp.dkpro.lexsemresource.Entity.PoS;
import de.tudarmstadt.ukp.dkpro.lexsemresource.LSRFramework;
import de.tudarmstadt.ukp.dkpro.lexsemresource.LexicalSemanticResource;
import de.tudarmstadt.ukp.dkpro.lexsemresource.core.ResourceFactory;
import de.tudarmstadt.ukp.dkpro.lexsemresource.exception.ResourceLoaderException;

public class PathLengthComparatorTest {

private static final double epsilon = 0.0001;

private static LexicalSemanticResource wordnet;
private static LexicalSemanticResource germanet;
private static LexicalSemanticResource wikipedia;
private static LexicalSemanticResource wiktionary;

@BeforeClass
public static void initialize() throws ResourceLoaderException {
wordnet = ResourceFactory.getInstance().get("wordnet3", "en");
// germanet = ResourceFactory.getInstance().get("germanet7", "de");
wikipedia = ResourceFactory.getInstance().get("wikipedia", "test");
// wiktionary = ResourceFactory.getInstance().get("wiktionary", "en");
}

private static String oldWorkspace;

@BeforeClass
public static void setup()
{
oldWorkspace = System.getProperty(LSRFramework.SYS_LSR_WORKSPACE);
System.setProperty(LSRFramework.SYS_LSR_WORKSPACE,
"target/test-output/PathLengthComparatorTest/");
}

@AfterClass
public static void teardown()
{
System.setProperty(LSRFramework.SYS_LSR_WORKSPACE, oldWorkspace);
}

@Ignore("The original GermaNet API is not Apache licensed.")
@Test
public void testGermaNetUsingResourceLoader()
throws Exception
{
{
LexicalSemanticResource germanet = ResourceFactory.getInstance().get("germanet7", "de");

LexSemResourceComparator comparator = new PathLengthComparator(germanet);

Set<Entity> entitiesAuto = germanet.getEntity("Auto", PoS.n);
Expand All @@ -69,13 +75,15 @@ public void testGermaNetUsingResourceLoader()
assertEquals(6.0, comparator.getSimilarity(entitiesAuto, entitiesSchnell), epsilon);
}

// @Ignore("The path from 'tree' to 'tree' should be 0 but is 13! - See bug 163")
@Test
public void testWordNet()
throws Exception
{
Assume.assumeTrue(Runtime.getRuntime().maxMemory() > 1000000000);


LexicalSemanticResource wordnet = ResourceFactory.getInstance().get("wordnet-default",
"en");

LexSemResourceComparator comparator = new PathLengthComparator(wordnet);

Set<Entity> entitiesTree = wordnet.getEntity("tree", PoS.n);
Expand All @@ -93,7 +101,9 @@ public void testWikipediaArticle()
throws Exception
{
Assume.assumeTrue(Runtime.getRuntime().maxMemory() > 1000000000);


LexicalSemanticResource wikipedia = ResourceFactory.getInstance().get("wikipedia", "test");

LexSemResourceComparator comparator = new PathLengthComparator(wikipedia);

// this are pages
Expand Down Expand Up @@ -131,7 +141,9 @@ public void testWikipediaArticle()
@Ignore("WiktionaryResource.getParents() is not implemented.")
public void testWiktionary()
throws Exception
{
{
LexicalSemanticResource wiktionary = ResourceFactory.getInstance().get("wiktionary", "en");

LexSemResourceComparator comparator = new PathLengthComparator(wiktionary);

Set<Entity> entitiesFahrzeug = wiktionary.getEntity("Fahrzeug");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
log4j.rootLogger=WARN,development

log4j.appender.development=org.apache.log4j.ConsoleAppender
log4j.appender.development.layout=org.apache.log4j.PatternLayout
log4j.appender.development.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%t] (%C{1}) - %m%n

log4j.logger.de.tudarmstadt.ukp = DEBUG
5 changes: 1 addition & 4 deletions dkpro-similarity-algorithms-lsr-gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-gpl</relativePath>
</parent>
<artifactId>dkpro-similarity-algorithms-lsr-gpl</artifactId>
<properties>
<lsr.version>0.8.1</lsr.version>
</properties>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
Expand Down
2 changes: 1 addition & 1 deletion dkpro-similarity-asl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-algorithms-lsr-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion dkpro-similarity-example-gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-gpl</relativePath>
</parent>
<artifactId>dkpro-similarity-example-gpl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion dkpro-similarity-experiments-api-asl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-asl</relativePath>
</parent>
<artifactId>dkpro-similarity-experiments-api-asl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion dkpro-similarity-experiments-rte-gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-experiments</relativePath>
</parent>
<artifactId>dkpro-similarity-experiments-rte-gpl</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions dkpro-similarity-experiments-sts-2013-baseline-gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-experiments</relativePath>
</parent>
<artifactId>dkpro-similarity-experiments-sts-2013-baseline-gpl</artifactId>
Expand Down Expand Up @@ -132,14 +132,14 @@
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
6 changes: 3 additions & 3 deletions dkpro-similarity-experiments-sts-2013-gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-experiments</relativePath>
</parent>
<artifactId>dkpro-similarity-experiments-sts-2013-gpl</artifactId>
Expand Down Expand Up @@ -140,14 +140,14 @@
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion dkpro-similarity-experiments-wordchoice-asl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-experiments</relativePath>
</parent>
<artifactId>dkpro-similarity-experiments-wordchoice-asl</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions dkpro-similarity-experiments-wordpairs-asl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<relativePath>../dkpro-similarity-experiments</relativePath>
</parent>
<artifactId>dkpro-similarity-experiments-wordpairs-asl</artifactId>
Expand Down Expand Up @@ -85,7 +85,7 @@
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
18 changes: 9 additions & 9 deletions dkpro-similarity-experiments/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</parent>
<name>DKPro Similarity Experiments</name>
<artifactId>dkpro-similarity-experiments</artifactId>
Expand All @@ -40,46 +40,46 @@
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments.api-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments-rte-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments-sts-2013-baseline-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments-sts-2013-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments-api-asl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-experiments-coling2012-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion dkpro-similarity-gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>org.dkpro.similarity</groupId>
<artifactId>dkpro-similarity-algorithms-lsr-gpl</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
<module>dkpro-similarity-experiments</module>
</modules>
<properties>
<lsr.version>0.8.1</lsr.version>
<lsr.version>0.8.2-SNAPSHOT</lsr.version>
</properties>
<repositories>
<repository>
Expand Down