Created
September 19, 2019 14:31
-
-
Save pressure679/5413d4b396c0c4f20ab28e893bb68b7f to your computer and use it in GitHub Desktop.
use the rake algorithm (rapid applicable keywords) on a txt file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
// "io" | |
// "bufio" | |
// "strings" | |
// "strconv" | |
// "github.com/alixaxel/pagerank" | |
// "github.com/boltdb/bolt" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"github.com/Obaied/RAKE.Go" | |
"flag" | |
) | |
func main() { | |
file := flag.String("file", "", "file with or without path variable.") | |
flag.Parse() | |
osFile, err := os.Open(*file) | |
if err != nil { panic(err) } | |
defer osFile.Close() | |
bytes, err := ioutil.ReadFile(osFile.Name()) | |
if err != nil { panic(err) } | |
cands := rake.RunRake(string(bytes)) | |
for _, cand := range cands { | |
fmt.Println(cand.Value, "-", cand.Key) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment