Pages

Senin, 30 Juni 2014

Memasukkan BabelNet sebagai dependency di Maven Project

Maven POM

Repository configuration:

<repositories>
<repository>
<id>bippo-nexus-public</id>
<url>http://nexus.bippo.co.id/nexus/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

Dependencies:

<dependency>
    <groupId>commons-configuration</groupId>
    <artifactId>commons-configuration</artifactId>
    <version>1.10</version>
</dependency>
<dependency>
    <groupId>net.sf.jung</groupId>
    <artifactId>jung-algorithms</artifactId>
    <version>2.0.1</version>
</dependency>
<dependency>
    <groupId>edu.mit</groupId>
    <artifactId>jwi</artifactId>
    <version>2.2.3</version>
</dependency>
<dependency>
    <groupId>net.sourceforge.owlapi</groupId>
    <artifactId>owlapi-distribution</artifactId>
    <version>3.5.0</version>
</dependency>
<dependency>
<groupId>it.uniroma1.lcl</groupId>
<artifactId>jlt</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<!-- TODO: babelnet needs to be upgraded to Lucene 4.9+ -->
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>org.babelnet</groupId>
<artifactId>babelnet-api</artifactId>
<version>2.5</version>
</dependency>

Sample Code

TODO: BabelNet 2.5 belum bisa dipakai untuk WSD. Butuh BabelNet 1.0.1 + path indexes v1.0.1.

Required to run `id.ac.itb.ee.lskk.relexid.core.BabelNetTest`

1. Extract [BabelNet-API-2.5.zip](http://babelnet.org/download.jsp) to `$HOME/BabelNet-API-2.5`
2. Extract the indexes to $HOME (will create subdirectories inside `$HOME/BabelNet-2.5`. For testing you can use the small indexes only:
   a. babelnet-2.5-APACHE-20-index.tar.bz2
   b. babelnet-2.5-CC-BY-30-index.tar.bz2
   c. babelnet-2.5-CC-BY-NC-SA-30-index.tar.bz2
   d. babelnet-2.5-CECILL-C-index.tar.bz2
3. BabelNet API v1.0.1 + Path indexes v1.0.1:
   a. http://lcl.uniroma1.it/babelnet/data/babelnet-api-1.0.1.tar.gz 
   b. http://lcl.uniroma1.it/babelnet/data/babelnet-1.0.1-core-lucene.tar.bz2
   See [Ciarán Ó Duibhín's article](http://www.smo.uhi.ac.uk/~oduibhin/oideasra/interfaces/winbabelnet.htm) for reason.
4. Edit `$HOME/BabelNet-API-2.5/config/babelnet.var.properties` and set `babelnet.dir` to `${user.home}/BabelNet-2.5`.
5. Edit `$HOME/BabelNet-API-2.5/config/knowledge.var.properties` and set `knowledge.graph.pathIndex` to `${user.home}/BabelNet-1.0.1`. 

(Self-note) Deploy babelnet-api (dan beberapa dependency JARs) ke Maven repository

Download dulu BabelNet Java API.

Lalu extract distribusi BabelNet Java API.

Buat sources.jar :

jar cvf babelnet-api-2.5-sources.jar -C src .

Upload file-file JAR ke Nexus Maven repository:

mvn deploy:deploy-file -Dfile=lib/jlt-1.0.0.jar -DgroupId=it.uniroma1.lcl -DartifactId=jlt -Dversion=1.0.0 -Dpackaging=jar -Durl=http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/ -DrepositoryId=soluvas-public-thirdparty

mvn deploy:deploy-file -Dfile=babelnet-api-2.5.jar -DgroupId=org.babelnet -DartifactId=babelnet-api -Dversion=2.5 -Dpackaging=jar -Durl=http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/ -DrepositoryId=soluvas-public-thirdparty

mvn deploy:deploy-file -Dfile=babelnet-api-2.5-sources.jar -DgroupId=org.babelnet -DartifactId=babelnet-api -Dversion=2.5 -Dpackaging=jar -Dclassifier=sources -Durl=http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/ -DrepositoryId=soluvas-public-thirdparty

(pas deploy sources ini bakal 400 Bad Request tapi nggak papa koq)