{"_id":"@barb256/simple-sentiment-analysis","_rev":"3-484b51659e2ecf5d98ba3610517e8503","name":"@barb256/simple-sentiment-analysis","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@barb256/simple-sentiment-analysis","version":"1.0.0","license":"MIT","_id":"@barb256/simple-sentiment-analysis@1.0.0","maintainers":[{"name":"barb256","email":"bobkiewiczbartosz2@gmail.com"}],"dist":{"shasum":"1bf02f53b54d0dd79fbfc4fc016ca1a4efb76b1c","tarball":"https://registry.npmjs.org/@barb256/simple-sentiment-analysis/-/simple-sentiment-analysis-1.0.0.tgz","fileCount":3,"integrity":"sha512-/kIE+plWbKf9XrrSrmaK24TG7xVzLft9FOPEcHkbVhl0scyNvePZMAondNWRFa8+oefk4TEqdihpbAle3ukgvQ==","signatures":[{"sig":"MEYCIQDu41niEmRVvpHu3hIc5tCBxWtVzLijFChPDUY5SR5QMQIhAM1zdmzroO5sY4R+1C1SVXuwwVCyrNHHv8wNhsOlPh0x","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":289},"main":"index.js","gitHead":"81e35a923bede5d4ef390bfddfd1459f47f26a1e","_npmUser":{"name":"barb256","email":"bobkiewiczbartosz2@gmail.com"},"_npmVersion":"10.2.4","description":"","directories":{},"_nodeVersion":"21.5.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/simple-sentiment-analysis_1.0.0_1754218300635_0.912737632264103","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@barb256/simple-sentiment-analysis","version":"1.0.1","license":"MIT","_id":"@barb256/simple-sentiment-analysis@1.0.1","maintainers":[{"name":"barb256","email":"bobkiewiczbartosz2@gmail.com"}],"dist":{"shasum":"26d3329ab8058542a4983edd3c7597d19c7095ec","tarball":"https://registry.npmjs.org/@barb256/simple-sentiment-analysis/-/simple-sentiment-analysis-1.0.1.tgz","fileCount":3,"integrity":"sha512-Oxyuzybqd1P7iFsgqQQoYiDfofNKIZorZ+LLk6GPwUi1dBsoJ0liYievwxNOU8YwRJvgywaKkNaAg73BKlw/sg==","signatures":[{"sig":"MEUCIEqWXD7kVo/Jd1AkvOpiAlwINBUvn51J7El1bzkHO/rVAiEA+g/7ZxpeEpgzMXNnmLYpkUjWayQxToMGIVUIVNjrSPc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":462},"main":"index.js","gitHead":"a293b4371be0ebdfa45d87fac50dc9c946c3ee7b","_npmUser":{"name":"barb256","email":"bobkiewiczbartosz2@gmail.com"},"_npmVersion":"10.2.4","description":"A tiny sentiment analysis utility for demonstration and experimentation purposes.","directories":{},"_nodeVersion":"21.5.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/simple-sentiment-analysis_1.0.1_1754218711371_0.8636276965460412","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@barb256/simple-sentiment-analysis","version":"1.0.2","main":"index.js","license":"MIT","publishConfig":{"access":"public"},"_id":"@barb256/simple-sentiment-analysis@1.0.2","gitHead":"1efa794df15ecdfcdfe332ce2b70aff2df3d9498","description":"This npm package provides a simple, extensible sentiment analysis tool for text, based on keyword matching. Each keyword is assigned a \"weight\" that represents its sentiment (positive or negative) and strength. The tool supports multiple languages and is ","_nodeVersion":"21.5.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-vj4dY/aJ2y6+g4bilSEXo+uBNRWILT9YUXUYkymH+CjKhcCSg6jp5Jk0HMlY5IBjbXZuaDHb6QCih/zfssa2bw==","shasum":"672a48e877ee93850fec68924d20536d117e3256","tarball":"https://registry.npmjs.org/@barb256/simple-sentiment-analysis/-/simple-sentiment-analysis-1.0.2.tgz","fileCount":6,"unpackedSize":5306,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDu8N1/ACaQNGxzWv1pNhCOEbNp0IFw4/7EOPGfngoLTwIgaqGJo3GorFNwsCyhRTd1YXfibGSLpCqvdxXEgH4dxIc="}]},"_npmUser":{"name":"barb256","email":"bobkiewiczbartosz2@gmail.com"},"directories":{},"maintainers":[{"name":"barb256","email":"bobkiewiczbartosz2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/simple-sentiment-analysis_1.0.2_1754224474711_0.19733363907696022"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-03T10:51:40.528Z","modified":"2025-08-03T12:34:35.078Z","1.0.0":"2025-08-03T10:51:40.812Z","1.0.1":"2025-08-03T10:58:31.557Z","1.0.2":"2025-08-03T12:34:34.890Z"},"license":"MIT","description":"This npm package provides a simple, extensible sentiment analysis tool for text, based on keyword matching. Each keyword is assigned a \"weight\" that represents its sentiment (positive or negative) and strength. The tool supports multiple languages and is ","maintainers":[{"name":"barb256","email":"bobkiewiczbartosz2@gmail.com"}],"readme":"# Simple Sentiment Analysis\n\nThis npm package provides a simple, extensible sentiment analysis tool for text, based on keyword matching. Each keyword is assigned a \"weight\" that represents its sentiment (positive or negative) and strength. The tool supports multiple languages and is easily customizable.\n\n## Instalation\n```bash\nnpm install @barb256/simple-sentiment-analysis\n```\n\n## How It Works\n\n- The tool tokenizes input text and checks each word against a list of keywords for the selected language.\n- Each keyword has a numeric \"weight\":\n  - **Positive weights** (e.g., `1`) indicate positive sentiment.\n  - **Negative weights** (e.g., `1`) indicate negative sentiment.\n  - The **magnitude** of the weight represents the strength of the sentiment.\n- The sentiment score for the text is the sum of the weights of all matched keywords.\n\n\n#### Why weights? (dummy edition)\n- weights are used because some words are stronger than others.\n> not good\nhas less negative sentiment than\n> horrible\n\n## Installation\n\n```bash\nnpm install simple-sentiment-analysis\n```\n\n## Usage\n\n```js\nconst analyzeSentiment = require('simple-sentiment-analysis');\nconst score = analyzeSentiment('I am very happy but a bit sad');\nconsole.log(score); // Output: sentiment score based on keywords\n```\n```js\n//output example\n{ positive: 0, negative: 1, anger: 0 }\n```\n\n\n## Customizing Keywords and Adding Languages\n\nYou can add your own keywords or support new languages by editing or adding keyword files.\n\n### 1. Add or Edit Keywords\n\n- Edit the appropriate language file in the `keywords/` directory (e.g., `keywords/en.json` for English).\n- To add a new language, create a new JSON file (e.g., `keywords/es.json` for Spanish) with the same format:\n  ```json\n  {\n    \"happy\": 2,\n    \"sad\": 1\n  }\n  ```\n- Each key is a keyword, and each value is its sentiment weight.\n\n### 2. What Do Weights Mean?\n\n- **Positive number**: positive sentiment (higher = stronger).\n- **Negative number**: negative sentiment (higher = stronger).\n- **Zero or missing**: neutral or ignored.\n\n### 3. Regenerate Keyword Files\n\n**Important:**  \nAfter adding or changing any keywords or languages, you **must** run the following command to regenerate the processed keyword files:\n\n```bash\nnode scripts/generateKeywords.js\n```\n\nThis ensures your changes are included in the analysis.\n\n### 4. Using Custom Keywords in Your Project\n\nIf you want to use your own set of keywords in your project, you can fork this repository, edit the keyword files, and publish your own version, or submit a pull request to contribute new languages.\n\n---\n\n**Note:**  \nAlways run `node scripts/generateKeywords.js` after modifying keywords or adding a new language to ensure your changes take effect.\n\n---\n\n## Contributing\n\nContributions for new languages or improved keyword lists are welcome! Please open an issue or submit a pull request.\n","readmeFilename":"README.md"}