This GitHub repository is a fun project, the main purpose of which is to maintain a dataset containing acronyms and initialism. These files are generated using the Python module pycronyms, which exposes a library as well as a CLI.
This project is inspired by hosts, which maintains hosts files for name resolution.
It's important to clarify what an acronym is before reading any further.
An abbreviation is the reduction of a word to a few letters. An initialism is an abbreviation made up of initial letters. An Acronym is an initialism pronounced like a word.
Acronym generation depends on the acronym providers implemented in the project. At present, the following providers are available.
Each acronym is associated with a language and an associated category. Acronym providers don't have to implement every combination of language and category. They can implement the ones they want.
The library's entry point is the Pycronyms class, which manages acronym providers and can retrieve all possible acronyms.
There are multiple output formats, listed below.
In the library, acronyms and initialisms are represented by Python objects called Acronym. These are Pydantic data models which normalize the values and check that the acronym conforms. For example, the name of the acronym must match its meaning.
Several Python Logger objects are used in the module and are disabled by default. Here are their names.
| name | Description |
|---|---|
pycronyms.aggregator |
It gives informations about the fetched acronyms in the Pycronyms class. |
The pycronyms.aggregator provider could be enabled as shown below. We know that the disabled attribute of the Logger object is supposed to be read-only, but this is a simple solution for now.
import logging
logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s")
logger = logging.getLogger("pycronyms.aggregator")
logger.disabled = False
logger.setLevel(logging.DEBUG)Once installed, you can run the following command line.
pycronyms --helpHere are a few examples.
# Fetch
pycronyms fetch
pycronyms fetch --dir output_dir
# Guess game
pycronyms guess --category computer_science --language en
pycronyms guess --category computer_science --language en --name CPU
pycronyms guess --category computer_science --language en --dir custom_input_dirIf you're looking for examples of how to use the library, you can have a look at the cli folder.
If you want to help the project, you can follow the guidelines in CONTRIBUTING.md.