Thanks to visit codestin.com
Credit goes to github.com

Skip to content

theobori/pycronyms

Repository files navigation

Acronyms and initialisms aggregator

build

built with nix

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.

Definition

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.

How it works

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.

Acronyms

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.

Logging

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)

Usage

CLI

Once installed, you can run the following command line.

pycronyms --help

Here 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_dir

Module

If you're looking for examples of how to use the library, you can have a look at the cli folder.

Contribute

If you want to help the project, you can follow the guidelines in CONTRIBUTING.md.

About

Acronyms and initialisms aggregator, maintaining dataset.

Topics

Resources

License

Contributing

Stars

Watchers

Forks