Skip to content

Instantly share code, notes, and snippets.

@pressure679
Created October 15, 2020 16:53
Show Gist options
  • Save pressure679/4b8246cb506e96f371e0725c64c97ad7 to your computer and use it in GitHub Desktop.
Save pressure679/4b8246cb506e96f371e0725c64c97ad7 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
// "bufio"
"io/ioutil"
"flag"
"github.com/pressure679/rake"
"math"
)
func main() {
fileflag := flag.String("file", "", "file to read from")
flag.Parse()
osfile, err := os.Open(*fileflag)
if err != nil { panic(err) }
data, err := ioutil.ReadAll(osfile)
raked := rake.RunRake(string(data))
err = osfile.Close()
if err != nil { panic(err) }
for key, _ := range raked {
// fmt.Printf(".%2f - %s\n", raked[key].Value, raked[key].Key)
fmt.Println(fmt.Sprintf("%.2f", math.Round(raked[key].Value*100)/100), "-", raked[key].Key)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment