u
This commit is contained in:
@@ -363,7 +363,7 @@ module.exports = {
|
||||
summarize_story (story = []) {
|
||||
// story is an array of objects, each object could either be {text:'some string'}, {image: url} or {video:url}. Please construct a summary object as result: { textLength, imageCount, VideoCount }
|
||||
return story.reduce(
|
||||
(summary, { text, image, video, audio, file, linkTarget } = {}) => {
|
||||
(summary, { text, image, video, audio, file, linkTarget, _autocontent } = {}) => {
|
||||
if (text) {
|
||||
summary.textLength += text.length
|
||||
summary.wordCount += text.split(/\s+/).length
|
||||
@@ -377,12 +377,14 @@ module.exports = {
|
||||
summary.fileCount++
|
||||
} else if (linkTarget) {
|
||||
summary.linkCount++
|
||||
} else if (_autocontent) {
|
||||
summary.emptyContent++
|
||||
} else {
|
||||
summary.untypeCount++
|
||||
}
|
||||
return summary
|
||||
},
|
||||
{ textLength: 0, wordCount: 0, imageCount: 0, videoCount: 0, audioCount: 0, fileCount: 0, linkCount: 0, untypeCount: 0 }
|
||||
{ textLength: 0, wordCount: 0, imageCount: 0, videoCount: 0, audioCount: 0, fileCount: 0, linkCount: 0, emptyContent: 0, untypeCount: 0 }
|
||||
)
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user