Skip to content

Commit 13be113

Browse files
update deps
1 parent 6493c09 commit 13be113

13 files changed

+1038
-604
lines changed

lib/html-to-text.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const htmlToText = require('./html-to-text')
1010
const cases = [
1111
{
1212
input: 'automagical-1.html',
13-
output: `Why you should drop everything and try Automagical\n1. Video content is significantly more engaging than text content\nhttps://veed.me/blog/video-ads-vs-text-ads/\n2. Go from blog post → video in 5 minutes. Let our AI engine do the heavy lifting for you so you can quickly edit and publish your videos. Here’s an example of a post that was created from a blog article to a video in Automagical in about 10 minutes:\n3. Our builder is exceptionally easy to use. Quickly edit text, search through our massive free library of media assets (images, videos, gifs), add your own visual media, or add custom branding.\n4. For the cost of 1 highly produced video, you can get a year’s worth of videos from Automagical. A good rule of thumb is that it costs about $1,000 for 60 seconds of finished video when it’s created by a a production team. We wanted to bring affordability and scale to small businesses and entrepreneurs who want to compete in video inbound marketing.\n5. We’re here for you. We take great pride in our customer support, and we commit to continuously adding and building new features for you that will keep your automated video content on the cutting edge of technology and quality.\nAnd for fun, here’s this very post that we turned into a video… Automagically.\nBe Creative. ❤ The Automagical Team.`
13+
output: 'Why you should drop everything and try Automagical\n1. Video content is significantly more engaging than text content\nhttps://veed.me/blog/video-ads-vs-text-ads/\n2. Go from blog post → video in 5 minutes. Let our AI engine do the heavy lifting for you so you can quickly edit and publish your videos. Here’s an example of a post that was created from a blog article to a video in Automagical in about 10 minutes:\n3. Our builder is exceptionally easy to use. Quickly edit text, search through our massive free library of media assets (images, videos, gifs), add your own visual media, or add custom branding.\n4. For the cost of 1 highly produced video, you can get a year’s worth of videos from Automagical. A good rule of thumb is that it costs about $1,000 for 60 seconds of finished video when it’s created by a a production team. We wanted to bring affordability and scale to small businesses and entrepreneurs who want to compete in video inbound marketing.\n5. We’re here for you. We take great pride in our customer support, and we commit to continuously adding and building new features for you that will keep your automated video content on the cutting edge of technology and quality.\nAnd for fun, here’s this very post that we turned into a video… Automagically.\nBe Creative. ❤ The Automagical Team.'
1414
}
1515
]
1616

lib/list-items.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = (listItems) => {
1414
.filter((item) => (item.li && item.li > 0))
1515

1616
let listicle = 0
17-
let scores = []
17+
const scores = []
1818

1919
if (items.length) {
2020
let min = Infinity

lib/list-items.test.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,50 @@ const { test } = require('ava')
44
const listItems = require('./list-items')
55

66
test('[ ]', (t) => {
7-
t.deepEqual(listItems([ ]), {
8-
scores: [ ],
7+
t.deepEqual(listItems([]), {
8+
scores: [],
99
listicle: 0
1010
})
1111
})
1212

1313
test('[ 0, 0, 0, undefined ]', (t) => {
14-
t.deepEqual(listItems([ 0, 0, 0, undefined ]), {
15-
scores: [ 0, 0, 0, 0 ],
14+
t.deepEqual(listItems([0, 0, 0, undefined]), {
15+
scores: [0, 0, 0, 0],
1616
listicle: 0
1717
})
1818
})
1919

2020
test('[ 1, 2, 3, 4 ]', (t) => {
21-
t.deepEqual(listItems([ 1, 2, 3, 4 ]), {
22-
scores: [ 1, 1, 1, 1 ],
21+
t.deepEqual(listItems([1, 2, 3, 4]), {
22+
scores: [1, 1, 1, 1],
2323
listicle: 4
2424
})
2525
})
2626

2727
test('[ 0, 1, 2, 0, 0, 0, 3, 4, 0 ]', (t) => {
28-
t.deepEqual(listItems([ 0, 1, 2, 0, 0, 3, 4, 0 ]), {
29-
scores: [ 0, 1, 1, 0, 0, 1, 1, 0 ],
28+
t.deepEqual(listItems([0, 1, 2, 0, 0, 3, 4, 0]), {
29+
scores: [0, 1, 1, 0, 0, 1, 1, 0],
3030
listicle: 4
3131
})
3232
})
3333

3434
test('[ 1, 2, 4 ]', (t) => {
35-
t.deepEqual(listItems([ 1, 2, 4 ]), {
36-
scores: [ 0.2, 0.2, 0.2 ],
35+
t.deepEqual(listItems([1, 2, 4]), {
36+
scores: [0.2, 0.2, 0.2],
3737
listicle: 0
3838
})
3939
})
4040

4141
test('[ 1 ]', (t) => {
42-
t.deepEqual(listItems([ 1 ]), {
43-
scores: [ 0.1 ],
42+
t.deepEqual(listItems([1]), {
43+
scores: [0.1],
4444
listicle: 0
4545
})
4646
})
4747

4848
test('[ 0, 0, 0, 1, 2, 3, 0, 0, 1, 2, 3, 4 ]', (t) => {
49-
t.deepEqual(listItems([ 0, 0, 0, 1, 2, 3, 0, 0, 1, 2, 3, 4 ]), {
50-
scores: [ 0, 0, 0, 0.4, 0.4, 0.4, 0, 0, 0.4, 0.4, 0.4, 0.4 ],
49+
t.deepEqual(listItems([0, 0, 0, 1, 2, 3, 0, 0, 1, 2, 3, 4]), {
50+
scores: [0, 0, 0, 0.4, 0.4, 0.4, 0, 0, 0.4, 0.4, 0.4, 0.4],
5151
listicle: 0
5252
})
5353
})

lib/map-media-to-sentences.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module.exports = ($, media, sentences, opts = { }) => {
1212
const minScore = opts.minScore || 0
13-
const scores = [ ]
13+
const scores = []
1414

1515
const n = sentences.length
1616
const m = media.length

lib/map-sentence-to-node.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
const normalize = require('./normalize')
44

55
const nodeNameToWeightMap = {
6-
'p': 0.0,
7-
'h1': 5.0,
8-
'h2': 4.0,
9-
'h3': 3.5,
10-
'h4': 2.0,
11-
'h5': 1.5,
12-
'strong': 1.0,
13-
'b': 1.0,
14-
'blockquote': 0.4,
15-
'ol': 1.0,
16-
'ul': 0.5,
17-
'li': 0.3,
18-
'em': 0.3,
19-
'i': 0.3,
20-
'a': 0.3
6+
p: 0.0,
7+
h1: 5.0,
8+
h2: 4.0,
9+
h3: 3.5,
10+
h4: 2.0,
11+
h5: 1.5,
12+
strong: 1.0,
13+
b: 1.0,
14+
blockquote: 0.4,
15+
ol: 1.0,
16+
ul: 0.5,
17+
li: 0.3,
18+
em: 0.3,
19+
i: 0.3,
20+
a: 0.3
2121
}
2222

2323
module.exports = (sentence, $) => {
@@ -55,7 +55,7 @@ module.exports = (sentence, $) => {
5555
const $node = $(node)
5656

5757
// extract info about node and its parents
58-
const path = [ node ].concat($node.parentsUntil('body').get())
58+
const path = [node].concat($node.parentsUntil('body').get())
5959
const base = node
6060

6161
path.forEach((node) => {

lib/normalize-sentence.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const cases = [
1010
original: 'Petting Tiny Kittens.',
1111
actual: 'Petting Tiny Kittens.',
1212
normalized: 'petting tiny kittens',
13-
tokenized: [ 'petting', 'tiny', 'kittens' ]
13+
tokenized: ['petting', 'tiny', 'kittens']
1414
}
1515
},
1616
{
@@ -19,7 +19,7 @@ const cases = [
1919
original: '3. List Item',
2020
actual: 'List Item',
2121
normalized: 'list item',
22-
tokenized: [ 'list', 'item' ],
22+
tokenized: ['list', 'item'],
2323
listItem: 3
2424
}
2525
},
@@ -29,7 +29,7 @@ const cases = [
2929
original: '13) Test McTestFace',
3030
actual: 'Test McTestFace',
3131
normalized: 'test mctestface',
32-
tokenized: [ 'test', 'mctestface' ],
32+
tokenized: ['test', 'mctestface'],
3333
listItem: 13
3434
}
3535
},
@@ -39,7 +39,7 @@ const cases = [
3939
original: 'Help Won’t arrive don\'t Dr. Seuss test-code',
4040
actual: 'Help Won’t arrive don\'t Dr. Seuss test-code',
4141
normalized: 'help wont arrive dont dr seuss testcode',
42-
tokenized: [ 'arrive', 'dr', 'seuss', 'testcode' ]
42+
tokenized: ['arrive', 'dr', 'seuss', 'testcode']
4343
}
4444
},
4545
{
@@ -48,7 +48,7 @@ const cases = [
4848
original: '-;test 123,',
4949
actual: 'test 123',
5050
normalized: 'test 123',
51-
tokenized: [ 'test', '123' ]
51+
tokenized: ['test', '123']
5252
}
5353
},
5454
{
@@ -57,7 +57,7 @@ const cases = [
5757
original: 'I SWEAR IM NOT YELLING,',
5858
actual: 'I swear im not yelling',
5959
normalized: 'i swear im not yelling',
60-
tokenized: [ 'swear', 'yelling' ]
60+
tokenized: ['swear', 'yelling']
6161
}
6262
}
6363
]

lib/summarize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ module.exports = async (opts) => {
146146
index: -1
147147
}
148148

149-
topItems = [ titleItem ].concat(topItems)
149+
topItems = [titleItem].concat(topItems)
150150
} else if (existingTitle > 0) {
151151
// ensure title is first
152152
topItems[existingTitle].index = -1

lib/summarize.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const path = require('path')
66

77
const summarize = require('./summarize')
88

9-
const fixtures = path.join(__dirname, `../fixtures`)
9+
const fixtures = path.join(__dirname, '../fixtures')
1010

1111
fs.readdirSync(fixtures).forEach((filename) => {
1212
test(filename, async (t) => {

lib/tfidf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module.exports = (tokenizedSentences) => {
99
const n = tokenizedSentences.length
1010
const weights = { }
11-
const scores = [ ]
11+
const scores = []
1212

1313
for (let i = 0; i < n; ++i) {
1414
const tokensI = tokenizedSentences[i]

lib/tokenize-words.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ const tokenize = require('./tokenize-words')
66
const cases = [
77
{
88
input: 'test mr. fuzzy',
9-
output: [ 'test', 'fuzzy' ]
9+
output: ['test', 'fuzzy']
1010
},
1111
{
1212
input: 'automagically turn blog posts into videos',
13-
output: [ 'automagically', 'turn', 'blog', 'posts', 'videos' ]
13+
output: ['automagically', 'turn', 'blog', 'posts', 'videos']
1414
},
1515
{
1616
input: 'the man is old and hairy',
17-
output: [ 'man', 'hairy' ]
17+
output: ['man', 'hairy']
1818
}
1919
]
2020

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "text-summarization",
33
"version": "0.3.3",
4-
"description": "Automagically generates summaries from html or text.",
4+
"description": "Automagically generate summaries from html or text.",
55
"repository": "transitive-bullshit/text-summarization",
66
"author": "Travis Fischer <travis@transitivebullsh.it>",
77
"license": "MIT",
@@ -15,17 +15,17 @@
1515
},
1616
"dependencies": {
1717
"capitalize": "^1.0.0",
18-
"cheerio": "^1.0.0-rc.2",
18+
"cheerio": "^1.0.0-rc.3",
1919
"commander": "^2.11.0",
20-
"dotenv-safe": "^4.0.4",
20+
"dotenv-safe": "^8.1.0",
2121
"is-capitalized": "^1.0.0",
2222
"lodash.isequal": "^4.5.0",
2323
"lodash.uniqby": "^4.7.0",
24-
"natural": "0.5.0",
25-
"p-map": "^1.2.0",
26-
"p-retry": "^1.0.0",
27-
"request-image-size": "^2.0.0",
28-
"request-promise-native": "^1.0.4",
24+
"natural": "^0.6.3",
25+
"p-map": "^3.0.0",
26+
"p-retry": "^4.2.0",
27+
"request-image-size": "^2.1.0",
28+
"request-promise-native": "^1.0.8",
2929
"retext": "^5.0.0",
3030
"retext-readability": "^4.1.2",
3131
"retext-redundant-acronyms": "^1.2.1",
@@ -39,7 +39,7 @@
3939
"ava": "^0.25.0",
4040
"nock": "^9.0.14",
4141
"sinon": "^3.2.1",
42-
"standard": "^10.0.2"
42+
"standard": "^14.3.1"
4343
},
4444
"ava": {
4545
"failFast": true,

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# text-summarization
22

3-
> Automagically generates summaries from html or text.
3+
> Automagically generate summaries from html or text.
44
55
[![NPM](https://img.shields.io/npm/v/text-summarization.svg)](https://www.npmjs.com/package/text-summarization) [![Build Status](https://travis-ci.com/transitive-bullshit/text-summarization.svg?branch=master)](https://travis-ci.com/transitive-bullshit/text-summarization) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
66

0 commit comments

Comments
 (0)