Skip to content

Commit

Permalink
feat: support new JMdict types
Browse files Browse the repository at this point in the history
  • Loading branch information
Moseco committed Oct 4, 2024
1 parent 9e1afa2 commit ee7a097
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
35 changes: 34 additions & 1 deletion lib/src/dictionary_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ class DictionaryBuilder {
case '&sK;':
return WritingInfo.searchOnlyForm;
default:
print('Unsupported writing info: $writingInfo');
return null;
}
}
Expand Down Expand Up @@ -682,9 +683,12 @@ class DictionaryBuilder {
return ReadingInfo.irregularKana;
case '&ok;':
return ReadingInfo.outdatedKana;
case '&rk;':
return ReadingInfo.rareKanaForm;
case '&sk;':
return ReadingInfo.searchOnlyForm;
default:
print('Unsupported reading info: $readingInfo');
return null;
}
}
Expand Down Expand Up @@ -993,7 +997,7 @@ class DictionaryBuilder {
case "&vz;":
return PartOfSpeech.verbIchidanZuru;
default:
print('Unknown part-of-speech');
print('Unsupported part of speech: $partOfSpeech');
return PartOfSpeech.unknown;
}
}
Expand Down Expand Up @@ -1024,6 +1028,8 @@ class DictionaryBuilder {
return Field.biology;
case '⊥':
return Field.botany;
case '&boxing;':
return Field.boxing;
case '&Buddh;':
return Field.buddhism;
case '&bus;':
Expand All @@ -1032,8 +1038,12 @@ class DictionaryBuilder {
return Field.cardGames;
case '&chem;':
return Field.chemistry;
case '&chmyth;':
return Field.chineseMythology;
case '&Christn;':
return Field.christianity;
case '&civeng;':
return Field.civilEngineering;
case '&cloth;':
return Field.clothing;
case '∁':
Expand All @@ -1056,6 +1066,8 @@ class DictionaryBuilder {
return Field.engineering;
case '&ent;':
return Field.entomology;
case '&figskt;':
return Field.figureSkating;
case '&film;':
return Field.film;
case '&finc;':
Expand Down Expand Up @@ -1086,6 +1098,10 @@ class DictionaryBuilder {
return Field.hanafuda;
case '&horse;':
return Field.horseRacing;
case '&internet;':
return Field.internet;
case '&jpmyth;':
return Field.japaneseMythology;
case '&kabuki;':
return Field.kabuki;
case '&law;':
Expand All @@ -1110,8 +1126,12 @@ class DictionaryBuilder {
return Field.meteorology;
case '&mil;':
return Field.military;
case '&min;':
return Field.mineralogy;
case '&mining;':
return Field.mining;
case '&motor;':
return Field.motorsport;
case '&music;':
return Field.music;
case '&noh;':
Expand All @@ -1136,6 +1156,8 @@ class DictionaryBuilder {
return Field.politics;
case '&print;':
return Field.printing;
case '&prowres;':
return Field.professionalWrestling;
case '&psy;':
return Field.psychiatry;
case '&psyanal;':
Expand All @@ -1160,17 +1182,22 @@ class DictionaryBuilder {
return Field.stockMarket;
case '&sumo;':
return Field.sumo;
case '&surg;':
return Field.surgery;
case '&telec;':
return Field.telecommunications;
case '&tradem;':
return Field.trademark;
case '&tv;':
return Field.television;
case '&vet;':
return Field.veterinaryTerms;
case '&vidg;':
return Field.videoGames;
case '&zool;':
return Field.zoology;
default:
print('Unsupported field: $field');
return null;
}
}
Expand Down Expand Up @@ -1288,6 +1315,7 @@ class DictionaryBuilder {
case '&yoji;':
return MiscellaneousInfo.yojijukugo;
default:
print('Unsupported miscellaneous info: $miscellaneousInfo');
return null;
}
}
Expand Down Expand Up @@ -1319,6 +1347,7 @@ class DictionaryBuilder {
case '&tsug;':
return Dialect.tsugaruBen;
default:
print('Unsupported dialect: $dialect');
return null;
}
}
Expand Down Expand Up @@ -1526,6 +1555,9 @@ class DictionaryBuilder {
case 'urd':
languageSource.add(LanguageSource.urd);
break;
case 'uzb':
languageSource.add(LanguageSource.uzb);
break;
case 'vie':
languageSource.add(LanguageSource.vie);
break;
Expand Down Expand Up @@ -2507,6 +2539,7 @@ class DictionaryBuilder {
case 'rel':
return ProperNounType.religion;
default:
print('Unsupported proper noun type: $type');
return ProperNounType.unknown;
}
}
Expand Down
13 changes: 13 additions & 0 deletions lib/src/utils/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ enum ReadingInfo {
gikun,
irregularKana,
outdatedKana,
rareKanaForm,
searchOnlyForm,
}

Expand Down Expand Up @@ -199,11 +200,14 @@ enum Field {
biochemistry,
biology,
botany,
boxing,
buddhism,
business,
cardGames,
chemistry,
chineseMythology,
christianity,
civilEngineering,
clothing,
computing,
crystallography,
Expand All @@ -215,6 +219,7 @@ enum Field {
embryology,
engineering,
entomology,
figureSkating,
film,
finance,
fishing,
Expand All @@ -230,6 +235,8 @@ enum Field {
greekMythology,
hanafuda,
horseRacing,
internet,
japaneseMythology,
kabuki,
law,
linguistics,
Expand All @@ -242,7 +249,9 @@ enum Field {
medicine,
meteorology,
military,
mineralogy,
mining,
motorsport,
music,
noh,
ornithology,
Expand All @@ -255,6 +264,7 @@ enum Field {
physiology,
politics,
printing,
professionalWrestling,
psychiatry,
psychoanalysis,
psychology,
Expand All @@ -267,9 +277,11 @@ enum Field {
statistics,
stockMarket,
sumo,
surgery,
telecommunications,
trademark,
television,
veterinaryTerms,
videoGames,
zoology,
}
Expand Down Expand Up @@ -414,6 +426,7 @@ enum LanguageSource {
tur,
ukr,
urd,
uzb,
vie,
yid,
}

0 comments on commit ee7a097

Please sign in to comment.