zzfy 0.0.1__py3-none-any.whl
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.
- zzfy-0.0.1.dist-info/METADATA +76 -0
- zzfy-0.0.1.dist-info/RECORD +5 -0
- zzfy-0.0.1.dist-info/WHEEL +4 -0
- zzfy-0.0.1.dist-info/licenses/LICENSE +21 -0
- zzfy.py +77 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: zzfy
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: 一个没有任何实际用途的翻译。A translation that's completely useless.
|
|
5
|
+
Author-email: VoidFunction <598708293@qq.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 VoidFunction
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Classifier: Operating System :: OS Independent
|
|
29
|
+
Classifier: Programming Language :: Python :: 3
|
|
30
|
+
Requires-Python: >=3.8
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# ZZFy
|
|
34
|
+
|
|
35
|
+
> This article was fully machine-translated (because I don't speak English)
|
|
36
|
+
|
|
37
|
+
## How to use it
|
|
38
|
+
|
|
39
|
+
Too Easy:
|
|
40
|
+
```python
|
|
41
|
+
import zzfy
|
|
42
|
+
print(zzfy.fy_etc(s="Some Texts...", o=()))
|
|
43
|
+
```
|
|
44
|
+
Then, you can get the translated text. (That can't be right)
|
|
45
|
+
|
|
46
|
+
Arguments:
|
|
47
|
+
- s: The English text you want to translate
|
|
48
|
+
- o: Do you want to output the process
|
|
49
|
+
- `o` is a tuple parameter that can have two valid elements: `"s"` and `"r"`.
|
|
50
|
+
- If `o` contains `"s"`, then the text will be output after removing some symbols and converting it to lowercase (and then it will be split into new words)
|
|
51
|
+
- If `o` contains `"r"`, then a list of the words split into new ones will be output.
|
|
52
|
+
|
|
53
|
+
And then... that's it?
|
|
54
|
+
Exactly, ZZFy is that simple!
|
|
55
|
+
|
|
56
|
+
## More features
|
|
57
|
+
You can customize the dictionary:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import zzfy
|
|
61
|
+
|
|
62
|
+
dct = {} # You can customize it
|
|
63
|
+
print(
|
|
64
|
+
zzfy.fy_etc_(
|
|
65
|
+
e=zzfy.split(
|
|
66
|
+
s="...",
|
|
67
|
+
dct=dct,
|
|
68
|
+
vt=zzfy.VT,
|
|
69
|
+
ct=zzfy.CT,
|
|
70
|
+
o=()
|
|
71
|
+
),
|
|
72
|
+
dct=dct,
|
|
73
|
+
tdct=zzfy.TDCT # For transliteration
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
zzfy.py,sha256=qh4HTdISYovqhJvfkAhM_uldgKHG2X7ogMAZBZwZCCw,2137
|
|
2
|
+
zzfy-0.0.1.dist-info/METADATA,sha256=EqPw8JwoYVrnsW2wqntfz5bdFwOhZo9HayomIR58hzQ,2631
|
|
3
|
+
zzfy-0.0.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
zzfy-0.0.1.dist-info/licenses/LICENSE,sha256=DRBvP3vnUSi_ZrFi4-XvSSkhHgSiWQmkpS0J608ZBhQ,1088
|
|
5
|
+
zzfy-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VoidFunction
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
zzfy.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from traceback import print_tb
|
|
2
|
+
|
|
3
|
+
from dictionary import DictionaryEC, DictionaryTransliteration
|
|
4
|
+
|
|
5
|
+
DCT = DictionaryEC().ALL
|
|
6
|
+
TDCT = DictionaryTransliteration().ALL
|
|
7
|
+
OO = ("a", "i", "s", "y", "m")
|
|
8
|
+
VT = ("a", "i", "u", "e", "o", "w", "y",)
|
|
9
|
+
CT = ("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def split(s: str, dct: dict, vt: tuple[str, ...], ct: tuple[str, ...], o: tuple[str,...] = ()) ->tuple[str, ...]:
|
|
13
|
+
s = "".join(c for c in s).lower().replace(" ", "").replace("'", "")
|
|
14
|
+
if "s" in o:
|
|
15
|
+
print(s)
|
|
16
|
+
r = []
|
|
17
|
+
u = [False] * (len(s) + 1)
|
|
18
|
+
for i in range(len(s)):
|
|
19
|
+
if u[i]:
|
|
20
|
+
continue
|
|
21
|
+
if not s[i].isalpha():
|
|
22
|
+
r.append(s[i])
|
|
23
|
+
continue
|
|
24
|
+
f = True
|
|
25
|
+
for j in range(i,len(s)):
|
|
26
|
+
u[j] = True
|
|
27
|
+
if dct.get(s[i:j+1]):
|
|
28
|
+
r.append(s[i:j+1])
|
|
29
|
+
f = False
|
|
30
|
+
break
|
|
31
|
+
if f:
|
|
32
|
+
r.append(s[i])
|
|
33
|
+
for j in range(i, len(s)):
|
|
34
|
+
u[j] = False
|
|
35
|
+
f = False
|
|
36
|
+
for i in range(len(r)-2):
|
|
37
|
+
if f:
|
|
38
|
+
f = False
|
|
39
|
+
continue
|
|
40
|
+
try:
|
|
41
|
+
if (len(r[i]) == 1) and (r[i] not in OO) and (len(r[i+1]) == 1) and (r[i+1] not in OO) and (r[i] in ct) and (r[i+1] in vt):
|
|
42
|
+
r[i] += r[i+1]
|
|
43
|
+
del r[i+1]
|
|
44
|
+
f = True
|
|
45
|
+
except IndexError:
|
|
46
|
+
continue
|
|
47
|
+
if "r" in o:
|
|
48
|
+
print(r)
|
|
49
|
+
return tuple(r)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def fy_etc_(e: tuple[str, ...], dct: dict, tdct: dict) -> str:
|
|
53
|
+
r = []
|
|
54
|
+
for i in e:
|
|
55
|
+
if dct.get(i):
|
|
56
|
+
r.append(dct.get(i))
|
|
57
|
+
elif i.isalpha():
|
|
58
|
+
r.append(tdct.get(i))
|
|
59
|
+
else:
|
|
60
|
+
r.append(i)
|
|
61
|
+
r = "".join(i for i in r if i)
|
|
62
|
+
r = r.replace(" ", "")
|
|
63
|
+
return r
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def fy_etc(s: str, o: tuple[str, ...] = ()) -> str:
|
|
67
|
+
return fy_etc_(
|
|
68
|
+
e = split(
|
|
69
|
+
s = s,
|
|
70
|
+
dct = DCT,
|
|
71
|
+
vt = VT,
|
|
72
|
+
ct = CT,
|
|
73
|
+
o = o
|
|
74
|
+
),
|
|
75
|
+
dct = DCT,
|
|
76
|
+
tdct = TDCT,
|
|
77
|
+
)
|