This repo is a port of Wanikani's JS implementation located here.
No errors are returned by any of the exported functions or methods; this is to keep the behavior the same as the original implementation, but there is an argument to be made to change this.
If anyone would like to make a PR to improve this repository, here are a few suggestions regarding what could be done:
- Improve tree caching -- currently only one tree can be stored in the cache and it is not modifiable
- Add a wasm compilation target and add support for binding and unbinding an element similar to what the original implementation is capable of
- Move the tree generation logic into a
generate
package. Runninggo generate
should generate source code with thego:embed
directive along with all of the key/value pairs to store in the tree. This makes it more transparent as to what each tree contains by default rather than having to decipher how it is being generated.
Here is an example of how this package can be used:
package main
import (
"fmt"
"github.com/deelawn/wanakana"
"github.com/deelawn/wanakana/config"
)
func main() {
romaji := "okonomiyakinikuman"
options := config.Options{
IMEMode: config.ToKanaMethodKatakana,
}
kana := wanakana.ToKana(romaji, options, nil)
fmt.Println(kana)
}
This produces オコノミヤキニクマン