Commits

Anonymous committed c6ef9ee

update

Comments (0)

Files changed (1)

 """
 
 class StanfordCoreNLPServer(object):
-    """
-    Serve the given object via json-rpc (http://json-rpc.org/)
-    """
+    
     def __init__(self):	
-        print "Initializing Server"
-        jars = ["stanford-corenlp-2010-11-12.jar", "stanford-corenlp-models-2010-11-06.jar",
-        "jgraph.jar", "jgrapht.jar", "xom.jar"]
+        """
+        Checks the location of the jar files.
+        Spawns the server as a process.
+        """
+
+        jars = ["stanford-corenlp-2010-11-12.jar", 
+                "stanford-corenlp-models-2010-11-06.jar",
+                "jgraph.jar",
+                "jgrapht.jar",
+                "xom.jar"]
+
         classname = "edu.stanford.nlp.pipeline.StanfordCoreNLP"
         javapath = "java"
 
             if not os.path.exists(jar):
                 print "Error! Cannot locate %s" % jar
                 sys.exit(1)
-
+        
+        # spawn the server
         self._server = pexpect.spawn("%s -Xmx3g -cp %s %s" % (javapath, ':'.join(jars), classname))
 
+        # show progress bar while loading the models
         widgets = ['Starting Server: ', Fraction(), ' ', Bar(marker=RotatingMarker()), ' ', ETA()]
         pbar = ProgressBar(widgets=widgets, maxval=5, force_update=True).start()
         self._server.expect("done.")
         pbar.update(2)
         self._server.expect("done.")
         pbar.update(3)
-        self._server.expect("done.")
-        pbar.update(4)
-        self._server.expect("done.")
-        pbar.update(5)
         self._server.expect("Entering interactive shell.")
         pbar.finish()
         print self._server.before
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.