SpatialRelEx: Spatial Relation Extraction System
A multi-pass sieve classifier for automatically annotating spatial relations between spatial elements in text.
The SpatialRelEx tool has been written in Java and is released as free software.
This repository includes modification for Linux systems. The original repository is jennydsuza9/SpatialRelEx
See also the original README
- External Java libraries (you have to download by yourself)
- Apache Commons IO v2.4
- v2.6 (03/23/2018)
- Stanford CoreNLP
- v3.9.1 (03/23/2018)
- Apache Commons IO v2.4
- SVM-LIGHT-TK. See
src/main/resources/svm_light_TK/README.md
for setting up. - Senna. See
src/main/resources/senna/README.md
for setting up.
After downloading the prerequisite libraries, type the following command to add them to your CLASSPATH.
# Stanford CoreNLP
for file in `find /path/to/stanford-corenlp/ -name "*.jar"`; do export CLASSPATH="$CLASSPATH:`realpath $file`"; done
# Apache Commons IO
for file in `find /path/to/apache-commons-io/ -name "*.jar"`; do export CLASSPATH="$CLASSPATH:`realpath $file`"; done
# WordNet
export CLASSPATH=$CLASSPATH:`pwd`/src/main/resources/jaws-bin.jar
You may write them in your .bashrc
.
Training using SpaceEval dataset
java -Dwordnet.database.dir=main/resources/wordnet-dict/ main.java.spatialrelex.Main -train <YOUR TRAIN DIRECTORY> -dev <YOUR DEVELOPMENT DIRECTORY> -test <YOUR TEST DIRECTORY>
# Sample
java -Dwordnet.database.dir=main/resources/wordnet-dict/ main.java.spatialrelex.Main -train main/resources/space-eval/train -dev main/resources/space-eval/dev -test main/resources/space-eval/test
java -Dwordnet.database.dir=main/resources/wordnet-dict/ main.java.spatialrelex.Main -test <YOUR TEST DIRECTORY>
java -Dwordnet.database.dir=main/resources/wordnet-dict/ main.java.spatialrelex.Main -test main/resources/space-eval/test
The annotated output in both cases will be written to the src/output/
folder.
The relation extraction system is described in:
Sieve-Based Spatial Relation Extraction with Expanding Parse Trees. Jennifer D'Souza and Vincent Ng. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 758–768.
- Replaced windows-style file paths (backslash) with linux style (slash)
- Remove windows binaries from
src/main/resources/