Skip to main content

Expand and collapse abbreviations commonly used in online communication

Project description

abbrfix

Library for expanding and collapsing abbreviations commonly used in online communication.

Installation

To install the library, use pip:

pip install abbrfix

Alternatively, install the latest directly from the GitHub repository:

pip install git+https://github.com/dsymbol/abbrfix.git

Usage

Expand

from abbrfix import expand_all, expand_one

# Example text with abbreviations
text = "I'll brb, gtg for lunch, ttyl!"

# Expand all abbreviations in the text
expanded_text = expand_all(text)
print(expanded_text)
# Output: "I'll be right back, got to go for lunch, talk to you later!"

# Expand a specific abbreviation
expanded_text = expand_one(text, "brb")
print(expanded_text)
# Output: "I'll be right back, gtg for lunch, ttyl!"

Collapse

from abbrfix import collapse_all, collapse_one

# Example text with expanded abbreviations
text = "I'll be right back, got to go for lunch, talk to you later!"

# Collapse all abbreviations in the text
collapsed_text = collapse_all(text)
print(collapsed_text)
# Output: "I'll brb, gtg for lunch, ttyl!"

# Collapse a specific full form
collapsed_text = collapse_one(text, "talk to you later")
print(collapsed_text)
# Output: "I'll be right back, got to go for lunch, ttyl!"

Update and Remove Abbreviations

from abbrfix import update_abbreviations, remove_abbreviations

# Update the abbreviations dictionary with more abbreviations
new_abbreviations = {"lol": "laughing out loud", "omg": "oh my god"}
update_abbreviations(new_abbreviations)

# Remove abbreviations from the dictionary
abbreviations_to_remove = ["brb", "gtg"]
remove_abbreviations(abbreviations_to_remove)

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

abbrfix-26.2.2024.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

abbrfix-26.2.2024-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file abbrfix-26.2.2024.tar.gz.

File metadata

  • Download URL: abbrfix-26.2.2024.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for abbrfix-26.2.2024.tar.gz
Algorithm Hash digest
SHA256 da3db312329ddc254112531247719606297cc182d3dcf4179d3478087e60347f
MD5 254f675581fa59453f7909bd025957db
BLAKE2b-256 a56be1fd42df846b91679b2b73e4bf294dc8da752e7e2e81a894720e9365be5e

See more details on using hashes here.

File details

Details for the file abbrfix-26.2.2024-py3-none-any.whl.

File metadata

  • Download URL: abbrfix-26.2.2024-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for abbrfix-26.2.2024-py3-none-any.whl
Algorithm Hash digest
SHA256 353970ab076dbde589b75dbabe0b7c18be733d808689488fac7ae97c5ca6ad20
MD5 cb2c03a912203d41153dc7b828c0595a
BLAKE2b-256 d6115d5d5d640bb8f921c253b116dc0e746ea40d4378403e13054daeebd0f11a

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