Skip to main content

A simple library to generate numeronyms.

Project description

Numeronymizer

A simple library to generate numeronyms.

Example

input

The utilization of this library can significantly enhance the accessibility of written content by abbreviating lengthy words. By reducing the number of characters in words such as internationalization, the overall readability and understandability of the text improves. Furthermore, it can also aid in reducing the amount of space required to display the text, which can be beneficial in digital contexts such as on websites or mobile devices.

output

The u9n of this library can s11y enhance the a11y of written content by a10g lengthy words. By reducing the number of c8s in words such as i18n, the overall r9y and u15y of the text improves. F9e, it can also aid in reducing the amount of space required to display the text, which can be b8l in digital contexts such as on websites or mobile devices.

Installation

pip install numeronymizer

Usage

from numeronymizer import numeronymize

text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."

numeronymized_text = numeronymize(text)
print(numeronymized_text)
# "Lorem ipsum dolor sit amet, c9r a8g elit, sed do eiusmod tempor i8t ut labore et dolore magna aliqua."

numeronymized_text = numeronymize(text, n=5)
print(numeronymized_text)
# "L3m i3m d3r sit amet, c9r a8g elit, sed do e5d t4r i8t ut l4e et d3re m3a a4a."

For example, you can use the following code to read a text file named my_text.txt, and replace its text. Additionally, you can also save the shortened text to another text file of your choice.

from numeronymizer import numeronymize

with open("my_text.txt", "r", encoding='utf-8') as file:
    text = file.read()

numeronymized_text = numeronymize(text, n=10)
print(numeronymized_text)

with open("numeronymized.txt", "w", encoding='utf-8') as file:
    file.write(numeronymized_text)

Function

numeronymize(text:str, n:int=10)->str:
    """
    Numeronymize the words in text.
    :param text: input text.
    :param n: the number of characters (default value is 10).
    :return: replaced text.
    """

The function takes two arguments, the text you want to shorten and the number of characters, and returns the replaced text. The default number of characters is 10.

License

This project is licensed under the 0BSD License.

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

numeronymizer-0.0.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numeronymizer-0.0.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file numeronymizer-0.0.1.tar.gz.

File metadata

  • Download URL: numeronymizer-0.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for numeronymizer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 46890666c17837035523516c9edefa01e2c9147ae2f94253d4e3ef54cbdc55d6
MD5 2570347d46e6a149b7752d370977ba7f
BLAKE2b-256 d567c98e6e221d83fa0e1dbd823c467368e7f0c85faa9261150bd472359ceb0c

See more details on using hashes here.

File details

Details for the file numeronymizer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: numeronymizer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for numeronymizer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1c1096c650b7ade88cc0b8a07a34b041705988a7c0bba2da58d1b5486928479
MD5 ce07d9d98511a445ffe86964edd02676
BLAKE2b-256 d79b158bacc53fd01f47f38006035eb83907c8ac3b1e4f88e16ea19a5ce36836

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page