Commits

Felix_Remmel  committed cda62b9

Added optional usage of environment variable for looking up the stanford corenlp directory.
Also increased the timeout for loading the stanford parser, because on slower computers 30 seconds is too fast and an exception will be thrown.

  • Participants
  • Parent commits c03f5e5

Comments (0)

Files changed (1)

File corenlp/corenlp.py

 WORD_PATTERN = re.compile('\[([^\]]+)\]')
 CR_PATTERN = re.compile(r"\((\d*),(\d)*,\[(\d*),(\d*)\)\) -> \((\d*),(\d)*,\[(\d*),(\d*)\)\), that is: \"(.*)\" -> \"(.*)\"")
 
-DIRECTORY = "stanford-corenlp-full-2013-06-20"
-
+if os.environ.has_key("CORENLP"):
+    DIRECTORY = os.environ["CORENLP"]
+else:
+    DIRECTORY = "stanford-corenlp-full-2013-06-20"
 
 class bc:
     HEADER = '\033[95m'
     def _spawn_corenlp(self):
         if VERBOSE:
             print self.start_corenlp
-        self.corenlp = pexpect.spawn(self.start_corenlp, maxread=8192, searchwindowsize=80)
+        self.corenlp = pexpect.spawn(self.start_corenlp, timeout=60, maxread=8192, searchwindowsize=80)
 
         # show progress bar while loading the models
         if VERBOSE: