halkyon/halkyon_learn_curator/test/alphabets_test.dart
Tizian 「ティツィアーン」 8820cefde3
feat(curator): characters of Chinese and Korean, the Greek alphabet, Korean words from KRDict
For parity with Japanese's KANJIDIC2 and kana:

- Unihan (Unicode License v3) makes characters' dictionaries: the 8,105
  standard simplified characters (unihan-hans) and the traditional ones in
  use (unihan-hant), told apart and ranked by CC-CEDICT's words (Unihan
  calls 这 its own traditional variant; 後 ranks as the 后 of 以后), with
  pinyin, meanings, strokes, Kangxi radical, HSK 2025 character levels,
  the 3,500 common ones and Hong Kong's grades; and Korean Hanja
  (unihan-ko) with their sounds, the 1,800 of education, and their native
  readings from Wiktionary (물 수), with the 40 Hangul letters as kana are.
- The Greek alphabet, the curator's own (CC0): letters with names,
  transliteration and sound.
- KRDict, the Basic Korean Dictionary for learners (CC BY-SA 2.0 KR,
  downloaded without an account), replaces Wiktionary for Korean's words:
  learners' levels, pronunciation where it differs from the spelling
  (같이 [가치]), Hanja, English senses; Wiktionary's update keeps the
  words' forms (가다's 99) and the Hanja's readings beside it for both.
- The update converts KRDict when its page offers another export and the
  characters weekly, and removes the files of languages no longer kept
  or of sources replaced.

Measured on the real data: Unihan 3 s; KRDict 54,870 entries in 24 s
and under 600 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-14 14:35:28 +02:00

45 lines
1.6 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'dart:convert';
import 'package:halkyon_learn_curator/src/sources/alphabets.dart';
import 'package:test/test.dart';
void main() {
test('the Greek alphabet in its order, each letter with its capital, '
'names, transliteration and sound', () {
final [header, ...letters] = [
for (final line in greekAlphabet())
jsonDecode(line) as Map<String, Object?>,
];
expect(header['source'], 'greek-alphabet');
expect(header['kind'], 'characters');
expect(header['language'], 'el');
expect(letters, hasLength(24));
expect(letters.first['headword'], 'Α α');
final sigma = letters.singleWhere((letter) => letter['id'] == 'σ');
expect(sigma['headword'], 'Σ σ ς');
expect(sigma['keys'], containsAll(['ς', 'σίγμα', 'sigma', 's']));
expect(letters[1]['entry'], {
'romaji': 'v',
'script': 'greek',
'name': 'βήτα',
'englishName': 'beta',
'sound': 'v',
});
// Found by a name typed without its accent.
expect(letters.last['keys'], contains('ωμεγα'));
});
test('the Hangul letters in the order schools teach them, found by sound '
'and name', () {
final letters = hangulEntries();
expect(letters, hasLength(40));
expect(letters.first.headword, 'ㄱ');
expect(letters.first.keys, containsAll(['ㄱ', '기역', 'g', 'k']));
// ㅇ is silent opening a syllable: no key for its sound there.
final ieung = letters.singleWhere((letter) => letter.id == 'ㅇ');
expect(ieung.keys, ['ㅇ', '이응', 'ng']);
expect(letters.last.headword, 'ㅢ');
});
}