cyclic-text-compressor 0.1.0__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.
- alignment_mvp.py +203 -0
- cycle_compressor.py +969 -0
- cyclic_text_compressor/__init__.py +24 -0
- cyclic_text_compressor/__main__.py +3 -0
- cyclic_text_compressor-0.1.0.dist-info/METADATA +89 -0
- cyclic_text_compressor-0.1.0.dist-info/RECORD +12 -0
- cyclic_text_compressor-0.1.0.dist-info/WHEEL +5 -0
- cyclic_text_compressor-0.1.0.dist-info/entry_points.txt +2 -0
- cyclic_text_compressor-0.1.0.dist-info/licenses/LICENSE +21 -0
- cyclic_text_compressor-0.1.0.dist-info/top_level.txt +5 -0
- pattern_library.py +1414 -0
- pin_only_12block.py +1061 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Public API for the cyclic UTF-8 text compressor."""
|
|
2
|
+
|
|
3
|
+
from alignment_mvp import (
|
|
4
|
+
decode_text,
|
|
5
|
+
decode_text_file,
|
|
6
|
+
encode_text,
|
|
7
|
+
encode_text_file,
|
|
8
|
+
pairs_to_text,
|
|
9
|
+
text_to_pairs,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0"
|
|
13
|
+
__author__ = "Randall Lujan"
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"__author__",
|
|
17
|
+
"__version__",
|
|
18
|
+
"decode_text",
|
|
19
|
+
"decode_text_file",
|
|
20
|
+
"encode_text",
|
|
21
|
+
"encode_text_file",
|
|
22
|
+
"pairs_to_text",
|
|
23
|
+
"text_to_pairs",
|
|
24
|
+
]
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cyclic-text-compressor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lossless UTF-8 text encoding with cyclic alignment tracks
|
|
5
|
+
Author: Randall Lujan
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/50shades0fGraei/666-cyclic-compression-
|
|
8
|
+
Project-URL: Source, https://github.com/50shades0fGraei/666-cyclic-compression-
|
|
9
|
+
Project-URL: Issues, https://github.com/50shades0fGraei/666-cyclic-compression-/issues
|
|
10
|
+
Keywords: text,compression,cyclic,lossless,alignment
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Text Processing
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# Cyclic Text Compressor
|
|
22
|
+
|
|
23
|
+
**Author: Randall Lujan**
|
|
24
|
+
|
|
25
|
+
`cyclic-text-compressor` is a Python command-line tool and library for
|
|
26
|
+
losslessly encoding and rebuilding UTF-8 text files using cyclic alignment
|
|
27
|
+
streams. It uses only the Python standard library at runtime.
|
|
28
|
+
|
|
29
|
+
The encoder compares a packed pair stream, whole-stream runs, and
|
|
30
|
+
multiplier-lane runs, then selects the smallest supported representation.
|
|
31
|
+
Savings depend on the input; some files may become larger.
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
python -m pip install cyclic-text-compressor
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Command line
|
|
40
|
+
|
|
41
|
+
Encode a text file:
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
cyclic-text-compress encode input.txt output.cyal
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use the experimental seven-digit drift track:
|
|
48
|
+
|
|
49
|
+
```powershell
|
|
50
|
+
cyclic-text-compress encode input.txt output.cyd7 --drift
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Decode either format; the file header selects the decoder:
|
|
54
|
+
|
|
55
|
+
```powershell
|
|
56
|
+
cyclic-text-compress decode output.cyal rebuilt.txt
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The encoder reports source and output sizes. For example, `"aeiou " * 10000`
|
|
60
|
+
encoded from 60,000 UTF-8 bytes to 39 bytes in a local test. This repetitive
|
|
61
|
+
sample is not representative of all text and does not guarantee a particular
|
|
62
|
+
compression ratio.
|
|
63
|
+
|
|
64
|
+
## Python API
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from cyclic_text_compressor import decode_text, encode_text
|
|
68
|
+
|
|
69
|
+
encoded = encode_text("Hello, world!", drift=True)
|
|
70
|
+
assert decode_text(encoded) == "Hello, world!"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
File helpers are also available:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from cyclic_text_compressor import decode_text_file, encode_text_file
|
|
77
|
+
|
|
78
|
+
stats = encode_text_file("input.txt", "output.cyd7", drift=True)
|
|
79
|
+
decode_text_file("output.cyd7", "rebuilt.txt")
|
|
80
|
+
print(stats["reduction_percent_vs_source"])
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The decoder preserves case, punctuation, line endings, and Unicode text.
|
|
84
|
+
Aggregate alignment totals can be ambiguous, so the exact stream format
|
|
85
|
+
preserves the ordering information required for lossless reconstruction.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
alignment_mvp.py,sha256=cR37aCi_cAesC7NuSVqEX-90180B1C2vC7mos08uMwc,7544
|
|
2
|
+
cycle_compressor.py,sha256=pA6bcDmeOx1rmR77JTZS7jlZfEWdzf2SiuePTBiimaM,37895
|
|
3
|
+
pattern_library.py,sha256=zuTQ7Y8tEraaWX1C4VLcVOHPEabczOFMZjOIB6fhBsw,55370
|
|
4
|
+
pin_only_12block.py,sha256=FSIJqL0MgiLLrQoYvqXRZDt9pJkB2FYcFKORkw0cI8M,43669
|
|
5
|
+
cyclic_text_compressor/__init__.py,sha256=uvyNr4zRIColBU8-zagm2JEhMM9MbTeZy48SK6cWcuE,458
|
|
6
|
+
cyclic_text_compressor/__main__.py,sha256=eWjURDN78KoCX7x0r0DdsCYZJPZBdcPpQ_q9yAFQCwg,60
|
|
7
|
+
cyclic_text_compressor-0.1.0.dist-info/licenses/LICENSE,sha256=uyT1u_QNKVT1NvsMyPPzNciufVoM2_ZBlwpX-wmnhvE,1091
|
|
8
|
+
cyclic_text_compressor-0.1.0.dist-info/METADATA,sha256=iZt15tWXAwPtOKxMBdJn3ZA-FJ-JxuNi64GzbRJ7V8k,2766
|
|
9
|
+
cyclic_text_compressor-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
10
|
+
cyclic_text_compressor-0.1.0.dist-info/entry_points.txt,sha256=pSbUvRFtJ1qtE3TcS2Q7b2f-ZBWOwfWJ4t--hHD0Hzs,60
|
|
11
|
+
cyclic_text_compressor-0.1.0.dist-info/top_level.txt,sha256=ZqA8Ao7QkkxEmYG5PhrXnnEx8TkARml6qzJC_3p_b8w,87
|
|
12
|
+
cyclic_text_compressor-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Randall Lujan
|
|
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.
|