Wormbait
Wormbait is a simple knn-like algo to identify clickbait titles.
What's so special about it ? Wormbait is trained with 1040 Inc.com titles, because besides having great articles, they have some of the most clickbaity titles out there.
Why is it called wormbait ?
-
- Click ==> worms
-
- I built [
fishingrod
])(http://npmjs.org/package/fishingrod) so obviously you need bait and worms
- I built [
CLI
Wormbait is bunbled with a very small CLI tool
Installation
npm install -g wormbait
Usage
$ wormbait "this is not clickbait" "deep fried chicken" Learning from 1040 sentences Finished Learning! YES: "this is not clickbait" is PROBABLY clickbait with a score of 0.2942307692307693 NO: "deep fried chicken" is PROBABLY NOT clickbait with a score of 0.013565
API
Wormbait is a class
you can instanciate and provides some utility methods
Installation
npm install wormbait
tl;dr
const Wormbait = ;let inc = ; inc;let is_bait = inc; ifis_bait console
Methods
getDataSet()
Returns the data set bundled with wormbait, with over 1000 Inc.com article titles.
DataSet
is simply an array filled with strings.
learn(data)
data
: Array with strings
Learns from the provided data. Simple example:
let data = w;w;
predict(title)
title
: String
Returns boolean predicting if clickbait or not depending on data learned from.
test(data)
data
: Array with LearnObject
LearnObject
:
title: 'This is some title to test against' clickbait: true
Tests the learning algorithm, and returns predictions and statistics
predictions: score: 0005 val: true correct: false ratio: 08 correct: 80 wrong: 20
__predict(title)
Returns the associated score (0 to 1)
setThreshold(t)
Sets the minimum threshold to identify title as clickbait. Default is 0.2