word_search_result: add getter for unusual kanji flag
All checks were successful
Build and test / build (push) Successful in 11m48s
All checks were successful
Build and test / build (push) Successful in 11m48s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:jadb/models/common/jlpt_level.dart';
|
||||
import 'package:jadb/models/jmdict/jmdict_kanji_info.dart';
|
||||
import 'package:jadb/models/jmdict/jmdict_misc.dart';
|
||||
import 'package:jadb/models/jmdict/jmdict_reading_info.dart';
|
||||
import 'package:jadb/models/word_search/word_search_match_span.dart';
|
||||
import 'package:jadb/models/word_search/word_search_ruby.dart';
|
||||
@@ -45,6 +46,13 @@ class WordSearchResult {
|
||||
/// the original searchword.
|
||||
List<WordSearchMatchSpan>? matchSpans;
|
||||
|
||||
/// Whether the first item in [japanese] contains kanji that likely is rare.
|
||||
bool get hasUnusualKanji =>
|
||||
(japanese.first.furigana != null &&
|
||||
kanjiInfo[japanese.first.base] == JMdictKanjiInfo.rK) ||
|
||||
senses.where((sense) => sense.misc.contains(JMdictMisc.onlyKana)).length >
|
||||
(senses.length / 2);
|
||||
|
||||
/// All contents of [japanese], transliterated to romaji
|
||||
List<String> get romaji => japanese
|
||||
.map((word) => transliterateKanaToLatin(word.furigana ?? word.base))
|
||||
|
||||
Reference in New Issue
Block a user