({
make: (content) => {
const wrx = /[a-z-]+/gi
const srx = / [a-z][^\.]+\.(\s+|$)/gi
const wrd = content.match(wrx) || []
const sen = content.match(srx) || []
const title = wrd.length + " word" + (wrd.length === 1 ? "" : "s")
let body = ""
if (wrd.length && sen.length > 1) {
const avg = +(wrd.length / (sen.length || 1)).toFixed(1)
body += `There are ${sen.length} sentences, with an average length of ${avg} words per sentence. `
}
if (wrd.length) {
const big = wrd.sort((a, b) => (a.length < b.length ? 1 : -1))[0]
body += `The longest word is "${big}". `
body += `It is ${big.length} letters long.`
}
return {
type: "card",
title,
body,
}
},
})