https://github.com/gojp/japanese
Golang package for Japanese grammar.
https://github.com/gojp/japanese
go golang grammar japanese nihongo
Last synced: 2 months ago
JSON representation
Golang package for Japanese grammar.
- Host: GitHub
- URL: https://github.com/gojp/japanese
- Owner: gojp
- License: other
- Created: 2013-10-31T14:19:53.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-06-09T05:23:38.000Z (about 5 years ago)
- Last Synced: 2025-03-28T04:28:29.034Z (3 months ago)
- Topics: go, golang, grammar, japanese, nihongo
- Language: Go
- Homepage:
- Size: 54.7 KB
- Stars: 50
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://travis-ci.org/gojp/japanese) [](https://goreportcard.com/report/github.com/gojp/japanese) [](https://godoc.org/github.com/gojp/japanese)
# JapaneseA Go (golang) package for generating the different possible word forms and conjugations in Japanese.
This is still in the experimental stage. However, later extensions might also include basic grammar parsing, analysis and translation.
## Where this is aiming
A `GetRoot` function that takes a string and returns one or more root forms, along with the rule used to transform it to root form. For example:
```
>>> roots := japanese.Analyze("食べない")
>>> root := roots[0]
>>> fmt.Println(root.Root, root.DictionaryForm, root.Rule)
食べ 食べる negative
```## Examples
For the most comprehensive examples, see the `words_test.go` file.For the impatient, here's an example of usage right now (subject to change in the future):
func main() {
taberu := Verb{Verb{Word{"食べる", "たべる"}}
kau := Verb{Verb{Word{"買う", "かう"}}
matsu := Verb{Word{"待つ", "まつ"}}fmt.Println(taberu.Negative()) // prints 食べない
fmt.Println(kau.Negative()) // prints 買わない
fmt.Println(matsu.Negative()) // prints 待たない
}