Skip to content

Go bindings for Morfeusz 2, a morphological analyzer for Polish

License

Notifications You must be signed in to change notification settings

go-morfeusz/morfeusz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morfeusz

Go bindings for Morfeusz 2, a morphological analyser for Polish.

Installation

  1. Install the C/C++ headers for Morfeusz, as described on the page about Morfeusz's programming tools.

  2. go get github.com/go-morfeusz/morfeusz

Usage example

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))
	}
}

Author

Marcin Ciura

License

The Go package morfeusz, like Morfeusz 2 itself, is licensed under BSD 2-Clause License.