parameters: (self, mode=None, 
              configfile=None, configdict=None,
              corenlp_jars=(
                  "/home/sw/corenlp/stanford-corenlp-full-2015-04-20/*",
                  "/home/sw/stanford-srparser-2014-10-23-models.jar",
                  ),
              comm_mode='PIPE',  # SOCKET or PIPE
              server_port=12340, outpipe_filename_prefix="/tmp/corenlp_pywrap_pipe",
              **more_configdict_args
              )
docstring: mode: if you supply this as a single string, we'll use a prebaked set
          of annotators.  if you don't want this, specify either (configfile or
          configdict) and set 'annotators' there.
  
          corenlp_jars: jars for the classpath.  tuple or list of strings.
          this is just passed on to java's "-cp" flag; note that it accepts
          limited use of wildcards.
  
          configfile, configdict: can give a corenlp configuration, either as an
          external file (like the .ini or java properties format, whatever it
          is), or else as a python dictionary.  we just pass it on, though we
          will look at the annotators setting.
  
          Extra keyword arguments are added to the configdict.
          Note you can't pass options with dots in them this way.
  
          server_port: have to specify this if you want to run multple instances
          in separate processes.  todo we should use some other communication
          mechanism that doesnt have to worry about this
docstring_summary: mode: if you supply this as a single string, we'll use a prebaked set
          of annotators.  if you don't want this, specify either (configfile or
          configdict) and set 'annotators' there.
docstring_tokens: mode : if you supply this as a single string we ll use a prebaked set of annotators . if you don t want this specify either ( configfile or configdict ) and set annotators there .
function: def __init__(self, mode=None, 
              configfile=None, configdict=None,
              corenlp_jars=(
                  "/home/sw/corenlp/stanford-corenlp-full-2015-04-20/*",
                  "/home/sw/stanford-srparser-2014-10-23-models.jar",
                  ),
              comm_mode='PIPE',  # SOCKET or PIPE
              server_port=12340, outpipe_filename_prefix="/tmp/corenlp_pywrap_pipe",
              **more_configdict_args
              ):
          """
          mode: if you supply this as a single string, we'll use a prebaked set
          of annotators.  if you don't want this, specify either (configfile or
          configdict) and set 'annotators' there.
  
          corenlp_jars: jars for the classpath.  tuple or list of strings.
          this is just passed on to java's "-cp" flag; note that it accepts
          limited use of wildcards.
  
          configfile, configdict: can give a corenlp configuration, either as an
          external file (like the .ini or java properties format, whatever it
          is), or else as a python dictionary.  we just pass it on, though we
          will look at the annotators setting.
  
          Extra keyword arguments are added to the configdict.
          Note you can't pass options with dots in them this way.
  
          server_port: have to specify this if you want to run multple instances
          in separate processes.  todo we should use some other communication
          mechanism that doesnt have to worry about this
          """
          self.mode = mode
          self.proc = None
          self.server_port = server_port
          self.configfile = configfile
          self.comm_mode = comm_mode
          self.outpipe = None
  
          self.configdict = deepcopy(configdict)
          if not self.configdict: self.configdict = {}
          self.configdict.update(more_configdict_args)
          if not self.configdict: self.configdict = None
  
          if self.comm_mode=='PIPE':
              tag = "pypid=%d_time=%s" % (os.getpid(), time.time())
              self.outpipe = "%s_%s" % (outpipe_filename_prefix, tag)
              assert not os.path.exists(self.outpipe)
  
          assert isinstance(corenlp_jars, (list,tuple))
  
          deglobbed = itertools.chain(*[glob.glob(f) for f in corenlp_jars])
          assert any(os.path.exists(f) for f in deglobbed), "CoreNLP jar files don't seem to exist; are the paths correct?  Searched files: %s" % repr(deglobbed)
  
          local_libdir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                      'lib')
  
          jars = [os.path.join(local_libdir, "*")]
          jars += corenlp_jars
          self.classpath = ':'.join(jars)
          # self.classpath += ":../bin:bin"  ## for eclipse java dev
  
          # LOG.info("CLASSPATH: " + self.classpath)
  
          self.start_server()
          # This probably is only half-reliable, but worth a shot.
          atexit.register(self.cleanup)
function_tokens: def __init__ ( self , mode = None , configfile = None , configdict = None , corenlp_jars = ( "/home/sw/corenlp/stanford-corenlp-full-2015-04-20/*" , "/home/sw/stanford-srparser-2014-10-23-models.jar" , ) , comm_mode = 'PIPE' , # SOCKET or PIPE server_port = 12340 , outpipe_filename_prefix = "/tmp/corenlp_pywrap_pipe" , * * more_configdict_args ) : self . mode = mode self . proc = None self . server_port = server_port self . configfile = configfile self . comm_mode = comm_mode self . outpipe = None self . configdict = deepcopy ( configdict ) if not self . configdict : self . configdict = { } self . configdict . update ( more_configdict_args ) if not self . configdict : self . configdict = None if self . comm_mode == 'PIPE' : tag = "pypid=%d_time=%s" % ( os . getpid ( ) , time . time ( ) ) self . outpipe = "%s_%s" % ( outpipe_filename_prefix , tag ) assert not os . path . exists ( self . outpipe ) assert isinstance ( corenlp_jars , ( list , tuple ) ) deglobbed = itertools . chain ( * [ glob . glob ( f ) for f in corenlp_jars ] ) assert any ( os . path . exists ( f ) for f in deglobbed ) , "CoreNLP jar files don't seem to exist; are the paths correct?  Searched files: %s" % repr ( deglobbed ) local_libdir = os . path . join ( os . path . abspath ( os . path . dirname ( __file__ ) ) , 'lib' ) jars = [ os . path . join ( local_libdir , "*" ) ] jars += corenlp_jars self . classpath = ':' . join ( jars ) # self.classpath += ":../bin:bin"  ## for eclipse java dev # LOG.info("CLASSPATH: " + self.classpath) self . start_server ( ) # This probably is only half-reliable, but worth a shot. atexit . register ( self . cleanup )