Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Imported client.py, README, and JAR of server

  • Loading branch information...
commit df43a3d40b6cfbd156a1984e1c3435c09b7657bf 1 parent 191509e
@turian authored
Showing with 48 additions and 0 deletions.
  1. +28 −0 README
  2. +20 −0 client.py
  3. BIN  tagger_server.jar
View
28 README
@@ -0,0 +1,28 @@
+wget 'http://nlp.stanford.edu/software/stanford-postagger-full-2010-05-26.tgz'
+
+Here you have:
+
+1. a jar archive including the Stanford Postagger XML-RPC service
+2. a python client to test the service
+
+
+How to start the service:
+-----------------------------
+- Copy the tagger_server.jar into "stanford-postagger-full-2010-05-26"
+- Change to directory "stanford-postagger-full-2010-05-26"
+- Type at command prompt:
+ java -classpath /path/to/xmlrpc-1.2-b1.jar;tagger_server.jar;stanford-postagger-2010-05-26.jar edu.stanford.main.MaxentTaggerServer <modelFile> [port]
+
+e.g.
+java -classpath /path/to/xmlrpc-1.2-b1.jar;tagger_server.jar;
+stanford-postagger-2010-05-26.jar edu.stanford.main.MaxentTaggerServer models\left3words-distsim-wsj-0-18.tagger 8050
+
+
+
+Here is the python client, in client.py
+
+Invoke at command prompt:
+python client.py <inputFile> [port]
+
+e.g:
+python client.py /stanford-postagger-full-2010-05-26/sample-input.txt 8050
View
20 client.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# client.py
+
+import xmlrpclib
+import os, sys
+
+PORT = 8000 # default port
+
+assert len(sys.argv) > 1
+
+modelFile = sys.argv[1]
+print "\nInput file: %s\n" %modelFile
+
+if len(sys.argv) > 2:
+ PORT = sys.argv[2]
+
+server = xmlrpclib.ServerProxy('http://127.0.0.1:%s'%PORT)
+txt = open(modelFile).read()
+
+print server.tagger.runTagger(txt)
View
BIN  tagger_server.jar
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.