Git Product home page Git Product logo

python-vncorenlp's Introduction

python-vncorenlp

PyPI PyPI - Python Version

A Python wrapper for VnCoreNLP using a bidirectional communication channel.

Table Of Contents

Prerequisites

Installation

You can install this package from PyPI using pip:

$ [sudo] pip install vncorenlp

For Windows users, please ensure that you run the Command Prompt with admin privileges.

Example Usage

A simple example of how to use vncorenlp:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging

from vncorenlp import VnCoreNLP


def simple_usage():
    # Uncomment this line for debugging
    # logging.basicConfig(level=logging.DEBUG)

    vncorenlp_file = r'.../VnCoreNLP-1.0.1/VnCoreNLP-1.0.1.jar'

    sentences = 'VTV đồng ý chia sẻ bản quyền World Cup 2018 cho HTV để khai thác. ' \
                'Nhưng cả hai nhà đài đều phải chờ sự đồng ý của FIFA mới thực hiện được điều này.'

    # Use "with ... as" to close the server automatically
    with VnCoreNLP(vncorenlp_file) as vncorenlp:
        print('Tokenizing:', vncorenlp.tokenize(sentences))
        print('POS Tagging:', vncorenlp.pos_tag(sentences))
        print('Named-Entity Recognizing:', vncorenlp.ner(sentences))
        print('Dependency Parsing:', vncorenlp.dep_parse(sentences))
        print('Annotating:', vncorenlp.annotate(sentences))
        print('Language:', vncorenlp.detect_language(sentences))

    # In this way, you have to close the server manually by calling close function
    vncorenlp = VnCoreNLP(vncorenlp_file)

    print('Tokenizing:', vncorenlp.tokenize(sentences))
    print('POS Tagging:', vncorenlp.pos_tag(sentences))
    print('Named-Entity Recognizing:', vncorenlp.ner(sentences))
    print('Dependency Parsing:', vncorenlp.dep_parse(sentences))
    print('Annotating:', vncorenlp.annotate(sentences))
    print('Language:', vncorenlp.detect_language(sentences))

    # Do not forget to close the server
    vncorenlp.close()


if __name__ == '__main__':
    simple_usage()

And here is the output:

Tokenizing:
[
    ['VTV', 'đồng_ý', 'chia_sẻ', 'bản_quyền', 'World_Cup', '2018', 'cho', 'HTV', 'để', 'khai_thác', '.'],
    ['Nhưng', 'cả', 'hai', 'nhà', 'đài', 'đều', 'phải', 'chờ', 'sự', 'đồng_ý', 'của', 'FIFA', 'mới', 'thực_hiện', 'được', 'điều', 'này', '.']
]
 
 
POS Tagging:
[
    [('VTV', 'Ny'), ('đồng_ý', 'V'), ('chia_sẻ', 'V'), ('bản_quyền', 'N'), ('World_Cup', 'N'), ('2018', 'M'), ('cho', 'E'), ('HTV', 'Ny'), ('để', 'E'), ('khai_thác', 'V'), ('.', 'CH')],
    [('Nhưng', 'C'), ('cả', 'P'), ('hai', 'M'), ('nhà', 'N'), ('đài', 'N'), ('đều', 'R'), ('phải', 'V'), ('chờ', 'V'), ('sự', 'Nc'), ('đồng_ý', 'V'), ('của', 'E'), ('FIFA', 'Np'), ('mới', 'R'), ('thực_hiện', 'V'), ('được', 'R'), ('điều', 'N'), ('này', 'P'), ('.', 'CH')]
]
 
 
Named-Entity Recognizing:
[
    [('VTV', 'O'), ('đồng_ý', 'O'), ('chia_sẻ', 'O'), ('bản_quyền', 'O'), ('World_Cup', 'O'), ('2018', 'O'), ('cho', 'O'), ('HTV', 'O'), ('để', 'O'), ('khai_thác', 'O'), ('.', 'O')],
    [('Nhưng', 'O'), ('cả', 'O'), ('hai', 'O'), ('nhà', 'O'), ('đài', 'O'), ('đều', 'O'), ('phải', 'O'), ('chờ', 'O'), ('sự', 'O'), ('đồng_ý', 'O'), ('của', 'O'), ('FIFA', 'B-ORG'), ('mới', 'O'), ('thực_hiện', 'O'), ('được', 'O'), ('điều', 'O'), ('này', 'O'), ('.', 'O')]
]
 
 
Dependency Parsing:
[
    [('sub', 2, 1), ('root', 0, 2), ('vmod', 2, 3), ('dob', 3, 4), ('nmod', 4, 5), ('det', 5, 6), ('iob', 3, 7), ('pob', 7, 8), ('prp', 3, 9), ('vmod', 9, 10), ('punct', 2, 11)],
    [('dep', 7, 1), ('nmod', 4, 2), ('det', 4, 3), ('sub', 7, 4), ('nmod', 4, 5), ('adv', 7, 6), ('root', 0, 7), ('vmod', 7, 8), ('dob', 8, 9), ('nmod', 9, 10), ('nmod', 9, 11), ('pob', 11, 12), ('adv', 14, 13), ('vmod', 7, 14), ('adv', 14, 15), ('dob', 14, 16), ('det', 16, 17), ('punct', 7, 18)]
]
 
 
Annotating:
{
  "sentences": [
    [
      {
        "index": 1,
        "form": "VTV",
        "posTag": "Ny",
        "nerLabel": "O",
        "head": 2,
        "depLabel": "sub"
      },
      {
        "index": 2,
        "form": "đồng_ý",
        "posTag": "V",
        "nerLabel": "O",
        "head": 0,
        "depLabel": "root"
      },
      {
        "index": 3,
        "form": "chia_sẻ",
        "posTag": "V",
        "nerLabel": "O",
        "head": 2,
        "depLabel": "vmod"
      },
      {
        "index": 4,
        "form": "bản_quyền",
        "posTag": "N",
        "nerLabel": "O",
        "head": 3,
        "depLabel": "dob"
      },
      {
        "index": 5,
        "form": "World_Cup",
        "posTag": "N",
        "nerLabel": "O",
        "head": 4,
        "depLabel": "nmod"
      },
      {
        "index": 6,
        "form": "2018",
        "posTag": "M",
        "nerLabel": "O",
        "head": 5,
        "depLabel": "det"
      },
      {
        "index": 7,
        "form": "cho",
        "posTag": "E",
        "nerLabel": "O",
        "head": 3,
        "depLabel": "iob"
      },
      {
        "index": 8,
        "form": "HTV",
        "posTag": "Ny",
        "nerLabel": "O",
        "head": 7,
        "depLabel": "pob"
      },
      {
        "index": 9,
        "form": "để",
        "posTag": "E",
        "nerLabel": "O",
        "head": 3,
        "depLabel": "prp"
      },
      {
        "index": 10,
        "form": "khai_thác",
        "posTag": "V",
        "nerLabel": "O",
        "head": 9,
        "depLabel": "vmod"
      },
      {
        "index": 11,
        "form": ".",
        "posTag": "CH",
        "nerLabel": "O",
        "head": 2,
        "depLabel": "punct"
      }
    ],
    [
      {
        "index": 1,
        "form": "Nhưng",
        "posTag": "C",
        "nerLabel": "O",
        "head": 7,
        "depLabel": "dep"
      },
      {
        "index": 2,
        "form": "cả",
        "posTag": "P",
        "nerLabel": "O",
        "head": 4,
        "depLabel": "nmod"
      },
      {
        "index": 3,
        "form": "hai",
        "posTag": "M",
        "nerLabel": "O",
        "head": 4,
        "depLabel": "det"
      },
      {
        "index": 4,
        "form": "nhà",
        "posTag": "N",
        "nerLabel": "O",
        "head": 7,
        "depLabel": "sub"
      },
      {
        "index": 5,
        "form": "đài",
        "posTag": "N",
        "nerLabel": "O",
        "head": 4,
        "depLabel": "nmod"
      },
      {
        "index": 6,
        "form": "đều",
        "posTag": "R",
        "nerLabel": "O",
        "head": 7,
        "depLabel": "adv"
      },
      {
        "index": 7,
        "form": "phải",
        "posTag": "V",
        "nerLabel": "O",
        "head": 0,
        "depLabel": "root"
      },
      {
        "index": 8,
        "form": "chờ",
        "posTag": "V",
        "nerLabel": "O",
        "head": 7,
        "depLabel": "vmod"
      },
      {
        "index": 9,
        "form": "sự",
        "posTag": "Nc",
        "nerLabel": "O",
        "head": 8,
        "depLabel": "dob"
      },
      {
        "index": 10,
        "form": "đồng_ý",
        "posTag": "V",
        "nerLabel": "O",
        "head": 9,
        "depLabel": "nmod"
      },
      {
        "index": 11,
        "form": "của",
        "posTag": "E",
        "nerLabel": "O",
        "head": 9,
        "depLabel": "nmod"
      },
      {
        "index": 12,
        "form": "FIFA",
        "posTag": "Np",
        "nerLabel": "B-ORG",
        "head": 11,
        "depLabel": "pob"
      },
      {
        "index": 13,
        "form": "mới",
        "posTag": "R",
        "nerLabel": "O",
        "head": 14,
        "depLabel": "adv"
      },
      {
        "index": 14,
        "form": "thực_hiện",
        "posTag": "V",
        "nerLabel": "O",
        "head": 7,
        "depLabel": "vmod"
      },
      {
        "index": 15,
        "form": "được",
        "posTag": "R",
        "nerLabel": "O",
        "head": 14,
        "depLabel": "adv"
      },
      {
        "index": 16,
        "form": "điều",
        "posTag": "N",
        "nerLabel": "O",
        "head": 14,
        "depLabel": "dob"
      },
      {
        "index": 17,
        "form": "này",
        "posTag": "P",
        "nerLabel": "O",
        "head": 16,
        "depLabel": "det"
      },
      {
        "index": 18,
        "form": ".",
        "posTag": "CH",
        "nerLabel": "O",
        "head": 7,
        "depLabel": "punct"
      }
    ]
  ]
}
 
 
Language: vi

Use An Existing Server

I highly recommend you to use this approach to save your time when you are debugging your code.

First, you need to start the VnCoreNLPServer using this command:

$ vncorenlp -Xmx2g <VnCoreNLP File> -p 9000 -a "wseg,pos,ner,parse"

The parameter -Xmx2g means that the VM can allocate a maximum of 2 GB for the Heap Space.

And then connect to the server using this code:

# Use the existing server
with VnCoreNLP(address='http://127.0.0.1', port=9000) as vncorenlp:
    ...

Debug

There are 3 ways to enable debugging:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
import sys

from vncorenlp import VnCoreNLP


# 1. Use the global logger
# logging.basicConfig(level=logging.DEBUG)

def simple_usage():
    vncorenlp_file = r'.../VnCoreNLP-1.0.1/VnCoreNLP-1.0.1.jar'

    sentences = 'VTV đồng ý chia sẻ bản quyền World Cup 2018 cho HTV để khai thác. ' \
                'Nhưng cả hai nhà đài đều phải chờ sự đồng ý của FIFA mới thực hiện được điều này.'

    # Use "with ... as" to close the server automatically
    vncorenlp = VnCoreNLP(vncorenlp_file)

    # 2. Set up the local logger here
    logger = vncorenlp.logger
    logger.setLevel(logging.DEBUG)
    # Add stdout
    ch = logging.StreamHandler(sys.stdout)
    ch.setLevel(logging.DEBUG)
    # Add formatter
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)

    with vncorenlp:
        print('Tokenizing:', vncorenlp.tokenize(sentences))
        print('POS Tagging:', vncorenlp.pos_tag(sentences))
        print('Named-Entity Recognizing:', vncorenlp.ner(sentences))
        print('Dependency Parsing:', vncorenlp.dep_parse(sentences))
        print('Annotating:', vncorenlp.annotate(sentences))
        print('Language:', vncorenlp.detect_language(sentences))

    # In this way, you have to close the server manually by calling close function
    vncorenlp = VnCoreNLP(vncorenlp_file)

    # 3. Set up the local logger here
    logger = vncorenlp.logger
    logger.setLevel(logging.DEBUG)
    # Add stdout
    ch = logging.StreamHandler(sys.stdout)
    ch.setLevel(logging.DEBUG)
    # Add formatter
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)

    print('Tokenizing:', vncorenlp.tokenize(sentences))
    print('POS Tagging:', vncorenlp.pos_tag(sentences))
    print('Named-Entity Recognizing:', vncorenlp.ner(sentences))
    print('Dependency Parsing:', vncorenlp.dep_parse(sentences))
    print('Annotating:', vncorenlp.annotate(sentences))
    print('Language:', vncorenlp.detect_language(sentences))

    # Do not forget to close the server
    vncorenlp.close()


if __name__ == '__main__':
    simple_usage()

Some Use Cases

#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging

from vncorenlp import VnCoreNLP

logging.basicConfig(level=logging.DEBUG)


def simple_usage():
    vncorenlp_file = r'.../VnCoreNLP-1.0.1/VnCoreNLP-1.0.1.jar'

    sentences = 'VTV đồng ý chia sẻ bản quyền World Cup 2018 cho HTV để khai thác. ' \
                'Nhưng cả hai nhà đài đều phải chờ sự đồng ý của FIFA mới thực hiện được điều này.'

    # Use only word segmentation
    with VnCoreNLP(vncorenlp_file, annotators="wseg") as vncorenlp:
        print('Tokenizing:', vncorenlp.tokenize(sentences))

    # Specify the maximum heap size
    with VnCoreNLP(vncorenlp_file, annotators="wseg", max_heap_size='-Xmx4g') as vncorenlp:
        print('Tokenizing:', vncorenlp.tokenize(sentences))

    # For debugging
    with VnCoreNLP(vncorenlp_file, annotators="wseg", max_heap_size='-Xmx4g', quiet=False) as vncorenlp:
        print('Tokenizing:', vncorenlp.tokenize(sentences))


if __name__ == '__main__':
    simple_usage()

License

MIT

python-vncorenlp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-vncorenlp's Issues

raise FileNotFoundError, even when java have been installed

I have tried your example code but there was an issue

File "<stdin>", line 2, in <module>
  File "/home/cpu10508-local/.virtualenvs/dl4cv/lib/python3.5/site-packages/vncorenlp/vncorenlp.py", line 53, in __init__
    raise FileNotFoundError('Java was not found, please install JRE or JDK 1.8 first.')

I have installed java though

>>> import os
>>> os.system("java -version")
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
0

Form too large error with VncoreNLPServer

I got this problem when tokenizing data using vncorenlp python, and it work fine until it reach 1 of the line in the data file.

org.eclipse.jetty.http.BadMessageException: 400: Unable to parse form content at org.eclipse.jetty.server.Request.getParameters(Request.java:380) at org.eclipse.jetty.server.Request.getParameter(Request.java:1021) at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:194) at spark.Request.queryParams(Request.java:283) at spark.http.matching.RequestWrapper.queryParams(RequestWrapper.java:141) at vncorenlp.VnCoreNLPServer.handle(VnCoreNLPServer.java:247) at vncorenlp.VnCoreNLPServer.lambda$3(VnCoreNLPServer.java:184) at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47) at spark.http.matching.Routes.execute(Routes.java:61) at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130) at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:530) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.IllegalStateException: Form too large: 250544 > 200000 at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:523) at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:461) at org.eclipse.jetty.server.Request.getParameters(Request.java:376)

Best regards

Server unable to process multiple requests

Hi,
I am facing an issue with the VnCoreNLP server (the Java server) when I create multiple requests using goroutines. It would be great if you could please take a look:

ERROR VnCoreNLPServer - null
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at vncorenlp.VnCoreNLPServer.annotate(VnCoreNLPServer.java:237)
at vncorenlp.VnCoreNLPServer.handle(VnCoreNLPServer.java:270)
at vncorenlp.VnCoreNLPServer.lambda$3(VnCoreNLPServer.java:184)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:530)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at marmot.util.Encoder.append(Encoder.java:68)
at marmot.morph.MorphWeightVector.extractTransitionFeatures(MorphWeightVector.java:584)
at marmot.core.SimpleTagger.addTransitions(SimpleTagger.java:73)
at marmot.core.SimpleTagger.getSumLattice(SimpleTagger.java:407)
at marmot.core.SimpleTagger.tag_states(SimpleTagger.java:565)
at marmot.morph.MorphTagger.tagWithLemma(MorphTagger.java:49)
at vn.corenlp.postagger.PosTagger.tagSentence(PosTagger.java:52)
at vn.pipeline.Sentence.createWords(Sentence.java:60)
at vn.pipeline.Sentence.init(Sentence.java:53)
at vn.pipeline.Sentence.(Sentence.java:30)

corrupted jar

Hey man, nice work! Just for you to double check the file VnCoreNLPServer.jar is probably corrupted.

Cannot start server

I'm starting server using this line

vncorenlp -Xmx2g ../out/VnCoreNLP-1.1.jar -p 9000 -a "wseg"

However, I got this error
2019-05-04 01.57.19 INFO VnCoreNLPServer - Using annotators: wseg 2019-05-04 01:57:19 INFO WordSegmenter:24 - Loading Word Segmentation model 2019-05-04 01.57.19 ERROR VnCoreNLPServer - null java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at vncorenlp.VnCoreNLPServer.loadVnCoreNLP(VnCoreNLPServer.java:79) at vncorenlp.VnCoreNLPServer.main(VnCoreNLPServer.java:175) Caused by: java.io.IOException: WordSegmenter: ../out/models/wordsegmenter/wordsegmenter.rdr is not found! at vn.corenlp.wordsegmenter.WordSegmenter.<init>(WordSegmenter.java:27) at vn.corenlp.wordsegmenter.WordSegmenter.initialize(WordSegmenter.java:34) ... 6 more

How to use

When I run the code:
vncorenlp = VnCoreNLP('path/to/VnCoreNLP-1.0.1.jar')
in python shell, I got this output and this command never end.

image

ArrayIndexOutOfBoundsException when multithreading call

When I submit multiple requests async to VnCoreNLPServer I got ArrayIndexOutOfBoundsException: -1

2019-11-05 15:39:37,233 [qtp950350040-18] ERROR vncorenlp.VnCoreNLPServer.handle(VnCoreNLPServer.java:278) - -1
java.lang.ArrayIndexOutOfBoundsException: -1
	at marmot.util.Encoder.append(Encoder.java:68)
	at marmot.morph.MorphWeightVector.extractStateFeatures(MorphWeightVector.java:366)
	at marmot.core.SimpleTagger.getStates(SimpleTagger.java:181)
	at marmot.core.SimpleTagger.getSumLattice(SimpleTagger.java:322)
	at marmot.core.SimpleTagger.tag_states(SimpleTagger.java:565)
	at marmot.morph.MorphTagger.tagWithLemma(MorphTagger.java:49)
	at vn.corenlp.postagger.PosTagger.tagSentence(PosTagger.java:52)
	at vn.pipeline.Sentence.createWords(Sentence.java:60)
	at vn.pipeline.Sentence.init(Sentence.java:53)
	at vn.pipeline.Sentence.<init>(Sentence.java:30)
	at vncorenlp.VnCoreNLPServer.annotate(VnCoreNLPServer.java:236)
	at vncorenlp.VnCoreNLPServer.handle(VnCoreNLPServer.java:269)
	at vncorenlp.VnCoreNLPServer.lambda$main$2(VnCoreNLPServer.java:178)
	at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
	at spark.http.matching.Routes.execute(Routes.java:61)
	at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:134)
	at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1671)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:505)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
	at java.lang.Thread.run(Thread.java:748)

How to start server

Hi,

Thank for this awesome toolkit @dnanhkhoa ,

Could you please show me how to run your toolkit as a service so I can send request to it when using python?

I follow the instruction in this link but when I enter the command vncorenlp -Xmx2g E:\Data\Projects\MobiFone5\NLP\VnCoreNLP-master\VnCoreNLP-1.1.jar -p 9000 -a "wseg,pos,ner,parse" into command prompt, it returns 'vncorenlp' is not recognized as an internal or external command, operable program or batch file.

How can I run this command properly?

command prompt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.