• Stars
    star
    113
  • Rank 310,115 (Top 7 %)
  • Language
    Go
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

go-gimei

Build Status Codecov GoDoc Go Report Card

This project is a golang port of Ruby's gimei. Import as library or use as CLI.

go-gimei generates fake data that people's name and address in Japanese and supports furigana phonetic renderings of kanji.

The project name comes from Japanese '偽名' means a false name.

Usage

package main

import (
	"fmt"

	"github.com/mattn/go-gimei"
)

func main() {
	name := gimei.NewName()
	fmt.Println(name)                  // 斎藤 陽菜
	fmt.Println(name.Kanji())          // 斎藤 陽菜
	fmt.Println(name.Hiragana())       // さいとう はるな
	fmt.Println(name.Katakana())       // サイトウ ハルナ
	fmt.Println(name.Romaji())         // Haruna Saito
	fmt.Println(name.Last.Kanji())     // 斎藤
	fmt.Println(name.Last.Hiragana())  // さいとう
	fmt.Println(name.Last.Katakana())  // サイトウ
	fmt.Println(name.Last.Romaji())    // Saito
	fmt.Println(name.First.Kanji())    // 陽菜
	fmt.Println(name.First.Hiragana()) // はるな
	fmt.Println(name.First.Katakana()) // ハルナ
	fmt.Println(name.First.Romaji())   // Haruna
	fmt.Println(name.Sex)              // 女
	fmt.Println(name.IsMale())         // false

	male := gimei.NewMale()
	fmt.Println(male)            // 小林 顕士
	fmt.Println(male.IsMale())   // true
	fmt.Println(male.IsFemale()) // false

	address := gimei.NewAddress()
	fmt.Println(address)                       // 岡山県大島郡大和村稲木町
	fmt.Println(address.Kanji())               // 岡山県大島郡大和村稲木町
	fmt.Println(address.Hiragana())            // おかやまけんおおしまぐんやまとそんいなぎちょう
	fmt.Println(address.Katakana())            // オカヤマケンオオシマグンヤマトソンイナギチョウ
	fmt.Println(address.Prefecture)            // 岡山県
	fmt.Println(address.Prefecture.Kanji())    // 岡山県
	fmt.Println(address.Prefecture.Hiragana()) // おかやまけん
	fmt.Println(address.Prefecture.Katakana()) // オカヤマケン
	fmt.Println(address.City)                  // 大島郡大和村
	fmt.Println(address.City.Kanji())          // 大島郡大和村
	fmt.Println(address.City.Hiragana())       // おおしまぐんやまとそん
	fmt.Println(address.City.Katakana())       // オオシマグンヤマトソン
	fmt.Println(address.Town)                  // 稲木町
	fmt.Println(address.Town.Kanji())          // 稲木町
	fmt.Println(address.Town.Hiragana())       // いなぎちょう
	fmt.Println(address.Town.Katakana())       // イナギチョウ

	prefecture := gimei.NewPrefecture()
	fmt.Println(prefecture) // 青森県
}

Deterministic Random

go-gimei supports seeding of its pseudo-random number generator to provide deterministic output of repeated method calls.

import "math/rand"

gimei.SetRandom(rand.New(rand.NewSource(42)))
fmt.Println(gimei.NewName())    // 前川 永麻
fmt.Println(gimei.NewAddress()) // 佐賀県斜里郡斜里町浄法寺町樋口

gimei.SetRandom(rand.New(rand.NewSource(42)))
fmt.Println(gimei.NewName())    // 前川 永麻
fmt.Println(gimei.NewAddress()) // 佐賀県斜里郡斜里町浄法寺町樋口

CLI Usage

$ gimei [OPTIONS] [ARGS]

Omitting ARGS is equivalent to specifying name:kanji.

OPTIONS

-sep string
    specify string used to separate fields(default: ", ").
-n number
    display number record(s).
-count
    display records read from embedded yaml files and exit.
-h, -help
    display usage and exit.

ARGS

Argument for a personal name:

name|male|female[:NAME_DISPLAY_OPTION]

NAME_DISPLAY_OPTION list

to display full name:
    'kanji', (is equivalent to omitting NAME_DISPLAY_OPTION)
    'hiragana',
    'katakana',
    'romaji'
to display last name:
    'last-kanji',
    'last-hiragana',
    'last-katakana',
    'last-romaji'
to display first name:
    'first-kanji',
    'first-hiragana',
    'first-katakana',
    'first-romaji'
to display which it is male/female:
    'is-male',
    'is-female'

Argument for an address:

address[:ADDRESS_DISPLAY_OPTION]

ADDRESS_DISPLAY_OPTION list

to display address:
    'kanji', (is eqivalent ot omitting ADDRESS_DISPLAY_OPTION)
    'hiragana',
    'katakana'
to display prefecture:
    'prefecture-kanji',
    'prefecture-hiragana',
    'prefecture-katakana'
to display city:
    'city-kanji',
    'city-hiragana',
    'city-katakana'
to display town:
    'town-kanji',
    'town-hiragana',
    'town-katakana'

EXAMPLES

$ gimei
古賀 正浩
$ gimei name:kanji name:katakana
中村 紳一, ナカムラ シンイチ
$ gimei -sep '/' address:prefecture-kanji address:town-kanji
滋賀県/田所町
$ gimei -n 3 name name:hiragana
白川 彰花, しらかわ あきか
関根 勇一, せきね ゆういち
大場 星良, おおば きらら

Requirements

golang

Installation

Install the library.

$ go get github.com/mattn/go-gimei

CLI installation

On Go version 1.16 or later, this command works:

$ go install github.com/mattn/go-gimei/cmd/gimei@latest

Running Tests

To run all the tests, do:

$ go test

License

MIT

Dictionary YAML file is generated from naist-jdic.

Author

Yasuhiro Matsumoto (a.k.a mattn)

More Repositories

1

go-sqlite3

sqlite3 driver for go using database/sql
C
7,722
star
2

emmet-vim

emmet for vim: http://emmet.io/
Vim Script
6,288
star
3

goreman

foreman clone written in go language
Go
2,330
star
4

go-gtk

Go binding for GTK
Go
2,108
star
5

vim-gist

Vim plugin for Gist
Vim Script
1,688
star
6

gom

Go Manager - bundle for go
Go
1,389
star
7

anko

Scriptable interpreter written in golang
Go
1,364
star
8

go-generics-example

Example code for Go generics
Go
1,324
star
9

vim-lsp-settings

Auto configurations for Language Server for vim-lsp
Vim Script
1,110
star
10

memo

📓 Memo Life For You
Go
924
star
11

efm-langserver

General purpose Language Server
Go
880
star
12

goveralls

Go
789
star
13

go-isatty

Go
739
star
14

sudo

sudo for windows
Go
732
star
15

go-colorable

Go
713
star
16

webapi-vim

vim interface to Web API
Vim Script
680
star
17

longcat

Looooooooooooooooooooooooooooooooooooooooooooooong cat
Go
645
star
18

go-oci8

Oracle driver for Go using database/sql
Go
618
star
19

docx2md

Convert Microsoft Word Document to Markdown
Go
575
star
20

awesome-twitter-communities

Awesome Twitter Communities for Engineers
561
star
21

go-mastodon

mastodon client for golang
Go
553
star
22

go-runewidth

wcwidth for golang
Go
544
star
23

go-shellwords

Parse line as shell words
Go
491
star
24

vim-sonictemplate

Easy and high speed coding method
Vim Script
329
star
25

go-webkit

webkit widget for go-gtk
Go
291
star
26

twty

command-line twitter client written in golang
Go
280
star
27

gopher

Windows Desktop Mascot Applicaiton "Gopher"
Go
279
star
28

go-tflite

Go binding for TensorFlow Lite
Jupyter Notebook
270
star
29

go-v8

Go binding for v8
Go
264
star
30

calendar-vim

calendar vimscript
Vim Script
253
star
31

flappyvird-vim

Vim Script
235
star
32

growl-for-linux

Growl Implementation For Linux #growl4linux
C
207
star
33

go-zglob

Go
195
star
34

go-redmine

Go
186
star
35

ft

File Transferer
Go
185
star
36

go-tty

Go
184
star
37

goemon

五右衛門
Go
179
star
38

gof

Go
177
star
39

qq

Go
166
star
40

vim-maketable

Vim Script
150
star
41

vim-goimports

Vim plugin for Minimalist Gopher
Vim Script
149
star
42

go-pipeline

Go
147
star
43

etcdenv

Go
142
star
44

jvgrep

grep for japanese vimmer
Go
140
star
45

go-sixel

DRCS/Sixel Encoder/Decoder
Go
137
star
46

go-vue-example

Example App using Go, Vue.js, Element, Axios
Go
135
star
47

tailscale-systray

Linux port of tailscale system tray menu.
Go
134
star
48

go-adodb

Microsoft ActiveX Object DataBase driver for go that using exp/sql
Go
133
star
49

vim-particle

This plugin works on Windows
C
129
star
50

todo

A simple command-line todo list written in Go.
Go
129
star
51

jedie

Static site generator written in golang
Go
128
star
52

clask

Web micro-framework like flask in C++.
C++
124
star
53

golisp

Lisp Interpreter
Go
123
star
54

go-pointer

Go
118
star
55

godown

Convert HTML into Markdown
Go
113
star
56

vim-trex

Running T-Rex with Vim
JavaScript
111
star
57

golang-wasm-example

Example app using Go's wasm support.
JavaScript
111
star
58

livestyle-vim

Emmet LiveStyle for Vim
Vim Script
110
star
59

go-pubsub

Go
107
star
60

go-scan

Go
103
star
61

go-slim

Slim Template Engine for golang
Go
103
star
62

vim-notification

Message notification system for Vim8
Vim Script
103
star
63

gowasmer

WebAssembly runtime for wasmer-go
Go
102
star
64

bsky

A cli application for bluesky social
Go
101
star
65

dotfiles

100
star
66

vim-starwars

Playing StarWars on Vim
Vim Script
97
star
67

vim-brain

Neural Networks written in Vim script
Vim Script
96
star
68

go-nulltype

Null friendly types
Go
96
star
69

go-jsonpointer

Go
95
star
70

files

Fast file find
Go
92
star
71

mkup

Portable Markdown Previewer
JavaScript
92
star
72

go-uv

Go binding for libuv
Go
92
star
73

dboxpaper

client for Dropbox Paper
Go
92
star
74

mruby-uv

interface to libuv for mruby(experimental)
C
91
star
75

davfs

Go
90
star
76

tinytinyhttpd

tiny tiny httpd
C++
88
star
77

echo-scaffold

Echo scaffold is CLI to generate scaffolds for the echo framework.
Go
87
star
78

vim-chatgpt

Vim Script
85
star
79

streeem

ごめんなさいごめんなさい
Go
85
star
80

go-mruby

go-mruby make interface to embed mruby into go.
Go
83
star
81

algia

A cli application for nostr
Go
80
star
82

http-server

C
76
star
83

go-ieproxy

Go
76
star
84

cho

Go
76
star
85

vim-sqlfmt

Vim Script
74
star
86

vim-molder

Vim Script
71
star
87

vim-treesitter

Go
70
star
88

vimtweak

VimTweak : The tweaking dll for GVim.exe.
C
69
star
89

gomate

Go
68
star
90

awesome-sonomasakada

68
star
91

ansicolor-w32.c

C
67
star
92

gh-ost

gh extension to meet ghost.
Shell
66
star
93

http-gonsole

Speak HTTP like a local. (the simple, intuitive HTTP console, golang version)
Go
65
star
94

vim-fz

Ultra Fast Fuzzy Finder for Vim8
Vim Script
65
star
95

vdbi-vim

Database client for Vim
Vim Script
64
star
96

chatgpt

Go
63
star
97

xgopher

Linux port of https://github.com/mattn/gopher
C
61
star
98

gntp-send

command line program that send to growl using GNTP protocol.
C
57
star
99

vim-usa_president_2016

Vim Script
55
star
100

go-uwsgi

uwsgi implement for go
Go
54
star