Beispiel #1
0
    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
Beispiel #3
0
    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()
Beispiel #5
0
    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()
Beispiel #6
0
    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
Beispiel #7
0
    def __init__(self):

        print "calling constructor"

        # launches java gateway server.
        self.gateway_server = GateWayServer()

        self.gateway = JavaGateway()

        # limit how long to wait for connection to gateway to be available.
        kill_time = 20
        init_time = time.time()

        while True:

            if time.time() - init_time > kill_time:
                exit("\ncould not establish connection to gateway...")

            try:
                self.tokenizer = self.gateway.entry_point.getOpenNlpTokenizer()
                break
            except:
                continue