> built 2026-09-22 14:42 UTC from 2536724 (master) · hm 0.0.6. Details: build_info.json

# index.html.md

<!-- generated by epythet -->

# hm

Mnemonic tools

To install:	`pip install hm`

# Mnemonic Major System

The [major system](https://en.wikipedia.org/wiki/Mnemonic_major_system)
is a mnemonic technique used to aid in memorizing numbers.

It works as follows:

```none
>>> from hm import MajorSystem
>>> m = MajorSystem()
```

The “Mnemonic Major System” (https://en.wikipedia.org/wiki/Mnemonic_major_system)
assigns a set of similar phonemes to each digit:

```none
>>> assert m.phones_for_num == {
...     0: {'S', 'Z'},
...     1: {'D', 'DH', 'T', 'TH'},
...     2: {'N'},
...     3: {'M'},
...     4: {'R'},
...     5: {'L'},
...     6: {'CH', 'JH', 'SH'},
...     7: {'G', 'K'},
...     8: {'F', 'V'},
...     9: {'B', 'P'}
... }
```

As a consequence these phonemes are mapped to numbers:

```none
>>> assert m.num_of_phone == {
...     'B': 9,
...     'CH': 6,
...     'D': 1,
...     'DH': 1,
...     'F': 8,
...     'G': 7,
...     'JH': 6,
...     'K': 7,
...     'L': 5,
...     'M': 3,
...     'N': 2,
...     'P': 9,
...     'R': 4,
...     'S': 0,
...     'SH': 6,
...     'T': 1,
...     'TH': 1,
...     'V': 8,
...     'Z': 0
... }
```

Any sentence has a corresponding phoneme sequence:

```none
>>> m.term_to_phones('wild cat')
['W', 'AY1', 'L', 'D', 'K', 'AE1', 'T']
```

The system doesn’t contain all phonemes; only some of the consonant phonemes.
So if we only keep those phonemes that the system covers, we get:

```none
>>> m.term_to_mst_sequence('wild cat')
['L', 'D', 'K', 'T']
```

Which corresponds to a number.

```none
>>> m.term_to_nums('wild cat')
[5, 1, 7, 1]
```

But really, the system is used to be able to create words (therefore images)
that correspond to a sequence of numbers, so that one can remember them:

```none
>>> m.terms_of_numstr['3214']  # doctest: +NORMALIZE_WHITESPACE
['hammontree', 'mahindra', 'manteer', 'mantra', 'mentor', 'minteer', 'mondry',
'monetary', 'monteiro', 'monterey', 'montero', 'monterrey', 'montrouis',
'montroy', 'montuori', 'omohundro']
```

<p class="epythet-aggregates">This documentation as a single file: <a href="hm.md">hm.md</a> (Markdown, for agents).</p>


# _autosummary/hm.html.md

# hm

Tools to remember stuff

### Modules

| [`phonemes`](_autosummary/hm.phonemes.html.md#module-hm.phonemes)   | Mnemonic tools using phonemes   |
|--------------------------------------------------------------------------------|---------------------------------|


# _autosummary/hm.phonemes.html.md

# hm.phonemes

Mnemonic tools using phonemes

### Functions

| [`keys_for_value`](_autosummary/hm.phonemes.html.md#hm.phonemes.keys_for_value)(d)   | An inverse of dict `d`.   |
|----------------------------------------------------------------------|---------------------------|

### Classes

| [`MajorSystem`](_autosummary/hm.phonemes.html.md#hm.phonemes.MajorSystem)(\*[, url_term_and_phones])   | See:    [https://en.wikipedia.org/wiki/Mnemonic_major_system](https://en.wikipedia.org/wiki/Mnemonic_major_system)   |
|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| `Phone`(\*[, url_term_and_phones])                                                        |                                                                                                                      |

### *class* hm.phonemes.MajorSystem(, url_term_and_phones='http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b')

Bases: `Phone`

See:    [https://en.wikipedia.org/wiki/Mnemonic_major_system](https://en.wikipedia.org/wiki/Mnemonic_major_system)

```pycon
>>> m = MajorSystem()
```

The “Mnemonic Major System” ([https://en.wikipedia.org/wiki/Mnemonic_major_system](https://en.wikipedia.org/wiki/Mnemonic_major_system))
assigns a set of similar phonemes to each digit:

```pycon
>>> assert m.phones_for_num == {
...     0: {'S', 'Z'},
...     1: {'D', 'DH', 'T', 'TH'},
...     2: {'N'},
...     3: {'M'},
...     4: {'R'},
...     5: {'L'},
...     6: {'CH', 'JH', 'SH'},
...     7: {'G', 'K'},
...     8: {'F', 'V'},
...     9: {'B', 'P'}
... }
```

As a consequence these phonemes are mapped to numbers:

```pycon
>>> assert m.num_of_phone == {
...     'B': 9,
...     'CH': 6,
...     'D': 1,
...     'DH': 1,
...     'F': 8,
...     'G': 7,
...     'JH': 6,
...     'K': 7,
...     'L': 5,
...     'M': 3,
...     'N': 2,
...     'P': 9,
...     'R': 4,
...     'S': 0,
...     'SH': 6,
...     'T': 1,
...     'TH': 1,
...     'V': 8,
...     'Z': 0
... }
```

Any sentence has a corresponding phoneme sequence:

```pycon
>>> m.term_to_phones('wild cat')
['W', 'AY1', 'L', 'D', 'K', 'AE1', 'T']
```

The system doesn’t contain all phonemes; only some of the consonant phonemes.
So if we only keep those phonemes that the system covers, we get:

```pycon
>>> m.term_to_mst_sequence('wild cat')
['L', 'D', 'K', 'T']
```

Which corresponds to a number.

```pycon
>>> m.term_to_nums('wild cat')
[5, 1, 7, 1]
```

But really, the system is used to be able to create words (therefore images)
that correspond to a sequence of numbers, so that one can remember them:

```pycon
>>> m.terms_of_numstr['3214']
['hammontree', 'mahindra', 'manteer', 'mantra', 'mentor', 'minteer', 'mondry',
'monetary', 'monteiro', 'monterey', 'montero', 'monterrey', 'montrouis',
'montroy', 'montuori', 'omohundro']
```

### hm.phonemes.keys_for_value(d)

An inverse of dict `d`.
If `d` is a mapping of `(key, value)`, `keys_for_value` will return
a dict of `(unique_value, group_of_key)` items.


# about-this-build.html.md

<!-- generated by epythet -->

# About this build

This documentation was built on **2026-09-22 14:42 UTC** from commit <a href="https://github.com/thorwhalen/hm/commit/2536724566130a021955f0a39c8e71dd8372789b"><code>2536724</code></a> on branch <code>master</code>, for **hm 0.0.6** (from <code>pyproject.toml</code>).

#### WARNING
The documentation and the package may be misaligned:

- The documented version (0.0.6) is behind the latest release on PyPI (0.0.7): `pip install hm` gives newer code than these docs describe.

## Source

|                     |                                                                                                                                                      |
|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| Commit              | <a href="https://github.com/thorwhalen/hm/commit/2536724566130a021955f0a39c8e71dd8372789b"><code>2536724566130a021955f0a39c8e71dd8372789b</code></a> |
| Branch              | <code>master</code>                                                                                                                                  |
| Tags at this commit | none                                                                                                                                                 |
| Working tree        | clean                                                                                                                                                |
| Remote              | <code>https://github.com/thorwhalen/hm</code>                                                                                                        |

## Continuous integration

|              |                                                                                            |
|--------------|--------------------------------------------------------------------------------------------|
| Repository   | <code>thorwhalen/hm</code>                                                                 |
| Run          | <a href="https://github.com/thorwhalen/hm/actions/runs/35742041149">35742041149</a>        |
| Ref          | <code>refs/heads/master</code>                                                             |
| Event commit | <code>2536724566130a021955f0a39c8e71dd8372789b</code> (in the history of the built commit) |

## Tools

|          |         |
|----------|---------|
| epythet  | 0.2.12  |
| Sphinx   | 9.1.0   |
| docutils | 0.22.4  |
| Python   | 3.12.14 |

## Configuration as resolved

|               |                                                                  |
|---------------|------------------------------------------------------------------|
| theme         | <code>auto</code> (Sphinx theme <code>furo</code>)               |
| accent        | <code>#5e5d00</code>                                             |
| api_generator | <code>autosummary</code>                                         |
| ignore        | <code>tests/</code>, <code>scrap/</code>, <code>examples/</code> |
| agent_outputs | <code>true</code>                                                |
| aggregates    | <code>md</code>                                                  |
| ai_artifacts  | <code>true</code>                                                |

## Package on PyPI

Latest release: <a href="https://pypi.org/project/hm/0.0.7/">0.0.7</a>, newer than the documented version (0.0.6).

## Reproduce

```bash
git clone https://github.com/thorwhalen/hm && cd hm
git checkout 2536724566130a021955f0a39c8e71dd8372789b
pip install "epythet==0.2.12"
epythet quickstart . --ignore tests/ scrap/ examples/
```

The same data, for machines: <a href="build_info.json"><code>build_info.json</code></a> (schema version 1).


# api.html.md

# API reference

| [`hm`](_autosummary/hm.html.md#module-hm)   | Tools to remember stuff   |
|-----------------------------------------------------------------|---------------------------|


