예제 #1
0
def getClient():
    socket = TSocket.TSocket('localhost', port)
    socket.setTimeout(10000)
    transport = TTransport.TBufferedTransport(socket)
    protocol = TBinaryProtocol.TBinaryProtocol(transport)
    client = StanfordCoreNLP.Client(protocol)
    transport.open()
    return client
예제 #2
0
    u'.'
]

ahs_test = "And be it further enacted, That the seat of government of said Territory is hereby located temporarily at Fort Leavenworth; and that such portions of the public buildings as may not be actually used and needed for military purposes, may be occupied and used, under the direction of the Governor and Legislative Assembly, for such public purposes as may be required under the provisions of this act."

# Make socket
transport = TSocket.TSocket(server, port)

# Buffering is critical. Raw sockets are very slow
transport = TTransport.TBufferedTransport(transport)

# Wrap in a protocol
protocol = TBinaryProtocol.TBinaryProtocol(transport)

# Create a client to use the protocol encoder
client = StanfordCoreNLP.Client(protocol)

# Connect!
transport.open()

# This list is for options for how we'd like the output formatted.  See README.md for the full list of possible options.
# Note that the DEFAULT is what you would get if you specified "oneline" on the command line, or "None" here.
# You have to pass in something, and unfortunately it doesn't seem like that something can be None or an empty list.
# See http://diwakergupta.github.io/thrift-missing-guide/#_defining_structs for a possible explanation as to why...
# So, the following examples are VALID values for the second argument to these parse_* methods.
# (There are, of course, many more valid combinations depending on what the Stanford Parser supports.)
#outputOptions = ["-outputFormat", "typedDependencies,penn", "-outputFormatOptions", "basicDependencies"]
outputOptions = ["-outputFormat", "oneline"]
#outputOptions = ["-outputFormat", "typedDependencies"]
'''
try: