Skip to content

Instantly share code, notes, and snippets.

@cipepser
Created Aug 6, 2017
Embed
What would you like to do?
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