Building RelEx

From OpenCog
Jump to: navigation, search

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

On Ubuntu

Install dependencies

Run the following steps,

git clone https://github.com/opencog/relex
cd relex
install-scripts/install-ubuntu-dependencies.sh

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 http://sourceforge.net/projects/opennlp/

tar -xvf opennlp-tools-1.5.0.tgz
cd opennlp-tools-1.5.0
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
./build.sh
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,

ant


Run relex

The full set of options available for running can be found at README.md#using-relex. But, for testing run

./relation-extractor.sh

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



    +-----------------Xp-----------------+       
    +------>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)

Attributes:

    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.

====

...
...


Alternatives

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