1. Hiroyoshi Komatsu
  2. corenlp-python

Commits

dustin smith  committed 33828a5

update

  • Participants
  • Parent commits 7a984b6
  • Branches master

Comments (0)

Files changed (1)

File server.py

View file
 
 Dustin Smith, 2011
 """
+import pexpect
 from wsgiref import simple_server
 from webob import Request, Response
 from webob import exc
     def __init__(self):	
         print "Initializing Server"
         jars = ["stanford-corenlp-2010-11-12.jar", "stanford-corenlp-models-2010-11-06.jar",
-        "stanford-corenlp-src-2010-11-06.jar","jgraph.jar", "jgrapht.jar", "xom.jar"]
+        "jgraph.jar", "jgrapht.jar", "xom.jar"]
         classname = "edu.stanford.nlp.pipeline.StanfordCoreNLP"
+        javapath = "java"
 
         for jar in jars:
             if not os.path.exists(jar):
 
         self._server = pexpect.spawn("%s -Xmx3g -cp %s %s" % (javapath, ':'.join(jars), classname))
 
-        widgets = ['Starting Server: ', Fraction(), ' ', Bar(marker=RotatingMarker()), ' ', ETA(), ' ', FileTransferSpeed()]
+        widgets = ['Starting Server: ', Fraction(), ' ', Bar(marker=RotatingMarker()), ' ', ETA(300)]
         pbar = ProgressBar(widgets=widgets, maxval=5, force_update=True).start()
         self._server.expect("done.")
         pbar.update(1)
         pbar.finish()
         print self._server.before
         
-        self._server.expect("NLP> Sentence")
-        
-        if not self._server.returncode == 0:
-            print "Server could not start. Error: "
-            for line in self._server.stderr.readlines(): print "\t", line
-        else:
-            for line in self._server.stdout.readlines(): print "\t", line
-        print "Server", self._server
     
     def __call__(self, environ, start_response):
         req = Request(environ)