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
|
#!/bin/bash
#
# Shell script to start the link-grammar network server.
#
# Usage: java org.linkgrammar.LGService [-verbose] [-threads n] port [language] [dictPath]
# Start a link-grammar parse server on TCP/IP port. The server returns
# JSON-formatted parse results. Socket input should be a single sentence
# to parse, proceeded by the identifier "text:".
#
# 'port' The TCP port the service should listen to.
# -verbose Generate verbose output.
# -threads Number of concurrent threads/clients allowed (default 1).
# 'language' Language abbreviation (en, ru, de, lt, fr, he, tr, any).
# 'dictPath' Full path to the Link-Grammar dictionaries.
#
# The below starts the server on port 9000. It the port is omitted,
# help text is printed. This server can be contacted directly via
# TCP/IP; for example:
#
# telnet localhost 9000
#
# (Alternately, use netcat instead of telnet). After connecting, type
# in:
#
# text: this is an example sentence to parse
#
# The returned bytes will be a JSON message providing the parses of
# the sentence. By default, the ASCII-art parse of the text is not
# transmitted. This can be obtained by sending messages of the form:
#
# storeDiagramString:true, text: this is a test.
#
# Putting this all together:
#
# echo "text:this is a test" | nc localhost 9000
#
# returns the parse; and
#
# echo "storeDiagramString:true, text:this is a test" | nc localhost 9000
#
# returns the parse and diagram string.
export LANG=en_US.UTF-8
VM_OPTS="-Xmx1024m -Djava.library.path=/usr/lib:/usr/lib/jni:/usr/local/lib:/usr/local/lib/jni"
CLASSPATH="-classpath bin:../../build/bindings/java/bin:../../bindings/java/bin:/usr/share/java/linkgrammar.jar:/usr/local/share/java/linkgrammar.jar"
java $VM_OPTS $CLASSPATH org.linkgrammar.LGService 9000
|