Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meghaniankov/news-toxicity-analyzer
📰 Analyze news sites for text toxicity using TensorFlowJS
https://github.com/meghaniankov/news-toxicity-analyzer
javascript personal-project tensorflow
Last synced: 21 days ago
JSON representation
📰 Analyze news sites for text toxicity using TensorFlowJS
- Host: GitHub
- URL: https://github.com/meghaniankov/news-toxicity-analyzer
- Owner: meghaniankov
- Created: 2020-02-22T15:53:47.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T19:09:03.000Z (about 2 years ago)
- Last Synced: 2024-11-03T16:16:12.466Z (2 months ago)
- Topics: javascript, personal-project, tensorflow
- Language: JavaScript
- Homepage:
- Size: 5.7 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# News Toxicity Analyzer
A tool that analyzes text toxicity (using Tensorflow's toxicy model) of news articles.
## Built With
* Javascript
* Tensorflow.js (Toxicty Model)
* Firebase (databse)## Running The Program
Install dependencies and prepare the build directory:
```$ yarn```
Run the server:
```$ yarn watch```
View in browser:
Visit ```http://localhost:1234/```
## How It Works
1. User inputs text and clicks 'classify'
2. ```predict()``` is run
1. Loads TF toxicity model
2. Saves user input to ```var text```
3. Runs ```classify()``` on ```text```
4. Runs ```sendData()```
5. Saves prediction to ```var allPredictions```
3. ```classify()```
1. Runs ```model.classify()``` (model that was loaded in earlier step, as TF classify function) on user input
2. Sets the output of that function to ```var results```
- output is an array of objects, one object for each toxicty type/label & it's probability
3. Creates ```const obj``` that has a property of ```text``` set equal to the user input
4. Iterates over ```results``` and adds each toxicty type/label & it's probability to ```obj```
5. Returns ```obj```
4. ```sendData()```
1. Saves ```obj``` data into database
2. Returns error if it did not save correctly.
3. Returns Firebase key if data successfully saved.
5. User clicks 'Display Predictions'
6. ```displayPredictions()``` is called
1. Iterates over each prediction in ```allPredictions```
2. console.logs key/value pair of each prediction (toxicity type/lable => true/false)