Skip to content

Commit 047cf7c

Browse files
authored
Docker: support for user defined sentences (#116)
1 parent 0482be9 commit 047cf7c

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

README.Docker.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Start a container with:
88

99
Your application will be available at http://localhost:8000.
1010

11-
### Customise Wordlist
11+
### Customise Wordlists and Sentences
1212

13-
You might want to run HanziGraph on your own filtered wordlist instead of the full dictionary provided.
13+
You might want to run HanziGraph on your own filtered wordlists instead of the full dictionary provided.
1414

1515
For this, create a `wordlist.json` file containing the array of your words:
1616

@@ -23,13 +23,40 @@ For this, create a `wordlist.json` file containing the array of your words:
2323
]
2424
```
2525

26-
Then, in `compose.yaml` add a new bind mount to your custom wordlist by adapting `YOUR-PATH-TO`:
26+
Then, in `compose.yaml` add a new bind mount to your custom wordlist by adapting `YOUR-PATH-TO` and `TARGET-CHARSET`.
27+
`TARGET-CHARSET` should be one of `simplified`, `traditional`, `hsk` or `cantonese`.
2728

2829
```yaml
2930
...
3031
volumes:
3132
- "<YOUR-PATH-TO>/wordlist.json\
32-
:/usr/src/app/public/data/simplified/wordlist.json\
33+
:/usr/src/app/public/data/<TARGET-CHARSET>/wordlist.json\
34+
:ro"
35+
...
36+
```
37+
38+
Similarly, you can customise the available sentences too. Create a `sentences.json` file containing an array with
39+
elements as the one below. The Chinese translations are split into meaningful words to guide segmentation.
40+
41+
```json
42+
{
43+
"en": "Guilin's sceneries are the most beautiful ones under the heaven.",
44+
"zh": [
45+
"桂林山水",
46+
"甲天下",
47+
""
48+
],
49+
"pinyin": "Gui4lin2 shan1shui3 jia3 tian1xia4."
50+
},
51+
```
52+
53+
Just like with wordlists, activate your custom sentences:
54+
55+
```yaml
56+
...
57+
volumes:
58+
- "<YOUR-PATH-TO>/sentences.json\
59+
:/usr/src/app/public/data/<TARGET-CHARSET>/sentences.json\
3360
:ro"
3461
...
3562
```

compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ services:
77
NODE_ENV: production
88
ports:
99
- 8000:8000
10+
# Uncomment volumes below for custom wordlists and sentences - see README.Docker.md for details:
1011
# volumes:
1112
# - "<YOUR-PATH-TO>/wordlist.json\
1213
# :/usr/src/app/public/data/simplified/wordlist.json\
1314
# :ro"
15+
# - "<YOUR-PATH-TO>/sentences.json\
16+
# :/usr/src/app/public/data/simplified/sentences.json\
17+
# :ro"
1418

0 commit comments

Comments
 (0)