1.1.0 • Published 7 years ago

extract-summary v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

extract-summary extracts summaries from blocks of text.

const extractSummary = require('extract-summary')

let summary = extractSummary(`

<p><b>Human action</b> is <em>purposeful behavior</em>. Or we may say: Action is will put
into operation and transformed into an agency, is aiming at ends and goals, is the ego's
meaningful response to stimuli and to the conditions of its environment, is a person's
conscious adjustment to the state of the universe that determines his life. Such paraphrases
may clarify the definition given and prevent possible misinterpretations. But the definition
itself is adequate and does not need complement of commentary.</p>

(continuining HTML content...)

`, 'html')

That yields a string that can be used as a summary in blogs and similar things.

Please see the source to see a grasp of the algorithm being used. It is simple, but it is not just slicing the text without looking at it. See the tests for more examples.

Licensed in the MIT terms.