def __init__(self): # print "\nLoading stanford dependency parser..." # launches java gateway server. GateWayServer.launch_gateway() init_time = time.time() while True: try: self.gateway = JavaGateway(eager_load=True) self.parser = self.gateway.entry_point.getStanfordParserObj() except: if (time.time() - init_time) > 60: exit("Could not load dependencies...") else: time.sleep(5) continue break
def __init__(self): print "calling constructor" #launches java gateway server. GateWayServer.launch_gateway() print "attempting to connect to py4j gateway" self.gateway = JavaGateway() init_time = time.time() self.tokenizer = None while True: if time.time() - init_time > 600: exit("couldn't get py4j server running") try: self.tokenizer = self.gateway.entry_point.getIXATokenizer() break except Py4JNetworkError: time.sleep(60) continue
def __init__(self): print "calling constructor" # launches java gateway server. GateWayServer.launch_gateway() print "attempting to connect to py4j gateway" # time.sleep(30) self.gateway = JavaGateway(eager_load=True) self.tagger = self.gateway.entry_point.getIXANerTagger()
def __init__(self): MetaMapServer.start_server() # launches java gateway server. GateWayServer.launch_gateway() init_time = time.time() while True: try: self.gateway = JavaGateway(eager_load=True) self.metamap = self.gateway.entry_point.getMetaMapObj() except: if (time.time() - init_time) > 60: exit("Could not load necessary dependencies...") else: time.sleep(5) continue break