Skip to content

Instantly share code, notes, and snippets.

@pressure679
Created October 15, 2020 16:53
Show Gist options
  • Save pressure679/8262d1ac996cd573b0928e858f49b014 to your computer and use it in GitHub Desktop.
Save pressure679/8262d1ac996cd573b0928e858f49b014 to your computer and use it in GitHub Desktop.
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"
"math"
)
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.Printf("%.2f", cand.Value, "-", cand.Key)
fmt.Println(fmt.Sprintf("%.2f", math.Round(cand.Value*100)/100), "-", cand.Key)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment