Code Monkey home page Code Monkey logo

travisgk / long-s Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 228 KB

This Python script converts text to use the archaic long S letter ( ſ ) in its spellings. English, Spanish, French, Italian, and German are supported.

License: MIT License

Python 100.00%
english english-language french french-language german german-language historical-linguistics italian italian-language linguistics old-alphabet orthography spanish spanish-language spelling text-converter long-s archaic historical language

long-s's Introduction

long-s

This Python script converts text to use the archaic long S letter ( ſ ) in its spellings.

English, Spanish, French, Italian, and German are supported.

import long_s

print(long_s.convert("The discussion was surprisingly insightful.", lang="en"))
print(long_s.convert("La discusión fue sorprendentemente perspicaz.", lang="es"))
print(long_s.convert("La discussion était étonnamment perspicace.", lang="fr"))
print(long_s.convert("La discussione è stata sorprendentemente perspicace.", lang="it"))
print(long_s.convert("Die Diskussion war überraschend aufschlussreich.", lang="de"))
The diſcuſſion was ſurpriſingly inſightful.
La diſcuſión fue ſorprendentemente perſpicaz.
La diſcuſſion était étonnamment perſpicace.
La diſcuſſione è ſtata ſorprendentemente perſpicace.
Die Diskuſſion war überraſchend aufſchluſsreich.

German

With German words, the script might encounter an occurrence of the letter S that remains ambiguous, even after the conversion process.

By default, any leftover ambiguous S will be replaced with a long S ( ſ ).

If it's preferred to leave it up to human interpretation, the program can be explicitly told to leave these ambiguities marked in the returned string:

print(long_s.convert("Mäuschen", lang="de", keep_unknown_s=True))

This will print Mäu╳chen, which can then be manually changed to Mäuschen.



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, Spanish, French, and Italian.

long-s's People

Contributors

travisgk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.