kodokan.vocab#

Word parts of technique names: which techniques share which part, and how often.

A Kodokan technique name is a compound of recurring word parts: Harai-goshi is harai (sweep) + goshi (hip), O-soto-gari is o (large) + soto (outer) + gari (reap). Learning a dozen of those parts makes a hundred names guessable, which is what the web app’s word-part quizzes train (thorwhalen/kodokan#65).

The same part is spelled differently depending on its position: Japanese rendaku voices the first consonant of a non-initial part, so koshi (hip) becomes goshi in Harai-goshi but stays koshi in Koshi-guruma; likewise kari/gari, kuruma/guruma, kake/gake, kaeshi/gaeshi. Those variants are one part. A part is keyed by its glossary entry, and a name token maps to it when it is the entry’s primary romaji or one of its declared alternate readings (the glossary’s alts):

>>> glossary = {
...     "goshi": {"alts": ["koshi"]},
...     "guruma": {"alts": ["kuruma"]},
...     "harai": {"alts": ["barai"]},
...     "gaeshi": {"alts": []},
... }
>>> index = variant_index(glossary)
>>> [index.get(t) for t in ("koshi", "goshi", "barai", "kaeshi", "nage")]
['goshi', 'goshi', 'harai', None, None]
>>> parts_of_name("Koshi-guruma", index)
['goshi', 'guruma']

Variants are declared, not guessed: rendaku is regular enough to suggest a variant but not to merge one silently (devoicing de, “advancing”, gives te, “hand”, a different word). So unmatched_tokens() reports the name tokens no part claims, with the part they are a rendaku variant of, for a person to add as an alts entry:

>>> unmatched_tokens({"kaeshiwaza": "Kaeshi-waza"}, glossary)
{'kaeshi': 'gaeshi', 'waza': None}

word_throws() derives part -> techniques by tokenizing the names, rather than trusting a hand-kept list (which had missed Koshi-guruma under goshi), and part_stats() counts the distinct techniques per part. MIN_TECHNIQUES is the threshold for a part to be offered in the quizzes; its docstring records why.

Module Attributes

MIN_TECHNIQUES

A part is offered in the word-part quizzes when at least this many distinct techniques use it.

HOMOGRAPHS

technique names where a token is NOT the glossary part.

Functions

devoiced(token)

The unvoiced (rendaku-undone) form of token, or token if it starts unvoiced.

homographs_by_kanji(names, kanji, glossary)

part key -> technique keys whose name has the part's spelling but not its kanji.

name_tokens(romaji)

The lower-cased parts of a romaji name: "O-soto-gari" -> ['o', 'soto', 'gari'].

part_stats(part_throws, *[, min_techniques])

One row per part, most-shared first: {part, n_techniques, offered}.

parts_of_name(romaji, index)

The distinct part keys of a name, in order of appearance.

threshold_table(part_throws, *[, upto])

k -> number of parts shared by at least k techniques, for choosing a threshold.

unmatched_tokens(names, glossary)

token -> part it is a rendaku variant of (or None) for tokens no part claims.

variant_index(glossary)

spelling -> part key for every primary key and declared alternate reading.

word_throws(names, glossary, *[, homographs])

part key -> sorted technique keys whose name contains the part.

kodokan.vocab.HOMOGRAPHS: dict[str, frozenset[str]] = {'kata': frozenset({'katajujijime'})}#

technique names where a token is NOT the glossary part. Kata-juji-jime’s kata is 片 (“one-sided”), not the glossary’s 肩 (“shoulder”). The fallback when no technique kanji is at hand; homographs_by_kanji() finds these from the kanji instead.

Type:

Same spelling, different word

kodokan.vocab.MIN_TECHNIQUES = 3#

A part is offered in the word-part quizzes when at least this many distinct techniques use it. Chosen from the statistics of the 68 nage-waza (2026-11-09, kodokan#65): 23 parts are shared by >=2 techniques, 20 by >=3, 16 by >=4, 13 by >=5. A part shared by only two techniques (obi, sumi, wakare) is a pair to memorize, not a pattern to spot, while 3 keeps seoi (Seoi-nage, Ippon-seoi-nage, Seoi-otoshi), one of the four parts the owner named as the point of the exercise; 4 would drop it. So 3.

kodokan.vocab.devoiced(token)[source]#

The unvoiced (rendaku-undone) form of token, or token if it starts unvoiced.

>>> devoiced("gaeshi"), devoiced("jime"), devoiced("barai"), devoiced("ashi")
('kaeshi', 'shime', 'harai', 'ashi')
Return type:

str

kodokan.vocab.homographs_by_kanji(names, kanji, glossary)[source]#

part key -> technique keys whose name has the part’s spelling but not its kanji.

A name token that is a part’s spelling is another word when the technique’s own kanji lacks the part’s glossary kanji: Kata-juji-jime (片十字絞) has kata but not 肩. Techniques with no kanji in kanji are not judged. The result is what word_throws() takes as homographs, found from the data rather than kept by hand beside the technique keys.

>>> glossary = {"kata": {"kanji": "肩"}, "juji": {"kanji": "十字"}}
>>> names = {"katajujijime": "Kata-juji-jime", "kataguruma": "Kata-guruma"}
>>> kanji = {"katajujijime": "片十字絞", "kataguruma": "肩車"}
>>> homographs_by_kanji(names, kanji, glossary)
{'kata': frozenset({'katajujijime'})}
Return type:

dict[str, frozenset[str]]

kodokan.vocab.name_tokens(romaji)[source]#

The lower-cased parts of a romaji name: "O-soto-gari" -> ['o', 'soto', 'gari'].

Return type:

list[str]

kodokan.vocab.part_stats(part_throws, *, min_techniques=3)[source]#

One row per part, most-shared first: {part, n_techniques, offered}.

>>> part_stats({"ashi": ["a", "b", "c"], "obi": ["d", "e"], "kani": ["f"]})
...
[{'part': 'ashi', 'n_techniques': 3, 'offered': True},
 {'part': 'obi', 'n_techniques': 2, 'offered': False},
 {'part': 'kani', 'n_techniques': 1, 'offered': False}]
Return type:

list[dict]

kodokan.vocab.parts_of_name(romaji, index)[source]#

The distinct part keys of a name, in order of appearance.

Return type:

list[str]

kodokan.vocab.threshold_table(part_throws, *, upto=6)[source]#

k -> number of parts shared by at least k techniques, for choosing a threshold.

Return type:

dict

kodokan.vocab.unmatched_tokens(names, glossary)[source]#

token -> part it is a rendaku variant of (or None) for tokens no part claims.

Return type:

dict[str, str | None]

kodokan.vocab.variant_index(glossary)[source]#

spelling -> part key for every primary key and declared alternate reading.

glossary maps a part key (its primary romaji, lower-case) to a mapping that may hold alts: alternate readings such as ["koshi"] for goshi.

Raises:

ValueError – if one spelling would belong to two parts (glossary order must never decide which part a name token is).

Return type:

dict[str, str]

kodokan.vocab.word_throws(names, glossary, *, homographs={'kata': frozenset({'katajujijime'})})[source]#

part key -> sorted technique keys whose name contains the part.

Parameters:
Return type:

dict[str, list[str]]

>>> word_throws(
...     {"kataguruma": "Kata-guruma", "katajujijime": "Kata-juji-jime"},
...     {"kata": {}, "guruma": {}},
... )
{'kata': ['kataguruma'], 'guruma': ['kataguruma']}