-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·174 lines (133 loc) · 5.12 KB
/
setup
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
ARGOS_ENV=~/env/argos
function setup_dependencies {
echo -e "\n\n\n"
echo -e "$(tput setaf 3)Installing dependencies...$(tput sgr0)"
echo -e "\n\n\n"
# Check if OSX.
if [[ "$OSTYPE" =~ ^darwin ]]
then
brew install rabbitmq
brew install wget
# Redis
brew install redis
# Bzr, for python-dateutil
brew install bzr
# gcc, for building scipy
brew install gcc
brew install gfortran
# PostgreSQL
brew install postgres
# For galaxy
brew tap homebrew/science
brew install hdf5
# Otherwise, assume Linux...
else
# Various python deps and also scipy deps.
sudo apt-get -y install python3 python3-dev python3-setuptools build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties python-pip python-dev
sudo apt-get install python3-pip -y
# This *ensures* scipy deps are there!
sudo apt-get -y build-dep python3-scipy
sudo apt-get install rabbitmq-server -y
sudo apt-get install unzip -y
# Java for the NER server
sudo apt-get install openjdk-7-jre -y
# Required by lxml.
sudo apt-get install libxml2-dev libxslt1-dev python-dev lib32z1-dev -y
# Redis
sudo apt-get install redis-server -y
# Bzr, for python-dateutil
sudo apt-get install bzr -y
# PostgreSQL
sudo apt-get install postgresql postgresql-server-dev-9.3 -y
# For galaxy
sudo apt-get install libhdf5-dev
sudo pip3 install virtualenv
fi
}
function setup_virtualenv {
echo -e "\n\n\n"
echo -e "$(tput setaf 3)Setting up virtual environment...$(tput sgr0)"
echo -e "\n\n\n"
# Setup the Python 3.3 virtualenv.
virtualenv -p `which python3` $ARGOS_ENV --no-site-packages
source $ARGOS_ENV/bin/activate
pip install numpy cython numexpr
pip install -r requirements.txt
}
function setup_nltk {
echo -e "\n\n\n"
echo -e "$(tput setaf 3)Gathering NLTK data...$(tput sgr0)"
echo -e "\n\n\n"
# Download NLTK (Python 3) data.
source $ARGOS_ENV/bin/activate
python -m nltk.downloader wordnet
python -m nltk.downloader stopwords
python -m nltk.downloader punkt
python -m nltk.downloader words
python -m nltk.downloader maxent_treebank_pos_tagger
python -m nltk.downloader maxent_ne_chunker
}
function setup_ner {
echo -e "\n\n\n"
echo -e "$(tput setaf 3)Setting up Stanford NER...$(tput sgr0)"
echo -e "\n\n\n"
wget -O $ARGOS_ENV/ner.zip 'http://nlp.stanford.edu/software/stanford-ner-2013-06-20.zip'
unzip -o $ARGOS_ENV/ner.zip
mv 'stanford-ner-2013-06-20' $ARGOS_ENV/ner
rm $ARGOS_ENV/ner.zip
}
function setup_knowledge {
echo -e "\n\n\n"
echo -e "$(tput setaf 3)Setting up Apache Jena/Fuseki...$(tput sgr0)"
echo -e "\n\n\n"
JENA_VERSION=2.12.1
FUSEKI_VERSION=1.1.1
wget -O $ARGOS_ENV/jena.tar.gz "http://mirrors.gigenet.com/apache//jena/binaries/apache-jena-$JENA_VERSION"
wget -O $ARGOS_ENV/fuseki.tar.gz "http://mirrors.gigenet.com/apache//jena/binaries/jena-fuseki-$FUSEKI_VERSION-distribution.tar.gz"
# Extract only the Jena tools we need directly to jena/.
mkdir $ARGOS_ENV/jena
tar -xzvf $ARGOS_ENV/jena.tar.gz
mv "apache-jena-$JENA_VERSION" $ARGOS_ENV/jena/jena
rm $ARGOS_ENV/jena.tar.gz
tar -xvzf $ARGOS_ENV/fuseki.tar.gz
mv "jena-fuseki-$FUSEKI_VERSION" $ARGOS_ENV/jena/fuseki
rm $ARGOS_ENV/fuseki.tar.gz
# Make a directory to store the TDB (the triple database, i.e.
# the knowledge database).
mkdir -p $ARGOS_ENV/data/knowledge
# Download and digest the DBpedia dumps.
python -c "from argos.core.digester import knowledge; knowledge.download(); knowledge.digest()"
}
function setup_spotlight {
echo -e "\n\n\n"
echo -e "$(tput setaf 3)Setting up DBpedia Spotlight...$(tput sgr0)"
echo -e "\n\n\n"
mkdir -p $ARGOS_ENV/data/spotlight
wget -O $ARGOS_ENV/data/spotlight/en_2+2.tar.gz http://spotlight.sztaki.hu/downloads/en_2+2.tar.gz
tar -xvf $ARGOS_ENV/data/spotlight/en_2+2.tar.gz
mv 'en_2+2' $ARGOS_ENV/data/spotlight
rm $ARGOS_ENV/data/spotlight/en_2+2.tar.gz
wget -O $ARGOS_ENV/data/spotlight/dbpedia-spotlight-0.7.jar http://spotlight.sztaki.hu/downloads/dbpedia-spotlight-0.7.jar
}
echo -e "\n\n\n\n\n"
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "$(tput setaf 6)Welcome to $(tput setaf 3)Argos$(tput setaf 6)!$(tput sgr0)"
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "\n\n\n\n\n"
setup_dependencies
setup_virtualenv
setup_ner
setup_knowledge
setup_nltk
setup_spotlight
./run db:create
./run doc
# Make some folders.
sudo mkdir -p /var/{run,log}/celery
sudo chown -R $USER /var/{run,log}/celery
echo -e "\n\n\n\n\n"
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "$(tput setaf 6)Finished setting up $(tput setaf 3)Argos$(tput setaf 6)!$(tput sgr0)"
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "\n\n\n\n\n"