Created
August 6, 2017 06:08
-
-
Save cipepser/8a0fc9ac1d9432a9da14bd87d91476ae to your computer and use it in GitHub Desktop.
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 ( | |
"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