go-textrank

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2021 License: MIT

README

text rank

go-textrank is go port for the textrank python library.

Usage :


import "github.com/vikesh-raj/go-textrank/textrank"

func main() {
    sentences := []string{
        "sentence 1",
        "sentence 2",
    }

    // Summarization
    scores, _ := textrank.SummarizeSentences(sentences, textrank.Options{Language: "english"})
    top := textrank.PickTopSentencesByRatio(scores, 0.3)
    summary := strings.Join(top, "\n")
    fmt.Println("---- Summary ---")
    fmt.Println(summary)

    // Keywords
    text := strings.Join(sentences, " ")
    keywordScores, _ := textrank.Keywords(text, textrank.Options{Language: "english"}, 0.0, 15)
    keywords := textrank.ScoreSentenceToText(keywordScores)
    allKeywords := strings.Join(keywords, "\n")
    fmt.Println("---- Keywords ---")
    fmt.Println(allKeywords)
}

Directories

Path Synopsis
cmd
examples module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL