@uwanaaa/senti
v1.0.1
Published
**Senti** is a high-performance sentiment analysis module written in C++ and exposed to Node.js for Nigerian Pidgin English via `node-addon-api`. It uses a customizable lexicon to evaluate the sentiment of input text and returns a label: `"Positive"`, `"N
Readme
🧠 Senti — Pidgin English Native Sentiment Analysis Addon for Node.js
Senti is a high-performance sentiment analysis module written in C++ and exposed to Node.js for Nigerian Pidgin English via node-addon-api. It uses a customizable lexicon to evaluate the sentiment of input text and returns a label: "Positive", "Negative", or "Neutral".
🚀 Features
- ⚡ Fast native performance using C++
- 🔗 Seamless Node.js integration via
node-gyp - 📖 Customizable lexicon file (
lexicon.txt) - 🧪 Simple API: pass a Pidgin English string, get a sentiment label
- 🧩 ES6-compatible via
createRequireor wrapper
📦 Installation
1. Clone the repository
git clone https://github.com/Uwanaaa/Senti.git
cd sentiment2. Install Dependencies
npm install
npm install node-addon-api3. Build the Native Addon
node-gyp configure
node-gyp buildLexicon Format
The sentiment lexicon is stored in data/lexicon.txt. Each line contains a word followed by its sentiment score: craze -3 wahala -3 gbese -3
🧪 Usage
CommonJS
const addon = require('./build/Release/sentiment');
console.log(addon.analyze("Sharp.")); // "Positive"ES Modules
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const addon = require('./build/Release/sentiment');
console.log(addon.analyze("Gbese.")); // "Negative"🛠 Project Structure
sentimenter/ ├── binding.gyp ├── sentiment.cpp ├── data/ │ └── lexicon.txt ├── index.js └── README.md
🧩 API
analyze(text: string): string
Analyzes the sentiment of the input string and returns one of:
"Positive" — if score > 1
"Negative" — if score < -1
"Neutral" — otherwise
🧰 Development Notes
. Written in C++17
. Uses node-addon-api for N-API bindings
. Built with node-gyp
. Compatible with macOS, Linux, and Windows
📄 License
MIT License. Feel free to modify and use it in your own projects.
