Skip to content

Commit

Permalink
Merge pull request #29 from windchime-yk/add-example
Browse files Browse the repository at this point in the history
Add example
  • Loading branch information
windchime-yk committed Mar 2, 2024
2 parents d3d6660 + f9092c8 commit e7deef8
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
coverage/
bid_output/
bid_output_archive.zip
/coverage/
/bid_output
/bid_output_archive.zip
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,29 @@ Denoで作られた、IMEユーザー辞書統一出力ツール。
deno install --allow-read --allow-write --allow-run -n bid https://deno.land/x/bid/cli.ts
```

## 対応ファイル形式
以下の入力ファイル形式に対応しています。

- CSV
- JSON

また、Microsoft Excelなどの表計算ソフトウェアでの利用を想定し、`.xlsx``.ods`の実例ファイルも同梱しています。
詳しくは`example/input`を確認してください。

## 使用方法
### すべての対応IMEユーザー辞書を出力
``` bash
bid --dir=test/mock --all
bid --dir=example/input/raw --all
```

### 特定の対応IMEユーザー辞書を出力
``` bash
bid --dir=test/mock --google --macos --microsoft --gboard
bid --dir=example/input/raw --google --macos --microsoft --gboard
```

### 出力したユーザー辞書ファイル群を圧縮
``` bash
bid --dir=test/mock --all --compress
bid --dir=example/input/raw --all --compress
```

## GitHub Actionsでの設定例
Expand All @@ -61,17 +70,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Deno
uses: denolib/setup-deno@v2
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Output dictionary data
run: |
deno install --allow-read --allow-write -n bid https://deno.land/x/bid/cli.ts
bid --dir=test/mock --all
bid --dir=example/input/raw --all
- name: Archive production artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: dictionary
path: bid_output
Expand Down
21 changes: 14 additions & 7 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,27 @@ The goal is to create all IME user dictionaries from a single file.
deno install --allow-read --allow-write --allow-run -n bid https://deno.land/x/bid/cli.ts
```

## Input File Extensions Support
- CSV
- JSON

Example files in `.xlsx` and `.ods` are included for use with spreadsheet software such as Microsoft Excel.
Please check `example/input` for details.

## Usage
### All dictionaries
``` bash
bid --dir=test/mock --all
bid --dir=example/input/raw --all
```

### Specific dictionaries
``` bash
bid --dir=test/mock --google --macos --microsoft --gboard
bid --dir=example/input/raw --google --macos --microsoft --gboard
```

### Compress dictionaries
``` bash
bid --dir=test/mock --all --compress
bid --dir=example/input/raw --all --compress
```

## Build dictionary workflow example
Expand All @@ -63,17 +70,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Deno
uses: denolib/setup-deno@v2
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Output dictionary data
run: |
deno install --allow-read --allow-write -n bid https://deno.land/x/bid/cli.ts
bid --dir=test/mock --all
bid --dir=example/input/raw --all
- name: Archive production artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: dictionary
path: bid_output
Expand Down
Binary file added example/input/bid-example.ods
Binary file not shown.
Binary file added example/input/bid-example.xlsx
Binary file not shown.
4 changes: 4 additions & 0 deletions example/input/raw/bid-example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type,word,reading,isSuppress,isSuggest,description
人名,Ryan Dahl,らいあんだーる,NO,NO,Node.jsやDenoの生みの親
人名,Brendan Eich,ぶれんだんあいく,NO,NO,JavaScriptの生みの親
人名,Linus Benedict Torvalds,りーなすべねでぃくととーばるず,NO,YES,Linuxカーネルの生みの親
29 changes: 29 additions & 0 deletions example/input/raw/bid-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://cdn.jsdelivr.net/gh/windchime-yk/bid@v1.0.0/schema.json",
"dictionaries": [
{
"type": "人名",
"word": "Ryan Dahl",
"reading": "らいあんだーる",
"isSuppress": "NO",
"isSuggest": "NO",
"description": "Node.jsやDenoの生みの親"
},
{
"type": "人名",
"word": "Brendan Eich",
"reading": "ぶれんだんあいく",
"isSuppress": "NO",
"isSuggest": "NO",
"description": "JavaScriptの生みの親"
},
{
"type": "人名",
"word": "Linus Benedict Torvalds",
"reading": "りーなすべねでぃくととーばるず",
"isSuppress": "NO",
"isSuggest": "YES",
"description": "Linuxカーネルの生みの親"
}
]
}
3 changes: 3 additions & 0 deletions example/output/bid_output/bid-example/bid-example-gboard.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
らいあんだーる Ryan Dahl ja-JP
ぶれんだんあいく Brendan Eich ja-JP
りーなすべねでぃくととーばるず Linus Benedict Torvalds ja-JP
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
らいあんだーる Ryan Dahl 人名
ぶれんだんあいく Brendan Eich 人名
りーなすべねでぃくととーばるず Linus Benedict Torvalds サジェストのみ
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
らいあんだーる,Ryan Dahl,人名
ぶれんだんあいく,Brendan Eich,人名
りーなすべねでぃくととーばるず,Linus Benedict Torvalds,人名
Binary file not shown.
Binary file added example/output/bid_output_archive.zip
Binary file not shown.

0 comments on commit e7deef8

Please sign in to comment.