Jpdict
jpdict
¶
BundleMode
¶
How aggressively the stitch function groups UniDic short-unit tokens into
words
The modes trade granularity for a learner's needs, from whole dictionary words down to raw morphemes
words
-
The coarsest grouping
-
Merges compound nouns and the whole inflected tail of a predicate, including the connecting て, bound auxiliary verbs, and politeness, into single dictionary words (e.g.
図書館,食べてみたかった) -
Best for looking words up
grammar (default)
-
The
learningview -
Keeps compound nouns and a predicate's inflectional auxiliaries together, but breaks off the pieces a learner parses separately, like the connecting て, bound auxiliary verbs (みる/いる/出す), and the politeness stems (ます/です) (e.g.
食べ | て | みたかった,読み | ました)
morphemes
-
The finest grouping
-
No stitching at all, one word per UniDic short unit (e.g.
図書 | 館,読み | まし | た)
EnrichedJapaneseWord
¶
Bases: BaseModel
A JapaneseWord paired with its dictionary data
Returned by the enrichment endpoint (one kotobase lookup per stitched
word), as opposed to the fast tokenize endpoint which returns bare
JapaneseWord models
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word
|
JapaneseWord
|
The stitched word |
required |
kotobase_data
|
KotobaseData
|
The dictionary data for the word's lemma |
required |
Example
¶
FuriganaSegment
¶
Bases: BaseModel
One segment of a word's furigana segmentation (JmdictFurigana)
Rendering
-
rubyis the text (kanji or kana) andrtis the kana reading annotation of that text (appears on top ofrubyin frontend) -
Kana-only words carry no
rt, so they render as plain text
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ruby
|
str
|
The text (kanji or kana) |
required |
rt
|
str | None
|
The kana reading annotation, when the text is kanji |
required |
JMEntry
¶
Bases: BaseModel
Represents a single word entry in the Japanese-Multilingual Dictionary
freq_rank
-
Kotobasederives this field from JMDict'snfxxpriority tags, which split the 24000 most common words into 500-word bands -
1is the most common band and48the least,Nonemeans the word is outside the ranked corpus
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_common
|
bool
|
Whether any form carries a JMDict common-word priority tag |
required |
freq_rank
|
int | None
|
The 500-word frequency band, when ranked |
required |
kana
|
list[str]
|
Kana reading forms |
required |
kanji
|
list[str]
|
Kanji written forms |
required |
senses
|
list[JMWordSense]
|
The entry's senses, in editorial order |
required |
JMNEntry
¶
Bases: BaseModel
Represents a single name entry in the Japanese Multi-Lingual
Dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kana
|
list[str]
|
Kana reading forms |
required |
kanji
|
list[str]
|
Kanji written forms |
required |
name_types
|
list[str]
|
Readable name-type labels (e.g. surname, place name) |
required |
gloss
|
list[str]
|
Translation strings |
required |
JMWordSense
¶
Bases: BaseModel
Represents a single sense (distinct meanings, translations, or nuances
of a Japanese word) for a word within the Japanese-Multilingual Dictionary
Sense Order
-
Senses are returned in their editorial order
-
They progress from primary, literal definitions to secondary, figurative, or technical nuances
-
The order is already preserved in the list returned by kotobase, so no explicit field carries it
Readable Tags
pos, field, and misc carry human-readable labels (e.g.
Godan verb with 'u' ending instead of the raw JMDict code v5u),
expanded server-side
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
glosses
|
list[str]
|
English equivalents for this sense |
required |
pos
|
list[str]
|
Readable grammatical classifications |
required |
field
|
list[str]
|
Readable subject-domain labels (e.g. medicine) |
required |
misc
|
list[str]
|
Readable usage labels (e.g. colloquial, archaic) |
required |
antonyms
|
list[str]
|
Antonym cross-references |
required |
xrefs
|
list[str]
|
Related-entry cross-references |
required |
JapaneseWord
¶
Bases: BaseModel
Represents a single useful word stitched from one or more UniDic short-unit tokens
Stitching
-
UniDic segments at the short-unit level, which is often too granular to be useful (e.g.
図書館->図書+館, or a verb split from its auxiliaries) -
A
JapaneseWordre-bundles those short units into the word a learner actually wants to click -
The original short-unit
Tokenmodels are kept intokensso no morphological detail is lost
the word built from 読み + まし + た
- surface = "読みました" (the pieces joined as written)
- reading = "ヨミマシタ" (their katakana readings joined)
- lemma = "読む" (the dictionary form, for look-ups)
- pos = "動詞" (verb -- the head piece's part of speech)
- tokens = [読み, まし, た] (the three original short units)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
str
|
The bundle's combined surface form |
required |
reading
|
str
|
The combined katakana reading of the component tokens |
required |
lemma
|
str
|
Dictionary-lookup form (the head token's UniDic's
|
required |
pos
|
str
|
The head token's top-level part of speech |
required |
tokens
|
list[Token]
|
The component short-unit tokens, in order |
required |
KanjiAudio
¶
Bases: BaseModel
Pronunciation clips available for a single Kanji (Kanji Alive)
Clips
-
Kanji Aliverecords example-word pronunciations per Kanji, so each clip id names one recorded example word -
A clip's bytes are streamed by the audio clip endpoint using its id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kanji
|
str
|
The Kanji literal the clips belong to |
required |
clips
|
list[str]
|
Clip ids, one per recorded example word |
required |
fmt
|
str
|
Audio container format of the clips (e.g. |
required |
attribution
|
str | None
|
Attribution string required by the source license, when provided |
required |
KanjiInfo
¶
Bases: BaseModel
Represents a single Kanji entry aggregated from KANJIDIC2, KRADFILE,
and KanjiVG
jlpt
-
kotobae exposes both the kanji jlpt level from the
Tanosstudy lists, and the pre-2010KANJIDIC2level -
The server exposes only one aggreagated jlpt level which prefers the more updataded
Tanoslevel, and falls back to the pre-2010 level when the former is not available
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
literal
|
str
|
Kanji literal |
required |
grade
|
int | None
|
Optional Japanese grade in which Kanji is learned |
required |
stroke_count
|
int | None
|
Number of strokes in handwriting |
required |
freq
|
int | None
|
Frequency-of-use rank (1 = most common), when ranked |
required |
jlpt
|
int | None
|
JLPT level (5 easiest to 1 hardest), when listed |
required |
is_joyo
|
bool
|
Whether the Kanji is in the Joyo (regular use) set |
required |
meanings
|
list[str]
|
List of known meanings |
required |
onyomi
|
list[str]
|
List of |
required |
kunyomi
|
list[str]
|
List of |
required |
nanori
|
list[str]
|
Name-only readings |
required |
radicals
|
list[str]
|
The Kanji's radical components ( |
required |
has_stroke_order
|
bool
|
Whether a |
required |
KotobaseData
¶
Bases: BaseModel
Represents all information extracted from kotobase for a single
query (either a single Japanese word, or a wildcard pattern matching
multiple words)
meanings
-
Exposes the English equivalents contained in the first Japanese-Multilingual Dictionary entry for the query, one string per sense
-
If the query has only
JMNEntryentries, the first entry'sglossattribute is used
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
query literal (either a single Japanese word or a wildcard pattern) |
required |
jmentries
|
list[JMEntry]
|
All Japanese-Multilingual Dictionary entries for the query |
required |
jmnentries
|
list[JMNEntry]
|
All |
required |
kanji
|
list[KanjiInfo]
|
Kanji entries for all Kanji present in the query |
required |
furigana
|
list[FuriganaSegment]
|
Furigana segmentation of the query word's primary form, empty for wildcard queries or unknown words |
required |
meanings
|
list[str]
|
All English equivalents contained in the first
|
required |
jlpt
|
str
|
JLPT vocabulary level for the word extracted from the
|
required |
examples
|
list[Example]
|
Example sentences (with translations) containing the single word or any words matched by the wildcard query |
required |
RadicalInfo
¶
Token
¶
Bases: BaseModel
Represents morphological data extracted for a single Japanese token
Maps all core token features and deep UniDic morphological data produced by Fugashi. Converts internal dictionary symbols (like asterisks) into clean pythonic types.
Attributes:
| Name | Type | Description |
|---|---|---|
surface |
str
|
The raw string exactly as it appears in the text. |
lemma |
str
|
The dictionary base form (語彙素) of the word. |
reading |
str
|
The standard reading of the token in Katakana. |
pos |
str
|
The broad, top-level part of speech (品詞). |
pos2 |
str
|
Sub-category level 2 part of speech. |
pos3 |
str
|
Sub-category level 3 part of speech. |
pos4 |
str
|
Sub-category level 4 part of speech. |
c_type |
str
|
Conjugation type (活用型) if applicable. |
c_form |
str
|
Conjugation form (活用形) if applicable. |
l_form |
str
|
Lemma reading in Katakana. |
orth |
str
|
Orthographic surface representation. |
pron |
str
|
Actual pronunciation including long vowels. |
orth_base |
str
|
Base form using current orthography. |
pron_base |
str
|
Pronunciation of the base form. |
goshu |
str
|
Word origin type (語種) e.g., Native, Sino-Japanese. |
i_type |
str
|
Word-initial transformation type. |
i_form |
str
|
Word-initial transformation form. |
f_type |
str
|
Word-final transformation type. |
f_form |
str
|
Word-final transformation form. |
clear_asterisks(data)
classmethod
¶
Cleans incoming dictionary fields by converting UniDic's "*" sentinel
and any missing (None) feature to an empty string, since unknown /
out-of-vocabulary tokens leave some features unset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Raw dictionary data containing morphological fields |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict[str, Any]
|
The modified dictionary with "*"/ |