Skip to content

Commit b65900b

Browse files
committed
docs: add README to each example
1 parent 9b43806 commit b65900b

File tree

5 files changed

+77
-13
lines changed

5 files changed

+77
-13
lines changed

_examples/db_search/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ It demonstrates how to tokenize Japanese text using Kagome, which is a common re
5555
By using SQLite with FTS4, it efficiently manages and searches through a large amount of text data, making it suitable for applications like:
5656

5757
1. **Search Engines:** You can use this code as a basis for building a search engine that indexes and searches Japanese text content.
58-
2. **Document Management Systems:** This code can be integrated into a document management system to enable full-text search capabilities for Japanese documents.
58+
2. **Document Management Systems:** This code can be integrated into a document management system to enable full-text search capabilities for Japanese documents.
5959
3. **Content Recommendation Systems:** When you have a large collection of Japanese content, you can use this code to implement content recommendation systems based on user queries.
6060
4. **Chatbots and NLP:** If you're building chatbots or natural language processing (NLP) systems for Japanese language, this code can assist in text analysis and search within the chatbot's knowledge base.
6161

_examples/tokenize/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Tokenizing Example with Kagome
2+
3+
## Analyzing a Japanese text into words and parts of speech with Kagome
4+
5+
This example demonstrates how to analyzes a sentence (tokenize) and get the part-of-speech (POS) of each word using Kagome.
6+
7+
- Target text data is as follows:
8+
9+
```text
10+
すもももももももものうち
11+
```
12+
13+
- Example output:
14+
15+
```shellsession
16+
$ cd /path/to/kagome/_examples/tokenize
17+
$ go run .
18+
---tokenize---
19+
すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
20+
も 助詞,係助詞,*,*,*,*,も,モ,モ
21+
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
22+
も 助詞,係助詞,*,*,*,*,も,モ,モ
23+
もも 名詞,一般,*,*,*,*,もも,モモ,モモ
24+
の 助詞,連体化,*,*,*,*,の,ノ,ノ
25+
うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
26+
```
27+
28+
> __Note__ that tokenization varies depending on the dictionary used. In this example we use the IPA dictionary.

_examples/tokenize/main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ func main() {
2222
}
2323

2424
// Output:
25-
//---tokenize---
26-
//すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
27-
//も 助詞,係助詞,*,*,*,*,も,モ,モ
28-
//もも 名詞,一般,*,*,*,*,もも,モモ,モモ
29-
//も 助詞,係助詞,*,*,*,*,も,モ,モ
30-
//もも 名詞,一般,*,*,*,*,もも,モモ,モモ
31-
//の 助詞,連体化,*,*,*,*,の,ノ,ノ
32-
//うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
25+
// ---tokenize---
26+
// すもも 名詞,一般,*,*,*,*,すもも,スモモ,スモモ
27+
// も 助詞,係助詞,*,*,*,*,も,モ,モ
28+
// もも 名詞,一般,*,*,*,*,もも,モモ,モモ
29+
// も 助詞,係助詞,*,*,*,*,も,モ,モ
30+
// もも 名詞,一般,*,*,*,*,もも,モモ,モモ
31+
// の 助詞,連体化,*,*,*,*,の,ノ,ノ
32+
// うち 名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
3333
}

_examples/wakati/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Wakati Example with Kagome
2+
3+
## Segmenting Japanese text into words with Kagome
4+
5+
In this example, we demonstrate how to segment Japanese text into words using Kagome.
6+
7+
- Target text data is as follows:
8+
9+
```text
10+
すもももももももものうち
11+
```
12+
13+
- Example output:
14+
15+
```shellsession
16+
$ cd /path/to/kagome/_examples/wakati
17+
$ go run .
18+
----wakati---
19+
すもも/も/もも/も/もも/の/うち
20+
```
21+
22+
> __Note__ that segmentation varies depending on the dictionary used.
23+
> In this example we use the IPA dictionary. But for searching purposes, the Uni dictionary is recommended.
24+
>
25+
> - [What is a Kagome dictionary?](https://github.com/ikawaha/kagome/wiki/About-the-dictionary#what-is-a-kagome-dictionary) | Wiki | kagome @ GitHub

_examples/wasm/README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
# WebAssembly Example of Kagome
1+
# WebAssembly Example with Kagome
22

3-
- Build
3+
In this example we will demonstrate how to use Kagome in a WebAssembly application and show how responsive it can be.
4+
5+
- See: "[Kagome As a Server Side Tokenizer (Feeling Kagome Slow?)](https://github.com/ikawaha/kagome/wiki/Kagome-As-a-Server-Side-Tokenizer)" | Wiki | kagome @ GitHub
6+
7+
## How to Use
48

59
```sh
10+
# Build the wasm binary
611
GOOS=js GOARCH=wasm go build -o kagome.wasm main.go
12+
13+
# Copy wasm_exec.js which maches to the compiled binary
14+
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
15+
**snip**
716
```
817

18+
Now call the `wasm_exec.js` and `kagome.wasm` from the HTML file and run a web server.
19+
20+
- Online demo: [https://ikawaha.github.io/kagome/](https://ikawaha.github.io/kagome/)
21+
922
```shellsession
1023
├── docs ... gh-pages
1124
│   ├── index.html
@@ -19,5 +32,3 @@ GOOS=js GOARCH=wasm go build -o kagome.wasm main.go
1932
│   ├── go.mod
2033
│   └── go.sum
2134
```
22-
23-
- Online demo: [https://ikawaha.github.io/kagome/](https://ikawaha.github.io/kagome/)

0 commit comments

Comments
 (0)