-
Notifications
You must be signed in to change notification settings - Fork 35
/
run-test.sh
55 lines (47 loc) · 2.32 KB
/
run-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
jarpath=berkeley-entity-1.0.jar
mkdir test/scratch
mkdir test/preprocessed
mkdir test/coref
mkdir test/corefner
mkdir test/joint
# Preprocess the data, no NER
if [ ! -f test/preprocessed/government.txt ]; then
echo "RUNNING PREPROCESSING"
java -Xmx2g -cp $jarpath edu.berkeley.nlp.entity.preprocess.PreprocessingDriver ++config/base.conf -execDir test/scratch/preprocess -inputDir test/text -outputDir test/preprocessed
else
echo "Skipping preprocessing..."
fi
# The following commands demonstrate running:
# 1) the coref system in isolation
# 2) the coref + NER system
# 3) the full joint system
# Note that the joint system does not depend on either of the earlier two;
# this is merely meant to demonstrate possible modes of operation.
# Run the coreference system
if [ ! -f test/coref/government.txt-0.pred_conll ]; then
echo "RUNNING COREF"
java -Xmx2g -cp $jarpath edu.berkeley.nlp.entity.Driver ++config/base.conf -execDir test/scratch/coref -mode COREF_PREDICT -modelPath models/coref-onto.ser.gz -testPath test/preprocessed -outputPath test/coref -corefDocSuffix ""
else
echo "Skipping coref..."
fi
# Run the coref+NER system
if [ ! -f test/corefner/output.conll ]; then
echo "RUNNING COREF+NER"
java -Xmx6g -cp $jarpath edu.berkeley.nlp.entity.Driver ++config/base.conf -execDir test/scratch/corefner -mode PREDICT -modelPath models/corefner-onto.ser.gz -testPath test/preprocessed
cp test/scratch/corefner/output*.conll test/corefner/
else
echo "Skipping coref+ner..."
fi
# Run the full joint system
# Now run the joint prediction
if [ ! -f test/joint/output.conll ]; then
echo "RUNNING COREF+NER+WIKI"
# First, need to extract the subset of Wikipedia relevant to these documents. We have already
# done this to avoid having. Here is the command used:
#java -Xmx4g -cp $jarpath:lib/bliki-resources edu.berkeley.nlp.entity.wiki.WikipediaInterface -datasetPaths test/preprocessed -docSuffix "" -wikipediaDumpPath data/wikipedia/enwiki-latest-pages-articles.xml -outputPath models/wiki-db-test.ser.gz
java -Xmx8g -cp $jarpath edu.berkeley.nlp.entity.Driver ++config/base.conf -execDir test/scratch/joint -mode PREDICT -modelPath models/joint-onto.ser.gz -testPath test/preprocessed -wikipediaPath models/wiki-db-test.ser.gz
cp test/scratch/joint/output*.conll test/joint/
else
echo "Skipping coref+ner+wiki..."
fi