Building RelEx/alternatives

From OpenCog

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
sudo checkinstall --pkgname=link-grammar --pkgversion=5.0.8

For some reason, I had to symlink the and 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/" /usr/lib/
sudo ln -sv "$(pwd)/bindings/java-jni/.libs/" /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: 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)

    |            |    |
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
cd relex
mvn -DskipTests package

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

Compilation error: If you get "org.linkgrammar.JSONUtils cannot be resolved /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: - Policy: Releases

4. Configure relex xml files for wordnet

cd relex/data/wordnet	[see relex/ 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:

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

3. Install Link Parser (download:

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

4. Install WordNet

yum install wordnet
yum install wordnet-devel

5. Install JWNL Java wordnet library (download:

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/ for location]
chmod 644 /usr/share/java/jwnl.jar

6. Install opennlp (optional) (download:

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-
cp output/opennlp-tools-1.5.3.jar /usr/local/share/java/

7. Install 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-

8. Configure relex xml files for wordnet

cd relex-1.5.0/data/wordnet	# see relex/ 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]