https://github.com/travisgk/py-long-s
This Python script accurately inserts the historical long S character ( ſ ) into text based on language-specific spelling conventions. The long S was commonly used in various European languages from the Medieval to the early Modern period, giving texts an antiquated, old-style appearance.
https://github.com/travisgk/py-long-s
alphabet character-substitution converter english french german historical historical-linguistics history italian language languages latin-alphabet linguistics long-s orthography spanish spelling text-processing
Last synced: about 1 month ago
JSON representation
This Python script accurately inserts the historical long S character ( ſ ) into text based on language-specific spelling conventions. The long S was commonly used in various European languages from the Medieval to the early Modern period, giving texts an antiquated, old-style appearance.
- Host: GitHub
- URL: https://github.com/travisgk/py-long-s
- Owner: travisgk
- License: mit
- Created: 2024-06-28T20:15:07.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-23T17:44:27.000Z (6 months ago)
- Last Synced: 2024-10-24T16:04:46.507Z (6 months ago)
- Topics: alphabet, character-substitution, converter, english, french, german, historical, historical-linguistics, history, italian, language, languages, latin-alphabet, linguistics, long-s, orthography, spanish, spelling, text-processing
- Language: Python
- Homepage:
- Size: 523 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
#### Installation
```
pip install long-s
```The libraries used in this project can be installed separately by using:
```
pip install numpy python-docx odfpy unidecode
```
## Online Converter
There's also a [JavaScript version](https://github.com/travisgk/long-s-converter) available that can be used online.
## Example
```
import long_sprint(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](https://www.tug.org/TUGboat/tb32-1/tb100west.pdf), which was fundamental in writing the conversion functions for English, French, Spanish, and Italian.