Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
togatoga committed Jun 23, 2024
1 parent d84ee68 commit d482090
Showing 1 changed file with 57 additions and 7 deletions.
64 changes: 57 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Kanpyo

[https://docs.rs/kanpyo](https://docs.rs/kanpyo)

Kanpyo is Japanese morphological analyzer written in Rust inspired by [Kagome](https://github.com/ikawaha/kagome).

## Caution
Expand All @@ -14,14 +16,14 @@ You can install `kanpyo` via `cargo`:
cargo install kanpyo
```

You need a dictionary to use `kanpyo` and can build a dictionary by the following.
You need a dictionary to use `kanpyo` and can build and install a dictionary by the following.

```shell script
cd kanpyo-dict
cargo run --release --bin ipa-dict-builder --
```

Create a dictionary file in user's config directory.
A dictionary is installed in the following directory:

- Linux
- $HOME/.config/kanpyo/
Expand All @@ -32,18 +34,66 @@ You're ready to use `kanpyo`!

## Usage

```shell script
kanpyo --help
Japanese Morphological Analyzer

Usage: kanpyo [COMMAND]

Commands:
tokenize Tokenize input text
graphviz Output lattice in Graphviz format
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help
-V, --version Print version
```

### Tokenize

TODO
#### From command line

### Graphviz
```shell script
kanpyo tokenize "自然言語処理"
自然 名詞,形容動詞語幹,*,*,*,*,自然,シゼン,シゼン
言語 名詞,一般,*,*,*,*,言語,ゲンゴ,ゲンゴ
処理 名詞,サ変接続,*,*,*,*,処理,ショリ,ショリ
EOS
```

TODO
#### REPL mode

### Server
```shell script
kanpyo
自然言語処理
自然 名詞,形容動詞語幹,*,*,*,*,自然,シゼン,シゼン
言語 名詞,一般,*,*,*,*,言語,ゲンゴ,ゲンゴ
処理 名詞,サ変接続,*,*,*,*,処理,ショリ,ショリ
EOS
形態素解析
形態素 名詞,一般,*,*,*,*,形態素,ケイタイソ,ケイタイソ
解析 名詞,サ変接続,*,*,*,*,解析,カイセキ,カイセキ
EOS
```

#### From piped standard input

```shell script
echo "自然言語処理" | kanpyo
自然 名詞,形容動詞語幹,*,*,*,*,自然,シゼン,シゼン
言語 名詞,一般,*,*,*,*,言語,ゲンゴ,ゲンゴ
処理 名詞,サ変接続,*,*,*,*,処理,ショリ,ショリ
EOS
```

### Graphviz

TODO
Print lattice in Graphviz format for debugging.

```shell script
kanpyo graphviz "自然言語処理" | dot -Tpng -o lattice.png
```

### TODO

Expand Down

0 comments on commit d482090

Please sign in to comment.