Giter VIP home page Giter VIP logo

prg2p's Introduction

logo

Grapheme-to-phoneme converter for Polish in Go

The prg2p package implements a grapheme-to-phoneme rule based converter for Polish.

It provides a standalone command-line program to process data efficiently on the terminal and exposes the public API components of the package for code reuse.

Consult the package documentation or check Usage section below to see how to use prg2p in your code.

Installation

To add package to a Go project dependencies run the following command:

go get github.com/mdm-code/prg2p

In order to use the CLI program, you need to use this command:

go install github.com/mdm-code/prg2p@latest

Here, you can use the @latest or any version you find appropriate for that matter.

Usage

Type prg2p -h from the terminal after installing executables as described here to see how to use prg2p command-line interface.

Here is how you can use the public API of the prg2p package in your code:

package main

import (
	"fmt"

	"github.com/mdm-code/prg2p"
)

func main() {
	r := prg2p.Rules()
	g2p, err := prg2p.Load(r)
	if err != nil {
		fmt.Println(err)
		return
	}

	// Iterate over words to get their phonemic transcripts
	var trans []string
	for _, w := range []string{"ala", "ma", "kota"} {
		t, err := g2p.Transcribe(w, false)
		if err != nil {
			fmt.Println(err)
			continue
		}
		trans = append(trans, t...)
	}
	for _, t := range trans {
		fmt.Println(t)
	}
}

Development

All necessary development tools are in the Makefile. Calling make test consecutively invokes go fmt, go vet, golint and go test. CI/CD is handled by Github workflows. Remember to install golint before testing and building:

go install golang.org/x/lint/golint@latest

Happy coding!

License

Copyright (c) 2023 Michał Adamczyk.

This project is licensed under the MIT license. See LICENSE for more details.

prg2p's People

Contributors

mdm-code avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.