phonochrome


Namephonochrome JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/Kreusada/Phonochrome
SummaryA bijective 8-bit RGB encoding library that generates phonotactically plausible appellations.
upload_time2024-11-20 14:15:24
maintainerNone
docs_urlNone
authorKreusada
requires_python>=3.5
licenseNone
keywords rgb encoding linguistics phonotactics bijective encoding
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Phonochrome

Phonochrome is a bijective 8-bit RGB encoding library that generates phonotactically plausible appellations. The library constructs a unique string for each of the 16.7 million possible 8-bit RGB tuple permutations ($256^3 = 16,777,216$).

Each RGB component is first converted to base 16, which allows us to derive values from a more compact set of characters, represented as $S$. Let $x^1$ and $x^2$ represent the two hexadecimal digits (since the range 0-255 only comprises up to FF). If a component is less than 16, its hexadecimal string will be zero-padded to a length of two. Each hexadecimal character is then reconverted into decimal to serve as an index. $x^1$ maps to $C \subsetneq S$, and $x^2$ maps to $V \subsetneq S$, where $C$ and $V$ are lists of consonants and vowels (or vowel-like phonetics), meticulously curated to ensure phonotactic plausibility. The order of these lists changes based on the index of the enumerated RGB tuple. This is done for each component before the generated parts are concatenated and returned as an appellation.

## Example Usage

The library is extremely easy to use, and comes with two functions: ``encode`` and ``decode``.

```py
>>> import phonochrome

>>> black_rgb = (0, 0, 0) # define our RGB tuple
>>> phonochrome.encode(black_rgb) # encode the RGB into a phonochrome appellation
'bacedi'
```
```py
>>> import phonochrome

>>> phonochrome.decode('bacedi') # encode the RGB into a phonochrome appellation
(0, 0, 0)
```

## Command Line Interface

Phonochrome comes with a command line interface which is automatically added to your
environment's scripts upon installation. You can invoke it like this:

```bash
$ phonochrome encode 122 16 14
'kusdeda'
```
```bash
$ phonochrome decode kusdeda
(122, 16, 14)
```
```bash
$ phonochrome --help

usage: phonochrome [-h] {encode,decode} ...

Phonochrome: A bijective 8-bit RGB encoding library that generates phonotactically plausible appellations.

options:
  -h, --help       show this help message and exit

Commands:
  {encode,decode}
    encode         Encode an 8-bit RGB tuple into a phonochrome appellation.
    decode         Decode a phonochrome appellation into an 8-bit RGB tuple.
```

In the event that an invalid argument was passed to encode/decode, the script will terminate with
exit code 2, otherwise code 0.

```bash
$ phonochrome encode 295 543 712
Error: Invalid 8-bit RGB tuple: (295, 543, 712)
```
```bash
$ phonochrome decode invalid
Error: Invalid appellation: 'invalid'
```

## Installation

Install from pip:

```bash
pip install phonochrome
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Kreusada/Phonochrome",
    "name": "phonochrome",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": "RGB encoding, linguistics, phonotactics, bijective, encoding",
    "author": "Kreusada",
    "author_email": "kreusadaprojects@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/22/cc/808b2f8eda713e72180a32f67e2998967cf333e8249319838fed4d0dfba4/phonochrome-1.0.0.tar.gz",
    "platform": null,
    "description": "# Phonochrome\r\n\r\nPhonochrome is a bijective 8-bit RGB encoding library that generates phonotactically plausible appellations. The library constructs a unique string for each of the 16.7 million possible 8-bit RGB tuple permutations ($256^3 = 16,777,216$).\r\n\r\nEach RGB component is first converted to base 16, which allows us to derive values from a more compact set of characters, represented as $S$. Let $x^1$ and $x^2$ represent the two hexadecimal digits (since the range 0-255 only comprises up to FF). If a component is less than 16, its hexadecimal string will be zero-padded to a length of two. Each hexadecimal character is then reconverted into decimal to serve as an index. $x^1$ maps to $C \\subsetneq S$, and $x^2$ maps to $V \\subsetneq S$, where $C$ and $V$ are lists of consonants and vowels (or vowel-like phonetics), meticulously curated to ensure phonotactic plausibility. The order of these lists changes based on the index of the enumerated RGB tuple. This is done for each component before the generated parts are concatenated and returned as an appellation.\r\n\r\n## Example Usage\r\n\r\nThe library is extremely easy to use, and comes with two functions: ``encode`` and ``decode``.\r\n\r\n```py\r\n>>> import phonochrome\r\n\r\n>>> black_rgb = (0, 0, 0) # define our RGB tuple\r\n>>> phonochrome.encode(black_rgb) # encode the RGB into a phonochrome appellation\r\n'bacedi'\r\n```\r\n```py\r\n>>> import phonochrome\r\n\r\n>>> phonochrome.decode('bacedi') # encode the RGB into a phonochrome appellation\r\n(0, 0, 0)\r\n```\r\n\r\n## Command Line Interface\r\n\r\nPhonochrome comes with a command line interface which is automatically added to your\r\nenvironment's scripts upon installation. You can invoke it like this:\r\n\r\n```bash\r\n$ phonochrome encode 122 16 14\r\n'kusdeda'\r\n```\r\n```bash\r\n$ phonochrome decode kusdeda\r\n(122, 16, 14)\r\n```\r\n```bash\r\n$ phonochrome --help\r\n\r\nusage: phonochrome [-h] {encode,decode} ...\r\n\r\nPhonochrome: A bijective 8-bit RGB encoding library that generates phonotactically plausible appellations.\r\n\r\noptions:\r\n  -h, --help       show this help message and exit\r\n\r\nCommands:\r\n  {encode,decode}\r\n    encode         Encode an 8-bit RGB tuple into a phonochrome appellation.\r\n    decode         Decode a phonochrome appellation into an 8-bit RGB tuple.\r\n```\r\n\r\nIn the event that an invalid argument was passed to encode/decode, the script will terminate with\r\nexit code 2, otherwise code 0.\r\n\r\n```bash\r\n$ phonochrome encode 295 543 712\r\nError: Invalid 8-bit RGB tuple: (295, 543, 712)\r\n```\r\n```bash\r\n$ phonochrome decode invalid\r\nError: Invalid appellation: 'invalid'\r\n```\r\n\r\n## Installation\r\n\r\nInstall from pip:\r\n\r\n```bash\r\npip install phonochrome\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A bijective 8-bit RGB encoding library that generates phonotactically plausible appellations.",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/Kreusada/Phonochrome"
    },
    "split_keywords": [
        "rgb encoding",
        " linguistics",
        " phonotactics",
        " bijective",
        " encoding"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf9e912d01f89704bd0ea20d5c1aa132e706d93b33e7c21078648c2b4174f1e3",
                "md5": "2fe00de5a95b7d54900a1d9ce2c5f4e4",
                "sha256": "8d17818e487484400ed5b772afe64126c1217561ca2c78311434ff9700b3164c"
            },
            "downloads": -1,
            "filename": "phonochrome-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2fe00de5a95b7d54900a1d9ce2c5f4e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 4946,
            "upload_time": "2024-11-20T14:15:22",
            "upload_time_iso_8601": "2024-11-20T14:15:22.995070Z",
            "url": "https://files.pythonhosted.org/packages/bf/9e/912d01f89704bd0ea20d5c1aa132e706d93b33e7c21078648c2b4174f1e3/phonochrome-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22cc808b2f8eda713e72180a32f67e2998967cf333e8249319838fed4d0dfba4",
                "md5": "da492fadc4c3c99a9976d40f7acba35f",
                "sha256": "1e88ffb679adb26f1c38480df618747bfe6f0726286b92a64468c981bc9498fb"
            },
            "downloads": -1,
            "filename": "phonochrome-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "da492fadc4c3c99a9976d40f7acba35f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 4596,
            "upload_time": "2024-11-20T14:15:24",
            "upload_time_iso_8601": "2024-11-20T14:15:24.750704Z",
            "url": "https://files.pythonhosted.org/packages/22/cc/808b2f8eda713e72180a32f67e2998967cf333e8249319838fed4d0dfba4/phonochrome-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 14:15:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Kreusada",
    "github_project": "Phonochrome",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "phonochrome"
}
        
Elapsed time: 0.43618s