Building RelEx/alternatives

From OpenCog
Jump to: navigation, search

For instruction on how to build and run relex on Ubuntu, see instructions found in the Building RelEx page. The instructions here are only provided as an alternative

Installation examples are provided for using maven and a Red Hat (e.g. EL5/EL6) based linux operating system.


Using Maven on Ubuntu

The installation examples provided below are based on an Ubuntu 14.04 LTS (Trusty Tahr) / Linux Mint 17 64-bit operating system (although it probably should work with 32-bit also).

1. Install dependencies

This includes: Java Development Tools (openjdk), util-linux, checkinstall, maven, WordNet.

sudo apt-get install git openjdk-7-jdk ant libcommons-logging-java util-linux checkinstall maven \
 wordnet wordnet-dev wordnet-sense-index

(util-linux package contains getopt)

2. Install Link Grammar Parser

Download source tarball for Link Grammar Parser.

tar -zxf link-grammar-5.0.8.tar.gz
cd link-grammar-5.0.8
mkdir build
cd build
../configure
make
sudo checkinstall --pkgname=link-grammar --pkgversion=5.0.8

For some reason, I had to symlink the liblink-grammar.so.5 and linklink-grammar-java.so files manually, this should have been done automatically by install: --Hendy (talk) 05:48, 9 July 2014 (CDT)

sudo ln -sv "$(pwd)/link-grammar/.libs/liblink-grammar.so.5" /usr/lib/
sudo ln -sv "$(pwd)/bindings/java-jni/.libs/liblink-grammar-java.so" /usr/lib/

Test it:

ceefour@hendy:~/Downloads/link-grammar-5.0.8/build > link-parser
link-grammar: Info: Dictionary found at /usr/local/share/link-grammar/en/4.0.dict
link-grammar: Info: Using locale LC_CTYPE=en_US.UTF-8;LC_NUMERIC=id_ID.UTF-8;LC_TIME=id_ID.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=id_ID.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=id_ID.UTF-8;LC_NAME=id_ID.UTF-8;LC_ADDRESS=id_ID.UTF-8;LC_TELEPHONE=id_ID.UTF-8;LC_MEASUREMENT=id_ID.UTF-8;LC_IDENTIFICATION=id_ID.UTF-8.
link-grammar: Info: Dictionary version 5.0.8.
link-grammar: Info: Library version link-grammar-5.0.8. Enter "!help" for help.
linkparser> i like it
No complete linkages found.
Found 1 linkage (1 had no P.P. violations) at null count 1
        Unique linkage, cost vector = (UNUSED=1 DIS= 0,00 LEN=4)

    +-----Wi-----+-Osx+
    |            |    |
LEFT-WALL [i] like.v it 

Press Ctrl+D when done testing.

If you want to uninstall Link Grammar in the future, you can run: sudo apt-get remove link-grammar

Optional: If you want to install linkgrammar Java JAR into local Maven Repository. Otherwise linkgrammar artifact will be downloaded from Bippo Nexus Repository.

mvn install:install-file -Dfile=bindings/java/linkgrammar-5.0.8.jar \
 -DgroupId=org.linkgrammar -DartifactId=linkgrammar -Dversion=5.0.8 -Dpackaging=jar

3. Build RelEx from Git

(you can also download the latest release from RelEx project on Launchpad)

git clone git@github.com:opencog/relex.git
cd relex
mvn -DskipTests package
./batch-process.sh

Test error: If you get "java.lang.UnsatisfiedLinkError: no link-grammar-java in java.library.path" that means you haven't symlinked liblink-grammar-java.so.

Compilation error: If you get "org.linkgrammar.JSONUtils cannot be resolved PlainTextServer.java /relex/src/java/relex line 199", that means linkgrammar JAR artifact dependency is not fulfilled. If your company configuration uses Nexus Maven Repository Manager, then you should add a Proxy Repository to your Nexus instance:

ID: bippo-nexus-public - URL: http://nexus.bippo.co.id/nexus/content/groups/public/ - Policy: Releases

4. Configure relex xml files for wordnet

cd relex/data/wordnet	[see relex/batch-process.sh for location]
gedit file_properties.xml
verify dictionary_path as <param name="dictionary_path" value="/usr/share/wordnet"/>	
[see WordNet compilation output for location]


Redhat EL5/EL6

The installation examples provided below are based on an EL5/EL6 operating system with development libraries installed.

1. Install Java Development Tools (eg openjdk and openjdk-devel)

yum install java-1.6.0-openjdk-devel
yum install java-1.6.0-openjdk
yum install ant
yum install ant-commons-logging

2. Install Java GNU getopt options tool (download: http://download.java.net/maven/2/gnu/getopt/java-getopt/1.0.13/)

unzip getopt.jar.zip
cd getopt.jar.zip_FILES
su root
cp getopt.jar /usr/share/java/gnu-getopt.jar


3. Install Link Parser (download: http://www.abisource.com/projects/link-grammar/#download)

tar -xvf link-grammar-4.8.6.tar.gz
cd link-grammar-4.8.6
./configure
make
su root
make install


4. Install WordNet

yum install wordnet
yum install wordnet-devel

5. Install JWNL Java wordnet library (download: http://sourceforge.net/projects/jwordnet/)

unzip jwnl14-rc2.zip
cd jwnl14-rc2
su root
cp jwnl.jar /usr/share/java/		# see relex-1.3.0/build.xml for location]
cp jwnl.jar /usr/local/share/java/	# see relex-1.3.0/batch-process.sh for location]
chmod 644 /usr/share/java/jwnl.jar


6. Install opennlp (optional) (download: http://sourceforge.net/projects/opennlp/)

tar -xvf opennlp-tools-1.5.3.tgz
cd opennlp-tools-1.5.3
su root
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
./build.sh
cp output/opennlp-tools-1.5.3.jar /usr/local/share/java/

7. Install RelEx (download: https://launchpad.net/relex/+download)

tar -xvf relex-1.5.0.tar.gz
cd relex-1.5.0
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
ant
./batch-process.sh


8. Configure relex xml files for wordnet

cd relex-1.5.0/data/wordnet	# see relex/batch-process.sh for location]
gedit file_properties.xml
# change dictionary_path to <param name="dictionary_path" value="/usr/share/wordnet-3.0/dict"/>	
# see WordNet compilation output for location]