New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nlp-sentiment

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nlp-sentiment - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

4

lib/index.d.ts

@@ -9,9 +9,5 @@ import { Sentence, SentenceResult } from "./types";

withPositiveWords(words: string[]): NlpSentiment;
withPositiveAsFile(filePath: string): NlpSentiment;
withNegativeWords(words: string[]): NlpSentiment;
withNegativeAsFile(filePath: string): NlpSentiment;
withIntensifierWords(words: string[]): NlpSentiment;
withIntensifierAsFile(filePath: string): NlpSentiment;
withNegationWords(words: string[]): NlpSentiment;
withNegationAsFile(filePath: string): NlpSentiment;
analyse(sentences: Sentence[]): SentenceResult[];

@@ -18,0 +14,0 @@ }

@@ -16,6 +16,2 @@ "use strict";

};
NlpSentiment.prototype.withPositiveAsFile = function (filePath) {
this._positiveVocabulary = (0, vocabulary_1.formVocabularyFromFile)(filePath, 1);
return this;
};
NlpSentiment.prototype.withNegativeWords = function (words) {

@@ -25,6 +21,2 @@ this._negativeVocabulary = (0, vocabulary_1.formVocabularyFromWords)(words, -1);

};
NlpSentiment.prototype.withNegativeAsFile = function (filePath) {
this._negativeVocabulary = (0, vocabulary_1.formVocabularyFromFile)(filePath, -1);
return this;
};
NlpSentiment.prototype.withIntensifierWords = function (words) {

@@ -34,6 +26,2 @@ this._intensifierVocabulary = (0, vocabulary_1.formVocabularyFromWords)(words, 1.5);

};
NlpSentiment.prototype.withIntensifierAsFile = function (filePath) {
this._intensifierVocabulary = (0, vocabulary_1.formVocabularyFromFile)(filePath, 1.5);
return this;
};
NlpSentiment.prototype.withNegationWords = function (words) {

@@ -43,6 +31,2 @@ this._negationVocabulary = (0, vocabulary_1.formVocabularyFromWords)(words, -1);

};
NlpSentiment.prototype.withNegationAsFile = function (filePath) {
this._negationVocabulary = (0, vocabulary_1.formVocabularyFromFile)(filePath, -1);
return this;
};
NlpSentiment.prototype.analyse = function (sentences) {

@@ -49,0 +33,0 @@ var _this = this;

import { Vocabulary } from "./types";
export declare const formVocabularyFromFile: (pathToFile: string, value: number) => Vocabulary;
export declare const formVocabularyFromWords: (words: string[], value: number) => Vocabulary;

@@ -14,23 +14,3 @@ "use strict";

exports.__esModule = true;
exports.formVocabularyFromWords = exports.formVocabularyFromFile = void 0;
var fs = require("fs");
var formVocabularyFromFile = function (pathToFile, value) {
if (!pathToFile || !value) {
return {};
}
if (!fs.existsSync("foo.txt")) {
console.error("File \"".concat(pathToFile, "\" does not exist"));
return {};
}
var text = fs.readFileSync(pathToFile);
var textByLine = text.toString().split("\n");
return textByLine.reduce(function (obj, word) {
var _a;
if (word.length > 0) {
return __assign(__assign({}, obj), (_a = {}, _a[word] = value, _a));
}
return obj;
}, {});
};
exports.formVocabularyFromFile = formVocabularyFromFile;
exports.formVocabularyFromWords = void 0;
var formVocabularyFromWords = function (words, value) {

@@ -37,0 +17,0 @@ if (!words || !value) {

4

package.json
{
"name": "nlp-sentiment",
"version": "1.0.0",
"version": "1.0.1",
"description": "A very tiny, fast and useful tool for sentiment analysis. It works with any language and can also use provided intensifier words!",

@@ -42,2 +42,2 @@ "main": "lib/index.js",

}
}
}

@@ -6,3 +6,8 @@ # 😛 Sentiment — javascript NLP tool for fast and simple sentiment analysis

[![codecov](https://codecov.io/gh/MarkusBansky/sentiment/branch/main/graph/badge.svg?token=M1BGVWCQX8)](https://codecov.io/gh/MarkusBansky/sentiment)
[![Known Vulnerabilities](https://snyk.io/test/github/MarkusBansky/sentiment/badge.svg)](https://snyk.io/test/github/MarkusBansky/sentiment)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=MarkusBansky_sentiment&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=MarkusBansky_sentiment)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=MarkusBansky_sentiment&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=MarkusBansky_sentiment)
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-black.svg)](https://sonarcloud.io/summary/new_code?id=MarkusBansky_sentiment)
This is a small and fast library for nlp sentiment analysis which supports any language, or any custom vocabulary.

@@ -9,0 +14,0 @@ It can also use intensifiers with positive or negative words adding more contrast.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc