feat(dictionary): characters of Chinese, Korean and Greek, written by hand; pinyin typed
Parity with Japanese's kanji and kana: - The characters' tab is named by its language (Hanzi, Hangul & Hanja, Alphabet), its groups too: HSK levels and the characters in common use (Hong Kong's grades for traditional ones); Hangul and the Hanja taught in schools; Greek's letters. Radicals for Chinese and Korean in their own forms (讠 for 言 in simplified Chinese), none for Greek. - A character's readings are named as its language names them: On and Kun, Pinyin, Eum and Hun (음, 훈); a letter means its sound and name. - How characters are written comes by language: Chinese from Make Me a Hanzi (its medians in KanjiVG's square, Arphic Public License, a data file beside the app, never in cards), the Hangul letters drawn by the curator; a Korean word is written letter by letter (닭: ㄷ ㅏ ㄺ). Words of alphabets (German, Greek) aren't written by hand. - A Chinese word's pinyin is typed in a session, tone numbers turning into marks (ni3 → nǐ); KRDict's levels (초급, 중급, 고급) tag Korean words; a Korean word's pronunciation shows in brackets ([가치]). - Smaller: Look up in the composer keeps a noun's article; the Watch filter names its level list; hints and placeholders by language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
7070cd6bd2
commit
5479b973fc
1 changed files with 2559 additions and 230 deletions
|
|
@ -4,12 +4,14 @@ import 'dart:io';
|
|||
import 'package:archive/archive.dart';
|
||||
import 'package:args/args.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/cedict.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/hangul_strokes.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/jlpt.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/jmdict.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/jmdict_xml.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/kanjidic.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/kanjivg.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/krdict.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/makemeahanzi.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/tatoeba.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/unihan.dart';
|
||||
import 'package:halkyon_learn_curator/src/sources/wiktionary.dart';
|
||||
|
|
@ -30,6 +32,18 @@ import 'package:halkyon_learn_curator/src/wordfreq.dart';
|
|||
/// --input kanjivg-20260714.xml.gz \
|
||||
/// --output ../halkyon_learn_flutter/assets/kanjivg
|
||||
///
|
||||
/// The Hangul letters' strokes, the curator's own, into the app's stroke
|
||||
/// files:
|
||||
///
|
||||
/// dart run halkyon_learn_curator:curate hangul \
|
||||
/// --output ../halkyon_learn_flutter/assets/hangul
|
||||
///
|
||||
/// Make Me a Hanzi into the app's stroke files of Chinese characters:
|
||||
///
|
||||
/// dart run halkyon_learn_curator:curate makemeahanzi \
|
||||
/// --input graphics.txt --dictionary dictionary.txt \
|
||||
/// --output ../halkyon_learn_flutter/assets/makemeahanzi
|
||||
///
|
||||
/// Wiktionary, as kaikki.org's dump of it, into dictionary files of the
|
||||
/// languages named (German and Greek with English meanings, English with
|
||||
/// German ones):
|
||||
|
|
@ -143,6 +157,10 @@ Future<void> main(List<String> args) async {
|
|||
'unihan: CC-CEDICT, whose words tell traditional characters in use '
|
||||
'and rank the characters.',
|
||||
)
|
||||
..addOption(
|
||||
'dictionary',
|
||||
help: "makemeahanzi: its dictionary.txt, for the characters' components.",
|
||||
)
|
||||
..addOption(
|
||||
'korean',
|
||||
help:
|
||||
|
|
@ -382,6 +400,56 @@ Future<void> main(List<String> args) async {
|
|||
);
|
||||
return;
|
||||
}
|
||||
if (source == 'hangul') {
|
||||
final output = options.option('output');
|
||||
if (output == null) {
|
||||
_fail('Usage: curate hangul --output <folder>\n${parser.usage}');
|
||||
}
|
||||
final strokes = hangulStrokes();
|
||||
final folder = await Directory(output).create(recursive: true);
|
||||
final files = strokeFiles(strokes);
|
||||
for (final MapEntry(key: name, value: characters) in files.entries) {
|
||||
await File('${folder.path}/$name.json.gz')
|
||||
.writeAsBytes(gzip.encode(utf8.encode(jsonEncode(characters))));
|
||||
}
|
||||
stdout.writeln(
|
||||
'Wrote the strokes of ${strokes.length} Hangul letters to $output.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (source == 'makemeahanzi') {
|
||||
final input = options.option('input');
|
||||
final dictionary = options.option('dictionary');
|
||||
final output = options.option('output');
|
||||
if (input == null || output == null) {
|
||||
_fail(
|
||||
'Usage: curate makemeahanzi --input graphics.txt '
|
||||
'[--dictionary dictionary.txt] --output <folder>\n${parser.usage}',
|
||||
);
|
||||
}
|
||||
final strokes = makemeahanziStrokes(
|
||||
await File(input).readAsLines(),
|
||||
dictionary: dictionary == null
|
||||
? const []
|
||||
: await File(dictionary).readAsLines(),
|
||||
);
|
||||
final folder = await Directory(output).create(recursive: true);
|
||||
final files = strokeFiles(
|
||||
strokes,
|
||||
notice: makemeahanziNotice(
|
||||
DateTime.now().toUtc().toIso8601String().substring(0, 10),
|
||||
),
|
||||
);
|
||||
for (final MapEntry(key: name, value: characters) in files.entries) {
|
||||
await File('${folder.path}/$name.json.gz')
|
||||
.writeAsBytes(gzip.encode(utf8.encode(jsonEncode(characters))));
|
||||
}
|
||||
stdout.writeln(
|
||||
'Wrote the strokes of ${strokes.length} characters to '
|
||||
'${files.length} files in $output.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
final input = options.option('input');
|
||||
final output = options.option('output');
|
||||
if (!['jmdict', 'kanjidic', 'kanjivg'].contains(source) ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue