Пример #1
0
func summaryFromFulltext(str string) string {
	bag := tldr.New()
	result, err := bag.Summarize(str, 3)
	if err != nil {
		return ""
	}
	return result
}
Пример #2
0
func (story *Story) Summarize(sentences int) string {
	tldr := tldr.New()
	result, err := tldr.Summarize(story.Content, sentences)
	if err != nil {
		fmt.Printf("There was an error summarizing text:\n%s\n", err)
	}

	return result
}