Data Mappers
datatypes
¶
This module defines the kotobase
datatypes representing
information from the different data sources.
map_jmdict(entry)
¶
Map Raw JMDictEntry database row to a Python DTO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
JMDictEntry
|
SQLAlchemy Table object |
required |
Returns:
Name | Type | Description |
---|---|---|
JMDictEntryDTO |
JMDictEntryDTO
|
Python DTO |
Source code in kotobase/src/kotobase/core/datatypes.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
map_jmnedict(entry)
¶
Map Raw JMNeDictEntry database row to a Python DTO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
JMneDictEntry
|
SQLAlchemy Table object |
required |
Returns:
Name | Type | Description |
---|---|---|
JMNeDictEntryDTO |
JMNeDictEntryDTO
|
Python DTO |
Source code in kotobase/src/kotobase/core/datatypes.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
map_jlpt_vocab(row)
¶
Map Raw JLPT Vocabulary database row to a Python DTO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
JlptVocab
|
SQLAlchemy Table object |
required |
Returns:
Name | Type | Description |
---|---|---|
JLPTVocabDTO |
JLPTVocabDTO
|
Python DTO |
Source code in kotobase/src/kotobase/core/datatypes.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
map_jlpt_kanji(row)
¶
Map Raw JLPT Kanji database row to a Python DTO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
JlptKanji
|
SQLAlchemy Table object |
required |
Returns:
Name | Type | Description |
---|---|---|
JLPTKanjiDTO |
JLPTKanjiDTO
|
Python DTO |
Source code in kotobase/src/kotobase/core/datatypes.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
|
map_jlpt_grammar(row)
¶
Map Raw JLPT Grammar database row to a Python DTO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
JlptGrammar
|
SQLAlchemy Table object |
required |
Returns:
Name | Type | Description |
---|---|---|
JLPTGrammarDTO |
JLPTGrammarDTO
|
Python DTO |
Source code in kotobase/src/kotobase/core/datatypes.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
map_kanjidic(row, *, jlpt_tanos_level=None)
¶
Map Raw KANJIDIC2 database row to a Python DTO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row
|
Kanjidic
|
SQLAlchemy Table object |
required |
jlpt_tanos_level
|
int
|
JLPT level extracted from Tanos lists if it exists. |
None
|
Returns:
Name | Type | Description |
---|---|---|
KanjiDTO |
KanjiDTO
|
Python DTO |
Source code in kotobase/src/kotobase/core/datatypes.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
|
map_sentence(row)
¶
Map Raw Tatoeba exmaple sentences database row to a Python DTO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry
|
TatoebaSentence
|
SQLAlchemy Table object |
required |
Returns:
Name | Type | Description |
---|---|---|
SentenceDTO |
SentenceDTO
|
Python DTO |
Source code in kotobase/src/kotobase/core/datatypes.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
|
map_many(func, rows)
¶
Apply any single-row mapper across any iterable while keeping return order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
Callable
|
The mapper function to apply |
required |
rows
|
Iterable
|
The returned database rows |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
List
|
List of the DTO objects returned by |
Source code in kotobase/src/kotobase/core/datatypes.py
479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
|