https://github.com/mdm-code/prg2p
Grapheme-to-phoneme rule-based converter for Polish in Go.
https://github.com/mdm-code/prg2p
cli converter filter g2p go golang golang-package grapheme-to-phoneme natural-language-processing nlp nlproc tui
Last synced: 5 months ago
JSON representation
Grapheme-to-phoneme rule-based converter for Polish in Go.
- Host: GitHub
- URL: https://github.com/mdm-code/prg2p
- Owner: mdm-code
- License: mit
- Created: 2021-12-23T13:41:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-25T20:42:30.000Z (over 2 years ago)
- Last Synced: 2024-06-21T03:18:15.755Z (about 2 years ago)
- Topics: cli, converter, filter, g2p, go, golang, golang-package, grapheme-to-phoneme, natural-language-processing, nlp, nlproc, tui
- Language: Go
- Homepage: https://pkg.go.dev/github.com/mdm-code/prg2p
- Size: 51.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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](https://pkg.go.dev/github.com/mdm-code/prg2p)
or check [Usage](#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:
```sh
go get github.com/mdm-code/prg2p
```
In order to use the CLI program, you need to use this command:
```sh
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](#installation) 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:
```go
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:
```sh
go install golang.org/x/lint/golint@latest
```
Happy coding!
## License
Copyright (c) 2023 Michał Adamczyk.
This project is licensed under the [MIT license](https://opensource.org/licenses/MIT).
See [LICENSE](LICENSE) for more details.