From 3f267b78d39456f2675fa5a7fe7955a4b2ebd0b7 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Fri, 16 May 2025 21:06:19 +0200 Subject: [PATCH] lib: format --- lib/_data_ingestion/jmdict/objects.dart | 3 +- lib/_data_ingestion/jmdict/seed_data.dart | 6 +- lib/_data_ingestion/sql_writable.dart | 2 +- lib/cli/commands/create_db.dart | 3 +- lib/cli/commands/query_kanji.dart | 1 - lib/const_data/kanji_grades.dart | 17 +- lib/const_data/radicals.dart | 213 +++++++++++++++++++++- lib/models/jmdict/jmdict_dialect.dart | 3 +- lib/models/jmdict/jmdict_field.dart | 3 +- lib/models/jmdict/jmdict_kanji_info.dart | 3 +- lib/models/jmdict/jmdict_misc.dart | 3 +- lib/models/jmdict/jmdict_pos.dart | 166 +++++++++++------ lib/search/word_search/regrouping.dart | 10 +- lib/search/word_search/word_search.dart | 3 +- lib/util/datetime_extensions.dart | 19 +- lib/util/text_filtering.dart | 1 - 16 files changed, 360 insertions(+), 96 deletions(-) diff --git a/lib/_data_ingestion/jmdict/objects.dart b/lib/_data_ingestion/jmdict/objects.dart index 522e815..0a23cd9 100644 --- a/lib/_data_ingestion/jmdict/objects.dart +++ b/lib/_data_ingestion/jmdict/objects.dart @@ -197,7 +197,8 @@ class Sense extends SQLWritable { 'orderNum': orderNum, }; - bool get isEmpty => antonyms.isEmpty && + bool get isEmpty => + antonyms.isEmpty && dialects.isEmpty && fields.isEmpty && info.isEmpty && diff --git a/lib/_data_ingestion/jmdict/seed_data.dart b/lib/_data_ingestion/jmdict/seed_data.dart index 315677b..9b846e1 100644 --- a/lib/_data_ingestion/jmdict/seed_data.dart +++ b/lib/_data_ingestion/jmdict/seed_data.dart @@ -128,7 +128,8 @@ Future seedJMDictData(List entries, Database db) async { for (final e in entries) { for (final s in e.senses) { - b.insert(JMdictTableNames.sense, s.sqlValue..addAll({'entryId': e.entryId})); + b.insert( + JMdictTableNames.sense, s.sqlValue..addAll({'entryId': e.entryId})); for (final d in s.dialects) { b.insert( JMdictTableNames.senseDialect, @@ -136,7 +137,8 @@ Future seedJMDictData(List entries, Database db) async { ); } for (final f in s.fields) { - b.insert(JMdictTableNames.senseField, {'senseId': s.senseId, 'field': f}); + b.insert( + JMdictTableNames.senseField, {'senseId': s.senseId, 'field': f}); } for (final i in s.info) { b.insert(JMdictTableNames.senseInfo, {'senseId': s.senseId, 'info': i}); diff --git a/lib/_data_ingestion/sql_writable.dart b/lib/_data_ingestion/sql_writable.dart index d6426c5..c3d7df3 100644 --- a/lib/_data_ingestion/sql_writable.dart +++ b/lib/_data_ingestion/sql_writable.dart @@ -3,7 +3,7 @@ abstract class SQLWritable { const SQLWritable(); /// Returns a map of the object's properties and their values. - /// + /// /// Note that there might be properties in the object which is meant to be /// inserted into a different table. These properties will/should be excluded /// from this map. diff --git a/lib/cli/commands/create_db.dart b/lib/cli/commands/create_db.dart index 8d6391d..6f27d76 100644 --- a/lib/cli/commands/create_db.dart +++ b/lib/cli/commands/create_db.dart @@ -14,8 +14,7 @@ class CreateDb extends Command { addLibsqliteArg(argParser); argParser.addFlag( 'wal', - help: - '''Whether to use Write-Ahead Logging (WAL) mode. + help: '''Whether to use Write-Ahead Logging (WAL) mode. This is recommended for better performance, but may not be used with the readonly NixOS store. diff --git a/lib/cli/commands/query_kanji.dart b/lib/cli/commands/query_kanji.dart index b1cf3c2..bd2b5e3 100644 --- a/lib/cli/commands/query_kanji.dart +++ b/lib/cli/commands/query_kanji.dart @@ -1,4 +1,3 @@ - import 'dart:convert'; import 'dart:io'; diff --git a/lib/const_data/kanji_grades.dart b/lib/const_data/kanji_grades.dart index bf04fef..0850eab 100644 --- a/lib/const_data/kanji_grades.dart +++ b/lib/const_data/kanji_grades.dart @@ -1861,11 +1861,12 @@ const Map>> JOUYOU_KANJI_BY_GRADE_AND_STROKE_COUNT = }, }; -final Map> JOUYOU_KANJI_BY_GRADES = JOUYOU_KANJI_BY_GRADE_AND_STROKE_COUNT.entries - .expand((entry) => entry.value.entries) - .map((entry) => MapEntry(entry.key, entry.value)) - .fold>>( - {}, - (acc, entry) => acc - ..putIfAbsent(entry.key, () => []) - ..update(entry.key, (value) => value..addAll(entry.value))); +final Map> JOUYOU_KANJI_BY_GRADES = + JOUYOU_KANJI_BY_GRADE_AND_STROKE_COUNT.entries + .expand((entry) => entry.value.entries) + .map((entry) => MapEntry(entry.key, entry.value)) + .fold>>( + {}, + (acc, entry) => acc + ..putIfAbsent(entry.key, () => []) + ..update(entry.key, (value) => value..addAll(entry.value))); diff --git a/lib/const_data/radicals.dart b/lib/const_data/radicals.dart index 3549cd8..c90e16e 100644 --- a/lib/const_data/radicals.dart +++ b/lib/const_data/radicals.dart @@ -1,12 +1,211 @@ - const Map> RADICALS = { 1: ['一', '|', '丶', 'ノ', '乙', '亅'], - 2: ['二', '亠', '人', '⺅', '𠆢', '儿', '入', 'ハ', '丷', '冂', '冖', '冫', '几', '凵', '刀', '⺉', '力', '勹', '匕', '匚', '十', '卜', '卩', '厂', '厶', '又', 'マ', '九', 'ユ', '乃', '𠂉'], - 3: ['⻌', '口', '囗', '土', '士', '夂', '夕', '大', '女', '子', '宀', '寸', '小', '⺌', '尢', '尸', '屮', '山', '川', '巛', '工', '已', '巾', '干', '幺', '广', '廴', '廾', '弋', '弓', 'ヨ', '彑', '彡', '彳', '⺖', '⺘', '⺡', '⺨', '⺾', '⻏', '⻖', '也', '亡', '及', '久'], - 4: ['⺹', '心', '戈', '戸', '手', '支', '攵', '文', '斗', '斤', '方', '无', '日', '曰', '月', '木', '欠', '止', '歹', '殳', '比', '毛', '氏', '气', '水', '火', '⺣', '爪', '父', '爻', '爿', '片', '牛', '犬', '⺭', '王', '元', '井', '勿', '尤', '五', '屯', '巴', '毋'], - 5: ['玄', '瓦', '甘', '生', '用', '田', '疋', '疒', '癶', '白', '皮', '皿', '目', '矛', '矢', '石', '示', '禸', '禾', '穴', '立', '⻂', '世', '巨', '冊', '母', '⺲', '牙'], - 6: ['瓜', '竹', '米', '糸', '缶', '羊', '羽', '而', '耒', '耳', '聿', '肉', '自', '至', '臼', '舌', '舟', '艮', '色', '虍', '虫', '血', '行', '衣', '西'], - 7: ['臣', '見', '角', '言', '谷', '豆', '豕', '豸', '貝', '赤', '走', '足', '身', '車', '辛', '辰', '酉', '釆', '里', '舛', '麦'], + 2: [ + '二', + '亠', + '人', + '⺅', + '𠆢', + '儿', + '入', + 'ハ', + '丷', + '冂', + '冖', + '冫', + '几', + '凵', + '刀', + '⺉', + '力', + '勹', + '匕', + '匚', + '十', + '卜', + '卩', + '厂', + '厶', + '又', + 'マ', + '九', + 'ユ', + '乃', + '𠂉' + ], + 3: [ + '⻌', + '口', + '囗', + '土', + '士', + '夂', + '夕', + '大', + '女', + '子', + '宀', + '寸', + '小', + '⺌', + '尢', + '尸', + '屮', + '山', + '川', + '巛', + '工', + '已', + '巾', + '干', + '幺', + '广', + '廴', + '廾', + '弋', + '弓', + 'ヨ', + '彑', + '彡', + '彳', + '⺖', + '⺘', + '⺡', + '⺨', + '⺾', + '⻏', + '⻖', + '也', + '亡', + '及', + '久' + ], + 4: [ + '⺹', + '心', + '戈', + '戸', + '手', + '支', + '攵', + '文', + '斗', + '斤', + '方', + '无', + '日', + '曰', + '月', + '木', + '欠', + '止', + '歹', + '殳', + '比', + '毛', + '氏', + '气', + '水', + '火', + '⺣', + '爪', + '父', + '爻', + '爿', + '片', + '牛', + '犬', + '⺭', + '王', + '元', + '井', + '勿', + '尤', + '五', + '屯', + '巴', + '毋' + ], + 5: [ + '玄', + '瓦', + '甘', + '生', + '用', + '田', + '疋', + '疒', + '癶', + '白', + '皮', + '皿', + '目', + '矛', + '矢', + '石', + '示', + '禸', + '禾', + '穴', + '立', + '⻂', + '世', + '巨', + '冊', + '母', + '⺲', + '牙' + ], + 6: [ + '瓜', + '竹', + '米', + '糸', + '缶', + '羊', + '羽', + '而', + '耒', + '耳', + '聿', + '肉', + '自', + '至', + '臼', + '舌', + '舟', + '艮', + '色', + '虍', + '虫', + '血', + '行', + '衣', + '西' + ], + 7: [ + '臣', + '見', + '角', + '言', + '谷', + '豆', + '豕', + '豸', + '貝', + '赤', + '走', + '足', + '身', + '車', + '辛', + '辰', + '酉', + '釆', + '里', + '舛', + '麦' + ], 8: ['金', '長', '門', '隶', '隹', '雨', '青', '非', '奄', '岡', '免', '斉'], 9: ['面', '革', '韭', '音', '頁', '風', '飛', '食', '首', '香', '品'], 10: ['馬', '骨', '高', '髟', '鬥', '鬯', '鬲', '鬼', '竜', '韋'], diff --git a/lib/models/jmdict/jmdict_dialect.dart b/lib/models/jmdict/jmdict_dialect.dart index 3674cec..addaa79 100644 --- a/lib/models/jmdict/jmdict_dialect.dart +++ b/lib/models/jmdict/jmdict_dialect.dart @@ -24,8 +24,7 @@ enum JMdictDialect { required this.description, }); - static JMdictDialect fromId(String id) => - JMdictDialect.values.firstWhere( + static JMdictDialect fromId(String id) => JMdictDialect.values.firstWhere( (e) => e.id == id, orElse: () => throw Exception('Unknown id: $id'), ); diff --git a/lib/models/jmdict/jmdict_field.dart b/lib/models/jmdict/jmdict_field.dart index 24a30a9..4b48d85 100644 --- a/lib/models/jmdict/jmdict_field.dart +++ b/lib/models/jmdict/jmdict_field.dart @@ -107,8 +107,7 @@ enum JMdictField { required this.description, }); - static JMdictField fromId(String id) => - JMdictField.values.firstWhere( + static JMdictField fromId(String id) => JMdictField.values.firstWhere( (e) => e.id == id, orElse: () => throw Exception('Unknown id: $id'), ); diff --git a/lib/models/jmdict/jmdict_kanji_info.dart b/lib/models/jmdict/jmdict_kanji_info.dart index e0f1f78..28e8047 100644 --- a/lib/models/jmdict/jmdict_kanji_info.dart +++ b/lib/models/jmdict/jmdict_kanji_info.dart @@ -18,8 +18,7 @@ enum JMdictKanjiInfo { required this.description, }); - static JMdictKanjiInfo fromId(String id) => - JMdictKanjiInfo.values.firstWhere( + static JMdictKanjiInfo fromId(String id) => JMdictKanjiInfo.values.firstWhere( (e) => e.id == id, orElse: () => throw Exception('Unknown id: $id'), ); diff --git a/lib/models/jmdict/jmdict_misc.dart b/lib/models/jmdict/jmdict_misc.dart index bf78492..287595e 100644 --- a/lib/models/jmdict/jmdict_misc.dart +++ b/lib/models/jmdict/jmdict_misc.dart @@ -79,8 +79,7 @@ enum JMdictMisc { required this.description, }); - static JMdictMisc fromId(String id) => - JMdictMisc.values.firstWhere( + static JMdictMisc fromId(String id) => JMdictMisc.values.firstWhere( (e) => e.id == id, orElse: () => throw Exception('Unknown id: $id'), ); diff --git a/lib/models/jmdict/jmdict_pos.dart b/lib/models/jmdict/jmdict_pos.dart index 3f02444..9e035e5 100644 --- a/lib/models/jmdict/jmdict_pos.dart +++ b/lib/models/jmdict/jmdict_pos.dart @@ -7,14 +7,18 @@ enum JMdictPOS { adjIx(id: 'adj-ix', description: 'adjective (keiyoushi) - yoi/ii class'), adjKari(id: 'adj-kari', description: '\'kari\' adjective (archaic)'), adjKu(id: 'adj-ku', description: '\'ku\' adjective (archaic)'), - adjNa(id: 'adj-na', description: 'adjectival nouns or quasi-adjectives (keiyodoshi)'), + adjNa( + id: 'adj-na', + description: 'adjectival nouns or quasi-adjectives (keiyodoshi)'), adjNari(id: 'adj-nari', description: 'archaic/formal form of na-adjective'), - adjNo(id: 'adj-no', description: 'nouns which may take the genitive case particle ''no'''), + adjNo( + id: 'adj-no', + description: 'nouns which may take the genitive case particle ' 'no' ''), adjPn(id: 'adj-pn', description: 'pre-noun adjectival (rentaishi)'), adjShiku(id: 'adj-shiku', description: '\'shiku\' adjective (archaic)'), adjT(id: 'adj-t', description: '\'taru\' adjective'), adv(id: 'adv', description: 'adverb (fukushi)'), - advTo(id: 'adv-to', description: 'adverb taking the ''to'' particle'), + advTo(id: 'adv-to', description: 'adverb taking the ' 'to' ' particle'), aux(id: 'aux', description: 'auxiliary'), auxAdj(id: 'aux-adj', description: 'auxiliary adjective'), auxV(id: 'aux-v', description: 'auxiliary verb'), @@ -38,62 +42,123 @@ enum JMdictPOS { vUnspec(id: 'v-unspec', description: 'verb unspecified'), v1(id: 'v1', description: 'Ichidan verb'), v1S(id: 'v1-s', description: 'Ichidan verb - kureru special class'), - v2aS(id: 'v2a-s', description: 'Nidan verb with ''u'' ending (archaic)'), - v2bK(id: 'v2b-k', description: 'Nidan verb (upper class) with ''bu'' ending (archaic)'), - v2bS(id: 'v2b-s', description: 'Nidan verb (lower class) with ''bu'' ending (archaic)'), - v2dK(id: 'v2d-k', description: 'Nidan verb (upper class) with ''dzu'' ending (archaic)'), - v2dS(id: 'v2d-s', description: 'Nidan verb (lower class) with ''dzu'' ending (archaic)'), - v2gK(id: 'v2g-k', description: 'Nidan verb (upper class) with ''gu'' ending (archaic)'), - v2gS(id: 'v2g-s', description: 'Nidan verb (lower class) with ''gu'' ending (archaic)'), - v2hK(id: 'v2h-k', description: 'Nidan verb (upper class) with ''hu/fu'' ending (archaic)'), - v2hS(id: 'v2h-s', description: 'Nidan verb (lower class) with ''hu/fu'' ending (archaic)'), - v2kK(id: 'v2k-k', description: 'Nidan verb (upper class) with ''ku'' ending (archaic)'), - v2kS(id: 'v2k-s', description: 'Nidan verb (lower class) with ''ku'' ending (archaic)'), - v2mK(id: 'v2m-k', description: 'Nidan verb (upper class) with ''mu'' ending (archaic)'), - v2mS(id: 'v2m-s', description: 'Nidan verb (lower class) with ''mu'' ending (archaic)'), - v2nS(id: 'v2n-s', description: 'Nidan verb (lower class) with ''nu'' ending (archaic)'), - v2rK(id: 'v2r-k', description: 'Nidan verb (upper class) with ''ru'' ending (archaic)'), - v2rS(id: 'v2r-s', description: 'Nidan verb (lower class) with ''ru'' ending (archaic)'), - v2sS(id: 'v2s-s', description: 'Nidan verb (lower class) with ''su'' ending (archaic)'), - v2tK(id: 'v2t-k', description: 'Nidan verb (upper class) with ''tsu'' ending (archaic)'), - v2tS(id: 'v2t-s', description: 'Nidan verb (lower class) with ''tsu'' ending (archaic)'), - v2wS(id: 'v2w-s', description: 'Nidan verb (lower class) with ''u'' ending and ''we'' conjugation (archaic)'), - v2yK(id: 'v2y-k', description: 'Nidan verb (upper class) with ''yu'' ending (archaic)'), - v2yS(id: 'v2y-s', description: 'Nidan verb (lower class) with ''yu'' ending (archaic)'), - v2zS(id: 'v2z-s', description: 'Nidan verb (lower class) with ''zu'' ending (archaic)'), - v4b(id: 'v4b', description: 'Yodan verb with ''bu'' ending (archaic)'), - v4g(id: 'v4g', description: 'Yodan verb with ''gu'' ending (archaic)'), - v4h(id: 'v4h', description: 'Yodan verb with ''hu/fu'' ending (archaic)'), - v4k(id: 'v4k', description: 'Yodan verb with ''ku'' ending (archaic)'), - v4m(id: 'v4m', description: 'Yodan verb with ''mu'' ending (archaic)'), - v4n(id: 'v4n', description: 'Yodan verb with ''nu'' ending (archaic)'), - v4r(id: 'v4r', description: 'Yodan verb with ''ru'' ending (archaic)'), - v4s(id: 'v4s', description: 'Yodan verb with ''su'' ending (archaic)'), - v4t(id: 'v4t', description: 'Yodan verb with ''tsu'' ending (archaic)'), + v2aS(id: 'v2a-s', description: 'Nidan verb with ' 'u' ' ending (archaic)'), + v2bK( + id: 'v2b-k', + description: 'Nidan verb (upper class) with ' 'bu' ' ending (archaic)'), + v2bS( + id: 'v2b-s', + description: 'Nidan verb (lower class) with ' 'bu' ' ending (archaic)'), + v2dK( + id: 'v2d-k', + description: 'Nidan verb (upper class) with ' 'dzu' ' ending (archaic)'), + v2dS( + id: 'v2d-s', + description: 'Nidan verb (lower class) with ' 'dzu' ' ending (archaic)'), + v2gK( + id: 'v2g-k', + description: 'Nidan verb (upper class) with ' 'gu' ' ending (archaic)'), + v2gS( + id: 'v2g-s', + description: 'Nidan verb (lower class) with ' 'gu' ' ending (archaic)'), + v2hK( + id: 'v2h-k', + description: + 'Nidan verb (upper class) with ' 'hu/fu' ' ending (archaic)'), + v2hS( + id: 'v2h-s', + description: + 'Nidan verb (lower class) with ' 'hu/fu' ' ending (archaic)'), + v2kK( + id: 'v2k-k', + description: 'Nidan verb (upper class) with ' 'ku' ' ending (archaic)'), + v2kS( + id: 'v2k-s', + description: 'Nidan verb (lower class) with ' 'ku' ' ending (archaic)'), + v2mK( + id: 'v2m-k', + description: 'Nidan verb (upper class) with ' 'mu' ' ending (archaic)'), + v2mS( + id: 'v2m-s', + description: 'Nidan verb (lower class) with ' 'mu' ' ending (archaic)'), + v2nS( + id: 'v2n-s', + description: 'Nidan verb (lower class) with ' 'nu' ' ending (archaic)'), + v2rK( + id: 'v2r-k', + description: 'Nidan verb (upper class) with ' 'ru' ' ending (archaic)'), + v2rS( + id: 'v2r-s', + description: 'Nidan verb (lower class) with ' 'ru' ' ending (archaic)'), + v2sS( + id: 'v2s-s', + description: 'Nidan verb (lower class) with ' 'su' ' ending (archaic)'), + v2tK( + id: 'v2t-k', + description: 'Nidan verb (upper class) with ' 'tsu' ' ending (archaic)'), + v2tS( + id: 'v2t-s', + description: 'Nidan verb (lower class) with ' 'tsu' ' ending (archaic)'), + v2wS( + id: 'v2w-s', + description: 'Nidan verb (lower class) with ' + 'u' + ' ending and ' + 'we' + ' conjugation (archaic)'), + v2yK( + id: 'v2y-k', + description: 'Nidan verb (upper class) with ' 'yu' ' ending (archaic)'), + v2yS( + id: 'v2y-s', + description: 'Nidan verb (lower class) with ' 'yu' ' ending (archaic)'), + v2zS( + id: 'v2z-s', + description: 'Nidan verb (lower class) with ' 'zu' ' ending (archaic)'), + v4b(id: 'v4b', description: 'Yodan verb with ' 'bu' ' ending (archaic)'), + v4g(id: 'v4g', description: 'Yodan verb with ' 'gu' ' ending (archaic)'), + v4h(id: 'v4h', description: 'Yodan verb with ' 'hu/fu' ' ending (archaic)'), + v4k(id: 'v4k', description: 'Yodan verb with ' 'ku' ' ending (archaic)'), + v4m(id: 'v4m', description: 'Yodan verb with ' 'mu' ' ending (archaic)'), + v4n(id: 'v4n', description: 'Yodan verb with ' 'nu' ' ending (archaic)'), + v4r(id: 'v4r', description: 'Yodan verb with ' 'ru' ' ending (archaic)'), + v4s(id: 'v4s', description: 'Yodan verb with ' 'su' ' ending (archaic)'), + v4t(id: 'v4t', description: 'Yodan verb with ' 'tsu' ' ending (archaic)'), v5aru(id: 'v5aru', description: 'Godan verb - -aru special class'), - v5b(id: 'v5b', description: 'Godan verb with ''bu'' ending'), - v5g(id: 'v5g', description: 'Godan verb with ''gu'' ending'), - v5k(id: 'v5k', description: 'Godan verb with ''ku'' ending'), + v5b(id: 'v5b', description: 'Godan verb with ' 'bu' ' ending'), + v5g(id: 'v5g', description: 'Godan verb with ' 'gu' ' ending'), + v5k(id: 'v5k', description: 'Godan verb with ' 'ku' ' ending'), v5kS(id: 'v5k-s', description: 'Godan verb - Iku/Yuku special class'), - v5m(id: 'v5m', description: 'Godan verb with ''mu'' ending'), - v5n(id: 'v5n', description: 'Godan verb with ''nu'' ending'), - v5r(id: 'v5r', description: 'Godan verb with ''ru'' ending'), - v5rI(id: 'v5r-i', description: 'Godan verb with ''ru'' ending (irregular verb)'), - v5s(id: 'v5s', description: 'Godan verb with ''su'' ending'), - v5t(id: 'v5t', description: 'Godan verb with ''tsu'' ending'), - v5u(id: 'v5u', description: 'Godan verb with ''u'' ending'), - v5uS(id: 'v5u-s', description: 'Godan verb with ''u'' ending (special class)'), - v5uru(id: 'v5uru', description: 'Godan verb - Uru old class verb (old form of Eru)'), + v5m(id: 'v5m', description: 'Godan verb with ' 'mu' ' ending'), + v5n(id: 'v5n', description: 'Godan verb with ' 'nu' ' ending'), + v5r(id: 'v5r', description: 'Godan verb with ' 'ru' ' ending'), + v5rI( + id: 'v5r-i', + description: 'Godan verb with ' 'ru' ' ending (irregular verb)'), + v5s(id: 'v5s', description: 'Godan verb with ' 'su' ' ending'), + v5t(id: 'v5t', description: 'Godan verb with ' 'tsu' ' ending'), + v5u(id: 'v5u', description: 'Godan verb with ' 'u' ' ending'), + v5uS( + id: 'v5u-s', + description: 'Godan verb with ' 'u' ' ending (special class)'), + v5uru( + id: 'v5uru', + description: 'Godan verb - Uru old class verb (old form of Eru)'), vi(id: 'vi', description: 'intransitive verb'), vk(id: 'vk', description: 'Kuru verb - special class'), vn(id: 'vn', description: 'irregular nu verb'), vr(id: 'vr', description: 'irregular ru verb, plain form ends with -ri'), - vs(id: 'vs', description: 'noun or participle which takes the aux. verb suru'), + vs( + id: 'vs', + description: 'noun or participle which takes the aux. verb suru'), vsC(id: 'vs-c', description: 'suru verb - precursor to the modern suru'), vsI(id: 'vs-i', description: 'suru verb - included'), vsS(id: 'vs-s', description: 'suru verb - special class'), vt(id: 'vt', description: 'transitive verb'), - vz(id: 'vz', description: 'Ichidan verb - zuru verb (alternative form of -jiru verbs)'); + vz( + id: 'vz', + description: + 'Ichidan verb - zuru verb (alternative form of -jiru verbs)'); final String id; final String description; @@ -103,8 +168,7 @@ enum JMdictPOS { required this.description, }); - static JMdictPOS fromId(String id) => - JMdictPOS.values.firstWhere( + static JMdictPOS fromId(String id) => JMdictPOS.values.firstWhere( (e) => e.id == id, orElse: () => throw Exception('Unknown id: $id'), ); diff --git a/lib/search/word_search/regrouping.dart b/lib/search/word_search/regrouping.dart index 5749a68..49ee7f0 100644 --- a/lib/search/word_search/regrouping.dart +++ b/lib/search/word_search/regrouping.dart @@ -51,8 +51,9 @@ List regroupWordSearchResults({ .where((element) => element['entryId'] == scoredEntryId.entryId) .toList(); - final List> entryJlptTags = - jlptTags.where((element) => element['entryId'] == scoredEntryId.entryId).toList(); + final List> entryJlptTags = jlptTags + .where((element) => element['entryId'] == scoredEntryId.entryId) + .toList(); final jlptLevel = entryJlptTags .map((e) => JlptLevel.fromString(e['jlptLevel'] as String?)) @@ -62,8 +63,9 @@ List regroupWordSearchResults({ final isCommon = commonEntryIds.contains(scoredEntryId.entryId); - final List> entrySenses = - senses.where((element) => element['entryId'] == scoredEntryId.entryId).toList(); + final List> entrySenses = senses + .where((element) => element['entryId'] == scoredEntryId.entryId) + .toList(); final GroupedWordResult entryReadingElementsGrouped = _regroup_words( entryId: scoredEntryId.entryId, diff --git a/lib/search/word_search/word_search.dart b/lib/search/word_search/word_search.dart index ca5d3c9..647388f 100644 --- a/lib/search/word_search/word_search.dart +++ b/lib/search/word_search/word_search.dart @@ -45,7 +45,8 @@ Future?> searchWordWithDbConnection( return []; } - final LinearWordQueryData linearWordQueryData = await fetchLinearWordQueryData( + final LinearWordQueryData linearWordQueryData = + await fetchLinearWordQueryData( connection, entryIds.map((e) => e.entryId).toList(), ); diff --git a/lib/util/datetime_extensions.dart b/lib/util/datetime_extensions.dart index 351d0d2..94c95f4 100644 --- a/lib/util/datetime_extensions.dart +++ b/lib/util/datetime_extensions.dart @@ -289,15 +289,16 @@ extension on DateTime { } String get japaneseWeekdayPrefix => [ - '月', - '火', - '水', - '木', - '金', - '土', - '日', - ][weekday - 1]; + '月', + '火', + '水', + '木', + '金', + '土', + '日', + ][weekday - 1]; /// Returns the date in Japanese format. - String japaneseDate({bool showWeekday = false}) => '$month月$day日' + (showWeekday ? '($japaneseWeekdayPrefix)' : ''); + String japaneseDate({bool showWeekday = false}) => + '$month月$day日' + (showWeekday ? '($japaneseWeekdayPrefix)' : ''); } diff --git a/lib/util/text_filtering.dart b/lib/util/text_filtering.dart index c3b4e59..f3a4ec1 100644 --- a/lib/util/text_filtering.dart +++ b/lib/util/text_filtering.dart @@ -30,7 +30,6 @@ const String rawHiraganaRegex = r'\p{Script=Hiragana}'; /// Remember to turn on the unicode flag when making a new RegExp. const String rawKanjiRegex = r'[\u3400-\u4DB5\u4E00-\u9FCB\uF900-\uFA6A]'; - final RegExp cjkRegex = RegExp(rawCJKRegex, unicode: true); final RegExp katakanaRegex = RegExp(rawKatakanaRegex, unicode: true); final RegExp hiraganaRegex = RegExp(rawHiraganaRegex, unicode: true);