Go bindings for Morfeusz 2, a morphological analyser for Polish.
-
Install the C/C++ headers for Morfeusz, as described on the page about Morfeusz's programming tools.
-
go get github.com/go-morfeusz/morfeusz
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"github.com/go-morfeusz/morfeusz"
)
func main() {
b, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatal(err)
}
m, err := morfeusz.New(nil)
if err != nil {
log.Fatal(err)
}
r := m.Analyse(b)
for r.Next() {
t := r.TokenInfo()
fmt.Println(
t.StartNode(), t.EndNode(), t.Orth(), t.Lemma(),
t.Tag(m), t.Name(m), t.LabelsAsString(m))
}
}
Marcin Ciura
The Go package morfeusz
, like Morfeusz 2 itself,
is licensed under BSD 2-Clause License.