Name | nemony JSON |
Version |
0.0.2
JSON |
| download |
home_page | |
Summary | Convert text to adjective-noun mnemonics. |
upload_time | 2023-06-02 09:53:27 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.8 |
license | |
keywords |
mnemonic
hash
programming
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 🧠nemony
![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/scbirlab/nemony/python-publish.yml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nemony)
![PyPI](https://img.shields.io/pypi/v/nemony)
Deterministically encode text as mnemonic adjective-noun pairs.
The same text should be identically encoded across systems. While
there are currently more than 800,000 combinations of adjective and noun,
collisions (two texts having the same mnemonic) can happen.
## Installation
### The easy way
Install the pre-compiled version from PyPI:
```bash
pip install nemony
```
### From source
Clone the repository, then `cd` into it. Then run:
```bash
pip install -e .
```
## Usage
### Command line
You can use nemony to encode lines of text from a file
(the header info goes to `stderr`).
```bash
$ printf 'hello\nworld' > tmp.txt
$ nemony tmp.txt
## MNEMO: Generate adjective-noun mnemonics
Word list version: fancy_telecom
- Number of adjectives: 581
- Number of nouns: 1450
- Combinations: 842450
decorous_block
late_kevin
```
Or pipe from from `stdin`.
```bash
$ printf 'hello\nworld' | nemony
## MNEMO: Generate adjective-noun mnemonics
Word list version: fancy_telecom
- Number of adjectives: 581
- Number of nouns: 1450
- Combinations: 842450
decorous_block
late_kevin
```
You can also run interactively to check one thing at a time.
Bear in mind that this encodes the whole text, not one line
a time.
```bash
$ nemony -i
## MNEMO: Generate adjective-noun mnemonics
Word list version: fancy_telecom
- Number of adjectives: 581
- Number of nouns: 1450
- Combinations: 842450
(Ctrl-C to exit.)
What would you like to encode?
?> hello
decorous_block
?> world
late_kevin
?> hello\nworld
warm_dominic
```
```
usage: nemony [-h] [--interactive] [--output [OUTPUT]] [input]
Encode lines of text deterministically as adjective-noun mnemonics.
positional arguments:
input File to read and emit one mnemonic per line. Default STDIN.
options:
-h, --help show this help message and exit
--interactive, -i Run interactively.
--output [OUTPUT], -o [OUTPUT]
Output file. Default STDOUT.
```
### Python API
You can import **nemony** and use it to encode Python objects, as
long as they can be converted to strings.
```python
>>> import nemony as nm
>>> nm.encode('world', sep='-')
'late-kevin'
>>> nm.encode('world', sep='-', n=5)
'peppy-gabriel'
>>> nm.encode(5.)
'live_drum'
>>> nm.encode(['hello', 'world'])
'receding_cheese'
```
As a convenience, you can also use the SHA-256 hashing functions
(which use Python standard library `hashlib`).
```python
>>> nm.hash('world')
'486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7'
>>> nm.hash('world', n=8)
'486ea462'
>>> nm.hash(5., n=8)
'a19a1584'
```
#### Documentation
Check the Python API at [ReadTheDocs](https://nemony.readthedocs.io/).
Raw data
{
"_id": null,
"home_page": "",
"name": "nemony",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "mnemonic,hash,programming",
"author": "",
"author_email": "Eachan Johnson <eachan.johnson@crick.ac.uk>",
"download_url": "https://files.pythonhosted.org/packages/f6/96/5bbe63e3ea3103cdc7ca951e0d143f0b7201726868fcf6adffe62c63700a/nemony-0.0.2.tar.gz",
"platform": null,
"description": "# \ud83e\udde0 nemony\n\n![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/scbirlab/nemony/python-publish.yml)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nemony)\n![PyPI](https://img.shields.io/pypi/v/nemony)\n\nDeterministically encode text as mnemonic adjective-noun pairs.\n\nThe same text should be identically encoded across systems. While\nthere are currently more than 800,000 combinations of adjective and noun,\ncollisions (two texts having the same mnemonic) can happen.\n\n## Installation\n\n### The easy way\n\nInstall the pre-compiled version from PyPI:\n\n```bash\npip install nemony\n```\n\n### From source\n\nClone the repository, then `cd` into it. Then run:\n\n```bash\npip install -e .\n```\n\n## Usage\n\n### Command line\n\nYou can use nemony to encode lines of text from a file \n(the header info goes to `stderr`).\n\n```bash\n$ printf 'hello\\nworld' > tmp.txt\n$ nemony tmp.txt\n\n## MNEMO: Generate adjective-noun mnemonics\nWord list version: fancy_telecom\n - Number of adjectives: 581\n - Number of nouns: 1450\n - Combinations: 842450\n\ndecorous_block\nlate_kevin\n```\n\nOr pipe from from `stdin`.\n\n```bash\n$ printf 'hello\\nworld' | nemony \n\n## MNEMO: Generate adjective-noun mnemonics\nWord list version: fancy_telecom\n - Number of adjectives: 581\n - Number of nouns: 1450\n - Combinations: 842450\n\ndecorous_block\nlate_kevin\n```\n\nYou can also run interactively to check one thing at a time.\nBear in mind that this encodes the whole text, not one line \na time.\n\n```bash\n$ nemony -i\n\n## MNEMO: Generate adjective-noun mnemonics\nWord list version: fancy_telecom\n - Number of adjectives: 581\n - Number of nouns: 1450\n - Combinations: 842450\n\n\n(Ctrl-C to exit.)\nWhat would you like to encode?\n\n?> hello\ndecorous_block\n?> world\nlate_kevin\n?> hello\\nworld\nwarm_dominic\n```\n\n```\nusage: nemony [-h] [--interactive] [--output [OUTPUT]] [input]\n\nEncode lines of text deterministically as adjective-noun mnemonics.\n\npositional arguments:\n input File to read and emit one mnemonic per line. Default STDIN.\n\noptions:\n -h, --help show this help message and exit\n --interactive, -i Run interactively.\n --output [OUTPUT], -o [OUTPUT]\n Output file. Default STDOUT.\n```\n\n### Python API\n\nYou can import **nemony** and use it to encode Python objects, as\nlong as they can be converted to strings.\n\n```python\n>>> import nemony as nm\n>>> nm.encode('world', sep='-')\n'late-kevin'\n>>> nm.encode('world', sep='-', n=5)\n'peppy-gabriel'\n>>> nm.encode(5.)\n'live_drum'\n>>> nm.encode(['hello', 'world'])\n'receding_cheese'\n```\n\nAs a convenience, you can also use the SHA-256 hashing functions \n(which use Python standard library `hashlib`).\n\n```python\n>>> nm.hash('world')\n'486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7'\n>>> nm.hash('world', n=8)\n'486ea462'\n>>> nm.hash(5., n=8)\n'a19a1584'\n```\n\n#### Documentation\n\nCheck the Python API at [ReadTheDocs](https://nemony.readthedocs.io/).\n",
"bugtrack_url": null,
"license": "",
"summary": "Convert text to adjective-noun mnemonics.",
"version": "0.0.2",
"project_urls": {
"Bug Tracker": "https://github.com/scbirlab/nemony/issues",
"Homepage": "https://github.com/scbirlab/nemony"
},
"split_keywords": [
"mnemonic",
"hash",
"programming"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "38477bc5565e920e9e3d04f6cb89e90d12e3d6ed010389e8465c93458c15f07d",
"md5": "7f6dc706a5844e995e6238ce3a973d7a",
"sha256": "1dcac87d1d472e3264a428e7bc43fc6fc51351e8eef5690e6024224e9b466284"
},
"downloads": -1,
"filename": "nemony-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7f6dc706a5844e995e6238ce3a973d7a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 16040,
"upload_time": "2023-06-02T09:53:25",
"upload_time_iso_8601": "2023-06-02T09:53:25.756742Z",
"url": "https://files.pythonhosted.org/packages/38/47/7bc5565e920e9e3d04f6cb89e90d12e3d6ed010389e8465c93458c15f07d/nemony-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f6965bbe63e3ea3103cdc7ca951e0d143f0b7201726868fcf6adffe62c63700a",
"md5": "a05cc74e08f5c468e48e32168acd7d87",
"sha256": "fffb99721910caea5ee6bfc57483b49d68aeadd0beb974145a887ea4f4645080"
},
"downloads": -1,
"filename": "nemony-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "a05cc74e08f5c468e48e32168acd7d87",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 17340,
"upload_time": "2023-06-02T09:53:27",
"upload_time_iso_8601": "2023-06-02T09:53:27.396312Z",
"url": "https://files.pythonhosted.org/packages/f6/96/5bbe63e3ea3103cdc7ca951e0d143f0b7201726868fcf6adffe62c63700a/nemony-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-02 09:53:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scbirlab",
"github_project": "nemony",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nemony"
}