I am writing a tool that will give users the ability to summarize text content on a webpage, by highlighting the text that they wish to get summarized.

So far, I've received results that I can work with in order to further optimize the algorithm, but only when applied to single paragraphs. When multiple paragraphs are selected, the summary isn't very successful in that it usually focuses on a certain major part of the selected text input, ignoring other parts that should also be mentioned in the summary. This is because the entire algorithm functions around determining the most important sentence of a paragraph (or in this case, multiple paragraphs combined in one big "paragraph"), and then determining which other sentences are related/of importance to this "core sentence". The algorithm uses extractive automatic summarization (explanation on WikiPedia).

As a single paragraph usually handles one major subject, this algorithm works alright in such cases but when a big text with multiple paragraphs (and thus usually multiple major subjects), important parts are missing from the resulting summary.

My question is, how can I achieve succinct and qualitative summary results when handling a text with multiple paragraphs when using my "core sentence" approach without resorting to an algorithm such as TextRank (which works good but delivers summaries that are too long, often containing 60-70% of the original text) - or should I force my users to summarize paragraph per paragraph (as I haven't found a trustworthy way yet to correctly determine paragraphs in a text when there are no \n\n characters or <p>-tags between the paragraphs to split the input on).

2 Answers 2


I did some work a couple of years back on a similar project. The algorithm I used was to score sentences for relevance (based on a number of metrics including first reference to named entities mentioned later, back references from nearby sentences, and so on) and pick a user-selected number of them based on score, except:

  • always make sure at least one sentence from the first paragraph was included
  • if the text was over 5 paragraphs long, always ensure at least one sentence from the second paragraph was included
  • always ensure at least one sentence from the last paragraph was selected

Sentences were picked one at a time so that bonuses could be applied to then based on the current selection:

  • there was a bonus for sentences in paragraphs that weren't currently represented
  • there was a bonus for the first and last occurrence of any named entity in the selection

A genetic algorithm was used to optimize the weighting of the various contributors to sentence score based on hand selected summaries for a small corpus. The results (on short news stories) were reasonably good.

  • My algorithm works in a similar way (apart from the mandatory first/last paragraph sentence constraint). However, it fails to recognize where paragraphs begin and end - I believe this is currently the biggest obstacle. How did you manage to handle this? Or did you use previously indicated paragraphs so the algorithm did not have to figure them out itself?
    – Fluppe
    Apr 2, 2017 at 18:34
  • Yes. My text came from diffbot, which outputs text with blank lines to indicate paragraph breaks, so I just looked for \n\n in the text to split them.
    – Jules
    Apr 2, 2017 at 21:03
  • See related question: stackoverflow.com/questions/20015715/…
    – Jules
    Apr 2, 2017 at 21:07
  • I see. Interesting link but I'm not sure if I'll be able to use it since my product will be enitrely browser/JavaScript-based. I am currently modifying my algorithm that instead of one "core sentence" used, a set of core sentences is used (sentences with the highest scores with the highest amount of related sentences) in hopes of covering all important and noteworthy sections of the input in the summary.
    – Fluppe
    Apr 2, 2017 at 23:45

You should read:

H. P. Luhn. “The Automatic Creation of Literature Abstracts,” IBM Journal of Research and Development, 2, No. 2, 159 (April 1958).

I found a copy at http://courses.ischool.berkeley.edu/i256/f06/papers/luhn58.pdf.

  • Your answer reads like a comment. Could you provide more details about this paper and why you think it may be helpful in this situation?
    – scriptin
    Apr 3, 2017 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.