Skip to content

Commit

Permalink
Merge pull request #2 from deelawn/ci
Browse files Browse the repository at this point in the history
Readme and slight logic change
  • Loading branch information
deelawn committed Jul 12, 2023
2 parents 04d3564 + 8c21273 commit 2cc5c60
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
# WanaKana
[![godoc](https://godoc.org/github.com/deelawn/wanakana?status.svg)](https://godoc.org/github.com/deelawn/wanakana)
[![Coverage Status](https://coveralls.io/repos/github/deelawn/wanakana/badge.svg)](https://coveralls.io/github/deelawn/wanakana)
[![Go Report Card](https://goreportcard.com/badge/github.com/deelawn/wanakana)](https://goreportcard.com/report/github.com/deelawn/wanakana)
[![Go Report Card](https://goreportcard.com/badge/github.com/deelawn/wanakana)](https://goreportcard.com/report/github.com/deelawn/wanakana)

This repo is a port of Wanikani's JS implementation located [here](https://github.com/WaniKani/WanaKana).

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.

## Improvements
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. Running `go generate` should generate source code with the `go: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.

## Usage
Here is an example of how this package can be used:
``` go
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 `オコノミヤキニクマン`
2 changes: 1 addition & 1 deletion kana.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func ToKana(input string, options config.Options, treeMap *tree.Map) string {
tokens := transform.ToKanaToken(
[]rune(strings.ToLower(input)),
treeMap,
!(options.IMEMode == config.ToKanaMethodNone),
options.IMEMode != config.ToKanaMethodNone,
)

var result string
Expand Down

0 comments on commit 2cc5c60

Please sign in to comment.