feat: Grey out ignored kanji in grid with special list

This commit is contained in:
Dendy 2025-09-08 08:23:52 +02:00
parent a2c07e5d2f
commit 87ca6a5564
3 changed files with 91 additions and 3 deletions

61
data/ignored.list Normal file
View File

@ -0,0 +1,61 @@
Sale como 異体字 de 猛 pero en verdad parece ser que se usa en nombre de
cuidades tailandesas? Parece que denota un tipo de templo especifico.
https://en.wikipedia.org/wiki/Mueang
異体字 de 勅 y su 旧字体「敕」. No tiene mucho interés.
Significa "harmonioso" pero no hay mucho en referencia de ello.
Básicamente se usa para el nombre de un pavo que hizo un libro sobre agricultura.
En ebooks sale esta persona también referenciada.
Versión simplificada de 勩. No tiene ni uso ni referencias ni nada.
異体字 of 勉強の勉. No se usa. No tiene interés.
Old variant of 掬, also has the 古字 of "𦥑" . An ebook says it represent
having your hands full with rice.
Old variant/origin? of 陶, which is 常用漢字 / 名前に使える漢字 and 3級. Seems
to kinda mean "pottery" , "clay" . It's used in 陶器[とうき].
Not interesting on its own
Old vase for holding water/wine. Not used aside from that.
https://en.wikipedia.org/wiki/Yi_(vessel)
REVISIT
Simplified form of 匭. Not of interest at all. Small box or something.
Old variant of something that isn't even used. No reason to pay attention
Not used at all, wtf. Seems to be used in some dialects to kinda mean 蓋[ふた].
Of no interest.
Traditional chinese of 匾 (same code lol). Horizontal tablet to have the name
of stuff in entrances and stuff.
Traditional is 匾 and in japanese it's just 扁, wich is
一級. Of no interest for now, idk, too many characters for one concept.
https://zh.wikipedia.org/wiki/%E5%8C%BE%E9%A1%8D
REVISIT
Means forty. Not used aside historially and not as funny as 卄, 卅 or 卆
Seems to be used in names of places and that's kinda it. A variant of 鞭 or
something. Not learning it for now. Of no interst.
used in the transliteration of the names of organic compounds porphyrin 卟啉
and porphin 卟吩. Of no use.

View File

@ -29,6 +29,29 @@ class KanjiController extends AbstractController
return "kanji/$path.html.twig";
}
/** @return array<string, string> */
public function getIgnoredList(): array
{
$path = "{$this->getParameter('kernel.project_dir')}/data/ignored.list";
$ret = [];
$file = fopen($path, 'r');
while (($kanji = fgets($file)) !== false) {
$kanji = mb_trim($kanji);
if (mb_strlen($kanji) !== 1) throw new \Exception(sprintf(
'Kanji expected, got "%s"',
$kanji,
));
while (($explanation = fgets($file)) !== false) {
if ($explanation === "\n") continue 2;
$ret[$kanji] = mb_trim(fgets($file));
}
}
return $ret;
}
/** @return array<string, array<string, 0>> */
private function getCharInfo(bool $force = false): array
{
@ -42,6 +65,7 @@ class KanjiController extends AbstractController
'sn' => $this->anki->getKnownSnKanjiCounts(),
'sln' => $this->anki->getKnownSlnKanjiCounts(),
'unicode' => $this->anki->getUnicodeKanji(),
'ignored' => $this->getIgnoredList(),
];
// @formatter:off
@ -103,9 +127,12 @@ class KanjiController extends AbstractController
public function register(string $codepoint): Response
{
// Properly check it's valid (make a util?)
$char = mb_chr(Number::hexint($codepoint), 'UTF-8');
$charStr = mb_chr(Number::hexint($codepoint), 'UTF-8');
$note = UnicodeNote::fromCharacter($charStr);
$terms = $this->anki->searchTerms($charStr);
$note->setTerms($terms);
$note = UnicodeNote::fromCharacter($char);
$this->anki->addNote($note, UnicodeNote::DECK);
return new Response();

View File

@ -42,7 +42,7 @@
.ebook { border-top: 3px solid deeppink !important; }
.jimaku { border-top: 3px solid lightgray !important; }
.none { opacity: 0.40; }
.none, .ignored { opacity: 0.15; }
</style>
<div style="background-color: var(--bs-gray-300)">