{"id":16641701,"url":"https://github.com/maxim-mazurok/vader-sentiment-cpython","last_synced_at":"2026-04-29T23:32:39.579Z","repository":{"id":101138995,"uuid":"354033442","full_name":"Maxim-Mazurok/vader-sentiment-cpython","owner":"Maxim-Mazurok","description":"Updated replacement for vader-sentiment (vaderSentiment-js) that runs original vaderSentiment natively, using CPython.","archived":false,"fork":false,"pushed_at":"2024-05-18T11:12:38.000Z","size":6522,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T05:18:07.912Z","etag":null,"topics":["cpython","node","node-gyp","node-js","nodejs","npm-package","sentiment-analysis","vader","vader-sentiment","vader-sentiment-analysis","vadersentiment","wip"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Maxim-Mazurok.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-02T13:51:58.000Z","updated_at":"2024-05-18T11:12:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"77c8bdc2-84d9-4a04-800f-7696e357603a","html_url":"https://github.com/Maxim-Mazurok/vader-sentiment-cpython","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Maxim-Mazurok/vader-sentiment-cpython","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxim-Mazurok%2Fvader-sentiment-cpython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxim-Mazurok%2Fvader-sentiment-cpython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxim-Mazurok%2Fvader-sentiment-cpython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxim-Mazurok%2Fvader-sentiment-cpython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maxim-Mazurok","download_url":"https://codeload.github.com/Maxim-Mazurok/vader-sentiment-cpython/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maxim-Mazurok%2Fvader-sentiment-cpython/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cpython","node","node-gyp","node-js","nodejs","npm-package","sentiment-analysis","vader","vader-sentiment","vader-sentiment-analysis","vadersentiment","wip"],"created_at":"2024-10-12T07:47:33.869Z","updated_at":"2026-04-29T23:32:39.562Z","avatar_url":"https://github.com/Maxim-Mazurok.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vader-sentiment-cpython\n\nUpdated replacement for [vader-sentiment](https://www.npmjs.com/package/vader-sentiment) ([vaderSentiment-js](https://github.com/vaderSentiment/vaderSentiment-js)) that runs original [vaderSentiment](https://github.com/cjhutto/vaderSentiment) natively, using CPython.\n\n## Motivation\n\n[vader-sentiment](https://www.npmjs.com/package/vader-sentiment) is outdated and doesn't support emoji - vital element of comments nowadays.\n\nAlso, spawning python process from nodejs is slow. This module can analyze ~60,000 strings per second by re-using the same python instance, and doesn't leak memory.\n\n## Getting Started for dev\n\n1. Run `nvm i`\n1. Run `npm ci`\n1. Install dependencies. On Ubuntu, run [`./deps.sh`](./deps.sh)\n1. Build python and boost statically (see [`build_boost.sh`](./build_boost.sh) and [`build_python.sh`](./build_python.sh))\n1. Generate prebuild: `npm run prebuild` (might need to update hardcoded libs)\n1. Run it: `node test.js \"your awesome text goes here\"`\n\n## Getting Started for end user\n\nNote: target machine should have same python (and glibc?) version, as dev machine\n\nNote: currently is was tested on Ubuntu 20, and on Heroku (with Ubuntu 20). Check `mac` branch for Mac OS\n\nNote: if you'd like to use it on another linux distro, at least install Python 3.8.5 and make sure that `python3` points to it\n\nNote: requires Python 3.8.5 (installed on Ubuntu 20 by default)\n\n1. Run `npm install Maxim-Mazurok/vader-sentiment-cpython`\n2. Add [`install_vader.sh`](./install_vader.sh) script to your project, and run it before using module.\n   You can include it in `start` script, like so: `\"start\": \"bash ./node_modules/vader-sentiment-cpython/install_vader.sh \u0026\u0026 node start.js\",`\n\n## Current stage\n\nIt only has prebuild for Ubuntu 20 and Python 3.8.5.\n\nI have to figure out how to make it more portable and independent from installed Python interpreter.\n\nAs far as I understand, I have to create portable Python interpreter, similar to how [pyinstaller](https://github.com/pyinstaller/pyinstaller) works.\n\n### How pyinstaller embeds python?\n\nDisclaimer: this is my (very limited) understanding.\n\n- It bundles copy of the system (`libpython3.8.so.1.0` in my case)\n- It doesn't bundle system Python interpreter executable. Instead, it builds own Python interpreter (kind of), which is embedded in the final binary executable.\n- I think they use `objcopy` on Linux to bundle archives into one binary, see [api.py#L645](https://github.com/pyinstaller/pyinstaller/blob/532a465e348f84e1839526fa39bcc8d4155a2912/PyInstaller/building/api.py#L645)\n- Python \"starts\" in [`pyi_pylib_start_python` function](https://github.com/pyinstaller/pyinstaller/blob/ed4bf7406bae5a6c070079b6c4b3160e740a546f/bootloader/src/pyi_pythonlib.c#L385)\n- [pyinstaller bootloader's entrypoint](https://github.com/pyinstaller/pyinstaller/blob/ed4bf7406bae5a6c070079b6c4b3160e740a546f/bootloader/src/main.c#L89) is based on an [Python 2](https://github.com/python/cpython/blob/8d21aa21f2cbc6d50aab3f420bb23be1d081dac4/Modules/python.c) version of [Python interpreter main program](https://github.com/python/cpython/blob/96d5c7038b06e93d20822d28ed42a2183f876857/Modules/main.c)\n\nSo... Looks like I have to [use python's main.c](https://github.com/pyinstaller/pyinstaller/pull/5801#issuecomment-833797956) in order to create portable python interpreter that I can ship with this package.\nBut instead of running in console mode (and requiring to be ran using `spawn child process`), it'll be possible to embed NAPI into it, so it'll be a NodeJS package.\n\nThe most recent attempt to create such a portable python lives in my cpython fork's [vader-branch]\nCurrently it will run vader if you put `vaderSentiment-master` folder in the `cpython` root folder.\n\n`PyRun_SimpleString` is the key function under the hood.\n\n### What to do?\n\nThere are two options:\n\n1. Migrate [vader branch] of cpython to gyp building system\n\n   - Copy all cpython code into this project (or clone and patch)\n   - Either separate `node-gyp configure` step from the build step (in the `prebuildify`, somehow), so that we can change/merge cpython's Makefile and NodeJS's native module Makefile\n   - Or migrate cpython's Makefile to binding.gyp\n\n1. Move cpython code into this project\n\n   Essentially, copy only the required bits of code from cpython to this project. Probably will require copying a whole lot and diving very deep into cpython. Also, will probably require the same migration of cpython's Makefile to binding.gyp.\n\nSo, I think that I should try to migrate cpython's Makefile to binding.gyp. Then include and call cpython's main function in binding.cc?\n\n[vader branch]: https://github.com/Maxim-Mazurok/cpython/tree/vader\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxim-mazurok%2Fvader-sentiment-cpython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxim-mazurok%2Fvader-sentiment-cpython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxim-mazurok%2Fvader-sentiment-cpython/lists"}