Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ikawaha committed Oct 2, 2021
1 parent d6ccc71 commit a3ab9a8
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.14.x', '1.15.x', '1.16.x']
go: ['1.16.x', '1.17.x']
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -25,14 +25,14 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
path: src/github.com/ikawaha/encoding
path: src/github.com/ikawaha/kanji

- name: Build
run: go build -v ./...
working-directory: src/github.com/ikawaha/encoding
working-directory: src/github.com/ikawaha/kanji

- name: Test
run: |
go test -v ./...
working-directory: src/github.com/ikawaha/encoding
working-directory: src/github.com/ikawaha/kanji

9 changes: 1 addition & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
skip-dirs:
- jisx0208/tool
- tool
issues:
exclude-use-default: false
exclude-rules:
Expand All @@ -11,17 +11,10 @@ issues:
linters:
enable:
- gocyclo
- staticcheck
- govet
- revive
disable:
- maligned
- exhaustive
- noctx
- asciicheck
- sqlclosecheck
- rowserrcheck
- gosec
- scopelint
presets:
- bugs
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
Kanji
===
This package is a library for the Japanese kanji, including the regular-use kanji characters (常用漢字表), etc.

日本語漢字に関するパッケージです。

## 常用漢字

常用漢字は `一般の社会生活において現代の国語を書き表すための漢字使用の目安` として示される漢字の集合で、このパッケージでは [平成22年内閣告示第2号 (2010年11月30日)](https://www.bunka.go.jp/kokugo_nihongo/sisaku/joho/joho/kijun/naikaku/kanji/index.html) として告示されているものを対象にしています。

このパッケージで「常用漢字」は、標準字体 2136字、旧字体 364字、許容字体 5字からなる集合として扱っています。標準字体、旧字体、許容字体のそれぞれを `unicode.RangeTable` として定義していますので直接利用可能です。また、これらを扱う関数も定義されています。詳しくは [ドキュメント](https://pkg.go.dev/github.com/ikawaha/encoding/kanji) を参照してください。
このパッケージで「常用漢字」は、標準字体 2136字、旧字体 364字、許容字体 5字からなる集合として扱っています。標準字体、旧字体、許容字体のそれぞれを `unicode.RangeTable` として定義していますので直接利用可能です。また、これらを扱う関数も定義されています。詳しくは [ドキュメント](https://pkg.go.dev/github.com/ikawaha/kanji) を参照してください。

## 人名用漢字

人名用漢字は、常用漢字以外で子の名に使える漢字の集合のことです。法務省のページに [子の名に使える漢字](http://www.moj.go.jp/MINJI/minji86.html) として定義されています。 人名用漢字を `unicode.RangeTable` として定義していますので直接利用可能です。また、人名に使える漢字であるかどうか(常用漢字であるかまたは人名用漢字であるか)をチェックする関数を用意しています。詳しくは [ドキュメント](https://pkg.go.dev/github.com/ikawaha/encoding/kanji) を参照してください。
人名用漢字は、常用漢字以外で子の名に使える漢字の集合のことです。法務省のページに [子の名に使える漢字](http://www.moj.go.jp/MINJI/minji86.html) として定義されています。 人名用漢字を `unicode.RangeTable` として定義していますので直接利用可能です。また、人名に使える漢字であるかどうか(常用漢字であるかまたは人名用漢字であるか)をチェックする関数を用意しています。詳しくは [ドキュメント](https://pkg.go.dev/github.com/ikawaha/kanji) または [ブログ](https://zenn.dev/ikawaha/articles/20210801-e995d788c30ec1) を参照してください。

---
MIT
1 change: 1 addition & 0 deletions for_personal_name_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"unicode"
)

// DesignatedForPersonalNamesRangeTable is the designated kanji set for personal names.
var DesignatedForPersonalNamesRangeTable = &unicode.RangeTable{
R16: []unicode.Range16{
{Lo: 0x4E11, Hi: 0x4E11, Stride: 1},
Expand Down
2 changes: 1 addition & 1 deletion for_personal_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestIsForPersonalNames(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error, %v", err)
}
defer f.Close()
defer f.Close() //nolint: gosec
s := bufio.NewScanner(f)
s.Scan()
line := s.Text()
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/ikawaha/encoding
module github.com/ikawaha/kanji

go 1.16
go 1.17
2 changes: 1 addition & 1 deletion regularuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestIs_Golden(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
defer f.Close()
defer f.Close() //nolint: gosec
s := bufio.NewScanner(f)
var line int
for s.Scan() {
Expand Down
6 changes: 3 additions & 3 deletions tool/jinmeirangetablebuilder/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module rangerablebuilder

go 1.16
go 1.17

replace github.com/ikawaha/encoding => ./../..
replace github.com/ikawaha/kanji => ./../..

require github.com/ikawaha/encoding v0.0.0-00010101000000-000000000000
require github.com/ikawaha/kanji v0.0.0-00010101000000-000000000000
6 changes: 3 additions & 3 deletions tool/regularuserangetablebuilder/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module rangerablebuilder

go 1.16
go 1.17

replace github.com/ikawaha/encoding => ./../..
replace github.com/ikawaha/kanji => ./../..

require github.com/ikawaha/encoding v0.0.0-00010101000000-000000000000
require github.com/ikawaha/kanji v0.0.0-00010101000000-000000000000

0 comments on commit a3ab9a8

Please sign in to comment.