Repos
jlpt
¶
This module defines the JLPTRepo class used for querying
data extracted from Jonathan Weller's website in the database.
JLPTRepo
¶
Query JLPT Related Tables of Database
Source code in kotobase/src/kotobase/repos/jlpt.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
grammar_entries_like(pattern)
staticmethod
¶
Wildcard search for grammar patterns
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
Wildcard Pattern |
required |
Returns:
| Type | Description |
|---|---|
List[JLPTGrammarDTO]
|
List[JLPTGrammarDTO]: List of JLPT Grammar data objects. |
Source code in kotobase/src/kotobase/repos/jlpt.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
kanji_levels(chars)
staticmethod
¶
Get Kanji levels with bulk search
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chars
|
Iterable[str]
|
Iterable of character to query. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, int]
|
Dict[str, int]: Dictionary with character keys and level values. |
Source code in kotobase/src/kotobase/repos/jlpt.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
vocab_by_word(word)
cached
staticmethod
¶
Get vocabulary by word
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word
|
str
|
Word to query |
required |
Returns:
| Name | Type | Description |
|---|---|---|
JLPTVocabDTO |
Optional[JLPTVocabDTO]
|
JLPT Vocab data object. |
Source code in kotobase/src/kotobase/repos/jlpt.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
vocab_level(word)
staticmethod
¶
Get Vocab JLPT levels
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word
|
str
|
Word to query. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
Optional[int]
|
JLPT level if existent. |
Source code in kotobase/src/kotobase/repos/jlpt.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
jmdict
¶
This module defines the JMDictRepo class used for querying
data extracted from the JMDict XML file in the database.
JMDictRepo
¶
Queries JMDict Related Tables of Database
Source code in kotobase/src/kotobase/repos/jmdict.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
by_id(entry_id)
cached
staticmethod
¶
Retrieve Entry by id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_id
|
int
|
Entry ID in database. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
JMDictEntryDTO |
Optional[JMDictEntryDTO]
|
JMDict Entry Data Object. |
Source code in kotobase/src/kotobase/repos/jmdict.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
search_form(form, /, *, wildcard=False, limit=50)
cached
staticmethod
¶
Exact or wildcard search across kana and kanji.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form
|
str
|
Query string. |
required |
wildcard
|
bool
|
If true, treat |
False
|
limit
|
int
|
Limit of entries to return, can be set to
|
50
|
Returns: List[JMDictEntryDTO]: List of JMDictEntry data objects.
Source code in kotobase/src/kotobase/repos/jmdict.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
jmnedict
¶
This module defines the JMneDictRepo class used for querying
data extracted from the JMneDict XML file in the database.
JMNeDictRepo
¶
Queries related to JMNeDict Tables of the database.
Source code in kotobase/src/kotobase/repos/jmnedict.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
by_id(entry_id)
cached
staticmethod
¶
Retrieve Entry by id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_id
|
int
|
Entry ID in database. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
JMNeDictEntryDTO |
Optional[JMNeDictEntryDTO]
|
JMNeDict Entry Data Object. |
Source code in kotobase/src/kotobase/repos/jmnedict.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
search(form, limit=50)
cached
staticmethod
¶
LIKE search on JMNeDict table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form
|
str
|
Query string. |
required |
limit
|
int
|
Limit of entries to return, can be set to
|
50
|
Returns: List[JMNeDictEntryDTO]: List of JMNeDictEntry data objects.
Source code in kotobase/src/kotobase/repos/jmnedict.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
kanji
¶
This module defines the KanjiRepo class used for querying
data extracted from the KANJIDIC2 XML file in the database.
KanjiRepo
¶
Queries Kanji related Tables of the database
Source code in kotobase/src/kotobase/repos/kanji.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
bulk_fetch(chars)
staticmethod
¶
Bulk-Fetch Kanji for performance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chars
|
Iterable[str]
|
Iterable of kanjis. |
required |
Returns:
| Type | Description |
|---|---|
List[KanjiDTO]
|
List[KanjiDTO]: List of Kanji Data Objects. |
Source code in kotobase/src/kotobase/repos/kanji.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
by_literal(lit)
staticmethod
¶
Retrieve Kanji by literal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lit
|
str
|
The Kanji Literal |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KanjiDTO |
Optional[KanjiDTO]
|
Kanji Data Object |
Source code in kotobase/src/kotobase/repos/kanji.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
sentences
¶
This module defines the SentenceRepo class used for querying
data extracted from the Japanese Tatoeba example sentences
in the database.
SentenceRepo
¶
Query database for Tatoeba example senteces Tables.
Source code in kotobase/src/kotobase/repos/sentences.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
search_containing(text, /, limit=50, wildcard=False)
staticmethod
¶
Basic LIKE search. If wildcard=True every non-space char is wrapped
in '%' to simulate a contains all chars in order fuzzy search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text to look for in sentences |
required |
limit
|
int
|
Limit how many sentences are returned. |
50
|
wildcard
|
bool
|
If True every non-space char is wrapped
in '%' to simulate a |
False
|
Returns:
| Type | Description |
|---|---|
List[SentenceDTO]
|
List[SentenceDTO]: List of Sentence data objects. |
Source code in kotobase/src/kotobase/repos/sentences.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |