code: func (d *Document) Summary(n int) []RankedParagraph {
  	rankings := []RankedParagraph{}
  	scores := d.Keywords()
  	for i := 0; i < int(d.NumParagraphs); i++ {
  		p := RankedParagraph{Position: i}
  		rank := 0
  		size := 0
  		for _, s := range d.Sentences {
  			if s.Paragraph == i {
  				size += s.Length
  				for _, w := range s.Words {
  					if score, found := scores[w.Text]; found {
  						rank += score
  					}
  				}
  				p.Sentences = append(p.Sentences, s)
  			}
  		}
  		// Favor longer paragraphs, as they tend to be more informational.
  		p.Rank = (rank * size)
  		rankings = append(rankings, p)
  	}
  
  	// Sort by raking:
  	sort.Sort(byRank(rankings))
  
  	// Take the top-n paragraphs:
  	size := len(rankings)
  	if size > n {
  		rankings = rankings[size-n:]
  	}
  
  	// Sort by chronological position:
  	sort.Sort(byIndex(rankings))
  	return rankings
  }
docs: // Summary returns a Document's n highest ranked paragraphs according to
  // keyword frequency.