Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const describePostTexts = texts => {
- const postTitle = texts[0]
- const postIntro = texts.slice(1, 4).join('.\n')
- const intro = `The post is titled "${postTitle}" and it reads as it follows:\n`
- return intro + postIntro
- }
- const describeEntityCounts = counts => {
- const top = counts[0]
- const intro = `We find a total of ${counts.length} entities mentioned. `
- const topCount = `Mainly "${top.name}" which appears ${top.count} times, followed by `
- const topCounts = counts.slice(1, 4).map(({name, count}) => `"${name}" mentioned ${count} times`).join(', ')
- const rest = counts.slice(4, 7).map(({name}) => name).join(', ')
- const others = `. Some other mentions include ${rest} plus many others`
- return intro + topCount + topCounts + others
- }
- const describeTypesCounts = counts => {
- const intro = `Regarding the types of entities, it includes `
- const other = counts.find(({name}) => name = 'OTHER')
- const noOther = counts.filter(({name}) => name != 'OTHER')
- const body = noOther.map(({name, count}) => `${count} ${plural(cleanName(name), count)}`).join(', ')
- const closing = `, and also some other ${other.count} things`
- return intro + body + closing
- }
Add Comment
Please, Sign In to add comment