Building RelEx

From OpenCog

This page documents the building procedure to get RelEx up and running.

On Ubuntu

Install dependencies

Run the following steps,

git clone
cd relex

The script will download and install all the main dependencies.

opennlp is an optional dependency and can be installed by running the following steps after downloading it from

tar -xvf opennlp-tools-1.5.0.tgz
cd opennlp-tools-1.5.0
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
sudo cp output/opennlp-tools-1.5.0.jar /usr/local/share/java/
sudo cp lib/maxent-2.5.2.jar /usr/local/share/java/
sudo cp lib/trove.jar /usr/local/share/java/

Build relex

To build relex run,


Run relex

The full set of options available for running can be found at But, for testing run


you should get an output similar to the following

Info: Using default ./data/wordnet/file_properties.xml
Feb 23, 2016 3:23:19 AM net.didion.jwnl.dictionary.Dictionary doLog
INFO: Installing dictionary net.didion.jwnl.dictionary.FileBackedDictionary@54012da5
; Version: link-grammar-5.3.3	relex-1.6.2
; SENTENCE: [Alice ate the mushroom.]
link-grammar: Info: Dictionary found at /usr/local/share/link-grammar/en/4.0.dict
link-grammar: Info: JNI: dictionary version 5.3.3

Link-parsing: 1118 milliseconds (avg=1118 millisecs, cnt=1)
RelEx processing: 724 milliseconds (avg=724 millisecs, cnt=1)
Alice ate the mushroom.


Parse 1 of 4

(S (NP Alice.f) (VP ate.v-d (NP the mushroom.s)) .)

    +------>WV------>+------Os-----+     |       
    +---Wd---+---Ss--+     +-Ds**c-+     +--RW--+
    |        |       |     |       |     |      |
LEFT-WALL Alice.f ate.v-d the mushroom.s . RIGHT-WALL 

Parse confidence: 0.9821
cost vector = (UNUSED=0.0 DIS=0.0 LEN=6.0)


Dependency relations:

    _obj(eat, mushroom)
    _subj(eat, Alice)


    tense(eat, past)
    penn-POS(eat, VBD)
    pos(eat, verb)
    pos(., punctuation)
    definite-FLAG(mushroom, T)
    penn-POS(mushroom, NN)
    pos(mushroom, noun)
    noun_number(mushroom, singular)
    penn-POS(the, DT)
    pos(the, det)
    gender(Alice, feminine)
    definite-FLAG(Alice, T)
    penn-POS(Alice, NN)
    person-FLAG(Alice, T)
    pos(Alice, noun)
    noun_number(Alice, singular)


Stanford-style dependency relations:

    dobj(ate-2-VBD, mushroom-4-NN)
    nsubj(ate-2-VBD, Alice-1-NN)
    det(mushroom-4-NN, the-3-DT)


Alice ate the mushroom.




For installing using maven on ubuntu, or on Redhat Linux see Building RelEx/alternatives