Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matteocacciola committed Apr 3, 2023
1 parent c1e8c56 commit 9b71418
Show file tree
Hide file tree
Showing 29 changed files with 15 additions and 100 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
dist/*
node_modules/*
libraries/**/dist/*
libraries/**/node_modules/*
.eslintrc.js
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sentiment Analysis for Node.js

[![Coverage Status](https://coveralls.io/repos/github/matteocacciola/sentiment/badge.svg?branch=v1.0.3)](https://coveralls.io/github/matteocacciola/sentiment?branch=v1.0.3)
[![Coverage Status](https://coveralls.io/repos/github/matteocacciola/sentiment/badge.svg?branch=v1.0.4)](https://coveralls.io/github/matteocacciola/sentiment?branch=v1.0.4)

This library aims to provide a support for the analysis of texts, like the evaluation of Sentiment or Text Matching.
Please, consult the various methods here provided in order to have a wide overview of the possible features provided
Expand Down
2 changes: 1 addition & 1 deletion docs/libraries/naive-bayes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ classifier.classify('it is very sunny today');

naive-bayes contains a default set of positive and negative data enough to seed the algorithm and produce decent results.
The constructor function can optionally be passed custom paths to directories containing files with your own data.
See [sentiment.ts](https://github.com/matteocacciola/sentiment/blob/master/libraries/naive-bayes/src/sentiment.ts) if
See [sentiment.ts](https://github.com/matteocacciola/sentiment/blob/master/src/libraries/naive-bayes/sentiment.ts) if
you need more details.
8 changes: 0 additions & 8 deletions libraries/naive-bayes/.eslintrc.js

This file was deleted.

17 changes: 0 additions & 17 deletions libraries/naive-bayes/.gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions libraries/naive-bayes/package.json

This file was deleted.

19 changes: 0 additions & 19 deletions libraries/naive-bayes/tsconfig.json

This file was deleted.

18 changes: 4 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
},
"dependencies": {
"@google-cloud/language": "^5.2.1",
"@matteocacciola/naive-bayes-sentiment-classifier": "file:libraries/naive-bayes",
"axios": "^1.3.4",
"dotenv": "^16.0.3",
"google-gax": "^3.5.8",
Expand All @@ -21,6 +20,7 @@
"description": "Collection of functions for sentiment analysis",
"devDependencies": {
"@types/lodash": "^4.14.191",
"@types/node": "^18.15.11",
"@types/sentiment": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
Expand All @@ -41,7 +41,6 @@
},
"files": [
"dist",
"libraries/**/dist",
"node_modules",
"README.md",
"package.json"
Expand All @@ -67,16 +66,14 @@
},
"scripts": {
"build": "tsc -p ./tsconfig-build.json",
"build:bayes": "cd libraries/naive-bayes/ && npm run build",
"ci": "npm run lint && npm run build && npm run test",
"clean": "if [ -d 'dist/' ]; then rm -rf dist; fi; if [ -f 'tsconfig-build.tsbuildinfo' ]; then rm tsconfig-build.tsbuildinfo; fi",
"lint": "eslint 'src/**/*.ts'",
"lint:fix": "eslint 'src/**/*.ts' --fix --ext .js,.ts .",
"preinstall": "npm run build:bayes",
"prebuild": "npm run clean && npm run build:bayes",
"prebuild": "npm run clean",
"prepare": "husky install",
"prepublishOnly": "npm run build",
"test": "TZ=utc NODE_ENV=test vitest run --coverage"
},
"version": "1.0.3"
"version": "1.0.4"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export const bayesSentiment = (text: string, positivePath?: string, negativePath
const positiveCorpus = new Corpus();
const negativeCorpus = new Corpus();

if (!positivePath) positivePath = __dirname + '/../data/positive';
if (!negativePath) negativePath = __dirname + '/../data/negative';
if (!positivePath) positivePath = __dirname + '/data/positive';
if (!negativePath) negativePath = __dirname + '/data/negative';

positiveCorpus.loadFromDirectory(positivePath);
negativeCorpus.loadFromDirectory(negativePath);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/strategies/bayes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { bayesSentiment } from '@matteocacciola/naive-bayes-sentiment-classifier';
import { Strategy } from './interfaces';
import { BayesStrategyOptions, ScoreStrategyOptions, ScoreStrategyType, SENTIMENTS, SentimentsType } from './types';
import { bayesSentiment } from '../libraries/naive-bayes';

const strategy: Strategy = {
async evaluateScores(
Expand Down
6 changes: 2 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
"baseUrl": "."
},
"include": [
"libraries/**/src/**/*",
"src/**/*.ts",
"package.json",
"vite.config.ts",
],
"exclude": ["libraries/**/src/index.ts"]
"vite.config.ts"
]
}
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { configDefaults, defineConfig } from 'vitest/config';
export default defineConfig({
test: {
coverage: {
exclude: [...configDefaults.exclude, '**/utils/*', '**/index.ts', '**/__tests__/*', './libraries/**'],
exclude: [...configDefaults.exclude, '**/utils/*', '**/index.ts', '**/__tests__/*', '**/libraries/*'],
provider: 'istanbul',
reporter: ['text', 'json', 'html', 'lcov'],
enabled: true,
Expand Down

0 comments on commit 9b71418

Please sign in to comment.