forked from opencog/relex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opencog-server.sh
executable file
·61 lines (51 loc) · 1.97 KB
/
opencog-server.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
55
56
57
58
59
#!/bin/bash
#
# opencog-server.sh: read from socket, generate opencog output.
#
# This script starts a RelEx server that listens for plain-text input
# (English sentences) on port 4444. It then parses the text, and
# returns opencog output on the same socket. The end of the parse is
# demarcated with an ; END OF SENTENCE token.
#
# It is intended that this server be used entirely from within OpenCog
# (primarily by the OpenCog chatbot), to parse text. It is not intended
# for general, manual use.
#
# Example usage:
# ./opencog-server.sh &
# telnet localhost 4444
# This is a test
# ^]q
#
export LANG=en_US.UTF-8
VM_OPTS="-Xmx1024m"
RELEX_OPTS="\
-Djava.library.path=/usr/lib:/usr/lib/jni:/usr/local/lib:/usr/local/lib/jni \
-Drelex.algpath=data/relex-semantic.algs \
-Dwordnet.configfile=data/wordnet/file_properties.xml \
"
CLASSPATH="-classpath \
bin:\
/usr/local/share/java/opennlp-tools-1.5.0.jar:\
/usr/local/share/java/maxent-3.0.0.jar:\
/usr/local/share/java/maxent-2.5.2.jar:\
/usr/local/share/java/maxent-2.4.0.jar:\
/usr/local/share/java/trove.jar:\
/usr/local/share/java/jwnl-1.4rc2.jar:\
/usr/local/share/java/jwnl.jar:\
/usr/share/java/commons-logging.jar:\
/usr/share/java/gnu-getopt.jar:\
/usr/share/java/linkgrammar.jar:\
/usr/local/share/java/linkgrammar.jar:\
"
# Return with RelEx2Logic, Link Grammar, and Relex output on default port 4444.
java $VM_OPTS $RELEX_OPTS $CLASSPATH relex.Server --link --relex --logic
# This will return parsed text on the input socket.
# java $VM_OPTS $RELEX_OPTS $CLASSPATH relex.Server --relex
# Return Link Grammar and Relex output.
# java $VM_OPTS $RELEX_OPTS $CLASSPATH relex.Server --link --relex --verbose
# Like the above, but listens on a non-default port
# java $VM_OPTS $RELEX_OPTS $CLASSPATH relex.Server --logic --port 4242
# Like the above, but sents the output to a different host, instead of
# replying on the same socket.
# java $VM_OPTS $RELEX_OPTS $CLASSPATH relex.Server --logic --port 4242 --host somewhere.com:17001