e2k 0.2.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {e2k-0.2.2/src/e2k.egg-info → e2k-0.3.0}/PKG-INFO +27 -16
- {e2k-0.2.2 → e2k-0.3.0}/README.md +26 -15
- {e2k-0.2.2 → e2k-0.3.0}/pyproject.toml +1 -1
- {e2k-0.2.2 → e2k-0.3.0}/src/e2k/constants.py +3 -3
- {e2k-0.2.2 → e2k-0.3.0}/src/e2k/inference.py +1 -1
- e2k-0.3.0/src/e2k/models/model-c2k.npz +0 -0
- e2k-0.3.0/src/e2k/models/model-p2k.npz +0 -0
- {e2k-0.2.2 → e2k-0.3.0/src/e2k.egg-info}/PKG-INFO +27 -16
- e2k-0.2.2/src/e2k/models/model-c2k.npz +0 -0
- e2k-0.2.2/src/e2k/models/model-p2k.npz +0 -0
- {e2k-0.2.2 → e2k-0.3.0}/LICENSE +0 -0
- {e2k-0.2.2 → e2k-0.3.0}/setup.cfg +0 -0
- {e2k-0.2.2 → e2k-0.3.0}/src/e2k/__init__.py +0 -0
- {e2k-0.2.2 → e2k-0.3.0}/src/e2k.egg-info/SOURCES.txt +0 -0
- {e2k-0.2.2 → e2k-0.3.0}/src/e2k.egg-info/dependency_links.txt +0 -0
- {e2k-0.2.2 → e2k-0.3.0}/src/e2k.egg-info/requires.txt +0 -0
- {e2k-0.2.2 → e2k-0.3.0}/src/e2k.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: e2k
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A tool for automatic English to Katakana conversion
|
|
5
5
|
Author-email: Patchethium <asguftuikh@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -37,20 +37,31 @@ p2k = P2K()
|
|
|
37
37
|
|
|
38
38
|
g2p = G2p()
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
word = "word"
|
|
41
|
+
|
|
42
|
+
word = word.lower()
|
|
43
|
+
|
|
44
|
+
# you can check the accepted symbols using
|
|
45
|
+
in_table = c2k.in_table # `c2k` accepts lowercase characters, space and apostrophe
|
|
46
|
+
in_table = p2k.in_table # `p2k` accepts the phonemes from the CMUdict and space
|
|
47
|
+
# for output symbols
|
|
48
|
+
out_table = c2k.out_table
|
|
49
|
+
out_table = p2k.out_table
|
|
50
|
+
|
|
51
|
+
katakana = p2k(g2p(word))
|
|
41
52
|
|
|
42
53
|
print(katakana) # "ワード"
|
|
43
54
|
|
|
44
|
-
#
|
|
55
|
+
# characters directly to katakana
|
|
45
56
|
c2k = C2K()
|
|
46
57
|
|
|
47
|
-
katakana = c2k(
|
|
58
|
+
katakana = c2k(word)
|
|
48
59
|
|
|
49
60
|
print(katakana) # "ワード"
|
|
50
61
|
|
|
51
62
|
# decode strategy
|
|
52
63
|
# greedy by default, top_k and top_p are available
|
|
53
|
-
#
|
|
64
|
+
# I tried implementing beam search but it barely differs from greedy
|
|
54
65
|
c2k.set_decode_strategy("top_k", top_k=2) # low quality results, not recommended
|
|
55
66
|
c2k.set_decode_strategy("top_p", top_p=0.6, t=0.8)
|
|
56
67
|
# for further information, see
|
|
@@ -58,14 +69,17 @@ c2k.set_decode_strategy("top_p", top_p=0.6, t=0.8)
|
|
|
58
69
|
print(katakana) # "ワード"
|
|
59
70
|
```
|
|
60
71
|
|
|
72
|
+
> [!WARNING]
|
|
73
|
+
> For any symbols not in the `in_table`, the model will ignore them and may produce unexpected results.
|
|
74
|
+
|
|
61
75
|
### Performance
|
|
62
76
|
|
|
63
77
|
The BLEU score is calculated on a random subset with size of 10% of the dataset.
|
|
64
78
|
|
|
65
79
|
| Model | BLEU Score ↑ |
|
|
66
80
|
| ----- | ------------ |
|
|
67
|
-
| P2K | 0.
|
|
68
|
-
| C2K | 0.
|
|
81
|
+
| P2K | 0.89 |
|
|
82
|
+
| C2K | 0.92 |
|
|
69
83
|
|
|
70
84
|
## Dictionary
|
|
71
85
|
|
|
@@ -164,10 +178,10 @@ The model should be exported to `numpy` format for production use.
|
|
|
164
178
|
|
|
165
179
|
```bash
|
|
166
180
|
# --p2k for phoneme to katakana, if not provided, it will be character to katakana
|
|
167
|
-
# --
|
|
181
|
+
# --fp32 for double precision, by default we use fp16 to save space
|
|
168
182
|
# --output to specify the output file, in this project it's `model-{p2k/c2k}.npz`
|
|
169
183
|
# --safetenors to use safe tensors, it's for easier binding in some languages
|
|
170
|
-
python export.py --model /path/to/your/model.pth --p2k --
|
|
184
|
+
python export.py --model /path/to/your/model.pth --p2k --output /path/to/your/model.npz
|
|
171
185
|
```
|
|
172
186
|
|
|
173
187
|
> [!Note]
|
|
@@ -175,13 +189,10 @@ python export.py --model /path/to/your/model.pth --p2k --fp16 --output /path/to/
|
|
|
175
189
|
|
|
176
190
|
## License
|
|
177
191
|
|
|
178
|
-
The code is released under WTFPL, you can do WTF you want with it.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
In short, as long as you provide the attribution, you can use it for both commercial and non-commercial purposes.
|
|
183
|
-
|
|
184
|
-
The model weights are released under the same license as the dictionary.
|
|
192
|
+
- The code is released under WTFPL, you can do WTF you want with it.
|
|
193
|
+
- The dictionary follows the [Wikimedia's license](https://dumps.wikimedia.org/legal.html) and the [JMdict / EDICT's Copyright](https://www.edrdg.org/) license.
|
|
194
|
+
- In short, they both fall into CC-BY-SA.
|
|
195
|
+
- The model weights are trained using the dictionary. I am not a lawyer, whether the machine learning weights is considered as a derivative work is up to you.
|
|
185
196
|
|
|
186
197
|
## Credits
|
|
187
198
|
|
|
@@ -28,20 +28,31 @@ p2k = P2K()
|
|
|
28
28
|
|
|
29
29
|
g2p = G2p()
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
word = "word"
|
|
32
|
+
|
|
33
|
+
word = word.lower()
|
|
34
|
+
|
|
35
|
+
# you can check the accepted symbols using
|
|
36
|
+
in_table = c2k.in_table # `c2k` accepts lowercase characters, space and apostrophe
|
|
37
|
+
in_table = p2k.in_table # `p2k` accepts the phonemes from the CMUdict and space
|
|
38
|
+
# for output symbols
|
|
39
|
+
out_table = c2k.out_table
|
|
40
|
+
out_table = p2k.out_table
|
|
41
|
+
|
|
42
|
+
katakana = p2k(g2p(word))
|
|
32
43
|
|
|
33
44
|
print(katakana) # "ワード"
|
|
34
45
|
|
|
35
|
-
#
|
|
46
|
+
# characters directly to katakana
|
|
36
47
|
c2k = C2K()
|
|
37
48
|
|
|
38
|
-
katakana = c2k(
|
|
49
|
+
katakana = c2k(word)
|
|
39
50
|
|
|
40
51
|
print(katakana) # "ワード"
|
|
41
52
|
|
|
42
53
|
# decode strategy
|
|
43
54
|
# greedy by default, top_k and top_p are available
|
|
44
|
-
#
|
|
55
|
+
# I tried implementing beam search but it barely differs from greedy
|
|
45
56
|
c2k.set_decode_strategy("top_k", top_k=2) # low quality results, not recommended
|
|
46
57
|
c2k.set_decode_strategy("top_p", top_p=0.6, t=0.8)
|
|
47
58
|
# for further information, see
|
|
@@ -49,14 +60,17 @@ c2k.set_decode_strategy("top_p", top_p=0.6, t=0.8)
|
|
|
49
60
|
print(katakana) # "ワード"
|
|
50
61
|
```
|
|
51
62
|
|
|
63
|
+
> [!WARNING]
|
|
64
|
+
> For any symbols not in the `in_table`, the model will ignore them and may produce unexpected results.
|
|
65
|
+
|
|
52
66
|
### Performance
|
|
53
67
|
|
|
54
68
|
The BLEU score is calculated on a random subset with size of 10% of the dataset.
|
|
55
69
|
|
|
56
70
|
| Model | BLEU Score ↑ |
|
|
57
71
|
| ----- | ------------ |
|
|
58
|
-
| P2K | 0.
|
|
59
|
-
| C2K | 0.
|
|
72
|
+
| P2K | 0.89 |
|
|
73
|
+
| C2K | 0.92 |
|
|
60
74
|
|
|
61
75
|
## Dictionary
|
|
62
76
|
|
|
@@ -155,10 +169,10 @@ The model should be exported to `numpy` format for production use.
|
|
|
155
169
|
|
|
156
170
|
```bash
|
|
157
171
|
# --p2k for phoneme to katakana, if not provided, it will be character to katakana
|
|
158
|
-
# --
|
|
172
|
+
# --fp32 for double precision, by default we use fp16 to save space
|
|
159
173
|
# --output to specify the output file, in this project it's `model-{p2k/c2k}.npz`
|
|
160
174
|
# --safetenors to use safe tensors, it's for easier binding in some languages
|
|
161
|
-
python export.py --model /path/to/your/model.pth --p2k --
|
|
175
|
+
python export.py --model /path/to/your/model.pth --p2k --output /path/to/your/model.npz
|
|
162
176
|
```
|
|
163
177
|
|
|
164
178
|
> [!Note]
|
|
@@ -166,13 +180,10 @@ python export.py --model /path/to/your/model.pth --p2k --fp16 --output /path/to/
|
|
|
166
180
|
|
|
167
181
|
## License
|
|
168
182
|
|
|
169
|
-
The code is released under WTFPL, you can do WTF you want with it.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
In short, as long as you provide the attribution, you can use it for both commercial and non-commercial purposes.
|
|
174
|
-
|
|
175
|
-
The model weights are released under the same license as the dictionary.
|
|
183
|
+
- The code is released under WTFPL, you can do WTF you want with it.
|
|
184
|
+
- The dictionary follows the [Wikimedia's license](https://dumps.wikimedia.org/legal.html) and the [JMdict / EDICT's Copyright](https://www.edrdg.org/) license.
|
|
185
|
+
- In short, they both fall into CC-BY-SA.
|
|
186
|
+
- The model weights are trained using the dictionary. I am not a lawyer, whether the machine learning weights is considered as a derivative work is up to you.
|
|
176
187
|
|
|
177
188
|
## Credits
|
|
178
189
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from string import
|
|
1
|
+
from string import ascii_lowercase
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
PAD_IDX = 0
|
|
@@ -165,7 +165,7 @@ en_phones = [
|
|
|
165
165
|
"ZH",
|
|
166
166
|
]
|
|
167
167
|
|
|
168
|
-
ascii_entries = ["<pad>", "<sos>", "<eos>"] + list(
|
|
168
|
+
ascii_entries = ["<pad>", "<sos>", "<eos>"] + list(ascii_lowercase) + [" ", "'"]
|
|
169
169
|
|
|
170
170
|
kanas = ["<pad>", "<sos>", "<eos>"] + kanas
|
|
171
|
-
en_phones = ["<pad>", "<sos>", "<eos>"] + en_phones + [" "]
|
|
171
|
+
en_phones = ["<pad>", "<sos>", "<eos>"] + en_phones + [" ", "'"]
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: e2k
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A tool for automatic English to Katakana conversion
|
|
5
5
|
Author-email: Patchethium <asguftuikh@gmail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -37,20 +37,31 @@ p2k = P2K()
|
|
|
37
37
|
|
|
38
38
|
g2p = G2p()
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
word = "word"
|
|
41
|
+
|
|
42
|
+
word = word.lower()
|
|
43
|
+
|
|
44
|
+
# you can check the accepted symbols using
|
|
45
|
+
in_table = c2k.in_table # `c2k` accepts lowercase characters, space and apostrophe
|
|
46
|
+
in_table = p2k.in_table # `p2k` accepts the phonemes from the CMUdict and space
|
|
47
|
+
# for output symbols
|
|
48
|
+
out_table = c2k.out_table
|
|
49
|
+
out_table = p2k.out_table
|
|
50
|
+
|
|
51
|
+
katakana = p2k(g2p(word))
|
|
41
52
|
|
|
42
53
|
print(katakana) # "ワード"
|
|
43
54
|
|
|
44
|
-
#
|
|
55
|
+
# characters directly to katakana
|
|
45
56
|
c2k = C2K()
|
|
46
57
|
|
|
47
|
-
katakana = c2k(
|
|
58
|
+
katakana = c2k(word)
|
|
48
59
|
|
|
49
60
|
print(katakana) # "ワード"
|
|
50
61
|
|
|
51
62
|
# decode strategy
|
|
52
63
|
# greedy by default, top_k and top_p are available
|
|
53
|
-
#
|
|
64
|
+
# I tried implementing beam search but it barely differs from greedy
|
|
54
65
|
c2k.set_decode_strategy("top_k", top_k=2) # low quality results, not recommended
|
|
55
66
|
c2k.set_decode_strategy("top_p", top_p=0.6, t=0.8)
|
|
56
67
|
# for further information, see
|
|
@@ -58,14 +69,17 @@ c2k.set_decode_strategy("top_p", top_p=0.6, t=0.8)
|
|
|
58
69
|
print(katakana) # "ワード"
|
|
59
70
|
```
|
|
60
71
|
|
|
72
|
+
> [!WARNING]
|
|
73
|
+
> For any symbols not in the `in_table`, the model will ignore them and may produce unexpected results.
|
|
74
|
+
|
|
61
75
|
### Performance
|
|
62
76
|
|
|
63
77
|
The BLEU score is calculated on a random subset with size of 10% of the dataset.
|
|
64
78
|
|
|
65
79
|
| Model | BLEU Score ↑ |
|
|
66
80
|
| ----- | ------------ |
|
|
67
|
-
| P2K | 0.
|
|
68
|
-
| C2K | 0.
|
|
81
|
+
| P2K | 0.89 |
|
|
82
|
+
| C2K | 0.92 |
|
|
69
83
|
|
|
70
84
|
## Dictionary
|
|
71
85
|
|
|
@@ -164,10 +178,10 @@ The model should be exported to `numpy` format for production use.
|
|
|
164
178
|
|
|
165
179
|
```bash
|
|
166
180
|
# --p2k for phoneme to katakana, if not provided, it will be character to katakana
|
|
167
|
-
# --
|
|
181
|
+
# --fp32 for double precision, by default we use fp16 to save space
|
|
168
182
|
# --output to specify the output file, in this project it's `model-{p2k/c2k}.npz`
|
|
169
183
|
# --safetenors to use safe tensors, it's for easier binding in some languages
|
|
170
|
-
python export.py --model /path/to/your/model.pth --p2k --
|
|
184
|
+
python export.py --model /path/to/your/model.pth --p2k --output /path/to/your/model.npz
|
|
171
185
|
```
|
|
172
186
|
|
|
173
187
|
> [!Note]
|
|
@@ -175,13 +189,10 @@ python export.py --model /path/to/your/model.pth --p2k --fp16 --output /path/to/
|
|
|
175
189
|
|
|
176
190
|
## License
|
|
177
191
|
|
|
178
|
-
The code is released under WTFPL, you can do WTF you want with it.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
In short, as long as you provide the attribution, you can use it for both commercial and non-commercial purposes.
|
|
183
|
-
|
|
184
|
-
The model weights are released under the same license as the dictionary.
|
|
192
|
+
- The code is released under WTFPL, you can do WTF you want with it.
|
|
193
|
+
- The dictionary follows the [Wikimedia's license](https://dumps.wikimedia.org/legal.html) and the [JMdict / EDICT's Copyright](https://www.edrdg.org/) license.
|
|
194
|
+
- In short, they both fall into CC-BY-SA.
|
|
195
|
+
- The model weights are trained using the dictionary. I am not a lawyer, whether the machine learning weights is considered as a derivative work is up to you.
|
|
185
196
|
|
|
186
197
|
## Credits
|
|
187
198
|
|
|
Binary file
|
|
Binary file
|
{e2k-0.2.2 → e2k-0.3.0}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|