vncorenlp / VnCoreNLP

A Vietnamese natural language processing toolkit (NAACL 2018)
Other
587 stars 145 forks source link

How to Use toolkit as a service for Python users #18

Closed manhnguyenquoc closed 5 years ago

manhnguyenquoc commented 5 years ago

Hi,

Thank for this awesome toolkit @vncorenlp ,

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

qhungngo commented 5 years ago

Hi,

This message means that the OS can not understand/find vncorenlp. According to guide, you might run install command: pip3 install vncorenlp Then, in python you can check the location of lib by code:

import sysconfig
sysconfig.get_paths()['purelib']

Output can be: C:\ProgramData\Anaconda3\Lib\site-packages So, the excute file will be here: c:\ProgramData\Anaconda3\Scripts\vncorenlp.exe And the python scrip will be here: c:\ProgramData\Anaconda3\Lib\site-packages\vncorenlp\vncorenlp.py

You can replace vncorenlp by c:\ProgramData\Anaconda3\Scripts\vncorenlp.exe, and even update python file to change configure for JAVA and server port.

Good luck.