diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 0000000..e150426 --- /dev/null +++ b/.fvmrc @@ -0,0 +1,3 @@ +{ + "flutter": "3.24.1" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index d597e47..a7d00e4 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ build/ **/coverage/ **/coverage_badge.svg **/.test_coverage.dart + +# FVM +.fvm/ diff --git a/.mergify.yml b/.mergify.yml index ab9f8c4..c59fd53 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -1,45 +1,43 @@ pull_request_rules: -- name: "Assign author" - conditions: [] - actions: - assign: - users: - - "{{author}}" + - name: 'Assign author' + conditions: [] + actions: + assign: + users: + - '{{author}}' -# Merge flow for contributors -- name: "Request review" - conditions: - - "author!=jeroen-meijer" - actions: - request_reviews: - users: - - "jeroen-meijer" -- name: "Merge when CI passes & has one approval" - conditions: - - "author!=jeroen-meijer" - - "label!=wip" - - "status-success~=kana_kit" - - "#approved-reviews-by>=1" - actions: - merge: - method: squash - strict: smart - commit_message: default + # Merge flow for contributors + - name: 'Request review' + conditions: + - 'author!=jeroen-meijer' + actions: + request_reviews: + users: + - 'jeroen-meijer' + - name: 'Merge when CI passes & has one approval' + conditions: + - 'author!=jeroen-meijer' + - 'label!=wip' + - 'status-success~=kana_kit' + - '#approved-reviews-by>=1' + actions: + merge: + method: squash + commit_message: default -# Merge flow for non-contributors -- name: "Merge when CI passes" - conditions: - - "author=jeroen-meijer" - - "label!=wip" - - "status-success~=kana_kit" - actions: - merge: - method: squash - strict: smart - commit_message: default + # Merge flow for non-contributors + - name: 'Merge when CI passes' + conditions: + - 'author=jeroen-meijer' + - 'label!=wip' + - 'status-success~=kana_kit' + actions: + merge: + method: squash + commit_message: default -- name: Delete branch post merge - conditions: - - merged - actions: - delete_head_branch: {} + - name: Delete branch post merge + conditions: + - merged + actions: + delete_head_branch: {} diff --git a/.metadata b/.metadata deleted file mode 100644 index 4646fe6..0000000 --- a/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 8fe7655ed20ffd1395f68e30539a847a01a30351 - channel: beta - -project_type: package diff --git a/.vscode/settings.json b/.vscode/settings.json index e46e621..4679403 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "mkdir", "toukyou", "zenkaku" - ] -} + ], + "dart.flutterSdkPath": ".fvm/versions/3.24.1" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fabafe..ca6cfcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## 2.0.0 +- Fix シークヮーサー and シマウヮー conversion edge-cases (thanks to @Moseco and @HighLiuk) +- Change minimum required Dart version to `2.12.0`. +- Add CSpell spell checking config. +- Remove `package:equatable` dependency. +- Upgrade dependencies. +- Upgrade all dev dependencies and linter. + +## 2.0.0 + - Add NNBD support. - Change minimum required Dart version to `2.12.0`. - Change linter to `package:very_good_analysis`. diff --git a/analysis_options.yaml b/analysis_options.yaml index 663e7ed..9df80aa 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,19 +1 @@ include: package:very_good_analysis/analysis_options.yaml -# linter: -# rules: -# await_only_futures: true -# prefer_const_constructors: true -# prefer_const_literals_to_create_immutables: true -# prefer_relative_imports: false -# prefer_single_quotes: true -# public_member_api_docs: true -# sort_child_properties_last: true -# sort_constructors_first: true -# unawaited_futures: true -# analyzer: -# strong-mode: -# implicit-casts: false -# errors: -# close_sinks: ignore -# exclude: -# - '**/.test_coverage.dart' diff --git a/codecov.yml b/codecov.yml index 1a20e98..806952e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,10 +1,10 @@ codecov: require_ci_to_pass: true - + coverage: precision: 3 - range: "99...100" + range: '99...100' ignore: - - "**/*.g.dart" - - "lib/src/models/romanization/**" + - '**/*.g.dart' + - 'lib/src/models/romanization/**' diff --git a/cspell.yaml b/cspell.yaml new file mode 100644 index 0000000..c763ccf --- /dev/null +++ b/cspell.yaml @@ -0,0 +1,19 @@ +ignoreWords: + - transform +words: + - codecov + - hankaku + - hepburn + - HighLiuk + - hira + - initializers + - japanese + - Moseco + - NNBD + - Ōsaka + - pubspec + - romaji + - Tōkyō + - unicode + - zenkaku + - Zenkaku diff --git a/lib/kana_kit.dart b/lib/kana_kit.dart index bafcf0a..c352a68 100644 --- a/lib/kana_kit.dart +++ b/lib/kana_kit.dart @@ -50,7 +50,7 @@ class KanaKit { /// isRomaji('a!b&cーd'); // false (zenkaku punctuation is not allowed) /// ``` bool isRomaji(String input) { - assert(input.isNotEmpty); + assert(input.isNotEmpty, 'input cannot be empty'); return input.chars.every(_isCharRomaji); } @@ -68,7 +68,7 @@ class KanaKit { /// isJapanese('A泣き虫'); // false /// ``` bool isJapanese(String input) { - assert(input.isNotEmpty); + assert(input.isNotEmpty, 'input cannot be empty'); return input.chars.every(_isCharJapanese); } @@ -85,7 +85,7 @@ class KanaKit { /// isKana('あAア'); // false /// ``` bool isKana(String input) { - assert(input.isNotEmpty); + assert(input.isNotEmpty, 'input cannot be empty'); return input.chars.every(_isCharKana); } @@ -100,7 +100,7 @@ class KanaKit { /// isHiragana('あア'); // false /// ``` bool isHiragana(String input) { - assert(input.isNotEmpty); + assert(input.isNotEmpty, 'input cannot be empty'); return input.chars.every(_isCharHiragana); } @@ -116,7 +116,7 @@ class KanaKit { /// isKatakana('あア'); // false /// ``` bool isKatakana(String input) { - assert(input.isNotEmpty); + assert(input.isNotEmpty, 'input cannot be empty'); return input.chars.every(_isCharKatakana); } @@ -133,7 +133,7 @@ class KanaKit { /// isKanji('🐸'); // false /// ``` bool isKanji(String input) { - assert(input.isNotEmpty); + assert(input.isNotEmpty, 'input cannot be empty'); return input.chars.every(_isCharKanji); } @@ -153,12 +153,17 @@ class KanaKit { /// isMixed('あア'); // false /// ``` bool isMixed(String input) { - assert(input.isNotEmpty); + assert(input.isNotEmpty, 'input cannot be empty'); final chars = input.chars; final hasRomaji = chars.any(_isCharRomaji); final hasKana = chars.any(_isCharHiragana) || chars.any(_isCharKatakana); + + // FIXME: This can be simplified but I can't get my brain + // to do it right now. + + // ignore: avoid_bool_literals_in_conditional_expressions final hasKanji = !(!config.passKanji ? chars.any(_isCharKanji) : false); return hasKana && hasRomaji && hasKanji; @@ -173,6 +178,7 @@ class KanaKit { /// characters will be converted to uppercase characters. /// ignored. /// + // cspell: disable /// ```dart /// // With KanaKitConfig.upcaseKatakana == false (default) /// toRomaji('ひらがな カタカナ'); // "hiragana katakana" @@ -181,6 +187,7 @@ class KanaKit { /// toRomaji('ひらがな カタカナ'); // "hiragana KATAKANA" /// toRomaji('げーむ ゲーム'); // "ge-mu GEEMU" /// ``` + // cspell: enable String toRomaji(String input) { if (input.isEmpty) { return input; @@ -218,6 +225,7 @@ class KanaKit { /// The [input] `String` cannot be null. If an empty `String` is provided, /// an empty `String` will be returned immediately. /// + // cspell: disable /// ```dart /// toKana('onaji BUTTSUUJI'); // "おなじ ブッツウジ" /// toKana('ONAJI buttsuuji'); // "オナジ ぶっつうじ" @@ -225,6 +233,7 @@ class KanaKit { /// toKana('batsuge-mu'); // "ばつげーむ" /// toKana('!?.:/,~-‘’“”[](){}'); // "!?。:・、〜ー「」『』[](){}" /// ``` + // cspell: enable String toKana(String input) { if (input.isEmpty) { return input; diff --git a/lib/src/checks.dart b/lib/src/checks.dart index 4ca234d..981719f 100644 --- a/lib/src/checks.dart +++ b/lib/src/checks.dart @@ -5,14 +5,20 @@ bool _isCharInRange( required int start, required int end, }) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); final code = char.code; return start <= code && code <= end; } bool _isCharHiragana(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return _isCharLongDash(char) || _isCharInRange( @@ -23,7 +29,10 @@ bool _isCharHiragana(String char) { } bool _isCharKatakana(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return _isCharInRange( char, @@ -33,7 +42,10 @@ bool _isCharKatakana(String char) { } bool _isCharKanji(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return _isCharInRange( char, @@ -43,7 +55,10 @@ bool _isCharKanji(String char) { } bool _isCharUpperCase(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return _isCharInRange( char, @@ -53,43 +68,61 @@ bool _isCharUpperCase(String char) { } bool _isCharKana(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return _isCharHiragana(char) || _isCharKatakana(char); } bool _isCharLongDash(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return char.code == prolongedSoundMark; } bool _isCharSlashDot(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return char.code == kanaSlashDot; } bool _isCharRomaji(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return romajiRanges.any((range) { - return _isCharInRange(char, start: range.left, end: range.right); + return _isCharInRange(char, start: range.$1, end: range.$2); }); } bool _isCharEnglishPunctuation(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return enPunctuationRanges.any((range) { - return _isCharInRange(char, start: range.left, end: range.right); + return _isCharInRange(char, start: range.$1, end: range.$2); }); } bool _isCharJapanese(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return japaneseRanges.any((range) { - return _isCharInRange(char, start: range.left, end: range.right); + return _isCharInRange(char, start: range.$1, end: range.$2); }); } diff --git a/lib/src/constants.dart b/lib/src/constants.dart index 5e03cc6..8a85ed4 100644 --- a/lib/src/constants.dart +++ b/lib/src/constants.dart @@ -1,9 +1,7 @@ -import 'package:kana_kit/src/utils.dart'; - // ignore_for_file: public_member_api_docs // ignore_for_file: type_annotate_public_apis -// Charcodes +// Character codes const latinLowercaseStart = 0x61; const latinLowercaseEnd = 0x7a; const latinUppercaseStart = 0x41; @@ -51,44 +49,44 @@ final japaneseRanges = [ _rareCjk, ]; -const modernEnglish = Tuple(0x0000, 0x007f); +const modernEnglish = (0x0000, 0x007f); const hepburnMacronRanges = [ - Tuple(0x0100, 0x0101), // Ā ā - Tuple(0x0112, 0x0113), // Ē ē - Tuple(0x012a, 0x012b), // Ī ī - Tuple(0x014c, 0x014d), // Ō ō - Tuple(0x016a, 0x016b), // Ū ū + (0x0100, 0x0101), // Ā ā + (0x0112, 0x0113), // Ē ē + (0x012a, 0x012b), // Ī ī + (0x014c, 0x014d), // Ō ō + (0x016a, 0x016b), // Ū ū ]; const smartQuoteRanges = [ - Tuple(0x2018, 0x2019), // ‘ ’ - Tuple(0x201c, 0x201d), // “ ” + (0x2018, 0x2019), // ‘ ’ + (0x201c, 0x201d), // “ ” ]; final romajiRanges = [modernEnglish, ...hepburnMacronRanges]; final enPunctuationRanges = [ - const Tuple(0x20, 0x2f), - const Tuple(0x3a, 0x3f), - const Tuple(0x5b, 0x60), - const Tuple(0x7b, 0x7e), + const (0x20, 0x2f), + const (0x3a, 0x3f), + const (0x5b, 0x60), + const (0x7b, 0x7e), ...smartQuoteRanges, ]; // Private -const _zenkakuNumbers = Tuple(0xff10, 0xff19); -const _zenkakuUppercase = Tuple(uppercaseZenkakuStart, uppercaseZenkakuEnd); -const _zenkakuLowercase = Tuple(lowercaseZenkakuStart, lowercaseZenkakuEnd); -const _zenkakuPunctuation_1 = Tuple(0xff01, 0xff0f); -const _zenkakuPunctuation_2 = Tuple(0xff1a, 0xff1f); -const _zenkakuPunctuation_3 = Tuple(0xff3b, 0xff3f); -const _zenkakuPunctuation_4 = Tuple(0xff5b, 0xff60); -const _zenkakuSymbolsCurrency = Tuple(0xffe0, 0xffee); +const _zenkakuNumbers = (0xff10, 0xff19); +const _zenkakuUppercase = (uppercaseZenkakuStart, uppercaseZenkakuEnd); +const _zenkakuLowercase = (lowercaseZenkakuStart, lowercaseZenkakuEnd); +const _zenkakuPunctuation_1 = (0xff01, 0xff0f); +const _zenkakuPunctuation_2 = (0xff1a, 0xff1f); +const _zenkakuPunctuation_3 = (0xff3b, 0xff3f); +const _zenkakuPunctuation_4 = (0xff5b, 0xff60); +const _zenkakuSymbolsCurrency = (0xffe0, 0xffee); -const _hiraganaChars = Tuple(0x3040, 0x309f); -const _katakanaChars = Tuple(0x30a0, 0x30ff); -const _hankakuKatakana = Tuple(0xff66, 0xff9f); -const _katakanaPunctuation = Tuple(0x30fb, 0x30fc); -const _kanaPunctuation = Tuple(0xff61, 0xff65); -const _cjkSymbolsPunctuation = Tuple(0x3000, 0x303f); -const _commonCjk = Tuple(0x4e00, 0x9fff); -const _rareCjk = Tuple(0x3400, 0x4dbf); +const _hiraganaChars = (0x3040, 0x309f); +const _katakanaChars = (0x30a0, 0x30ff); +const _hankakuKatakana = (0xff66, 0xff9f); +const _katakanaPunctuation = (0x30fb, 0x30fc); +const _kanaPunctuation = (0xff61, 0xff65); +const _cjkSymbolsPunctuation = (0x3000, 0x303f); +const _commonCjk = (0x4e00, 0x9fff); +const _rareCjk = (0x3400, 0x4dbf); diff --git a/lib/src/conversions.dart b/lib/src/conversions.dart index abdef4d..671f297 100644 --- a/lib/src/conversions.dart +++ b/lib/src/conversions.dart @@ -7,19 +7,28 @@ String _katakanaToHiragana( bool destinationIsRomaji = false, }) { bool isCharInitialLongDash(String char, int index) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return _isCharLongDash(char) && index == 0; } bool isCharInnerLongDash(String char, int index) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return _isCharLongDash(char) && index > 0; } bool isKanaAsSymbol(String char) { - assert(char.length == 1); + assert( + char.length == 1, + 'char must be a single character', + ); return ['ヶ', 'ヵ'].contains(char); } @@ -38,7 +47,7 @@ String _katakanaToHiragana( final hiraChars = []; for (var index = 0; index < chars.length; index++) { final char = chars[index]; - // Short circuit to avoid incorrect codeshift for 'ー' and '・'. + // Short circuit to avoid incorrect code shift for 'ー' and '・'. if (_isCharSlashDot(char) || isCharInitialLongDash(char, index) || isKanaAsSymbol(char)) { @@ -56,7 +65,21 @@ String _katakanaToHiragana( hiraChars.add('お'); continue; } - hiraChars.add(longVowels[romaji]!); + // Ensure 'ヮー' => 'ゎー' => 'waa' + if (previousKana == 'ゎ' && char == 'ー') { + hiraChars + ..removeLast() + ..addAll(['わ', 'あ']); + continue; + } + // Try to get long vowel + final longVowel = longVowels[romaji]; + // If it does not exist 'ー' is being used as a hyphen + if (longVowel != null) { + hiraChars.add(longVowel); + } else { + hiraChars.add('ー'); + } continue; } else if (!_isCharLongDash(char) && _isCharKatakana(char)) { // Shift charcode. @@ -144,9 +167,13 @@ class _MappingParser { if (subtree == null) { return null; } + // If the next child node does not have a node value, set its node value to // the input. - return {'': tree[''] + nextChar, ...tree[nextChar]}; + return { + '': (tree[''] as String) + nextChar, + ...(tree[nextChar] as Map), + }; } List<_CharacterConversionToken> _newChunk( @@ -157,7 +184,10 @@ class _MappingParser { final firstChar = remaining.chars.first; return _parse( - tree: {'': firstChar, ...(root[firstChar] ?? {})}, + tree: { + '': firstChar, + ...((root[firstChar] as Map?) ?? {}), + }, remaining: remaining.substring(1), lastCursor: currentCursor, currentCursor: currentCursor + 1, diff --git a/lib/src/models/kana_kit_config.dart b/lib/src/models/kana_kit_config.dart index 13be969..74b4af8 100644 --- a/lib/src/models/kana_kit_config.dart +++ b/lib/src/models/kana_kit_config.dart @@ -1,6 +1,5 @@ -import 'package:equatable/equatable.dart'; - import 'package:kana_kit/kana_kit.dart'; +import 'package:meta/meta.dart'; /// {@template kana_kit_config} /// A configuration class with flags that influence @@ -9,13 +8,16 @@ import 'package:kana_kit/kana_kit.dart'; /// To use a default config and customize it, use [defaultConfig] and replace /// fields using [copyWith]. /// {@endtemplate} -class KanaKitConfig extends Equatable { +@immutable +class KanaKitConfig { /// {@macro kana_kit_config} const KanaKitConfig({ required this.passRomaji, required this.passKanji, required this.upcaseKatakana, - }) : romanization = Romanization.hepburn; + }) : + // ignore: avoid_field_initializers_in_const_classes + romanization = Romanization.hepburn; /// The default config for `KanaKit`. /// @@ -63,7 +65,7 @@ class KanaKitConfig extends Equatable { /// characters. /// /// ```dart - /// romanization: Romanizaion.hepburn, + /// romanization: Romanization.hepburn, /// ``` final Romanization romanization; @@ -81,10 +83,15 @@ class KanaKitConfig extends Equatable { } @override - List get props => [ - passRomaji, - passKanji, - upcaseKatakana, - romanization, - ]; + bool operator ==(covariant KanaKitConfig other) { + if (identical(this, other)) return true; + + return other.passRomaji == passRomaji && + other.passKanji == passKanji && + other.upcaseKatakana == upcaseKatakana; + } + + @override + int get hashCode => + passRomaji.hashCode ^ passKanji.hashCode ^ upcaseKatakana.hashCode; } diff --git a/lib/src/models/romanization/hepburn.dart b/lib/src/models/romanization/hepburn.dart index 98773b2..5644ba5 100644 --- a/lib/src/models/romanization/hepburn.dart +++ b/lib/src/models/romanization/hepburn.dart @@ -6,57 +6,276 @@ part of 'romanization.dart'; // DO NOT EDIT // --------------------------------- -const _hepburn = Romanization._( - name: 'Hepburn', - kanaToRomajiMap: { +const _hepburnKanaToRomajiMap = { + 'あ': {'': 'a'}, + 'い': {'': 'i'}, + 'う': {'': 'u'}, + 'え': {'': 'e'}, + 'お': {'': 'o'}, + 'か': {'': 'ka'}, + 'き': { + '': 'ki', + 'ゃ': {'': 'kya'}, + 'ゅ': {'': 'kyu'}, + 'ょ': {'': 'kyo'}, + 'ぃ': {'': 'kyi'}, + 'ぇ': {'': 'kye'}, + }, + 'く': { + '': 'ku', + 'ゃ': {'': 'kya'}, + 'ゅ': {'': 'kyu'}, + 'ょ': {'': 'kyo'}, + 'ぃ': {'': 'kyi'}, + 'ぇ': {'': 'kye'}, + }, + 'け': {'': 'ke'}, + 'こ': {'': 'ko'}, + 'さ': {'': 'sa'}, + 'し': { + '': 'shi', + 'ゃ': {'': 'sha'}, + 'ゅ': {'': 'shu'}, + 'ょ': {'': 'sho'}, + 'ぃ': {'': 'shyi'}, + 'ぇ': {'': 'she'}, + }, + 'す': {'': 'su'}, + 'せ': {'': 'se'}, + 'そ': {'': 'so'}, + 'た': {'': 'ta'}, + 'ち': { + '': 'chi', + 'ゃ': {'': 'cha'}, + 'ゅ': {'': 'chu'}, + 'ょ': {'': 'cho'}, + 'ぃ': {'': 'chyi'}, + 'ぇ': {'': 'che'}, + }, + 'つ': {'': 'tsu'}, + 'て': {'': 'te'}, + 'と': {'': 'to'}, + 'な': {'': 'na'}, + 'に': { + '': 'ni', + 'ゃ': {'': 'nya'}, + 'ゅ': {'': 'nyu'}, + 'ょ': {'': 'nyo'}, + 'ぃ': {'': 'nyi'}, + 'ぇ': {'': 'nye'}, + }, + 'ぬ': {'': 'nu'}, + 'ね': {'': 'ne'}, + 'の': {'': 'no'}, + 'は': {'': 'ha'}, + 'ひ': { + '': 'hi', + 'ゃ': {'': 'hya'}, + 'ゅ': {'': 'hyu'}, + 'ょ': {'': 'hyo'}, + 'ぃ': {'': 'hyi'}, + 'ぇ': {'': 'hye'}, + }, + 'ふ': { + '': 'fu', + 'ゃ': {'': 'fya'}, + 'ゅ': {'': 'fyu'}, + 'ょ': {'': 'fyo'}, + 'ぃ': {'': 'fyi'}, + 'ぇ': {'': 'fye'}, + }, + 'へ': {'': 'he'}, + 'ほ': {'': 'ho'}, + 'ま': {'': 'ma'}, + 'み': { + '': 'mi', + 'ゃ': {'': 'mya'}, + 'ゅ': {'': 'myu'}, + 'ょ': {'': 'myo'}, + 'ぃ': {'': 'myi'}, + 'ぇ': {'': 'mye'}, + }, + 'む': {'': 'mu'}, + 'め': {'': 'me'}, + 'も': {'': 'mo'}, + 'ら': {'': 'ra'}, + 'り': { + '': 'ri', + 'ゃ': {'': 'rya'}, + 'ゅ': {'': 'ryu'}, + 'ょ': {'': 'ryo'}, + 'ぃ': {'': 'ryi'}, + 'ぇ': {'': 'rye'}, + }, + 'る': {'': 'ru'}, + 'れ': {'': 're'}, + 'ろ': {'': 'ro'}, + 'や': {'': 'ya'}, + 'ゆ': {'': 'yu'}, + 'よ': {'': 'yo'}, + 'わ': {'': 'wa'}, + 'ゐ': {'': 'wi'}, + 'ゑ': {'': 'we'}, + 'を': {'': 'wo'}, + 'ん': { + '': 'n', + 'あ': {'': "n'a"}, + 'い': {'': "n'i"}, + 'う': {'': "n'u"}, + 'え': {'': "n'e"}, + 'お': {'': "n'o"}, + 'や': {'': "n'ya"}, + 'ゆ': {'': "n'yu"}, + 'よ': {'': "n'yo"}, + }, + 'が': {'': 'ga'}, + 'ぎ': { + '': 'gi', + 'ゃ': {'': 'gya'}, + 'ゅ': {'': 'gyu'}, + 'ょ': {'': 'gyo'}, + 'ぃ': {'': 'gyi'}, + 'ぇ': {'': 'gye'}, + }, + 'ぐ': {'': 'gu'}, + 'げ': {'': 'ge'}, + 'ご': {'': 'go'}, + 'ざ': {'': 'za'}, + 'じ': { + '': 'ji', + 'ゃ': {'': 'ja'}, + 'ゅ': {'': 'ju'}, + 'ょ': {'': 'jo'}, + 'ぃ': {'': 'jyi'}, + 'ぇ': {'': 'je'}, + }, + 'ず': {'': 'zu'}, + 'ぜ': {'': 'ze'}, + 'ぞ': {'': 'zo'}, + 'だ': {'': 'da'}, + 'ぢ': { + '': 'ji', + 'ゃ': {'': 'ja'}, + 'ゅ': {'': 'ju'}, + 'ょ': {'': 'jo'}, + 'ぃ': {'': 'jyi'}, + 'ぇ': {'': 'je'}, + }, + 'づ': {'': 'zu'}, + 'で': {'': 'de'}, + 'ど': {'': 'do'}, + 'ば': {'': 'ba'}, + 'び': { + '': 'bi', + 'ゃ': {'': 'bya'}, + 'ゅ': {'': 'byu'}, + 'ょ': {'': 'byo'}, + 'ぃ': {'': 'byi'}, + 'ぇ': {'': 'bye'}, + }, + 'ぶ': {'': 'bu'}, + 'べ': {'': 'be'}, + 'ぼ': {'': 'bo'}, + 'ぱ': {'': 'pa'}, + 'ぴ': { + '': 'pi', + 'ゃ': {'': 'pya'}, + 'ゅ': {'': 'pyu'}, + 'ょ': {'': 'pyo'}, + 'ぃ': {'': 'pyi'}, + 'ぇ': {'': 'pye'}, + }, + 'ぷ': {'': 'pu'}, + 'ぺ': {'': 'pe'}, + 'ぽ': {'': 'po'}, + 'ゔぁ': {'': 'va'}, + 'ゔぃ': {'': 'vi'}, + 'ゔ': { + '': 'vu', + 'ゃ': {'': 'vya'}, + 'ゅ': {'': 'vyu'}, + 'ょ': {'': 'vyo'}, + 'ぃ': {'': 'vyi'}, + 'ぇ': {'': 'vye'}, + }, + 'ゔぇ': {'': 've'}, + 'ゔぉ': {'': 'vo'}, + '。': {'': '.'}, + '、': {'': ','}, + ':': {'': ':'}, + '・': {'': '/'}, + '!': {'': '!'}, + '?': {'': '?'}, + '〜': {'': '~'}, + 'ー': {'': '-'}, + '「': {'': '‘'}, + '」': {'': '’'}, + '『': {'': '“'}, + '』': {'': '”'}, + '[': {'': '['}, + ']': {'': ']'}, + '(': {'': '('}, + ')': {'': ')'}, + '{': {'': '{'}, + '}': {'': '}'}, + ' ': {'': ' '}, + 'ゃ': {'': 'ya'}, + 'ゅ': {'': 'yu'}, + 'ょ': {'': 'yo'}, + 'ぁ': {'': 'a'}, + 'ぃ': {'': 'i'}, + 'ぅ': {'': 'u'}, + 'ぇ': {'': 'e'}, + 'ぉ': {'': 'o'}, + 'っ': { 'あ': {'': 'a'}, 'い': {'': 'i'}, 'う': {'': 'u'}, 'え': {'': 'e'}, 'お': {'': 'o'}, - 'か': {'': 'ka'}, + 'か': {'': 'kka'}, 'き': { - '': 'ki', - 'ゃ': {'': 'kya'}, - 'ゅ': {'': 'kyu'}, - 'ょ': {'': 'kyo'}, - 'ぃ': {'': 'kyi'}, - 'ぇ': {'': 'kye'}, + '': 'kki', + 'ゃ': {'': 'kkya'}, + 'ゅ': {'': 'kkyu'}, + 'ょ': {'': 'kkyo'}, + 'ぃ': {'': 'kkyi'}, + 'ぇ': {'': 'kkye'}, }, 'く': { - '': 'ku', - 'ゃ': {'': 'kya'}, - 'ゅ': {'': 'kyu'}, - 'ょ': {'': 'kyo'}, - 'ぃ': {'': 'kyi'}, - 'ぇ': {'': 'kye'}, - }, - 'け': {'': 'ke'}, - 'こ': {'': 'ko'}, - 'さ': {'': 'sa'}, + '': 'kku', + 'ゃ': {'': 'kkya'}, + 'ゅ': {'': 'kkyu'}, + 'ょ': {'': 'kkyo'}, + 'ぃ': {'': 'kkyi'}, + 'ぇ': {'': 'kkye'}, + }, + 'け': {'': 'kke'}, + 'こ': {'': 'kko'}, + 'さ': {'': 'ssa'}, 'し': { - '': 'shi', - 'ゃ': {'': 'sha'}, - 'ゅ': {'': 'shu'}, - 'ょ': {'': 'sho'}, - 'ぃ': {'': 'shyi'}, - 'ぇ': {'': 'she'}, - }, - 'す': {'': 'su'}, - 'せ': {'': 'se'}, - 'そ': {'': 'so'}, - 'た': {'': 'ta'}, + '': 'sshi', + 'ゃ': {'': 'ssha'}, + 'ゅ': {'': 'sshu'}, + 'ょ': {'': 'ssho'}, + 'ぃ': {'': 'sshyi'}, + 'ぇ': {'': 'sshe'}, + }, + 'す': {'': 'ssu'}, + 'せ': {'': 'sse'}, + 'そ': {'': 'sso'}, + 'た': {'': 'tta'}, 'ち': { - '': 'chi', - 'ゃ': {'': 'cha'}, - 'ゅ': {'': 'chu'}, - 'ょ': {'': 'cho'}, - 'ぃ': {'': 'chyi'}, - 'ぇ': {'': 'che'}, - }, - 'つ': {'': 'tsu'}, - 'て': {'': 'te'}, - 'と': {'': 'to'}, + '': 'tchi', + 'ゃ': {'': 'tcha'}, + 'ゅ': {'': 'tchu'}, + 'ょ': {'': 'tcho'}, + 'ぃ': {'': 'tchyi'}, + 'ぇ': {'': 'tche'}, + }, + 'つ': {'': 'ttsu'}, + 'て': {'': 'tte'}, + 'と': {'': 'tto'}, 'な': {'': 'na'}, 'に': { '': 'ni', @@ -69,139 +288,129 @@ const _hepburn = Romanization._( 'ぬ': {'': 'nu'}, 'ね': {'': 'ne'}, 'の': {'': 'no'}, - 'は': {'': 'ha'}, + 'は': {'': 'hha'}, 'ひ': { - '': 'hi', - 'ゃ': {'': 'hya'}, - 'ゅ': {'': 'hyu'}, - 'ょ': {'': 'hyo'}, - 'ぃ': {'': 'hyi'}, - 'ぇ': {'': 'hye'}, + '': 'hhi', + 'ゃ': {'': 'hhya'}, + 'ゅ': {'': 'hhyu'}, + 'ょ': {'': 'hhyo'}, + 'ぃ': {'': 'hhyi'}, + 'ぇ': {'': 'hhye'}, }, 'ふ': { - '': 'fu', - 'ゃ': {'': 'fya'}, - 'ゅ': {'': 'fyu'}, - 'ょ': {'': 'fyo'}, - 'ぃ': {'': 'fyi'}, - 'ぇ': {'': 'fye'}, - }, - 'へ': {'': 'he'}, - 'ほ': {'': 'ho'}, - 'ま': {'': 'ma'}, + '': 'ffu', + 'ゃ': {'': 'ffya'}, + 'ゅ': {'': 'ffyu'}, + 'ょ': {'': 'ffyo'}, + 'ぃ': {'': 'ffyi'}, + 'ぇ': {'': 'ffye'}, + }, + 'へ': {'': 'hhe'}, + 'ほ': {'': 'hho'}, + 'ま': {'': 'mma'}, 'み': { - '': 'mi', - 'ゃ': {'': 'mya'}, - 'ゅ': {'': 'myu'}, - 'ょ': {'': 'myo'}, - 'ぃ': {'': 'myi'}, - 'ぇ': {'': 'mye'}, - }, - 'む': {'': 'mu'}, - 'め': {'': 'me'}, - 'も': {'': 'mo'}, - 'ら': {'': 'ra'}, + '': 'mmi', + 'ゃ': {'': 'mmya'}, + 'ゅ': {'': 'mmyu'}, + 'ょ': {'': 'mmyo'}, + 'ぃ': {'': 'mmyi'}, + 'ぇ': {'': 'mmye'}, + }, + 'む': {'': 'mmu'}, + 'め': {'': 'mme'}, + 'も': {'': 'mmo'}, + 'ら': {'': 'rra'}, 'り': { - '': 'ri', - 'ゃ': {'': 'rya'}, - 'ゅ': {'': 'ryu'}, - 'ょ': {'': 'ryo'}, - 'ぃ': {'': 'ryi'}, - 'ぇ': {'': 'rye'}, - }, - 'る': {'': 'ru'}, - 'れ': {'': 're'}, - 'ろ': {'': 'ro'}, + '': 'rri', + 'ゃ': {'': 'rrya'}, + 'ゅ': {'': 'rryu'}, + 'ょ': {'': 'rryo'}, + 'ぃ': {'': 'rryi'}, + 'ぇ': {'': 'rrye'}, + }, + 'る': {'': 'rru'}, + 'れ': {'': 'rre'}, + 'ろ': {'': 'rro'}, 'や': {'': 'ya'}, 'ゆ': {'': 'yu'}, 'よ': {'': 'yo'}, - 'わ': {'': 'wa'}, - 'ゐ': {'': 'wi'}, - 'ゑ': {'': 'we'}, - 'を': {'': 'wo'}, - 'ん': { - '': 'n', - 'あ': {'': "n'a"}, - 'い': {'': "n'i"}, - 'う': {'': "n'u"}, - 'え': {'': "n'e"}, - 'お': {'': "n'o"}, - 'や': {'': "n'ya"}, - 'ゆ': {'': "n'yu"}, - 'よ': {'': "n'yo"}, - }, - 'が': {'': 'ga'}, + 'わ': {'': 'wwa'}, + 'ゐ': {'': 'wwi'}, + 'ゑ': {'': 'wwe'}, + 'を': {'': 'wwo'}, + 'ん': {'': 'n'}, + 'が': {'': 'gga'}, 'ぎ': { - '': 'gi', - 'ゃ': {'': 'gya'}, - 'ゅ': {'': 'gyu'}, - 'ょ': {'': 'gyo'}, - 'ぃ': {'': 'gyi'}, - 'ぇ': {'': 'gye'}, - }, - 'ぐ': {'': 'gu'}, - 'げ': {'': 'ge'}, - 'ご': {'': 'go'}, - 'ざ': {'': 'za'}, + '': 'ggi', + 'ゃ': {'': 'ggya'}, + 'ゅ': {'': 'ggyu'}, + 'ょ': {'': 'ggyo'}, + 'ぃ': {'': 'ggyi'}, + 'ぇ': {'': 'ggye'}, + }, + 'ぐ': {'': 'ggu'}, + 'げ': {'': 'gge'}, + 'ご': {'': 'ggo'}, + 'ざ': {'': 'zza'}, 'じ': { - '': 'ji', - 'ゃ': {'': 'ja'}, - 'ゅ': {'': 'ju'}, - 'ょ': {'': 'jo'}, - 'ぃ': {'': 'jyi'}, - 'ぇ': {'': 'je'}, - }, - 'ず': {'': 'zu'}, - 'ぜ': {'': 'ze'}, - 'ぞ': {'': 'zo'}, - 'だ': {'': 'da'}, + '': 'jji', + 'ゃ': {'': 'jja'}, + 'ゅ': {'': 'jju'}, + 'ょ': {'': 'jjo'}, + 'ぃ': {'': 'jjyi'}, + 'ぇ': {'': 'jje'}, + }, + 'ず': {'': 'zzu'}, + 'ぜ': {'': 'zze'}, + 'ぞ': {'': 'zzo'}, + 'だ': {'': 'dda'}, 'ぢ': { - '': 'ji', - 'ゃ': {'': 'ja'}, - 'ゅ': {'': 'ju'}, - 'ょ': {'': 'jo'}, - 'ぃ': {'': 'jyi'}, - 'ぇ': {'': 'je'}, - }, - 'づ': {'': 'zu'}, - 'で': {'': 'de'}, - 'ど': {'': 'do'}, - 'ば': {'': 'ba'}, + '': 'jji', + 'ゃ': {'': 'jja'}, + 'ゅ': {'': 'jju'}, + 'ょ': {'': 'jjo'}, + 'ぃ': {'': 'jjyi'}, + 'ぇ': {'': 'jje'}, + }, + 'づ': {'': 'zzu'}, + 'で': {'': 'dde'}, + 'ど': {'': 'ddo'}, + 'ば': {'': 'bba'}, 'び': { - '': 'bi', - 'ゃ': {'': 'bya'}, - 'ゅ': {'': 'byu'}, - 'ょ': {'': 'byo'}, - 'ぃ': {'': 'byi'}, - 'ぇ': {'': 'bye'}, - }, - 'ぶ': {'': 'bu'}, - 'べ': {'': 'be'}, - 'ぼ': {'': 'bo'}, - 'ぱ': {'': 'pa'}, + '': 'bbi', + 'ゃ': {'': 'bbya'}, + 'ゅ': {'': 'bbyu'}, + 'ょ': {'': 'bbyo'}, + 'ぃ': {'': 'bbyi'}, + 'ぇ': {'': 'bbye'}, + }, + 'ぶ': {'': 'bbu'}, + 'べ': {'': 'bbe'}, + 'ぼ': {'': 'bbo'}, + 'ぱ': {'': 'ppa'}, 'ぴ': { - '': 'pi', - 'ゃ': {'': 'pya'}, - 'ゅ': {'': 'pyu'}, - 'ょ': {'': 'pyo'}, - 'ぃ': {'': 'pyi'}, - 'ぇ': {'': 'pye'}, - }, - 'ぷ': {'': 'pu'}, - 'ぺ': {'': 'pe'}, - 'ぽ': {'': 'po'}, - 'ゔぁ': {'': 'va'}, - 'ゔぃ': {'': 'vi'}, + '': 'ppi', + 'ゃ': {'': 'ppya'}, + 'ゅ': {'': 'ppyu'}, + 'ょ': {'': 'ppyo'}, + 'ぃ': {'': 'ppyi'}, + 'ぇ': {'': 'ppye'}, + }, + 'ぷ': {'': 'ppu'}, + 'ぺ': {'': 'ppe'}, + 'ぽ': {'': 'ppo'}, + 'ゔぁ': {'': 'vva'}, + 'ゔぃ': {'': 'vvi'}, 'ゔ': { - '': 'vu', - 'ゃ': {'': 'vya'}, - 'ゅ': {'': 'vyu'}, - 'ょ': {'': 'vyo'}, - 'ぃ': {'': 'vyi'}, - 'ぇ': {'': 'vye'}, - }, - 'ゔぇ': {'': 've'}, - 'ゔぉ': {'': 'vo'}, + '': 'vvu', + 'ゃ': {'': 'vvya'}, + 'ゅ': {'': 'vvyu'}, + 'ょ': {'': 'vvyo'}, + 'ぃ': {'': 'vvyi'}, + 'ぇ': {'': 'vvye'}, + }, + 'ゔぇ': {'': 'vve'}, + 'ゔぉ': {'': 'vvo'}, '。': {'': '.'}, '、': {'': ','}, ':': {'': ':'}, @@ -229,1001 +438,789 @@ const _hepburn = Romanization._( 'ぅ': {'': 'u'}, 'ぇ': {'': 'e'}, 'ぉ': {'': 'o'}, - 'っ': { - 'あ': {'': 'a'}, - 'い': {'': 'i'}, - 'う': {'': 'u'}, - 'え': {'': 'e'}, - 'お': {'': 'o'}, - 'か': {'': 'kka'}, - 'き': { - '': 'kki', - 'ゃ': {'': 'kkya'}, - 'ゅ': {'': 'kkyu'}, - 'ょ': {'': 'kkyo'}, - 'ぃ': {'': 'kkyi'}, - 'ぇ': {'': 'kkye'}, - }, - 'く': { - '': 'kku', - 'ゃ': {'': 'kkya'}, - 'ゅ': {'': 'kkyu'}, - 'ょ': {'': 'kkyo'}, - 'ぃ': {'': 'kkyi'}, - 'ぇ': {'': 'kkye'}, - }, - 'け': {'': 'kke'}, - 'こ': {'': 'kko'}, - 'さ': {'': 'ssa'}, - 'し': { - '': 'sshi', - 'ゃ': {'': 'ssha'}, - 'ゅ': {'': 'sshu'}, - 'ょ': {'': 'ssho'}, - 'ぃ': {'': 'sshyi'}, - 'ぇ': {'': 'sshe'}, - }, - 'す': {'': 'ssu'}, - 'せ': {'': 'sse'}, - 'そ': {'': 'sso'}, - 'た': {'': 'tta'}, - 'ち': { - '': 'tchi', - 'ゃ': {'': 'tcha'}, - 'ゅ': {'': 'tchu'}, - 'ょ': {'': 'tcho'}, - 'ぃ': {'': 'tchyi'}, - 'ぇ': {'': 'tche'}, - }, - 'つ': {'': 'ttsu'}, - 'て': {'': 'tte'}, - 'と': {'': 'tto'}, - 'な': {'': 'na'}, - 'に': { - '': 'ni', - 'ゃ': {'': 'nya'}, - 'ゅ': {'': 'nyu'}, - 'ょ': {'': 'nyo'}, - 'ぃ': {'': 'nyi'}, - 'ぇ': {'': 'nye'}, - }, - 'ぬ': {'': 'nu'}, - 'ね': {'': 'ne'}, - 'の': {'': 'no'}, - 'は': {'': 'hha'}, - 'ひ': { - '': 'hhi', - 'ゃ': {'': 'hhya'}, - 'ゅ': {'': 'hhyu'}, - 'ょ': {'': 'hhyo'}, - 'ぃ': {'': 'hhyi'}, - 'ぇ': {'': 'hhye'}, - }, - 'ふ': { - '': 'ffu', - 'ゃ': {'': 'ffya'}, - 'ゅ': {'': 'ffyu'}, - 'ょ': {'': 'ffyo'}, - 'ぃ': {'': 'ffyi'}, - 'ぇ': {'': 'ffye'}, - }, - 'へ': {'': 'hhe'}, - 'ほ': {'': 'hho'}, - 'ま': {'': 'mma'}, - 'み': { - '': 'mmi', - 'ゃ': {'': 'mmya'}, - 'ゅ': {'': 'mmyu'}, - 'ょ': {'': 'mmyo'}, - 'ぃ': {'': 'mmyi'}, - 'ぇ': {'': 'mmye'}, - }, - 'む': {'': 'mmu'}, - 'め': {'': 'mme'}, - 'も': {'': 'mmo'}, - 'ら': {'': 'rra'}, - 'り': { - '': 'rri', - 'ゃ': {'': 'rrya'}, - 'ゅ': {'': 'rryu'}, - 'ょ': {'': 'rryo'}, - 'ぃ': {'': 'rryi'}, - 'ぇ': {'': 'rrye'}, - }, - 'る': {'': 'rru'}, - 'れ': {'': 'rre'}, - 'ろ': {'': 'rro'}, - 'や': {'': 'ya'}, - 'ゆ': {'': 'yu'}, - 'よ': {'': 'yo'}, - 'わ': {'': 'wwa'}, - 'ゐ': {'': 'wwi'}, - 'ゑ': {'': 'wwe'}, - 'を': {'': 'wwo'}, - 'ん': {'': 'n'}, - 'が': {'': 'gga'}, - 'ぎ': { - '': 'ggi', - 'ゃ': {'': 'ggya'}, - 'ゅ': {'': 'ggyu'}, - 'ょ': {'': 'ggyo'}, - 'ぃ': {'': 'ggyi'}, - 'ぇ': {'': 'ggye'}, - }, - 'ぐ': {'': 'ggu'}, - 'げ': {'': 'gge'}, - 'ご': {'': 'ggo'}, - 'ざ': {'': 'zza'}, - 'じ': { - '': 'jji', - 'ゃ': {'': 'jja'}, - 'ゅ': {'': 'jju'}, - 'ょ': {'': 'jjo'}, - 'ぃ': {'': 'jjyi'}, - 'ぇ': {'': 'jje'}, - }, - 'ず': {'': 'zzu'}, - 'ぜ': {'': 'zze'}, - 'ぞ': {'': 'zzo'}, - 'だ': {'': 'dda'}, - 'ぢ': { - '': 'jji', - 'ゃ': {'': 'jja'}, - 'ゅ': {'': 'jju'}, - 'ょ': {'': 'jjo'}, - 'ぃ': {'': 'jjyi'}, - 'ぇ': {'': 'jje'}, - }, - 'づ': {'': 'zzu'}, - 'で': {'': 'dde'}, - 'ど': {'': 'ddo'}, - 'ば': {'': 'bba'}, - 'び': { - '': 'bbi', - 'ゃ': {'': 'bbya'}, - 'ゅ': {'': 'bbyu'}, - 'ょ': {'': 'bbyo'}, - 'ぃ': {'': 'bbyi'}, - 'ぇ': {'': 'bbye'}, - }, - 'ぶ': {'': 'bbu'}, - 'べ': {'': 'bbe'}, - 'ぼ': {'': 'bbo'}, - 'ぱ': {'': 'ppa'}, - 'ぴ': { - '': 'ppi', - 'ゃ': {'': 'ppya'}, - 'ゅ': {'': 'ppyu'}, - 'ょ': {'': 'ppyo'}, - 'ぃ': {'': 'ppyi'}, - 'ぇ': {'': 'ppye'}, - }, - 'ぷ': {'': 'ppu'}, - 'ぺ': {'': 'ppe'}, - 'ぽ': {'': 'ppo'}, - 'ゔぁ': {'': 'vva'}, - 'ゔぃ': {'': 'vvi'}, - 'ゔ': { - '': 'vvu', - 'ゃ': {'': 'vvya'}, - 'ゅ': {'': 'vvyu'}, - 'ょ': {'': 'vvyo'}, - 'ぃ': {'': 'vvyi'}, - 'ぇ': {'': 'vvye'}, - }, - 'ゔぇ': {'': 'vve'}, - 'ゔぉ': {'': 'vvo'}, - '。': {'': '.'}, - '、': {'': ','}, - ':': {'': ':'}, - '・': {'': '/'}, - '!': {'': '!'}, - '?': {'': '?'}, - '〜': {'': '~'}, - 'ー': {'': '-'}, - '「': {'': '‘'}, - '」': {'': '’'}, - '『': {'': '“'}, - '』': {'': '”'}, - '[': {'': '['}, - ']': {'': ']'}, - '(': {'': '('}, - ')': {'': ')'}, - '{': {'': '{'}, - '}': {'': '}'}, - ' ': {'': ' '}, - 'ゃ': {'': 'ya'}, - 'ゅ': {'': 'yu'}, - 'ょ': {'': 'yo'}, - 'ぁ': {'': 'a'}, - 'ぃ': {'': 'i'}, - 'ぅ': {'': 'u'}, - 'ぇ': {'': 'e'}, - 'ぉ': {'': 'o'}, - '': '' - }, + '': '', }, - romajiToKanaMap: { - 'a': {'': 'あ'}, - 'i': {'': 'い'}, - 'u': {'': 'う'}, - 'e': {'': 'え'}, - 'o': {'': 'お'}, +}; +const _hepburnRomajiToKanaMap = { + 'a': {'': 'あ'}, + 'i': {'': 'い'}, + 'u': {'': 'う'}, + 'e': {'': 'え'}, + 'o': {'': 'お'}, + 'k': { + 'a': {'': 'か'}, + 'i': {'': 'き'}, + 'u': {'': 'く'}, + 'e': {'': 'け'}, + 'o': {'': 'こ'}, + 'y': { + 'a': {'': 'きゃ'}, + 'i': {'': 'きぃ'}, + 'u': {'': 'きゅ'}, + 'e': {'': 'きぇ'}, + 'o': {'': 'きょ'}, + }, + 'w': { + 'a': {'': 'くぁ'}, + }, 'k': { - 'a': {'': 'か'}, - 'i': {'': 'き'}, - 'u': {'': 'く'}, - 'e': {'': 'け'}, - 'o': {'': 'こ'}, + 'a': {'': 'っか'}, + 'i': {'': 'っき'}, + 'u': {'': 'っく'}, + 'e': {'': 'っけ'}, + 'o': {'': 'っこ'}, 'y': { - 'a': {'': 'きゃ'}, - 'i': {'': 'きぃ'}, - 'u': {'': 'きゅ'}, - 'e': {'': 'きぇ'}, - 'o': {'': 'きょ'} + 'a': {'': 'っきゃ'}, + 'i': {'': 'っきぃ'}, + 'u': {'': 'っきゅ'}, + 'e': {'': 'っきぇ'}, + 'o': {'': 'っきょ'}, }, 'w': { - 'a': {'': 'くぁ'} + 'a': {'': 'っくぁ'}, }, - 'k': { - 'a': {'': 'っか'}, - 'i': {'': 'っき'}, - 'u': {'': 'っく'}, - 'e': {'': 'っけ'}, - 'o': {'': 'っこ'}, - 'y': { - 'a': {'': 'っきゃ'}, - 'i': {'': 'っきぃ'}, - 'u': {'': 'っきゅ'}, - 'e': {'': 'っきぇ'}, - 'o': {'': 'っきょ'} - }, - 'w': { - 'a': {'': 'っくぁ'} - } - } }, - 's': { - 'a': {'': 'さ'}, + }, + 's': { + 'a': {'': 'さ'}, + 'i': {'': 'し'}, + 'u': {'': 'す'}, + 'e': {'': 'せ'}, + 'o': {'': 'そ'}, + 'y': { + 'a': {'': 'しゃ'}, + 'i': {'': 'しぃ'}, + 'u': {'': 'しゅ'}, + 'e': {'': 'しぇ'}, + 'o': {'': 'しょ'}, + }, + 'w': { + 'a': {'': 'すぁ'}, + 'i': {'': 'すぃ'}, + 'u': {'': 'すぅ'}, + 'e': {'': 'すぇ'}, + 'o': {'': 'すぉ'}, + }, + 'h': { + 'a': {'': 'しゃ'}, 'i': {'': 'し'}, - 'u': {'': 'す'}, - 'e': {'': 'せ'}, - 'o': {'': 'そ'}, + 'u': {'': 'しゅ'}, + 'e': {'': 'しぇ'}, + 'o': {'': 'しょ'}, 'y': { 'a': {'': 'しゃ'}, 'i': {'': 'しぃ'}, 'u': {'': 'しゅ'}, 'e': {'': 'しぇ'}, - 'o': {'': 'しょ'} + 'o': {'': 'しょ'}, + }, + }, + 's': { + 'a': {'': 'っさ'}, + 'i': {'': 'っし'}, + 'u': {'': 'っす'}, + 'e': {'': 'っせ'}, + 'o': {'': 'っそ'}, + 'y': { + 'a': {'': 'っしゃ'}, + 'i': {'': 'っしぃ'}, + 'u': {'': 'っしゅ'}, + 'e': {'': 'っしぇ'}, + 'o': {'': 'っしょ'}, }, 'w': { - 'a': {'': 'すぁ'}, - 'i': {'': 'すぃ'}, - 'u': {'': 'すぅ'}, - 'e': {'': 'すぇ'}, - 'o': {'': 'すぉ'} + 'a': {'': 'っすぁ'}, + 'i': {'': 'っすぃ'}, + 'u': {'': 'っすぅ'}, + 'e': {'': 'っすぇ'}, + 'o': {'': 'っすぉ'}, }, 'h': { - 'a': {'': 'しゃ'}, - 'i': {'': 'し'}, - 'u': {'': 'しゅ'}, - 'e': {'': 'しぇ'}, - 'o': {'': 'しょ'}, - 'y': { - 'a': {'': 'しゃ'}, - 'i': {'': 'しぃ'}, - 'u': {'': 'しゅ'}, - 'e': {'': 'しぇ'}, - 'o': {'': 'しょ'} - } - }, - 's': { - 'a': {'': 'っさ'}, + 'a': {'': 'っしゃ'}, 'i': {'': 'っし'}, - 'u': {'': 'っす'}, - 'e': {'': 'っせ'}, - 'o': {'': 'っそ'}, + 'u': {'': 'っしゅ'}, + 'e': {'': 'っしぇ'}, + 'o': {'': 'っしょ'}, 'y': { 'a': {'': 'っしゃ'}, 'i': {'': 'っしぃ'}, 'u': {'': 'っしゅ'}, 'e': {'': 'っしぇ'}, - 'o': {'': 'っしょ'} - }, - 'w': { - 'a': {'': 'っすぁ'}, - 'i': {'': 'っすぃ'}, - 'u': {'': 'っすぅ'}, - 'e': {'': 'っすぇ'}, - 'o': {'': 'っすぉ'} - }, - 'h': { - 'a': {'': 'っしゃ'}, - 'i': {'': 'っし'}, - 'u': {'': 'っしゅ'}, - 'e': {'': 'っしぇ'}, 'o': {'': 'っしょ'}, - 'y': { - 'a': {'': 'っしゃ'}, - 'i': {'': 'っしぃ'}, - 'u': {'': 'っしゅ'}, - 'e': {'': 'っしぇ'}, - 'o': {'': 'っしょ'} - } - } - } + }, + }, }, - 't': { - 'a': {'': 'た'}, - 'i': {'': 'ち'}, + }, + 't': { + 'a': {'': 'た'}, + 'i': {'': 'ち'}, + 'u': {'': 'つ'}, + 'e': {'': 'て'}, + 'o': {'': 'と'}, + 'y': { + 'a': {'': 'ちゃ'}, + 'i': {'': 'ちぃ'}, + 'u': {'': 'ちゅ'}, + 'e': {'': 'ちぇ'}, + 'o': {'': 'ちょ'}, + }, + 's': { + 'a': {'': 'つぁ'}, + 'i': {'': 'つぃ'}, 'u': {'': 'つ'}, - 'e': {'': 'て'}, - 'o': {'': 'と'}, + 'e': {'': 'つぇ'}, + 'o': {'': 'つぉ'}, + }, + 'h': { + 'a': {'': 'てゃ'}, + 'i': {'': 'てぃ'}, + 'u': {'': 'てゅ'}, + 'e': {'': 'てぇ'}, + 'o': {'': 'てょ'}, + }, + 'w': { + 'a': {'': 'とぁ'}, + 'i': {'': 'とぃ'}, + 'u': {'': 'とぅ'}, + 'e': {'': 'とぇ'}, + 'o': {'': 'とぉ'}, + }, + 't': { + 'a': {'': 'った'}, + 'i': {'': 'っち'}, + 'u': {'': 'っつ'}, + 'e': {'': 'って'}, + 'o': {'': 'っと'}, 'y': { - 'a': {'': 'ちゃ'}, - 'i': {'': 'ちぃ'}, - 'u': {'': 'ちゅ'}, - 'e': {'': 'ちぇ'}, - 'o': {'': 'ちょ'} + 'a': {'': 'っちゃ'}, + 'i': {'': 'っちぃ'}, + 'u': {'': 'っちゅ'}, + 'e': {'': 'っちぇ'}, + 'o': {'': 'っちょ'}, }, 's': { - 'a': {'': 'つぁ'}, - 'i': {'': 'つぃ'}, - 'u': {'': 'つ'}, - 'e': {'': 'つぇ'}, - 'o': {'': 'つぉ'} + 'a': {'': 'っつぁ'}, + 'i': {'': 'っつぃ'}, + 'u': {'': 'っつ'}, + 'e': {'': 'っつぇ'}, + 'o': {'': 'っつぉ'}, }, 'h': { - 'a': {'': 'てゃ'}, - 'i': {'': 'てぃ'}, - 'u': {'': 'てゅ'}, - 'e': {'': 'てぇ'}, - 'o': {'': 'てょ'} + 'a': {'': 'ってゃ'}, + 'i': {'': 'ってぃ'}, + 'u': {'': 'ってゅ'}, + 'e': {'': 'ってぇ'}, + 'o': {'': 'ってょ'}, }, 'w': { - 'a': {'': 'とぁ'}, - 'i': {'': 'とぃ'}, - 'u': {'': 'とぅ'}, - 'e': {'': 'とぇ'}, - 'o': {'': 'とぉ'} - }, - 't': { - 'a': {'': 'った'}, - 'i': {'': 'っち'}, - 'u': {'': 'っつ'}, - 'e': {'': 'って'}, - 'o': {'': 'っと'}, - 'y': { - 'a': {'': 'っちゃ'}, - 'i': {'': 'っちぃ'}, - 'u': {'': 'っちゅ'}, - 'e': {'': 'っちぇ'}, - 'o': {'': 'っちょ'} - }, - 's': { - 'a': {'': 'っつぁ'}, - 'i': {'': 'っつぃ'}, - 'u': {'': 'っつ'}, - 'e': {'': 'っつぇ'}, - 'o': {'': 'っつぉ'} - }, - 'h': { - 'a': {'': 'ってゃ'}, - 'i': {'': 'ってぃ'}, - 'u': {'': 'ってゅ'}, - 'e': {'': 'ってぇ'}, - 'o': {'': 'ってょ'} - }, - 'w': { - 'a': {'': 'っとぁ'}, - 'i': {'': 'っとぃ'}, - 'u': {'': 'っとぅ'}, - 'e': {'': 'っとぇ'}, - 'o': {'': 'っとぉ'} - } - } - }, - 'n': { - 'a': {'': 'な'}, - 'i': {'': 'に'}, - 'u': {'': 'ぬ'}, - 'e': {'': 'ね'}, - 'o': {'': 'の'}, - 'y': { - 'a': {'': 'にゃ'}, - 'i': {'': 'にぃ'}, - 'u': {'': 'にゅ'}, - 'e': {'': 'にぇ'}, - 'o': {'': 'にょ'} + 'a': {'': 'っとぁ'}, + 'i': {'': 'っとぃ'}, + 'u': {'': 'っとぅ'}, + 'e': {'': 'っとぇ'}, + 'o': {'': 'っとぉ'}, }, - '': 'ん', - "'": {'': 'ん'} + }, + }, + 'n': { + 'a': {'': 'な'}, + 'i': {'': 'に'}, + 'u': {'': 'ぬ'}, + 'e': {'': 'ね'}, + 'o': {'': 'の'}, + 'y': { + 'a': {'': 'にゃ'}, + 'i': {'': 'にぃ'}, + 'u': {'': 'にゅ'}, + 'e': {'': 'にぇ'}, + 'o': {'': 'にょ'}, + }, + '': 'ん', + "'": {'': 'ん'}, + }, + 'h': { + 'a': {'': 'は'}, + 'i': {'': 'ひ'}, + 'u': {'': 'ふ'}, + 'e': {'': 'へ'}, + 'o': {'': 'ほ'}, + 'y': { + 'a': {'': 'ひゃ'}, + 'i': {'': 'ひぃ'}, + 'u': {'': 'ひゅ'}, + 'e': {'': 'ひぇ'}, + 'o': {'': 'ひょ'}, }, 'h': { - 'a': {'': 'は'}, - 'i': {'': 'ひ'}, - 'u': {'': 'ふ'}, - 'e': {'': 'へ'}, - 'o': {'': 'ほ'}, + 'a': {'': 'っは'}, + 'i': {'': 'っひ'}, + 'u': {'': 'っふ'}, + 'e': {'': 'っへ'}, + 'o': {'': 'っほ'}, 'y': { - 'a': {'': 'ひゃ'}, - 'i': {'': 'ひぃ'}, - 'u': {'': 'ひゅ'}, - 'e': {'': 'ひぇ'}, - 'o': {'': 'ひょ'} + 'a': {'': 'っひゃ'}, + 'i': {'': 'っひぃ'}, + 'u': {'': 'っひゅ'}, + 'e': {'': 'っひぇ'}, + 'o': {'': 'っひょ'}, }, - 'h': { - 'a': {'': 'っは'}, - 'i': {'': 'っひ'}, - 'u': {'': 'っふ'}, - 'e': {'': 'っへ'}, - 'o': {'': 'っほ'}, - 'y': { - 'a': {'': 'っひゃ'}, - 'i': {'': 'っひぃ'}, - 'u': {'': 'っひゅ'}, - 'e': {'': 'っひぇ'}, - 'o': {'': 'っひょ'} - } - } + }, + }, + 'm': { + 'a': {'': 'ま'}, + 'i': {'': 'み'}, + 'u': {'': 'む'}, + 'e': {'': 'め'}, + 'o': {'': 'も'}, + 'y': { + 'a': {'': 'みゃ'}, + 'i': {'': 'みぃ'}, + 'u': {'': 'みゅ'}, + 'e': {'': 'みぇ'}, + 'o': {'': 'みょ'}, }, 'm': { - 'a': {'': 'ま'}, - 'i': {'': 'み'}, - 'u': {'': 'む'}, - 'e': {'': 'め'}, - 'o': {'': 'も'}, + 'a': {'': 'っま'}, + 'i': {'': 'っみ'}, + 'u': {'': 'っむ'}, + 'e': {'': 'っめ'}, + 'o': {'': 'っも'}, 'y': { - 'a': {'': 'みゃ'}, - 'i': {'': 'みぃ'}, - 'u': {'': 'みゅ'}, - 'e': {'': 'みぇ'}, - 'o': {'': 'みょ'} + 'a': {'': 'っみゃ'}, + 'i': {'': 'っみぃ'}, + 'u': {'': 'っみゅ'}, + 'e': {'': 'っみぇ'}, + 'o': {'': 'っみょ'}, }, - 'm': { - 'a': {'': 'っま'}, - 'i': {'': 'っみ'}, - 'u': {'': 'っむ'}, - 'e': {'': 'っめ'}, - 'o': {'': 'っも'}, - 'y': { - 'a': {'': 'っみゃ'}, - 'i': {'': 'っみぃ'}, - 'u': {'': 'っみゅ'}, - 'e': {'': 'っみぇ'}, - 'o': {'': 'っみょ'} - } - } }, + }, + 'y': { + 'a': {'': 'や'}, + 'u': {'': 'ゆ'}, + 'o': {'': 'よ'}, + 'i': {'': 'い'}, + 'e': {'': 'いぇ'}, 'y': { - 'a': {'': 'や'}, - 'u': {'': 'ゆ'}, - 'o': {'': 'よ'}, - 'i': {'': 'い'}, - 'e': {'': 'いぇ'}, - 'y': { - 'a': {'': 'っや'}, - 'u': {'': 'っゆ'}, - 'o': {'': 'っよ'}, - 'i': {'': 'っい'}, - 'e': {'': 'っいぇ'} - } + 'a': {'': 'っや'}, + 'u': {'': 'っゆ'}, + 'o': {'': 'っよ'}, + 'i': {'': 'っい'}, + 'e': {'': 'っいぇ'}, + }, + }, + 'r': { + 'a': {'': 'ら'}, + 'i': {'': 'り'}, + 'u': {'': 'る'}, + 'e': {'': 'れ'}, + 'o': {'': 'ろ'}, + 'y': { + 'a': {'': 'りゃ'}, + 'i': {'': 'りぃ'}, + 'u': {'': 'りゅ'}, + 'e': {'': 'りぇ'}, + 'o': {'': 'りょ'}, }, 'r': { - 'a': {'': 'ら'}, - 'i': {'': 'り'}, - 'u': {'': 'る'}, - 'e': {'': 'れ'}, - 'o': {'': 'ろ'}, + 'a': {'': 'っら'}, + 'i': {'': 'っり'}, + 'u': {'': 'っる'}, + 'e': {'': 'っれ'}, + 'o': {'': 'っろ'}, 'y': { - 'a': {'': 'りゃ'}, - 'i': {'': 'りぃ'}, - 'u': {'': 'りゅ'}, - 'e': {'': 'りぇ'}, - 'o': {'': 'りょ'} + 'a': {'': 'っりゃ'}, + 'i': {'': 'っりぃ'}, + 'u': {'': 'っりゅ'}, + 'e': {'': 'っりぇ'}, + 'o': {'': 'っりょ'}, }, - 'r': { - 'a': {'': 'っら'}, - 'i': {'': 'っり'}, - 'u': {'': 'っる'}, - 'e': {'': 'っれ'}, - 'o': {'': 'っろ'}, - 'y': { - 'a': {'': 'っりゃ'}, - 'i': {'': 'っりぃ'}, - 'u': {'': 'っりゅ'}, - 'e': {'': 'っりぇ'}, - 'o': {'': 'っりょ'} - } - } }, - 'w': { - 'a': {'': 'わ'}, + }, + 'w': { + 'a': {'': 'わ'}, + 'i': {'': 'うぃ'}, + 'e': {'': 'うぇ'}, + 'o': {'': 'を'}, + 'h': { + 'a': {'': 'うぁ'}, 'i': {'': 'うぃ'}, + 'u': {'': 'う'}, 'e': {'': 'うぇ'}, - 'o': {'': 'を'}, + 'o': {'': 'うぉ'}, + }, + 'u': {'': 'う'}, + 'w': { + 'a': {'': 'っわ'}, + 'i': {'': 'っうぃ'}, + 'e': {'': 'っうぇ'}, + 'o': {'': 'っを'}, 'h': { - 'a': {'': 'うぁ'}, - 'i': {'': 'うぃ'}, - 'u': {'': 'う'}, - 'e': {'': 'うぇ'}, - 'o': {'': 'うぉ'} - }, - 'u': {'': 'う'}, - 'w': { - 'a': {'': 'っわ'}, + 'a': {'': 'っうぁ'}, 'i': {'': 'っうぃ'}, + 'u': {'': 'っう'}, 'e': {'': 'っうぇ'}, - 'o': {'': 'っを'}, - 'h': { - 'a': {'': 'っうぁ'}, - 'i': {'': 'っうぃ'}, - 'u': {'': 'っう'}, - 'e': {'': 'っうぇ'}, - 'o': {'': 'っうぉ'} - }, - 'u': {'': 'っう'} - } + 'o': {'': 'っうぉ'}, + }, + 'u': {'': 'っう'}, + }, + }, + 'g': { + 'a': {'': 'が'}, + 'i': {'': 'ぎ'}, + 'u': {'': 'ぐ'}, + 'e': {'': 'げ'}, + 'o': {'': 'ご'}, + 'y': { + 'a': {'': 'ぎゃ'}, + 'i': {'': 'ぎぃ'}, + 'u': {'': 'ぎゅ'}, + 'e': {'': 'ぎぇ'}, + 'o': {'': 'ぎょ'}, + }, + 'w': { + 'a': {'': 'ぐぁ'}, + 'i': {'': 'ぐぃ'}, + 'u': {'': 'ぐぅ'}, + 'e': {'': 'ぐぇ'}, + 'o': {'': 'ぐぉ'}, }, 'g': { - 'a': {'': 'が'}, - 'i': {'': 'ぎ'}, - 'u': {'': 'ぐ'}, - 'e': {'': 'げ'}, - 'o': {'': 'ご'}, + 'a': {'': 'っが'}, + 'i': {'': 'っぎ'}, + 'u': {'': 'っぐ'}, + 'e': {'': 'っげ'}, + 'o': {'': 'っご'}, 'y': { - 'a': {'': 'ぎゃ'}, - 'i': {'': 'ぎぃ'}, - 'u': {'': 'ぎゅ'}, - 'e': {'': 'ぎぇ'}, - 'o': {'': 'ぎょ'} + 'a': {'': 'っぎゃ'}, + 'i': {'': 'っぎぃ'}, + 'u': {'': 'っぎゅ'}, + 'e': {'': 'っぎぇ'}, + 'o': {'': 'っぎょ'}, }, 'w': { - 'a': {'': 'ぐぁ'}, - 'i': {'': 'ぐぃ'}, - 'u': {'': 'ぐぅ'}, - 'e': {'': 'ぐぇ'}, - 'o': {'': 'ぐぉ'} + 'a': {'': 'っぐぁ'}, + 'i': {'': 'っぐぃ'}, + 'u': {'': 'っぐぅ'}, + 'e': {'': 'っぐぇ'}, + 'o': {'': 'っぐぉ'}, }, - 'g': { - 'a': {'': 'っが'}, - 'i': {'': 'っぎ'}, - 'u': {'': 'っぐ'}, - 'e': {'': 'っげ'}, - 'o': {'': 'っご'}, - 'y': { - 'a': {'': 'っぎゃ'}, - 'i': {'': 'っぎぃ'}, - 'u': {'': 'っぎゅ'}, - 'e': {'': 'っぎぇ'}, - 'o': {'': 'っぎょ'} - }, - 'w': { - 'a': {'': 'っぐぁ'}, - 'i': {'': 'っぐぃ'}, - 'u': {'': 'っぐぅ'}, - 'e': {'': 'っぐぇ'}, - 'o': {'': 'っぐぉ'} - } - } + }, + }, + 'z': { + 'a': {'': 'ざ'}, + 'i': {'': 'じ'}, + 'u': {'': 'ず'}, + 'e': {'': 'ぜ'}, + 'o': {'': 'ぞ'}, + 'y': { + 'a': {'': 'じゃ'}, + 'i': {'': 'じぃ'}, + 'u': {'': 'じゅ'}, + 'e': {'': 'じぇ'}, + 'o': {'': 'じょ'}, }, 'z': { - 'a': {'': 'ざ'}, - 'i': {'': 'じ'}, - 'u': {'': 'ず'}, - 'e': {'': 'ぜ'}, - 'o': {'': 'ぞ'}, + 'a': {'': 'っざ'}, + 'i': {'': 'っじ'}, + 'u': {'': 'っず'}, + 'e': {'': 'っぜ'}, + 'o': {'': 'っぞ'}, 'y': { - 'a': {'': 'じゃ'}, - 'i': {'': 'じぃ'}, - 'u': {'': 'じゅ'}, - 'e': {'': 'じぇ'}, - 'o': {'': 'じょ'} + 'a': {'': 'っじゃ'}, + 'i': {'': 'っじぃ'}, + 'u': {'': 'っじゅ'}, + 'e': {'': 'っじぇ'}, + 'o': {'': 'っじょ'}, }, - 'z': { - 'a': {'': 'っざ'}, - 'i': {'': 'っじ'}, - 'u': {'': 'っず'}, - 'e': {'': 'っぜ'}, - 'o': {'': 'っぞ'}, - 'y': { - 'a': {'': 'っじゃ'}, - 'i': {'': 'っじぃ'}, - 'u': {'': 'っじゅ'}, - 'e': {'': 'っじぇ'}, - 'o': {'': 'っじょ'} - } - } + }, + }, + 'd': { + 'a': {'': 'だ'}, + 'i': {'': 'ぢ'}, + 'u': {'': 'づ'}, + 'e': {'': 'で'}, + 'o': {'': 'ど'}, + 'y': { + 'a': {'': 'ぢゃ'}, + 'i': {'': 'ぢぃ'}, + 'u': {'': 'ぢゅ'}, + 'e': {'': 'ぢぇ'}, + 'o': {'': 'ぢょ'}, + }, + 'h': { + 'a': {'': 'でゃ'}, + 'i': {'': 'でぃ'}, + 'u': {'': 'でゅ'}, + 'e': {'': 'でぇ'}, + 'o': {'': 'でょ'}, + }, + 'w': { + 'a': {'': 'どぁ'}, + 'i': {'': 'どぃ'}, + 'u': {'': 'どぅ'}, + 'e': {'': 'どぇ'}, + 'o': {'': 'どぉ'}, }, 'd': { - 'a': {'': 'だ'}, - 'i': {'': 'ぢ'}, - 'u': {'': 'づ'}, - 'e': {'': 'で'}, - 'o': {'': 'ど'}, + 'a': {'': 'っだ'}, + 'i': {'': 'っぢ'}, + 'u': {'': 'っづ'}, + 'e': {'': 'っで'}, + 'o': {'': 'っど'}, 'y': { - 'a': {'': 'ぢゃ'}, - 'i': {'': 'ぢぃ'}, - 'u': {'': 'ぢゅ'}, - 'e': {'': 'ぢぇ'}, - 'o': {'': 'ぢょ'} + 'a': {'': 'っぢゃ'}, + 'i': {'': 'っぢぃ'}, + 'u': {'': 'っぢゅ'}, + 'e': {'': 'っぢぇ'}, + 'o': {'': 'っぢょ'}, }, 'h': { - 'a': {'': 'でゃ'}, - 'i': {'': 'でぃ'}, - 'u': {'': 'でゅ'}, - 'e': {'': 'でぇ'}, - 'o': {'': 'でょ'} + 'a': {'': 'っでゃ'}, + 'i': {'': 'っでぃ'}, + 'u': {'': 'っでゅ'}, + 'e': {'': 'っでぇ'}, + 'o': {'': 'っでょ'}, }, 'w': { - 'a': {'': 'どぁ'}, - 'i': {'': 'どぃ'}, - 'u': {'': 'どぅ'}, - 'e': {'': 'どぇ'}, - 'o': {'': 'どぉ'} + 'a': {'': 'っどぁ'}, + 'i': {'': 'っどぃ'}, + 'u': {'': 'っどぅ'}, + 'e': {'': 'っどぇ'}, + 'o': {'': 'っどぉ'}, }, - 'd': { - 'a': {'': 'っだ'}, - 'i': {'': 'っぢ'}, - 'u': {'': 'っづ'}, - 'e': {'': 'っで'}, - 'o': {'': 'っど'}, - 'y': { - 'a': {'': 'っぢゃ'}, - 'i': {'': 'っぢぃ'}, - 'u': {'': 'っぢゅ'}, - 'e': {'': 'っぢぇ'}, - 'o': {'': 'っぢょ'} - }, - 'h': { - 'a': {'': 'っでゃ'}, - 'i': {'': 'っでぃ'}, - 'u': {'': 'っでゅ'}, - 'e': {'': 'っでぇ'}, - 'o': {'': 'っでょ'} - }, - 'w': { - 'a': {'': 'っどぁ'}, - 'i': {'': 'っどぃ'}, - 'u': {'': 'っどぅ'}, - 'e': {'': 'っどぇ'}, - 'o': {'': 'っどぉ'} - } - } + }, + }, + 'b': { + 'a': {'': 'ば'}, + 'i': {'': 'び'}, + 'u': {'': 'ぶ'}, + 'e': {'': 'べ'}, + 'o': {'': 'ぼ'}, + 'y': { + 'a': {'': 'びゃ'}, + 'i': {'': 'びぃ'}, + 'u': {'': 'びゅ'}, + 'e': {'': 'びぇ'}, + 'o': {'': 'びょ'}, }, 'b': { - 'a': {'': 'ば'}, - 'i': {'': 'び'}, - 'u': {'': 'ぶ'}, - 'e': {'': 'べ'}, - 'o': {'': 'ぼ'}, + 'a': {'': 'っば'}, + 'i': {'': 'っび'}, + 'u': {'': 'っぶ'}, + 'e': {'': 'っべ'}, + 'o': {'': 'っぼ'}, 'y': { - 'a': {'': 'びゃ'}, - 'i': {'': 'びぃ'}, - 'u': {'': 'びゅ'}, - 'e': {'': 'びぇ'}, - 'o': {'': 'びょ'} + 'a': {'': 'っびゃ'}, + 'i': {'': 'っびぃ'}, + 'u': {'': 'っびゅ'}, + 'e': {'': 'っ���ぇ'}, + 'o': {'': 'っびょ'}, }, - 'b': { - 'a': {'': 'っば'}, - 'i': {'': 'っび'}, - 'u': {'': 'っぶ'}, - 'e': {'': 'っべ'}, - 'o': {'': 'っぼ'}, - 'y': { - 'a': {'': 'っびゃ'}, - 'i': {'': 'っびぃ'}, - 'u': {'': 'っびゅ'}, - 'e': {'': 'っ���ぇ'}, - 'o': {'': 'っびょ'} - } - } + }, + }, + 'p': { + 'a': {'': 'ぱ'}, + 'i': {'': 'ぴ'}, + 'u': {'': 'ぷ'}, + 'e': {'': 'ぺ'}, + 'o': {'': 'ぽ'}, + 'y': { + 'a': {'': 'ぴゃ'}, + 'i': {'': 'ぴぃ'}, + 'u': {'': 'ぴゅ'}, + 'e': {'': 'ぴぇ'}, + 'o': {'': 'ぴょ'}, }, 'p': { - 'a': {'': 'ぱ'}, - 'i': {'': 'ぴ'}, - 'u': {'': 'ぷ'}, - 'e': {'': 'ぺ'}, - 'o': {'': 'ぽ'}, + 'a': {'': 'っぱ'}, + 'i': {'': 'っぴ'}, + 'u': {'': 'っぷ'}, + 'e': {'': 'っぺ'}, + 'o': {'': 'っぽ'}, 'y': { - 'a': {'': 'ぴゃ'}, - 'i': {'': 'ぴぃ'}, - 'u': {'': 'ぴゅ'}, - 'e': {'': 'ぴぇ'}, - 'o': {'': 'ぴょ'} + 'a': {'': 'っぴゃ'}, + 'i': {'': 'っぴぃ'}, + 'u': {'': 'っぴゅ'}, + 'e': {'': 'っぴぇ'}, + 'o': {'': 'っぴょ'}, }, - 'p': { - 'a': {'': 'っぱ'}, - 'i': {'': 'っぴ'}, - 'u': {'': 'っぷ'}, - 'e': {'': 'っぺ'}, - 'o': {'': 'っぽ'}, - 'y': { - 'a': {'': 'っぴゃ'}, - 'i': {'': 'っぴぃ'}, - 'u': {'': 'っぴゅ'}, - 'e': {'': 'っぴぇ'}, - 'o': {'': 'っぴょ'} - } - } }, - 'v': { - 'a': {'': 'ゔぁ'}, + }, + 'v': { + 'a': {'': 'ゔぁ'}, + 'i': {'': 'ゔぃ'}, + 'u': {'': 'ゔ'}, + 'e': {'': 'ゔぇ'}, + 'o': {'': 'ゔぉ'}, + 'y': { + 'a': {'': 'ゔゃ'}, 'i': {'': 'ゔぃ'}, - 'u': {'': 'ゔ'}, + 'u': {'': 'ゔゅ'}, 'e': {'': 'ゔぇ'}, - 'o': {'': 'ゔぉ'}, + 'o': {'': 'ゔょ'}, + }, + 'v': { + 'a': {'': 'っゔぁ'}, + 'i': {'': 'っゔぃ'}, + 'u': {'': 'っゔ'}, + 'e': {'': 'っゔぇ'}, + 'o': {'': 'っゔぉ'}, 'y': { - 'a': {'': 'ゔゃ'}, - 'i': {'': 'ゔぃ'}, - 'u': {'': 'ゔゅ'}, - 'e': {'': 'ゔぇ'}, - 'o': {'': 'ゔょ'} - }, - 'v': { - 'a': {'': 'っゔぁ'}, + 'a': {'': 'っゔゃ'}, 'i': {'': 'っゔぃ'}, - 'u': {'': 'っゔ'}, + 'u': {'': 'っゔゅ'}, 'e': {'': 'っゔぇ'}, - 'o': {'': 'っゔぉ'}, - 'y': { - 'a': {'': 'っゔゃ'}, - 'i': {'': 'っゔぃ'}, - 'u': {'': 'っゔゅ'}, - 'e': {'': 'っゔぇ'}, - 'o': {'': 'っゔょ'} - } - } - }, - 'q': { - 'y': { - 'a': {'': 'くゃ'}, - 'i': {'': 'くぃ'}, - 'u': {'': 'くゅ'}, - 'e': {'': 'くぇ'}, - 'o': {'': 'くょ'} - }, - 'w': { - 'a': {'': 'くぁ'}, - 'i': {'': 'くぃ'}, - 'u': {'': 'くぅ'}, - 'e': {'': 'くぇ'}, - 'o': {'': 'くぉ'} + 'o': {'': 'っゔょ'}, }, + }, + }, + 'q': { + 'y': { + 'a': {'': 'くゃ'}, + 'i': {'': 'くぃ'}, + 'u': {'': 'くゅ'}, + 'e': {'': 'くぇ'}, + 'o': {'': 'くょ'}, + }, + 'w': { 'a': {'': 'くぁ'}, 'i': {'': 'くぃ'}, 'u': {'': 'くぅ'}, 'e': {'': 'くぇ'}, 'o': {'': 'くぉ'}, - 'q': { - 'y': { - 'a': {'': 'っくゃ'}, - 'i': {'': 'っくぃ'}, - 'u': {'': 'っくゅ'}, - 'e': {'': 'っくぇ'}, - 'o': {'': 'っくょ'} - }, - 'w': { - 'a': {'': 'っくぁ'}, - 'i': {'': 'っくぃ'}, - 'u': {'': 'っくぅ'}, - 'e': {'': 'っくぇ'}, - 'o': {'': 'っくぉ'} - }, - 'a': {'': 'っくぁ'}, - 'i': {'': 'っくぃ'}, - 'u': {'': 'っくぅ'}, - 'e': {'': 'っくぇ'}, - 'o': {'': 'っくぉ'} - } }, - 'f': { + 'a': {'': 'くぁ'}, + 'i': {'': 'くぃ'}, + 'u': {'': 'くぅ'}, + 'e': {'': 'くぇ'}, + 'o': {'': 'くぉ'}, + 'q': { 'y': { - 'a': {'': 'ふゃ'}, - 'i': {'': 'ふぃ'}, - 'u': {'': 'ふゅ'}, - 'e': {'': 'ふぇ'}, - 'o': {'': 'ふょ'} + 'a': {'': 'っくゃ'}, + 'i': {'': 'っくぃ'}, + 'u': {'': 'っくゅ'}, + 'e': {'': 'っくぇ'}, + 'o': {'': 'っくょ'}, }, 'w': { - 'a': {'': 'ふぁ'}, - 'i': {'': 'ふぃ'}, - 'u': {'': 'ふぅ'}, - 'e': {'': 'ふぇ'}, - 'o': {'': 'ふぉ'} + 'a': {'': 'っくぁ'}, + 'i': {'': 'っくぃ'}, + 'u': {'': 'っくぅ'}, + 'e': {'': 'っくぇ'}, + 'o': {'': 'っくぉ'}, }, + 'a': {'': 'っくぁ'}, + 'i': {'': 'っくぃ'}, + 'u': {'': 'っくぅ'}, + 'e': {'': 'っくぇ'}, + 'o': {'': 'っくぉ'}, + }, + }, + 'f': { + 'y': { + 'a': {'': 'ふゃ'}, + 'i': {'': 'ふぃ'}, + 'u': {'': 'ふゅ'}, + 'e': {'': 'ふぇ'}, + 'o': {'': 'ふょ'}, + }, + 'w': { 'a': {'': 'ふぁ'}, 'i': {'': 'ふぃ'}, - 'u': {'': 'ふ'}, + 'u': {'': 'ふぅ'}, 'e': {'': 'ふぇ'}, 'o': {'': 'ふぉ'}, - 'f': { - 'y': { - 'a': {'': 'っふゃ'}, - 'i': {'': 'っふぃ'}, - 'u': {'': 'っふゅ'}, - 'e': {'': 'っふぇ'}, - 'o': {'': 'っふょ'} - }, - 'w': { - 'a': {'': 'っふぁ'}, - 'i': {'': 'っふぃ'}, - 'u': {'': 'っふぅ'}, - 'e': {'': 'っふぇ'}, - 'o': {'': 'っふぉ'} - }, - 'a': {'': 'っふぁ'}, + }, + 'a': {'': 'ふぁ'}, + 'i': {'': 'ふぃ'}, + 'u': {'': 'ふ'}, + 'e': {'': 'ふぇ'}, + 'o': {'': 'ふぉ'}, + 'f': { + 'y': { + 'a': {'': 'っふゃ'}, 'i': {'': 'っふぃ'}, - 'u': {'': 'っふ'}, + 'u': {'': 'っふゅ'}, 'e': {'': 'っふぇ'}, - 'o': {'': 'っふぉ'} - } - }, - '.': {'': '。'}, - ',': {'': '、'}, - ':': {'': ':'}, - '/': {'': '・'}, - '!': {'': '!'}, - '?': {'': '?'}, - '~': {'': '〜'}, - '-': {'': 'ー'}, - '‘': {'': '「'}, - '’': {'': '」'}, - '“': {'': '『'}, - '”': {'': '』'}, - '[': {'': '['}, - ']': {'': ']'}, - '(': {'': '('}, - ')': {'': ')'}, - '{': {'': '{'}, - '}': {'': '}'}, - ' ': {'': ' '}, - 'x': { - 'n': {'': 'ん'}, - 't': { - 'u': {'': 'っ'}, - 's': { - 'u': {'': 'っ'} - } + 'o': {'': 'っふょ'}, }, 'w': { - 'a': {'': 'ゎ'} - }, - 'k': { - 'a': {'': 'ヵ'}, - 'e': {'': 'ヶ'} + 'a': {'': 'っふぁ'}, + 'i': {'': 'っふぃ'}, + 'u': {'': 'っふぅ'}, + 'e': {'': 'っふぇ'}, + 'o': {'': 'っふぉ'}, }, - 'c': { - 'a': {'': 'ヵ'}, - 'e': {'': 'ヶ'} + 'a': {'': 'っふぁ'}, + 'i': {'': 'っふぃ'}, + 'u': {'': 'っふ'}, + 'e': {'': 'っふぇ'}, + 'o': {'': 'っふぉ'}, + }, + }, + '.': {'': '。'}, + ',': {'': '、'}, + ':': {'': ':'}, + '/': {'': '・'}, + '!': {'': '!'}, + '?': {'': '?'}, + '~': {'': '〜'}, + '-': {'': 'ー'}, + '‘': {'': '「'}, + '’': {'': '」'}, + '“': {'': '『'}, + '”': {'': '』'}, + '[': {'': '['}, + ']': {'': ']'}, + '(': {'': '('}, + ')': {'': ')'}, + '{': {'': '{'}, + '}': {'': '}'}, + ' ': {'': ' '}, + 'x': { + 'n': {'': 'ん'}, + 't': { + 'u': {'': 'っ'}, + 's': { + 'u': {'': 'っ'}, }, - 'a': {'': 'ぁ'}, + }, + 'w': { + 'a': {'': 'ゎ'}, + }, + 'k': { + 'a': {'': 'ヵ'}, + 'e': {'': 'ヶ'}, + }, + 'c': { + 'a': {'': 'ヵ'}, + 'e': {'': 'ヶ'}, + }, + 'a': {'': 'ぁ'}, + 'i': {'': 'ぃ'}, + 'u': {'': 'ぅ'}, + 'e': {'': 'ぇ'}, + 'o': {'': 'ぉ'}, + 'y': { + 'a': {'': 'ゃ'}, 'i': {'': 'ぃ'}, - 'u': {'': 'ぅ'}, + 'u': {'': 'ゅ'}, 'e': {'': 'ぇ'}, - 'o': {'': 'ぉ'}, - 'y': { - 'a': {'': 'ゃ'}, - 'i': {'': 'ぃ'}, - 'u': {'': 'ゅ'}, - 'e': {'': 'ぇ'}, - 'o': {'': 'ょ'} - } + 'o': {'': 'ょ'}, }, - 'c': { - 'a': {'': 'か'}, - 'i': {'': 'き'}, - 'u': {'': 'く'}, - 'e': {'': 'け'}, - 'o': {'': 'こ'}, + }, + 'c': { + 'a': {'': 'か'}, + 'i': {'': 'き'}, + 'u': {'': 'く'}, + 'e': {'': 'け'}, + 'o': {'': 'こ'}, + 'y': { + 'a': {'': 'ちゃ'}, + 'i': {'': 'ちぃ'}, + 'u': {'': 'ちゅ'}, + 'e': {'': 'ちぇ'}, + 'o': {'': 'ちょ'}, + }, + 'h': { + 'a': {'': 'ちゃ'}, + 'i': {'': 'ち'}, + 'u': {'': 'ちゅ'}, + 'e': {'': 'ちぇ'}, + 'o': {'': 'ちょ'}, 'y': { 'a': {'': 'ちゃ'}, 'i': {'': 'ちぃ'}, 'u': {'': 'ちゅ'}, 'e': {'': 'ちぇ'}, - 'o': {'': 'ちょ'} - }, - 'h': { - 'a': {'': 'ちゃ'}, - 'i': {'': 'ち'}, - 'u': {'': 'ちゅ'}, - 'e': {'': 'ちぇ'}, 'o': {'': 'ちょ'}, - 'y': { - 'a': {'': 'ちゃ'}, - 'i': {'': 'ちぃ'}, - 'u': {'': 'ちゅ'}, - 'e': {'': 'ちぇ'}, - 'o': {'': 'ちょ'} - } }, - 'c': { - 'a': {'': 'っか'}, - 'i': {'': 'っき'}, - 'u': {'': 'っく'}, - 'e': {'': 'っけ'}, - 'o': {'': 'っこ'}, + }, + 'c': { + 'a': {'': 'っか'}, + 'i': {'': 'っき'}, + 'u': {'': 'っく'}, + 'e': {'': 'っけ'}, + 'o': {'': 'っこ'}, + 'y': { + 'a': {'': 'っちゃ'}, + 'i': {'': 'っちぃ'}, + 'u': {'': 'っちゅ'}, + 'e': {'': 'っちぇ'}, + 'o': {'': 'っちょ'}, + }, + 'h': { + 'a': {'': 'っちゃ'}, + 'i': {'': 'っち'}, + 'u': {'': 'っちゅ'}, + 'e': {'': 'っちぇ'}, + 'o': {'': 'っちょ'}, 'y': { 'a': {'': 'っちゃ'}, 'i': {'': 'っちぃ'}, 'u': {'': 'っちゅ'}, 'e': {'': 'っちぇ'}, - 'o': {'': 'っちょ'} - }, - 'h': { - 'a': {'': 'っちゃ'}, - 'i': {'': 'っち'}, - 'u': {'': 'っちゅ'}, - 'e': {'': 'っちぇ'}, 'o': {'': 'っちょ'}, - 'y': { - 'a': {'': 'っちゃ'}, - 'i': {'': 'っちぃ'}, - 'u': {'': 'っちゅ'}, - 'e': {'': 'っちぇ'}, - 'o': {'': 'っちょ'} - } - } - } + }, + }, }, - 'j': { + }, + 'j': { + 'a': {'': 'じゃ'}, + 'i': {'': 'じ'}, + 'u': {'': 'じゅ'}, + 'e': {'': 'じぇ'}, + 'o': {'': 'じょ'}, + 'y': { 'a': {'': 'じゃ'}, - 'i': {'': 'じ'}, + 'i': {'': 'じぃ'}, 'u': {'': 'じゅ'}, 'e': {'': 'じぇ'}, 'o': {'': 'じょ'}, + }, + 'j': { + 'a': {'': 'っじゃ'}, + 'i': {'': 'っじ'}, + 'u': {'': 'っじゅ'}, + 'e': {'': 'っじぇ'}, + 'o': {'': 'っじょ'}, 'y': { - 'a': {'': 'じゃ'}, - 'i': {'': 'じぃ'}, - 'u': {'': 'じゅ'}, - 'e': {'': 'じぇ'}, - 'o': {'': 'じょ'} - }, - 'j': { 'a': {'': 'っじゃ'}, - 'i': {'': 'っじ'}, + 'i': {'': 'っじぃ'}, 'u': {'': 'っじゅ'}, 'e': {'': 'っじぇ'}, 'o': {'': 'っじょ'}, - 'y': { - 'a': {'': 'っじゃ'}, - 'i': {'': 'っじぃ'}, - 'u': {'': 'っじゅ'}, - 'e': {'': 'っじぇ'}, - 'o': {'': 'っじょ'} - } - } - }, - 'l': { - 't': { - 'u': {'': 'っ'}, - 's': { - 'u': {'': 'っ'} - } }, - 'w': { - 'a': {'': 'ゎ'} - }, - 'k': { - 'a': {'': 'ヵ'}, - 'e': {'': 'ヶ'} - }, - 'c': { - 'a': {'': 'ヵ'}, - 'e': {'': 'ヶ'} + }, + }, + 'l': { + 't': { + 'u': {'': 'っ'}, + 's': { + 'u': {'': 'っ'}, }, - 'a': {'': 'ぁ'}, + }, + 'w': { + 'a': {'': 'ゎ'}, + }, + 'k': { + 'a': {'': 'ヵ'}, + 'e': {'': 'ヶ'}, + }, + 'c': { + 'a': {'': 'ヵ'}, + 'e': {'': 'ヶ'}, + }, + 'a': {'': 'ぁ'}, + 'i': {'': 'ぃ'}, + 'u': {'': 'ぅ'}, + 'e': {'': 'ぇ'}, + 'o': {'': 'ぉ'}, + 'y': { + 'a': {'': 'ゃ'}, 'i': {'': 'ぃ'}, - 'u': {'': 'ぅ'}, + 'u': {'': 'ゅ'}, 'e': {'': 'ぇ'}, - 'o': {'': 'ぉ'}, - 'y': { - 'a': {'': 'ゃ'}, - 'i': {'': 'ぃ'}, - 'u': {'': 'ゅ'}, - 'e': {'': 'ぇ'}, - 'o': {'': 'ょ'} - } - } + 'o': {'': 'ょ'}, + }, }, -); +}; diff --git a/lib/src/models/romanization/romanization.dart b/lib/src/models/romanization/romanization.dart index 006ae18..f81b7fc 100644 --- a/lib/src/models/romanization/romanization.dart +++ b/lib/src/models/romanization/romanization.dart @@ -1,14 +1,20 @@ -import 'package:equatable/equatable.dart'; - part 'hepburn.dart'; -/// A class containing maps that indicates how to convert between kana +/// An enum containing maps that indicates how to convert between kana /// characters and romaji. /// -/// Currently only supports [hepburn] +/// Currently only supports [hepburn]. /// (https://en.wikipedia.org/wiki/Hepburn_romanization). -class Romanization extends Equatable { - const Romanization._({ +enum Romanization { + /// The Hepburn romanization map. (https://en.wikipedia.org/wiki/Hepburn_romanization) + hepburn( + name: 'Hepburn', + kanaToRomajiMap: _hepburnKanaToRomajiMap, + romajiToKanaMap: _hepburnRomajiToKanaMap, + ), + ; + + const Romanization({ required this.name, required this.kanaToRomajiMap, required this.romajiToKanaMap, @@ -23,15 +29,6 @@ class Romanization extends Equatable { /// The map that can be used to convert from romaji to kana. final Map romajiToKanaMap; - /// The Hepburn romanization map. (https://en.wikipedia.org/wiki/Hepburn_romanization) - static const hepburn = _hepburn; - - /// Indicates if this is [Romanization.hepburn]. - bool get isHepburn => this == hepburn; - - @override - String toString() => '$Romanization ($name)'; - @override - List get props => [name]; + String toString() => '$Romanization($name)'; } diff --git a/lib/src/utils.dart b/lib/src/utils.dart index dd9d848..c149e6f 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -1,50 +1,33 @@ -import 'package:equatable/equatable.dart'; +import 'dart:core'; -/// {@template tuple} -/// A data class that contains two elements ([left] and [right]). -/// {@endtemplate} -class Tuple extends Equatable { - /// {@macro tuple} - const Tuple(this.left, this.right); - - /// The first element. - final T1 left; - - /// The second element. - final T2 right; - - @override - bool get stringify => true; - - @override - List get props => [left, right]; -} - -/// Extensions that make handling collections of [Tuple]s more convenient. -extension TupleIterableUtils on Iterable> { +/// Extensions that make handling collections of tuple records more convenient. +extension TupleRecordIterableExtensions on Iterable<(T1, T2)> { /// Returns a new [Iterator] that contains all `left` elements. - Iterable get allLefts => map((t) => t.left); + Iterable get allLefts => map((t) => t.$1); /// Returns a new [Iterator] that contains all `right` elements. - Iterable get allRights => map((t) => t.right); + Iterable get allRights => map((t) => t.$2); } /// Extensions that make handling [String]s more convenient. -extension StringUtils on String { +extension StringExtensions on String { /// Returns a list of every character in this `String`. List get chars => split(''); /// Returns the reverse of this string. /// + // cspell: disable /// ```dart /// "Hello".reversed; // "olleH" /// ``` + // cspell: enable String get reversed => chars.reversed.join(); /// The code unit for the first character in this `String`. /// /// Shorthand for [codeUnitAt(0)]. int get code { + assert(length == 1, 'String must be exactly one character long.'); return codeUnitAt(0); } diff --git a/pubspec.lock b/pubspec.lock index ceb69eb..2a8db91 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,386 +5,401 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "67.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + url: "https://pub.dev" source: hosted - version: "0.39.14" + version: "6.4.1" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + url: "https://pub.dev" source: hosted - version: "1.6.0" + version: "2.5.0" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "5bbf32bc9e518d41ec49718e2931cd4527292c9b0c6d2dffcf7fe6b9a8a8cf72" + url: "https://pub.dev" source: hosted version: "2.1.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + sha256: "8e36feea6de5ea69f2199f29cf42a450a855738c498b57c0b980e2d3cca9c362" + url: "https://pub.dev" source: hosted version: "1.2.0" - cli_util: - dependency: transitive + checks: + dependency: "direct main" description: - name: cli_util - url: "https://pub.dartlang.org" + name: checks + sha256: aad431b45a8ae2fa26db8c22e385b9cdec73f72986a1d9d9f2017f4c39ecf5c9 + url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.3.0" collection: - dependency: transitive + dependency: "direct main" description: name: collection - url: "https://pub.dartlang.org" + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.19.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.1.1" coverage: - dependency: transitive + dependency: "direct dev" description: name: coverage - url: "https://pub.dartlang.org" + sha256: c1fb2dce3c0085f39dc72668e85f8e0210ec7de05345821ff58530567df345a5 + url: "https://pub.dev" source: hosted - version: "0.14.2" + version: "1.9.2" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 + url: "https://pub.dev" source: hosted - version: "2.1.5" - csslib: + version: "3.0.5" + file: dependency: transitive description: - name: csslib - url: "https://pub.dartlang.org" + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" source: hosted - version: "0.16.1" - equatable: - dependency: "direct main" + version: "6.1.4" + frontend_server_client: + dependency: transitive description: - name: equatable - url: "https://pub.dartlang.org" + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "4.0.0" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" source: hosted - version: "1.2.0" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.0+3" + version: "2.1.2" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "40f592dd352890c3b60fec1b68e786cefb9603e05ff303dbc4dda49b304ecdf4" + url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "4.1.0" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" source: hosted - version: "0.3.4" + version: "1.0.4" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.3" - json_annotation: - dependency: transitive - description: - name: json_annotation - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - lcov: - dependency: transitive - description: - name: lcov - url: "https://pub.dartlang.org" + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" source: hosted - version: "5.7.0" + version: "0.7.1" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" source: hosted - version: "0.11.4" + version: "1.2.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.12.16+1" meta: - dependency: transitive + dependency: "direct main" description: name: meta - url: "https://pub.dartlang.org" + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.16.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + url: "https://pub.dev" source: hosted - version: "0.9.6+3" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" + version: "1.0.6" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.dartlang.org" + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" source: hosted - version: "1.4.12" + version: "2.0.2" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" source: hosted - version: "1.9.3" + version: "2.1.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "2ad4cddff7f5cc0e2d13069f2a3f7a73ca18f66abd6f5ecf215219cdb3638edb" + url: "https://pub.dev" source: hosted version: "1.8.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.0" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + sha256: "05955e3de2683e1746222efd14b775df7131139e07695dc8e24650f6b4204504" + url: "https://pub.dev" source: hosted version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" source: hosted - version: "1.4.4" + version: "2.1.4" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" source: hosted - version: "0.7.7" + version: "1.4.2" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.dartlang.org" + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.0.2" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.dartlang.org" + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" source: hosted - version: "0.2.8" + version: "1.1.3" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + url: "https://pub.dev" source: hosted - version: "0.2.3" + version: "2.0.0" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.dartlang.org" + sha256: "8c463326277f68a628abab20580047b419c2ff66756fd0affd451f73f9508c11" + url: "https://pub.dev" source: hosted version: "2.1.0" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.dartlang.org" + sha256: "52de2200bb098de739794c82d09c41ac27b2e42fd7e23cce7b9c74bf653c7296" + url: "https://pub.dev" source: hosted version: "0.10.10" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: d5f89a9e52b36240a80282b3dc0667dd36e53459717bb17b8fb102d30496606a + url: "https://pub.dev" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: f8d9f247e2f9f90e32d1495ff32dac7e4ae34ffa7194c5ff8fcc0fd0e52df774 + url: "https://pub.dev" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: db47e4797198ee601990820437179bb90219f918962318d494ada2b4b11e6f6d + url: "https://pub.dev" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: dd11571b8a03f7cadcf91ec26a77e02bfbd6bbba2a512924d3116646b4198fc4 + url: "https://pub.dev" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a88162591b02c1f3a3db3af8ce1ea2b374bd75a7bb8d5e353bcfbdc79d719830 + url: "https://pub.dev" source: hosted version: "1.2.0" test: dependency: "direct dev" description: name: test - url: "https://pub.dartlang.org" + sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" + url: "https://pub.dev" source: hosted - version: "1.16.5" + version: "1.25.8" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" source: hosted - version: "0.2.19" + version: "0.7.3" test_core: dependency: transitive description: name: test_core - url: "https://pub.dartlang.org" + sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" + url: "https://pub.dev" source: hosted - version: "0.3.15" - test_coverage: - dependency: "direct dev" - description: - name: test_coverage - url: "https://pub.dartlang.org" - source: hosted - version: "0.5.0" + version: "0.6.5" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + url: "https://pub.dev" source: hosted version: "1.3.0" very_good_analysis: dependency: "direct dev" description: name: very_good_analysis - url: "https://pub.dartlang.org" + sha256: "1fb637c0022034b1f19ea2acb42a3603cbd8314a470646a59a2fb01f5f3a8629" + url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "6.0.0" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.dartlang.org" + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "14.2.5" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" source: hosted - version: "0.9.7+15" + version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "3.0.1" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.dartlang.org" + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" source: hosted - version: "0.7.3" + version: "1.2.1" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "3.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=3.4.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 6765848..0d85aaa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,16 +2,18 @@ name: kana_kit description: > A Dart library for for detecting and transliterating Hiragana, Katakana, and Romaji. -version: 2.0.0 +version: 2.1.0 repository: https://github.com/jeroen-meijer/kana_kit environment: - sdk: ">=2.12.0 <3.0.0" + sdk: '>=3.0.0 <4.0.0' dependencies: - equatable: ^2.0.0 + checks: ^0.3.0 + collection: ^1.19.0 + meta: ^1.16.0 dev_dependencies: - test: 1.16.5 - test_coverage: 0.5.0 - very_good_analysis: 1.0.4 + coverage: 1.9.2 + test: 1.25.8 + very_good_analysis: 6.0.0 diff --git a/test/checks_test.dart b/test/checks_test.dart index 31b4331..c09b48d 100644 --- a/test/checks_test.dart +++ b/test/checks_test.dart @@ -1,3 +1,6 @@ +// cspell: disable + +import 'package:checks/checks.dart'; import 'package:kana_kit/kana_kit.dart'; import 'package:test/test.dart'; @@ -15,7 +18,12 @@ CheckerTest checkerTest(Checker checker, String checkResultName) { return test( '${formatInput(input)} is ${!shouldPass ? 'NOT ' : ''}$checkResultName', () { - expect(checker(input), shouldPass ? isTrue : isFalse); + final testCheck = check(checker(input)); + if (shouldPass) { + testCheck.isTrue(); + } else { + testCheck.isFalse(); + } }, ); }; @@ -55,6 +63,7 @@ void main() { the(input: 'a!b&cーd', shouldPass: false); the(input: 'hello', shouldPass: false); }); + group('isJapanese', () { final throwsAssertionErrorWithInputIs = checkerAssertionTest(kanaKit.isJapanese); @@ -96,6 +105,7 @@ void main() { shouldPass: true, ); }); + group('isKana', () { final throwsAssertionErrorWithInputIs = checkerAssertionTest(kanaKit.isKana); @@ -109,6 +119,7 @@ void main() { the(input: 'あAア', shouldPass: false); the(input: 'アーあ', shouldPass: true); }); + group('isHiragana', () { final throwsAssertionErrorWithInputIs = checkerAssertionTest(kanaKit.isHiragana); @@ -122,6 +133,7 @@ void main() { the(input: 'あア', shouldPass: false); the(input: 'げーむ', shouldPass: true); }); + group('isKatakana', () { final throwsAssertionErrorWithInputIs = checkerAssertionTest(kanaKit.isKatakana); @@ -155,6 +167,7 @@ void main() { the(input: '隻。', shouldPass: false); the(input: '🐸', shouldPass: false); }); + group('isMixed', () { final throwsAssertionErrorWithInputIs = checkerAssertionTest(kanaKit.isMixed); @@ -176,6 +189,7 @@ void main() { the(input: 'あ', shouldPass: false); the(input: 'ア', shouldPass: false); }); + group('(passKanji: false)', () { final the = checkerTest( kanaKit.copyWithConfig(passKanji: false).isMixed, diff --git a/test/conversions_test.dart b/test/conversions_test.dart index 53feaa4..cb96f21 100644 --- a/test/conversions_test.dart +++ b/test/conversions_test.dart @@ -1,3 +1,6 @@ +// cspell: disable + +import 'package:checks/checks.dart'; import 'package:kana_kit/kana_kit.dart'; import 'package:test/test.dart'; @@ -13,28 +16,27 @@ typedef ConverterAssertionTest = void Function(String input); ConverterTest converterTest(Converter converter) { return ({required input, shouldBecome, shouldNotBecome}) { - if (shouldNotBecome != null) { - final shouldChange = input == shouldNotBecome; - return test( - shouldChange - ? '${formatInput(input)} should change' - : '${formatInput(input)} does NOT become ' - '${formatInput(shouldNotBecome)}', - () { - expect(converter(input), isNot(shouldBecome)); - }, - ); - } else { - final shouldNotChange = input == shouldBecome; - return test( - shouldNotChange - ? '${formatInput(input)} should return the same' - : '${formatInput(input)} becomes ${formatInput(shouldBecome)}', - () { - expect(converter(input), shouldBecome); - }, - ); - } + return switch ((shouldBecome, shouldNotBecome)) { + (final shouldBecome, _) when shouldBecome != null => test( + input == shouldBecome + ? '${formatInput(input)} should return the same' + : '${formatInput(input)} becomes ${formatInput(shouldBecome)}', + () { + check(converter(input)).equals(shouldBecome); + }, + ), + (_, final shouldNotBecome) when shouldNotBecome != null => test( + input == shouldNotBecome + ? '${formatInput(input)} should change' + : '${formatInput(input)} does NOT become ' + '${formatInput(shouldNotBecome)}', + () { + check(converter(input)).not((it) => it.equals(shouldNotBecome)); + }, + ), + _ => + throw ArgumentError('shouldBecome or shouldNotBecome must be provided'), + }; }; } @@ -43,10 +45,7 @@ ConverterAssertionTest converterAssertionTest(Converter checker) { return test( 'throws AssertionError when input is ${formatInput(input)}', () { - expect( - () => checker(input), - throwsA(isA()), - ); + check(() => checker(input)).throws(); }, ); }; @@ -60,6 +59,7 @@ void main() { final the = converterTest( kanaKit.copyWithConfig(upcaseKatakana: false).toRomaji, ); + the(input: '', shouldBecome: ''); the(input: '.', shouldBecome: '.'); the(input: 'hello', shouldBecome: 'hello'); @@ -97,11 +97,19 @@ void main() { the(input: 'んよ んあ んゆ', shouldBecome: "n'yo n'a n'yu"); the(input: 'シンヨ', shouldBecome: "shin'yo"); }); + + group('edge cases containing "ゎー" or "ヮー"', () { + the(input: 'しーくゎーさー', shouldBecome: 'shiikuwaasaa'); + the(input: 'しまうゎー', shouldBecome: 'shimauwaa'); + the(input: 'シークヮーサー', shouldBecome: 'shiikuwaasaa'); + the(input: 'シマウヮー', shouldBecome: 'shimauwaa'); + }); }); group('(upcaseKatakana: true)', () { final the = converterTest( kanaKit.copyWithConfig(upcaseKatakana: true).toRomaji, ); + the(input: '', shouldBecome: ''); the(input: '.', shouldBecome: '.'); the(input: 'hello', shouldBecome: 'hello'); @@ -143,6 +151,7 @@ void main() { }); group('toKana', () { final the = converterTest(kanaKit.toKana); + the(input: '', shouldBecome: ''); the(input: '.', shouldBecome: '。'); the(input: 'onaji', shouldBecome: 'おなじ'); @@ -162,8 +171,8 @@ void main() { the(input: 'wi', shouldBecome: 'うぃ'); the(input: 'WI', shouldBecome: 'ウィ'); the( - input: 'ワニカニ AiUeO 鰐蟹 12345 @#\$%', - shouldBecome: 'ワニカニ アいウえオ 鰐蟹 12345 @#\$%', + input: r'ワニカニ AiUeO 鰐蟹 12345 @#$%', + shouldBecome: r'ワニカニ アいウえオ 鰐蟹 12345 @#$%', ); }); @@ -172,6 +181,7 @@ void main() { final the = converterTest( kanaKit.copyWithConfig(passRomaji: false).toHiragana, ); + the(input: '', shouldBecome: ''); the(input: '.', shouldBecome: '。'); the(input: 'wi', shouldBecome: 'うぃ'); @@ -214,6 +224,7 @@ void main() { final the = converterTest( kanaKit.copyWithConfig(passRomaji: false).toKatakana, ); + the(input: '', shouldBecome: ''); the(input: 'ー', shouldBecome: 'ー'); the(input: '.', shouldBecome: '。'); diff --git a/test/models/kana_kit_config_test.dart b/test/models/kana_kit_config_test.dart index 7b50d1d..d8a6abd 100644 --- a/test/models/kana_kit_config_test.dart +++ b/test/models/kana_kit_config_test.dart @@ -1,95 +1,66 @@ -// ignore_for_file: prefer_const_constructors +// ignore: lines_longer_than_80_chars +// ignore_for_file: prefer_const_constructors, prefer_const_declarations, use_named_constants, avoid_redundant_argument_values +import 'package:checks/checks.dart'; import 'package:kana_kit/kana_kit.dart'; import 'package:test/test.dart'; -const passRomaji = false; -const passKanji = true; -const upcaseKatakana = false; -const romanization = Romanization.hepburn; - void main() { group('KanaKitConfig', () { - test('props are correct', () { - final actual = const KanaKitConfig( + KanaKitConfig buildSubject({ + bool passRomaji = false, + bool passKanji = true, + bool upcaseKatakana = false, + }) { + return KanaKitConfig( passRomaji: passRomaji, passKanji: passKanji, upcaseKatakana: upcaseKatakana, - ).props; + ); + } - final expected = [ - passRomaji, - passKanji, - upcaseKatakana, - romanization, - ]; + test('supports value equality', () { + check(buildSubject()).equals(buildSubject()); + }); - expect(actual, expected); + test('has correct hash code', () { + final subject = buildSubject(); + check(subject).has((it) => it.hashCode, 'hashCode').equals( + subject.passRomaji.hashCode ^ + subject.passKanji.hashCode ^ + subject.upcaseKatakana.hashCode, + ); }); - group('constructor', () {}); + group('copyWith', () { - test( - 'returns same object with updated passRomaji' - 'when passRomaji is provided', - () { - const initial = false; - const changed = true; + test('returns same object when no arguments are provided', () { + check(buildSubject().copyWith()).equals(buildSubject()); + }); - expect( - KanaKitConfig( - passRomaji: initial, - passKanji: passKanji, - upcaseKatakana: upcaseKatakana, - ).copyWith(passRomaji: changed), - KanaKitConfig( - passRomaji: changed, - passKanji: passKanji, - upcaseKatakana: upcaseKatakana, - ), - ); - }, - ); - test( - 'returns same object with updated passKanji' - 'when passKanji is provided', - () { - const initial = true; - const changed = false; + test('returns same object with updated passRomaji when provided', () { + const initial = true; + const changed = false; - expect( - KanaKitConfig( - passRomaji: passRomaji, - passKanji: initial, - upcaseKatakana: upcaseKatakana, - ).copyWith(passKanji: changed), - KanaKitConfig( - passRomaji: passRomaji, - passKanji: changed, - upcaseKatakana: upcaseKatakana, - ), - ); - }, - ); - test( - 'returns same object with updated upcaseKatakana' - 'when upcaseKatakana is provided', - () { - const initial = false; - const changed = true; + check(buildSubject(passRomaji: initial).copyWith(passRomaji: changed)) + .equals(buildSubject(passRomaji: changed)); + }); - expect( - KanaKitConfig( - passRomaji: passRomaji, - passKanji: passKanji, - upcaseKatakana: initial, - ).copyWith(upcaseKatakana: changed), - KanaKitConfig( - passRomaji: passRomaji, - passKanji: passKanji, - upcaseKatakana: changed, - ), - ); - }, - ); + test('returns same object with updated passKanji when provided', () { + const initial = true; + const changed = false; + + check(buildSubject(passKanji: initial).copyWith(passKanji: changed)) + .equals(buildSubject(passKanji: changed)); + }); + + test('returns same object with updated upcaseKatakana when provided', () { + const initial = true; + const changed = false; + + check( + buildSubject(upcaseKatakana: initial) + .copyWith(upcaseKatakana: changed), + ).equals(buildSubject(upcaseKatakana: changed)); + }); }); }); } diff --git a/test/models/romanization_test.dart b/test/models/romanization_test.dart index a240106..f120b56 100644 --- a/test/models/romanization_test.dart +++ b/test/models/romanization_test.dart @@ -1,28 +1,15 @@ +import 'package:checks/checks.dart'; import 'package:kana_kit/kana_kit.dart'; import 'package:test/test.dart'; void main() { group('Romanization', () { - test('props are correct', () { - final actual = Romanization.hepburn.props; - - final expected = [ - Romanization.hepburn.name, - ]; - - expect(actual, expected); - }); - group('.is', () { - test('Hepburn is correct', () { - expect(Romanization.hepburn.isHepburn, isTrue); - }); + test('supports value equality', () { + check(Romanization.hepburn).equals(Romanization.hepburn); }); test('.toString is correct', () { - expect( - Romanization.hepburn.toString(), - 'Romanization (Hepburn)', - ); + check(Romanization.hepburn.toString()).equals('Romanization(Hepburn)'); }); }); } diff --git a/test/utils_test.dart b/test/utils_test.dart index 55f704a..e6c4997 100644 --- a/test/utils_test.dart +++ b/test/utils_test.dart @@ -1,75 +1,63 @@ +import 'package:checks/checks.dart'; import 'package:kana_kit/src/utils.dart'; import 'package:test/test.dart'; void main() { - group('Tuple', () { - const left = 20.7; - const right = 'Frederik'; - - test('props are correct', () { - // ignore: prefer_const_constructors - final actual = Tuple(left, right).props; - const expected = [left, right]; - - expect(actual, expected); - }); - test('.toString is correct', () { - expect( - const Tuple(left, right).toString(), - 'Tuple(20.7, Frederik)', - ); - }); - - test('left is correct', () { - expect(const Tuple(left, right).left, left); - }); - test('right is correct', () { - expect(const Tuple(left, right).right, right); - }); - }); - group('Tuple Extensions', () { + group('TupleRecordIterableExtensions', () { const tuples = [ - Tuple(1, 'a'), - Tuple(2, 'b'), - Tuple(3, 'c'), + (1, 'a'), + (2, 'b'), + (3, 'c'), ]; - test('allLefts returns all left elements', () { - expect(tuples.allLefts, [1, 2, 3]); + test('allLefts returns first of every element', () { + check(tuples.allLefts).deepEquals([1, 2, 3]); }); - test('allRights returns all right elements', () { - expect(tuples.allRights, ['a', 'b', 'c']); + test('allRights returns first of every element', () { + check(tuples.allRights).deepEquals(['a', 'b', 'c']); }); }); + group('String Extensions', () { test('chars returns characters', () { - expect('abcdefg'.chars, ['a', 'b', 'c', 'd', 'e', 'f', 'g']); + check('abcdefg'.chars).deepEquals(['a', 'b', 'c', 'd', 'e', 'f', 'g']); }); + test('reversed returns reversed string', () { - expect('abcdefg'.reversed, 'gfedcba'); + // cspell: disable + check('abcdefg'.reversed).equals('gfedcba'); + // cspell: enable }); + test('code returns first code unit', () { - expect('abcdefg'.code, 'a'.codeUnitAt(0)); + check('a'.code).equals('a'.codeUnitAt(0)); }); + test('isUpperCase returns true if string is uppercase', () { - expect('abcdefg'.isUpperCase, isFalse); - expect('ABCDEFG'.isUpperCase, isTrue); + check('abcdefg'.isUpperCase).isFalse(); + check('ABCDEFG'.isUpperCase).isTrue(); }); + test('isLowerCase returns true if string is lowercase', () { - expect('abcdefg'.isLowerCase, isTrue); - expect('ABCDEFG'.isLowerCase, isFalse); + check('abcdefg'.isLowerCase).isTrue(); + check('ABCDEFG'.isLowerCase).isFalse(); }); + group('containsAny', () { test('return false if no candidates are provided', () { - expect('I love Tokyo'.containsAny([]), isFalse); + check('I love Tokyo'.containsAny([])).isFalse(); }); + test('returns true if string contains any of the candidates', () { - expect('I love Tokyo'.containsAny(['Tokyo', 'Kyoto']), isTrue); - }); - test('returns false if string does not contain any of the candidates', - () { - expect('I love Osaka'.containsAny(['Tokyo', 'Kyoto']), isFalse); + check('I love Tokyo'.containsAny(['Tokyo', 'Kyoto'])).isTrue(); }); + + test( + 'returns false if string does not contain any of the candidates', + () { + check('I love Osaka'.containsAny(['Tokyo', 'Kyoto'])).isFalse(); + }, + ); }); }); }