Skip to content

Instantly share code, notes, and snippets.

@cipepser
Created August 6, 2017 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cipepser/8a0fc9ac1d9432a9da14bd87d91476ae to your computer and use it in GitHub Desktop.
Save cipepser/8a0fc9ac1d9432a9da14bd87d91476ae to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
"fmt"
"io"
"os"
"github.com/reiver/go-porterstemmer"
)
func main() {
f, err := os.Open("../data/q51_out.txt")
defer f.Close()
if err != nil {
panic(err)
}
r := bufio.NewReader(f)
for {
w, _, err := r.ReadLine()
if err == io.EOF {
break
}
if len(w) == 0 {
continue
}
stem := porterstemmer.StemString(string(w))
fmt.Println(string(w), "\t", stem)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment