{"id":18283636,"url":"https://github.com/hhsecond/corenlp_pywrap","last_synced_at":"2025-04-05T07:30:59.593Z","repository":{"id":62564830,"uuid":"64291949","full_name":"hhsecond/corenlp_pywrap","owner":"hhsecond","description":"Powerfull python wrapper for Stanford CoreNLP project","archived":false,"fork":false,"pushed_at":"2017-03-21T12:48:13.000Z","size":38,"stargazers_count":31,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T01:02:09.649Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hhsecond.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-27T08:40:03.000Z","updated_at":"2022-08-29T20:07:53.000Z","dependencies_parsed_at":"2022-11-03T16:00:48.051Z","dependency_job_id":null,"html_url":"https://github.com/hhsecond/corenlp_pywrap","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhsecond%2Fcorenlp_pywrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhsecond%2Fcorenlp_pywrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhsecond%2Fcorenlp_pywrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhsecond%2Fcorenlp_pywrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhsecond","download_url":"https://codeload.github.com/hhsecond/corenlp_pywrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305267,"owners_count":20917194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T13:10:13.463Z","updated_at":"2025-04-05T07:30:54.585Z","avatar_url":"https://github.com/hhsecond.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# corenlp_pywrap 1.0.5\n###### Powerfull python wrapper for Stanford CoreNLP project\n\n[![GitHub release](https://img.shields.io/badge/release-1.0.5-green.svg?maxAge=2592000)](https://github.com/hhsecond/corenlp_pywrap/releases) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/hhsecond/corenlp_pywrap/blob/master/LICENCE.txt) [![PyPI](https://img.shields.io/pypi/wheel/Django.svg?maxAge=2592000)](https://pypi.python.org/pypi/corenlp_pywrap)\n\n\n## CoreNLP v3.6.0\n- Update your version (both CoreNLP and corenlp_pywrap) for bug fixes and more features\n- Works only with python 3.x\n\n\n### Pywrap Doc\n    \n#### Install\n\u003epip install corenlp_pywrap\n\nor\n\n\u003epip3 install corenlp_pywrap\n\n#### Usage\n```python\nfrom corenlp_pywrap import pywrap\ncn = pywrap.CoreNLP(url='http://localhost:9000', annotator_list=full_annotator_list)\n#full_annotator_list = [\"tokenize\", \"cleanxml\", \"ssplit\", \"pos\", \"lemma\", \"ner\", \"regexner\", \"truecase\", \"parse\", \"depparse\", \"dcoref\", \"relation\", \"natlog\", \"quote\"]\n\n#Calling basic function which would return a 'requests' object\nout = cn.basic(data, out_format='json')\n```\nRemember 'out' would be 'requests' object, you can get information by using out.text or out.json()\n\nPywrap does not inherently support 'Sentiment' now as the downloadable server version of CoreNLP doesn't have 'Sentiment' support. But there is a hack for you to use (if you are sure that your server version is the newest one and has the support)\n- You can give sentiment as an attribute to annotator_list while instantiating the class object\n- or\n```\nannotator_list = CoreNLP.full_annotator_list + ['sentiment']\n```\n    \n#### Custom Function\n- arrange() can be used for getting formatted output\n- Format is given below\n```python\ntoken_dict = {\n'index':[],\n'truecaseText':[],\n'ner':[],\n'before':[],\n'originalText':[],\n'characterOffsetBegin':[],\n'lemma':[],\n'truecase':[],\n'pos':[],\n'characterOffsetEnd':[],\n'speaker':[],\n'word':[],\n'after':[]\n}\n```\n- arrange() would return token_dict which is in the above format.\n- arrange() would work only for 'sentences' now. More features like 'enhanceddependancies' are coming in future releases\n- Usage:\n```python\nfrom corenlp_pywrap import pywrap\ncn = pywrap.CoreNLP(url='http://localhost:9000', annotator_list=full_annotator_list)\n#full_annotator_list = [\"tokenize\", \"cleanxml\", \"ssplit\", \"pos\", \"lemma\", \"ner\", \"regexner\", \"truecase\", \"parse\", \"depparse\", \"dcoref\", \"relation\", \"natlog\", \"quote\"]\n\n#custom function\ntoken_dict = cn.arrange(data)\n\n#example out: token_dict['index'] would give you something like this - [1,2,3,4]\n```\n\n    \n#### Server Instantiation Error\n- If you don't have the CoreNLP server downloaded, please download the server [here](http://stanfordnlp.github.io/CoreNLP/download.html)\n- Make sure you have Jave 8+ version installed\n- CD to the downloaded folder\n- Follow below commands\n```\n# Run the server using all jars in the current directory (e.g., the CoreNLP home directory)\n# port and timeout are optional\njava -mx4g -cp \"*\" edu.stanford.nlp.pipeline.StanfordCoreNLPServer [port] [timeout]\n```\n- Verify the server instance in the browser\n\n\u003e http://localhost:port/\n\nreplace 'port' with the port number you have given. if you didn't give any port number, port would be 9000\n\n\u003e http://localhost:9000/\n\n\n    \n#### Debugging \u0026 Logging\n- Pywrap using logging module for logging and debugging.\n- Default logging level is set to 'warning'\n- If you need more verbose logs for debugging or logging purpose make changes to the logging values\n\n- Default log facilities\n```python\nroot = logging.getLogger('Root')\nroot.setLevel(logging.WARNING)\n\nlhandler = logging.StreamHandler(sys.stdout)\nformatter = logging.Formatter(\n                '%(asctime)s [%(name)s]:%(levelname)s - %(message)s',\n                '%Y-%m-%d %H:%M:%S')\nlhandler.setFormatter(formatter)\nroot.addHandler(lhandler)\n```\n\n- You can modify each of them just like below given example\n```python\nimport corenlp_pywrap as cp\nimport logging\ncp.pywrap.root.setLevel(logging.DEBUG)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhsecond%2Fcorenlp_pywrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhsecond%2Fcorenlp_pywrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhsecond%2Fcorenlp_pywrap/lists"}