This Python tool accurately inserts the historical long S character ( ſ ) back into the given text to make it appear as if it were written before the 20th century. English, French, German, Spanish and Italian are supported.
Project description
py-long-s
This Python tool accurately inserts the historical long S character ( Å¿ ) back into the given text to make it appear as if it were written before the 20th century.
English, French, German, Spanish, and Italian are supported.
Requirements:
pip install unidecode is the only required library for conversion, but if you want to convert .odf and .docx file types as well, install:
pip install unidecode odfpy python-docx
Online Converter
There's also a JavaScript version available that can be used online.
Example
import long_s
print(long_s.convert("The discussion was surprisingly insightful.", lang="en"))
print(long_s.convert("La discussion était étonnamment perspicace.", lang="fr"))
print(long_s.convert("Die Diskussion war überraschend aufschlussreich.", lang="de"))
print(long_s.convert("La discusión fue sorprendentemente perspicaz.", lang="es"))
print(long_s.convert("La discussione è stata sorprendentemente perspicace.", lang="it"))
The diſcuſſion was ſurpriſingly inſightful.
La diſcuſſion était étonnamment perſpicace.
Die Diskuſſion war überraſchend aufſchluſsreich.
La diſcuſión fue ſorprendentemente perſpicaz.
La diſcuſſione è ſtata ſorprendentemente perſpicace.
Converting Files
.txt files
long_s.convert_text_file(src_path="story.txt", dst_path=None, lang="en"))
Since dst_path is None, the program will save the converted text file as story-long-s.txt.
.odf files
long_s.convert_odf_file(src_path="story.odt", dst_path="old-story.odt", lang="en"))
.docx files
long_s.convert_docx_file(src_path="märschen.docx", lang="de"))
Special Thanks
Thank you Andrew West of the TeX Users Group for the documentation found under The Rules for Long S, which was fundamental in writing the conversion functions for English, French, Spanish, and Italian.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file long-s-1.0.2.tar.gz.
File metadata
- Download URL: long-s-1.0.2.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c5373f4b051fd15fcd4ef259ed7d9f234150c3417e90defbae2ea47ad2ebc18
|
|
| MD5 |
761adffa6053103469fae2f247792e83
|
|
| BLAKE2b-256 |
6e51b02352b221badf3a18a986df1c2ffe4b4cd984caab2f5df06e77aa363bca
|
File details
Details for the file long_s-1.0.2-py3-none-any.whl.
File metadata
- Download URL: long_s-1.0.2-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adfb2c371b51271b5facd29d8ad6d062e8fefdb4a4d8587aa0f4010bb969c89f
|
|
| MD5 |
6f9962bdbf1cbf098ee6b4951814d837
|
|
| BLAKE2b-256 |
8f55923621042669c61b9dcf84f013b372ace1dc4e774135b7c1e3bc0ff3e0e4
|