forked from opencog/relex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
276 lines (247 loc) · 12.5 KB
/
build.xml
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="relex">
<property name="VERSION" value="1.5"/> <!-- this is relex version 1.5.1 -->
<property name="REVISION" value="1.5.1"/> <!-- this is relex version 1.5.1 -->
<!-- <property name="PREFIX" value="${basedir}/lib"/> -->
<property name="PREFIX" value="/usr/share/java"/>
<property name="ALTPREFIX" value="/usr/local/share/java"/>
<property name="INSTALLDIR" value="/usr/local/share/java"/>
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.5"/> <!-- this 1.5 is java, not relex -->
<property name="source" value="1.5"/> <!-- this 1.5 is java, not relex -->
<path id="relex.classpath">
<pathelement location="bin"/>
<!-- Mandatory packages -->
<pathelement location="${PREFIX}/linkgrammar.jar"/>
<pathelement location="${PREFIX}/gnu-getopt.jar"/>
<pathelement location="${PREFIX}/java-getopt-1.0.13.jar"/>
<pathelement location="${PREFIX}/jwnl.jar"/>
<pathelement location="${PREFIX}/jwnl-1.4rc2.jar"/>
<pathelement location="${PREFIX}/jwnl-1.3.3.jar"/>
<!-- Packages required by mandatory JWNL -->
<pathelement location="${PREFIX}/commons-logging.jar"/>
<!-- Packages required by optional OpenNLP -->
<pathelement location="${PREFIX}/opennlp-tools-1.5.3.jar"/>
<pathelement location="${PREFIX}/opennlp-tools-1.5.0.jar"/>
<pathelement location="${PREFIX}/opennlp-tools-1.4.3.jar"/>
<pathelement location="${PREFIX}/maxent-3.0.3.jar"/>
<pathelement location="${PREFIX}/maxent-2.5.2.jar"/>
<pathelement location="${PREFIX}/trove.jar"/>
<!-- OpenNLP-1.4 and older require xerces -->
<pathelement location="${PREFIX}/xercesImpl.jar"/>
<!-- Mandatory packages -->
<pathelement location="${ALTPREFIX}/linkgrammar.jar"/>
<pathelement location="${ALTPREFIX}/gnu-getopt.jar"/>
<pathelement location="${ALTPREFIX}/jwnl.jar"/>
<pathelement location="${ALTPREFIX}/jwnl-1.4rc2.jar"/>
<pathelement location="${ALTPREFIX}/jwnl-1.3.3.jar"/>
<!-- Packages required by mandatory JWNL -->
<pathelement location="${ALTPREFIX}/commons-logging.jar"/>
<!-- Packages required by optional OpenNLP -->
<pathelement location="${ALTPREFIX}/opennlp-tools-1.5.3.jar"/>
<pathelement location="${ALTPREFIX}/opennlp-tools-1.5.0.jar"/>
<pathelement location="${ALTPREFIX}/opennlp-tools-1.4.3.jar"/>
<pathelement location="${ALTPREFIX}/maxent-3.0.3.jar"/>
<pathelement location="${ALTPREFIX}/maxent-2.5.2.jar"/>
<pathelement location="${ALTPREFIX}/trove.jar"/>
<!-- OpenNLP-1.4 and older require xerces -->
<pathelement location="${ALTPREFIX}/xercesImpl.jar"/>
</path>
<!-- Steps to take on initialization -->
<target name="init">
<mkdir dir="bin"/>
</target>
<!-- conditional compilation, check for OWL -->
<available classname="org.semanticweb.owl.model.OWLClass" classpathref="relex.classpath" property="OWL.present"/>
<target name="look-for-owl" unless="OWL.present">
<echo message="Will not build (optional) OWL output format; org.semanticweb.owl classes not found."/>
</target>
<!-- conditional compilation, check for OpenNLP-1.5 -->
<available classname="opennlp.tools.sentdetect.SentenceModel" classpathref="relex.classpath" property="OpenNLP15.present"/>
<target name="look-for-opennlp-1.5" unless="OpenNLP15.present">
<echo message="Could not find OpenNLP-1.5 classes; looking for OpenNLP-1.4."/>
</target>
<!-- conditional compilation, check for OpenNLP-1.4 or earlier -->
<!-- If 1.5 is found, then make sure that 1.4 is not used!
The API's are incompatible, so the build WILL fail.
Ouch, that hurts! -->
<target name="look-for-opennlp-1.4" unless="OpenNLP15.present" depends="look-for-opennlp-1.5">
<available classname="opennlp.tools.sentdetect.SentenceDetector" classpathref="relex.classpath" property="OpenNLP14.present"/>
<echo message="Looking for (optional) OpenNLP-1.4..."/>
</target>
<target name="look-for-opennlp" depends="look-for-opennlp-1.4">
</target>
<!-- Create a java source file containing the version number by replacing @REVISION@ -->
<target name="build-version">
<echo message="Building RelEx version ${REVISION}"/>
<copy file="src/java/relex/Version.java.in"
tofile="src/java/relex/Version.java"
overwrite="yes">
<filterset>
<filter token="REVISION" value="${REVISION}"/>
</filterset>
</copy>
</target>
<target name="build-project" depends="init, build-version, look-for-owl, look-for-opennlp">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac destdir="bin"
includeantruntime="false"
debug="true" debuglevel="${debuglevel}"
nowarn="true"
source="${source}" target="${target}">
<src path="src/java"/>
<exclude name="**/OWLView.java" unless="OWL.present" />
<exclude name="**/DocSplitterOpenNLP15Impl.java" unless="OpenNLP15.present" />
<exclude name="**/DocSplitterOpenNLP14Impl.java" unless="OpenNLP14.present" />
<classpath refid="relex.classpath"/>
<!-- <compilerarg value="-Wno-deadCode"/> -->
<!-- <compilerarg value="-Wno-unused"/> -->
</javac>
</target>
<target name="build-tests" depends="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin"
includeantruntime="false"
source="${source}" target="${target}">
<src path="src/java_test"/>
<classpath refid="relex.classpath"/>
</javac>
</target>
<!-- Main build target -->
<target name="build" depends="build-subprojects,build-project"/>
<target name="build-subprojects"/>
<!-- help -->
<target name="usage">
<echo message="RelEx build file (build.xml)"/>
<echo message=""/>
<echo message="Avaliable targets are:"/>
<echo message=""/>
<echo message=" build -- generate the relex.jar file (default)"/>
<echo message=" install -- install jar file in ${INSTALLDIR}"/>
<echo message=" test -- run test cases"/>
<echo message=" run -- run a demo of the parser"/>
<echo message=" dist -- create distribution (tar.gz file)"/>
<echo message=" clean -- remove temporary files created by build"/>
</target>
<target depends="usage" name="help"/>
<!-- cleanup -->
<target name="clean">
<delete dir="bin"/>
<delete dir="docs"/>
<delete file="relex-${REVISION}.jar"/>
</target>
<target name="cleanall" depends="clean"/>
<target name="realclean" depends="clean"/>
<!-- Run tests -->
<target name="test" depends="build-tests">
<java classname="relex.test.TestStanford" failonerror="true" fork="yes">
<jvmarg line="-Xmx1024m"/>
<jvmarg line="-Djava.library.path=/usr/lib/jni:/usr/lib:/usr/local/lib/jni:/usr/local/lib"/>
<classpath refid="relex.classpath"/>
<arg line=""/>
</java>
<java classname="relex.test.TestRelEx" failonerror="true" fork="yes">
<jvmarg line="-Xmx1024m"/>
<jvmarg line="-Djava.library.path=/usr/lib/jni:/usr/lib:/usr/local/lib/jni:/usr/local/lib"/>
<classpath refid="relex.classpath"/>
<arg line=""/>
</java>
</target>
<!-- Build a jar file, for public consumption -->
<target name="jar" depends="build-project">
<jar basedir="bin" destfile="relex-${REVISION}.jar">
<manifest>
<attribute name="Implementation-Title" value="RelEx Semantic Relation Extractor"/>
<attribute name="Implementation-URL" value="http://opencog.org/wiki/RelEx"/>
<attribute name="Specification-Version" value="${VERSION}"/>
<attribute name="Implementation-Version" value="${REVISION}"/>
<attribute name="Main-Class" value="relex.RelationExtractor"/>
</manifest>
<fileset file="data/relex-penn-tagging.algs" />
<fileset file="data/relex-semantic.algs" />
<fileset file="data/relex-stanford.algs" />
<fileset file="data/relex-tagging.algs" />
<fileset file="data/wordnet/file_properties.xml" />
<fileset file="data/sentence-detector/EnglishSD.bin.gz" />
<fileset file="data/opennlp/models-1.5/en-sent.bin" />
</jar>
</target>
<!-- Install on user's system -->
<target name="install" depends="jar">
<mkdir dir="${INSTALLDIR}"/>
<copy file="relex-${REVISION}.jar" todir="${INSTALLDIR}"/>
<symlink link="${INSTALLDIR}/relex.jar"
resource="relex-${REVISION}.jar"
overwrite="true" failonerror="false"/>
</target>
<!-- tar file for general distribution -->
<target name="dist">
<tar destfile="r.tar">
<!-- the shell and perl scripts need to be executable -->
<tarfileset dir="." prefix="relex-${REVISION}/"
excludes=".bzr*/**, relex-*/**" mode="755">
<include name="batch-process.sh"/>
<include name="batch-wiki.sh"/>
<include name="doc-splitter.sh"/>
<include name="link-grammar-server.sh"/>
<include name="opencog-server.sh"/>
<include name="parallel-relation-extractor.sh"/>
<include name="relation-extractor.sh"/>
<include name="src/perl/*.pl"/>
<include name="src/perl/*.sh"/>
</tarfileset>
<tarfileset dir="." prefix="relex-${REVISION}/"
excludes=".bzr*/**, relex-*/**">
<include name="AUTHORS"/>
<include name="ChangeLog"/>
<include name="LICENSE"/>
<include name="README"/>
<include name="build.xml"/>
<include name="pom.xml"/>
<include name="test-corpus.txt"/>
<include name="data/relex-penn-tagging.algs"/>
<include name="data/relex-semantic.algs"/>
<include name="data/relex-stanford.algs"/>
<include name="data/relex-tagging.algs"/>
<include name="data/sentence-detector/EnglishSD.bin.gz"/>
<include name="data/opennlp/models-1.5/en-sent.bin" />
<include name="data/wordnet/file_properties.xml"/>
<include name="src/java/relex/anaphora/test-corpus.txt"/>
<include name="**/README"/>
<include name="**/*.java"/>
<include name="**/*.java.in"/>
</tarfileset>
</tar>
<gzip destfile="relex-${REVISION}.tar.gz" src="r.tar"/>
<delete file="r.tar"/>
</target>
<!-- make documentation -->
<target name="javadoc">
<mkdir dir="docs" />
<javadoc packagenames="relex.*"
sourcepath="src/java"
destdir="docs"
version="true"
splitindex="true"
noindex="false"
windowtitle="RelEx"
doctitle="RelEx Dependency Relation Extractor version $VERSION"
bottom="Copyright © 2005-2009 Mike Ross, Linas Vepstas and others."
/>
</target>
<!-- demo example run -->
<target name="run" depends="build-project">
<java classname="relex.RelationExtractor" failonerror="true" fork="yes">
<jvmarg line="-Xmx1024m"/>
<jvmarg line="-Djava.library.path=/usr/lib/jni:/usr/lib:/usr/local/lib/jni:/usr/local/lib"/>
<jvmarg line="-Drelex.pennalgpath=data/relex-penn-tagging.algs"/>
<jvmarg line="-Drelex.semalgpath=data/relex-semantic.algs"/>
<jvmarg line="-Drelex.sfalgpath=data/relex-stanford.algs"/>
<jvmarg line="-Drelex.tagalgpath=data/relex-tagging.algs"/>
<jvmarg line="-Dwordnet.configfile=data/wordnet/file_properties.xml"/>
<classpath refid="relex.classpath"/>
<arg line="-n 4 -l -t -f -s 'Alice wrote a book about dinosaurs for the University of California in Berkeley.'"/>
</java>
</target>
</project>