e2k 0.2.2__tar.gz → 0.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: e2k
3
- Version: 0.2.2
3
+ Version: 0.2.3
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,14 +37,25 @@ p2k = P2K()
37
37
 
38
38
  g2p = G2p()
39
39
 
40
- katakana = p2k(g2p("word"))
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
- # character directly to katakana
55
+ # characters directly to katakana
45
56
  c2k = C2K()
46
57
 
47
- katakana = c2k("word")
58
+ katakana = c2k(word)
48
59
 
49
60
  print(katakana) # "ワード"
50
61
 
@@ -58,6 +69,9 @@ 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.
@@ -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
- # --fp16 for half precision, there's no reason not to use it
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 --fp16 --output /path/to/your/model.npz
184
+ python export.py --model /path/to/your/model.pth --p2k --output /path/to/your/model.npz
171
185
  ```
172
186
 
173
187
  > [!Note]
@@ -28,14 +28,25 @@ p2k = P2K()
28
28
 
29
29
  g2p = G2p()
30
30
 
31
- katakana = p2k(g2p("word"))
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
- # character directly to katakana
46
+ # characters directly to katakana
36
47
  c2k = C2K()
37
48
 
38
- katakana = c2k("word")
49
+ katakana = c2k(word)
39
50
 
40
51
  print(katakana) # "ワード"
41
52
 
@@ -49,6 +60,9 @@ 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.
@@ -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
- # --fp16 for half precision, there's no reason not to use it
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 --fp16 --output /path/to/your/model.npz
175
+ python export.py --model /path/to/your/model.pth --p2k --output /path/to/your/model.npz
162
176
  ```
163
177
 
164
178
  > [!Note]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "e2k"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "A tool for automatic English to Katakana conversion"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Patchethium", email = "asguftuikh@gmail.com" }]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: e2k
3
- Version: 0.2.2
3
+ Version: 0.2.3
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,14 +37,25 @@ p2k = P2K()
37
37
 
38
38
  g2p = G2p()
39
39
 
40
- katakana = p2k(g2p("word"))
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
- # character directly to katakana
55
+ # characters directly to katakana
45
56
  c2k = C2K()
46
57
 
47
- katakana = c2k("word")
58
+ katakana = c2k(word)
48
59
 
49
60
  print(katakana) # "ワード"
50
61
 
@@ -58,6 +69,9 @@ 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.
@@ -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
- # --fp16 for half precision, there's no reason not to use it
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 --fp16 --output /path/to/your/model.npz
184
+ python export.py --model /path/to/your/model.pth --p2k --output /path/to/your/model.npz
171
185
  ```
172
186
 
173
187
  > [!Note]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes